.upscale-settings{display:grid;gap:13px;margin-top:16px}.upscale-settings>label{display:flex;flex-direction:column;gap:7px;color:var(--muted);font-size:11px;font-weight:700}.upscale-settings select{height:42px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);font:600 12px inherit}.setting-title{color:var(--muted);font-size:11px;font-weight:700}.scale-presets{grid-template-columns:repeat(3,1fr)!important}.resource-note{margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:color-mix(in srgb,var(--accent-soft) 45%,var(--panel));color:var(--muted);font-size:11px;line-height:1.65}.dimension-result{color:var(--success)!important;font-weight:700}#upscaler-toast{position:fixed;z-index:100;right:18px;bottom:18px;padding:11px 14px;border-radius:10px;background:#172033;color:#fff;opacity:0;transform:translateY(12px);transition:.2s;pointer-events:none}#upscaler-toast.show{opacity:1;transform:none}.progress-line{height:5px;margin-top:8px;overflow:hidden;border-radius:99px;background:var(--line)}.progress-line span{display:block;width:0;height:100%;background:var(--accent);transition:width .15s}.upscaler-shell .compress-card .card-actions{grid-template-columns:1fr}.upscaler-shell .dropzone{margin-bottom:2px}

.upscaler-shell .preview-wrap {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  background: #0b101a;
}

.upscaler-shell .preview-status {
  position: absolute;
  z-index: 8;
  right: 9px;
  left: auto;
  bottom: 9px;
  display: inline-flex !important;
  width: auto !important;
  max-width: calc(100% - 18px);
  min-height: 24px;
  align-items: center;
  margin: 0 !important;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  background: rgba(15,23,42,.84);
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.28);
  font: 700 10px/1.25 'Noto Sans Thai','Segoe UI',sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(7px);
  pointer-events: none;
}
.upscaler-shell .preview-status.preview-state-done { background: rgba(8,116,90,.9); }
.upscaler-shell .preview-status.preview-state-working { background: rgba(79,70,229,.9); }
.upscaler-shell .preview-status.preview-state-failed { background: rgba(185,56,56,.92); }

.upscaler-shell .preview-wrap img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center;
}

.upscaler-shell .results.grid-view .compress-card .preview-wrap {
  width: min(100%, 360px);
  height: auto;
  aspect-ratio: var(--preview-ratio, 16 / 9);
  align-self: center;
}

.upscaler-shell .results.grid-view .compress-card.is-portrait .preview-wrap {
  width: min(100%, 360px) !important;
  height: auto !important;
  max-height: min(70dvh, 720px);
  aspect-ratio: var(--preview-ratio) !important;
  align-self: center;
}
.upscaler-shell .results.grid-view .compress-card.is-portrait .preview-wrap > img,
.upscaler-shell .results.grid-view .compress-card.is-portrait .before-after > img,
.upscaler-shell .results.grid-view .compress-card.is-portrait .compare-before-image > img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}
@media(max-width:520px){
  .upscaler-shell .results.grid-view .compress-card.is-portrait .preview-wrap {
    width: min(100%, 320px) !important;
    max-height: 68dvh;
  }
}
.upscaler-shell .compress-card .card-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
.upscaler-shell .compress-card .card-actions:has(.cancel-one){grid-template-columns:repeat(3,minmax(0,1fr))}
.upscaler-shell .cancel-one{touch-action:manipulation;user-select:none}
.upscaler-shell .compress-card .download-one{position:absolute!important;z-index:12;top:50px;right:10px;display:grid!important;width:32px!important;min-width:32px!important;height:32px!important;min-height:32px!important;padding:0!important;place-items:center;border:1px solid rgba(255,255,255,.28)!important;border-radius:999px!important;background:rgba(12,18,29,.82)!important;color:#fff!important;box-shadow:0 5px 16px rgba(0,0,0,.3)!important;backdrop-filter:blur(8px);transition:border-color .16s ease,background .16s ease,transform .16s ease,opacity .16s ease}
.upscaler-shell .compress-card .download-one svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.upscaler-shell .compress-card .download-one:not(:disabled):hover{border-color:rgba(255,255,255,.55)!important;background:var(--accent)!important;transform:scale(1.07)}
.upscaler-shell .compress-card .download-one:disabled{opacity:.38;cursor:not-allowed}
.upscaler-shell .compress-card .download-one:focus-visible{outline:3px solid color-mix(in srgb,var(--accent,#7488ff) 55%,transparent);outline-offset:2px}
.upscaler-shell .compress-card .card-actions:not(:has(.cancel-one)){display:block!important;width:0!important;min-width:0!important;height:0!important;min-height:0!important;margin:0!important;padding:0!important}
@media (max-width:760px){.upscaler-shell .compress-card .download-one{top:48px;right:8px}}
.upscale-settings>[hidden]{display:none!important}
.ai-model-heading{display:inline-flex;align-items:center;gap:6px}.upscaler-info-tooltip{position:relative;display:inline-grid;width:17px;height:17px;flex:0 0 17px;place-items:center;border:1px solid var(--line);border-radius:50%;color:var(--accent);font:700 11px/1 sans-serif;cursor:help}.upscaler-tooltip-bubble{position:absolute;z-index:40;left:0;bottom:calc(100% + 9px);display:grid;width:min(340px,75vw);gap:8px;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--panel);color:var(--ink);box-shadow:0 12px 30px rgba(0,0,0,.26);font:400 12px/1.55 'Noto Sans Thai','Segoe UI',sans-serif;opacity:0;visibility:hidden;transform:translateY(4px);transition:.15s;pointer-events:none}.upscaler-tooltip-bubble strong{font-size:13px}.upscaler-tooltip-bubble span{display:block;color:var(--muted)}.upscaler-tooltip-bubble b{color:var(--ink)}.upscaler-info-tooltip:hover .upscaler-tooltip-bubble,.upscaler-info-tooltip:focus .upscaler-tooltip-bubble,.upscaler-info-tooltip:focus-within .upscaler-tooltip-bubble{opacity:1;visibility:visible;transform:none}

.upscaler-shell .before-after{position:relative;isolation:isolate;cursor:ew-resize;touch-action:none;user-select:none}.upscaler-shell .before-after>.compare-after-image{position:absolute;inset:0}.upscaler-shell .compare-before-image{position:absolute;z-index:2;inset:0;overflow:hidden;clip-path:inset(0 calc(100% - var(--compare-position)) 0 0)}.upscaler-shell .compare-before-image img{position:absolute;inset:0}.upscaler-shell .compare-divider{position:absolute;z-index:4;top:0;bottom:0;left:var(--compare-position);width:2px;background:rgba(255,255,255,.92);box-shadow:0 0 0 1px rgba(15,23,42,.24);transform:translateX(-1px);pointer-events:none}.upscaler-shell .compare-divider i{position:absolute;top:50%;left:50%;display:grid;width:34px;height:34px;place-items:center;border:2px solid #fff;border-radius:50%;background:rgba(15,23,42,.78);color:#fff;font:700 16px/1 sans-serif;transform:translate(-50%,-50%);box-shadow:0 3px 12px rgba(0,0,0,.3)}.upscaler-shell .compare-range{position:absolute;z-index:5;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:ew-resize}.upscaler-shell .compare-label{position:absolute;z-index:3;top:9px;padding:4px 7px;border-radius:5px;background:rgba(15,23,42,.78);color:#fff;font:700 10px/1.2 'DM Mono',monospace;pointer-events:none}.upscaler-shell .compare-label-before{left:9px}.upscaler-shell .compare-label-after{right:9px;background:color-mix(in srgb,var(--accent) 88%,transparent)}

.upscaler-shell .image-editor-sidebar .toolbar-actions{grid-template-columns:repeat(2,minmax(0,1fr));align-items:stretch}
.upscaler-shell .image-editor-sidebar .toolbar-actions #clear-files{grid-column:1 / -1;order:1}
.upscaler-shell .image-editor-sidebar .toolbar-actions :is(#upscale-all,#stop-upscale){grid-column:1;order:2;min-height:42px;border:1px solid transparent;background:var(--accent);color:#fff;font-weight:700}
.upscaler-shell .image-editor-sidebar .toolbar-actions #stop-upscale{border-color:color-mix(in srgb,var(--danger,#d54b55) 60%,var(--line));background:color-mix(in srgb,var(--danger,#d54b55) 12%,var(--panel));color:var(--danger,#d54b55)}
.upscaler-shell .image-editor-sidebar .toolbar-actions #download-all{grid-column:2;order:3;min-height:42px}
.upscaler-shell .image-editor-sidebar .toolbar-actions :is(#upscale-all,#stop-upscale,#download-all):not(:disabled):hover{filter:brightness(1.07);transform:translateY(-1px)}
.upscaler-shell .image-editor-sidebar .toolbar-actions button[hidden]{display:none!important}
@media(max-width:420px){.upscaler-shell .image-editor-sidebar .toolbar-actions{grid-template-columns:minmax(0,1fr)}.upscaler-shell .image-editor-sidebar .toolbar-actions :is(#clear-files,#upscale-all,#stop-upscale,#download-all){grid-column:1}}

/* Large-card mode must follow the source image ratio. A viewport-based fixed
   height crops landscape images on ultrawide displays. */
.upscaler-shell .results.result-view-enhanced.card-view:not(.card-small-view):not(.card-medium-view) > .compress-card {
  width: 100%;
  max-width: min(1500px, 100%) !important;
}
.upscaler-shell .results.result-view-enhanced.card-view:not(.card-small-view):not(.card-medium-view) > .compress-card.is-landscape > .preview-wrap {
  width: 100% !important;
  max-width: 1500px !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: var(--preview-ratio) !important;
  align-self: center;
}
.upscaler-shell .results.result-view-enhanced.card-view:not(.card-small-view):not(.card-medium-view) > .compress-card.is-landscape > .preview-wrap img,
.upscaler-shell .results.result-view-enhanced.card-view:not(.card-small-view):not(.card-medium-view) > .compress-card.is-landscape > .before-after > img,
.upscaler-shell .results.result-view-enhanced.card-view:not(.card-small-view):not(.card-medium-view) > .compress-card.is-landscape > .before-after .compare-before-image > img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Large-grid cards also need to derive their height from each landscape
   image. The shared fixed 500px preview height clips wide images. */
.upscaler-shell .results.result-view-enhanced.large-grid-view > .compress-card.is-landscape > .preview-wrap {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: var(--preview-ratio) !important;
  align-self: center;
}
.upscaler-shell .results.result-view-enhanced.large-grid-view > .compress-card.is-landscape > .preview-wrap img,
.upscaler-shell .results.result-view-enhanced.large-grid-view > .compress-card.is-landscape > .before-after > img,
.upscaler-shell .results.result-view-enhanced.large-grid-view > .compress-card.is-landscape > .before-after .compare-before-image > img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  object-position: center !important;
}

/* Keep the view label, view dropdown, and A-Z sort button on one row. */
.upscaler-shell .image-editor-results-controls {
  flex-wrap: nowrap !important;
}
.upscaler-shell .image-editor-results-controls .result-view-select-wrap {
  display: flex !important;
  width: auto !important;
  min-width: 0 !important;
  order: 2;
  flex: 0 1 auto;
  margin-left: auto !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px;
}
.upscaler-shell .image-editor-results-controls .result-view-select-wrap > span {
  flex: 0 0 auto;
  white-space: nowrap;
}
.upscaler-shell .image-editor-results-controls .result-view-select-wrap > select {
  width: auto;
  min-width: 110px;
  max-width: 230px;
  flex: 1 1 180px;
}
.upscaler-shell .image-editor-results-controls #sort-files {
  order: 1;
  flex: 0 0 auto;
  margin-right: auto;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .upscaler-shell .image-editor-results-controls {
    gap: 6px;
    padding-inline: 8px;
  }
  .upscaler-shell .image-editor-results-controls .result-view-select-wrap {
    gap: 5px;
  }
  .upscaler-shell .image-editor-results-controls .result-view-select-wrap > select {
    min-width: 90px;
  }
}

.upscale-progress-modal[hidden]{display:none!important}.upscale-progress-modal{position:fixed;z-index:12000;inset:0;display:grid;place-items:center;padding:20px;background:rgba(7,11,20,.84);backdrop-filter:blur(10px)}.upscale-progress-panel{display:grid;width:min(480px,100%);gap:12px;padding:25px;border:1px solid color-mix(in srgb,var(--accent) 35%,var(--line));border-radius:18px;background:var(--panel);color:var(--ink);box-shadow:0 28px 80px rgba(0,0,0,.45);text-align:center}.upscale-progress-icon{display:grid;width:52px;height:52px;margin:auto;place-items:center;border-radius:15px;background:var(--accent);color:#fff;font:800 26px/1 sans-serif;animation:upscalePulse 1.3s ease-in-out infinite}.upscale-progress-panel h2{margin:2px 0 0;font-size:20px}.upscale-progress-file{max-width:100%;margin:0;overflow:hidden;color:var(--ink);font-size:12px;font-weight:700;text-overflow:ellipsis;white-space:nowrap}.upscale-progress-text,.upscale-progress-note{margin:0;color:var(--muted);font-size:12px;line-height:1.55}.upscale-progress-track{height:10px;overflow:hidden;border-radius:99px;background:color-mix(in srgb,var(--line) 78%,transparent)}.upscale-progress-track span{display:block;width:0;height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--accent),#8b5cf6);transition:width .18s ease}.upscale-progress-panel>strong{color:var(--accent);font:800 13px 'DM Mono',monospace}.upscale-progress-panel button{min-height:42px;padding:9px 14px;border:1px solid color-mix(in srgb,var(--danger,#d54b55) 55%,var(--line));border-radius:10px;background:color-mix(in srgb,var(--danger,#d54b55) 12%,var(--panel));color:var(--danger,#d54b55);font:700 12px 'Noto Sans Thai','Segoe UI',sans-serif;cursor:pointer}.upscale-modal-open{overflow:hidden!important}@keyframes upscalePulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.9);opacity:.72}}
