:root {
  --ink: #eeeae3;
  --muted: #898984;
  --muted-dark: #666762;
  --line: rgba(239, 237, 229, .11);
  --surface: #17191d;
  --surface-strong: #1e2025;
  --orange: #7c3aed;
  --orange-bright: #8b5cf6;
  --blue: #a78bfa;
  --bg: #111318;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Manrope", sans-serif;
  min-height: 100vh;
  letter-spacing: -.01em;
}
button, a { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1220px, calc(100% - 80px)); margin: 0 auto; position: relative; z-index: 1; }
.ambient { position: fixed; pointer-events: none; filter: blur(100px); opacity: .12; border-radius: 999px; }
.ambient-one { width: 380px; height: 380px; background: #3b65bb; top: -160px; right: -80px; }
.ambient-two { width: 260px; height: 260px; background: #4c1d95; bottom: 0; left: -140px; opacity: .07; }
.topbar { height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.brand-name { display: flex; align-items: baseline; gap: 8px; }
.brand-name strong { color: var(--ink); font-weight: 800; }
.brand-name small { color: var(--orange-bright); font: 500 9px "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { width: 25px; height: 25px; border: 1px solid #454b55; border-radius: 7px; display: flex; gap: 2px; align-items: end; padding: 5px; }
.brand-mark span { width: 3px; background: var(--orange); border-radius: 2px; }
.brand-mark span:nth-child(1) { height: 8px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 12px; opacity: .83; }
.brand-mark span:nth-child(3) { height: 16px; }
.local-badge { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 500 10px "DM Mono", monospace; letter-spacing: .1em; }
.live-dot, .tiny-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 12px rgba(124,58,237,.9); }
.hero { display: flex; justify-content: space-between; padding: 70px 5px 55px; }
.eyebrow, .control-label { color: var(--orange); font: 500 10px "DM Mono", monospace; letter-spacing: .14em; }
h1 { font-size: clamp(43px, 6vw, 76px); line-height: .98; letter-spacing: -.075em; margin: 19px 0 21px; font-weight: 700; }
h1 em { font-style: normal; color: var(--blue); }
.subtitle { max-width: 490px; color: #999b9c; font-size: 14px; line-height: 1.7; margin: 0; }
.hero-note { align-self: flex-end; display: flex; align-items: flex-start; gap: 15px; padding-bottom: 4px; }
.note-line { width: 30px; height: 1px; background: var(--orange); margin-top: 7px; }
.hero-note p { margin: 0; color: #777974; font: 11px/1.6 "DM Mono", monospace; letter-spacing: .04em; }
.workspace { border-top: 1px solid var(--line); padding: 32px 0 44px; }
.upload-card { min-height: 226px; border: 1px dashed #4c525d; border-radius: 5px; background: linear-gradient(110deg, rgba(167,139,250,.04), rgba(124,58,237,.02)); position: relative; transition: border-color .2s, background .2s, transform .2s; }
.upload-card:hover, .upload-card.dragging { border-color: var(--orange); background: rgba(124,58,237,.05); transform: translateY(-2px); }
.upload-inner { min-height: 226px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.upload-icon { width: 42px; height: 42px; border: 1px solid #59616d; border-radius: 50%; display: grid; place-items: center; margin-bottom: 15px; color: var(--blue); }
.upload-icon svg { width: 19px; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.upload-card h2 { margin: 0 0 6px; font-size: 16px; letter-spacing: -.02em; }
.upload-card p { color: #777a7c; margin: 0 0 18px; font-size: 11px; }
.secondary-button { border: 1px solid #4b515b; color: var(--ink); background: #24272d; border-radius: 3px; padding: 9px 14px; font-size: 11px; transition: .2s; }
.secondary-button:hover { border-color: var(--orange); color: var(--orange-bright); }
.secondary-button span { color: var(--orange); margin-left: 8px; }
.drop-hint { position: absolute; right: 18px; top: 17px; color: #656a72; font: 9px "DM Mono", monospace; letter-spacing: .15em; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 3px 35px; }
.control-group { display: flex; align-items: center; gap: 21px; }
.segmented { display: flex; background: #1b1e23; padding: 3px; border: 1px solid var(--line); border-radius: 4px; }
.segment { border: 0; border-radius: 2px; padding: 8px 15px; background: transparent; color: #777b83; font-size: 11px; transition: .2s; }
.segment.active { background: #353941; color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.2); }
.segment:hover:not(.active) { color: var(--ink); }
.toggle-control { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.toggle-control small { display: block; color: #686b70; font-size: 10px; margin-top: 4px; }
.toggle-control input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 36px; height: 20px; padding: 3px; border-radius: 99px; background: #30343b; transition: .2s; }
.toggle-track span { display: block; width: 14px; height: 14px; background: #777c84; border-radius: 50%; transition: transform .2s, background .2s; }
.toggle-control input:checked + .toggle-track { background: rgba(124,58,237,.25); }
.toggle-control input:checked + .toggle-track span { transform: translateX(16px); background: var(--orange); }
.control-actions { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.upscale-control { display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 8px; }
.upscale-control .control-label { grid-column: 1; }
.upscale-select { grid-column: 2; min-width: 118px; height: 29px; border: 1px solid #424954; border-radius: 3px; padding: 0 7px; background: #24282f; color: #d5d7d4; font: 9px "DM Mono", monospace; cursor: pointer; }
.upscale-select:hover, .upscale-select:focus { border-color: var(--orange); outline: none; }
.upscale-select option { background: #24282f; color: #d5d7d4; }
.upscale-control small { grid-column: 1 / -1; color: #777b83; font: 9px "DM Mono", monospace; white-space: nowrap; }
.inset-control { display: grid; grid-template-columns: auto auto; align-items: center; gap: 4px 8px; }
.inset-control .control-label { grid-column: 1; }
.inset-select { grid-column: 2; min-width: 65px; height: 29px; border: 1px solid #424954; border-radius: 3px; padding: 0 7px; background: #24282f; color: #d5d7d4; font: 9px "DM Mono", monospace; cursor: pointer; }
.inset-select:hover, .inset-select:focus { border-color: var(--orange); outline: none; }
.inset-select option { background: #24282f; color: #d5d7d4; }
.inset-control small { grid-column: 1 / -1; color: #777b83; font: 9px "DM Mono", monospace; white-space: nowrap; }
.preview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); align-items: center; }
.preview-column { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.preview-card { min-width: 0; border: 1px solid var(--line); background: #16181c; border-radius: 4px; overflow: hidden; }
.processed-card { border-color: rgba(126,167,255,.19); }
.preview-header { height: 69px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); }
.preview-header > div { display: flex; align-items: center; gap: 12px; }
.preview-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px; border: 1px solid rgba(126,167,255,.2); border-radius: 4px; background: #1b1e24; box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.zoom-control { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 2px; }
.toolbar-label { flex: 0 0 auto; color: var(--orange); font: 500 8px "DM Mono", monospace; letter-spacing: .08em; margin-right: 3px; }
.zoom-select { min-width: 82px; height: 28px; flex: 0 1 92px; border: 1px solid #424954; border-radius: 3px; padding: 0 7px; background: #24282f; color: #d5d7d4; font: 9px "DM Mono", monospace; cursor: pointer; }
.zoom-select:hover, .zoom-select:focus { border-color: var(--orange); outline: none; }
.zoom-select option { background: #24282f; color: #d5d7d4; }
.fit-button { flex: 0 0 auto; height: 28px; border: 1px solid #424954; border-radius: 3px; padding: 0 7px; background: #24282f; color: #a8adb5; font: 9px "DM Mono", monospace; white-space: nowrap; cursor: pointer; }
.fit-button:hover, .fit-button:focus { border-color: var(--orange); color: var(--ink); outline: none; }
.pixel-control { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; color: #a8adb5; font: 500 8px "DM Mono", monospace; letter-spacing: .04em; white-space: nowrap; cursor: pointer; }
.pixel-control input { appearance: none; width: 13px; height: 13px; margin: 0; border: 1px solid #535a65; border-radius: 2px; background: transparent; display: grid; place-items: center; cursor: pointer; }
.pixel-control input:checked { border-color: var(--orange); background: rgba(124,58,237,.18); }
.pixel-control input:checked::after { content: "✓"; color: var(--orange-bright); font: 9px Arial, sans-serif; }
.panel-index { color: #62666e; font: 11px "DM Mono", monospace; }
.panel-index.accent { color: var(--blue); }
.preview-header h3 { margin: 0; color: #c5c5c1; font-size: 12px; font-weight: 600; }
.panel-state { color: #5e636a; font: 9px "DM Mono", monospace; letter-spacing: .12em; }
.accent-state { color: #82a9fe; }
.preview-stage { height: 315px; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: default; }
.preview-stage.zoomed { cursor: grab; }
.preview-stage.panning { cursor: grabbing; }
.checkerboard { background-color: #25282e; background-image: linear-gradient(45deg, #30343b 25%, transparent 25%), linear-gradient(-45deg, #30343b 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #30343b 75%), linear-gradient(-45deg, transparent 75%, #30343b 75%); background-size: 22px 22px; background-position: 0 0, 0 11px, 11px -11px, -11px 0; }
.artwork-frame { width: 87%; height: 87%; min-width: 0; min-height: 0; display: grid; place-items: center; position: relative; z-index: 1; }
.preview-stage img { width: 100%; height: 100%; max-width: none; max-height: none; min-width: 0; min-height: 0; object-fit: contain; display: none; position: relative; filter: drop-shadow(0 8px 16px rgba(0,0,0,.32)); transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0) scale(var(--zoom, 1)); transform-origin: center center; transition: transform .18s ease; user-select: none; -webkit-user-drag: none; }
.preview-stage.panning img { transition: none; }
.preview-stage.pixel-view img { -ms-interpolation-mode: nearest-neighbor; image-rendering: pixelated; }
.preview-stage.has-image img { display: block; }
.preview-stage.has-image .empty-preview { display: none; }
.empty-preview { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #656970; font: 10px "DM Mono", monospace; letter-spacing: .05em; }
.empty-glyph { color: #5c626b; border: 1px solid #5c626b; border-radius: 50%; width: 29px; height: 29px; display: grid; place-items: center; font-size: 17px; font-family: Arial, sans-serif; }
.accent-glyph { color: #708ac5; border-color: #708ac5; font-size: 14px; }
.file-meta { height: 45px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #74777c; font: 10px "DM Mono", monospace; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.file-meta > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.result-meta { height: 58px; }
.result-meta > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.result-meta strong { overflow: hidden; color: #c5c5c1; font: 600 10px "Manrope", sans-serif; text-overflow: ellipsis; }
.result-meta small { overflow: hidden; color: #74777c; font: 9px "DM Mono", monospace; text-overflow: ellipsis; }
.ready-label { color: #6883bc; font-size: 9px; }
.ready-label .tiny-dot { width: 4px; height: 4px; margin-right: 5px; box-shadow: none; background: var(--blue); }
.compare-rail { display: flex; align-items: center; flex-direction: column; gap: 10px; color: #59616d; }
.compare-rail span { height: 100px; width: 1px; background: var(--line); }
.compare-rail svg { width: 26px; stroke: currentColor; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.processing-overlay { display: none; position: absolute; inset: 0; z-index: 2; place-items: center; gap: 9px; align-content: center; color: #b1b6c0; background: rgba(18,20,24,.75); font: 10px "DM Mono", monospace; }
.processing .processing-overlay { display: grid; }
.spinner { width: 15px; height: 15px; border: 1px solid #687ca9; border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.action-row { display: flex; align-items: center; gap: 13px; padding: 32px 0 36px; }
.primary-button, .upscale-action-button, .download-button { height: 47px; display: inline-flex; align-items: center; justify-content: center; gap: 13px; border-radius: 3px; border: 0; padding: 0 19px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-decoration: none; transition: .2s; }
.primary-button { flex: 1; background: var(--orange); color: #171717; }
.primary-button:hover:not(:disabled) { background: var(--orange-bright); transform: translateY(-1px); box-shadow: 0 7px 18px rgba(124,58,237,.16); }
.primary-button:disabled { opacity: .32; cursor: not-allowed; }
.upscale-action-button { flex: 0 0 auto; min-width: 126px; border: 1px solid var(--orange); background: rgba(124,58,237,.1); color: var(--orange-bright); }
.upscale-action-button:hover:not(:disabled) { background: rgba(124,58,237,.2); transform: translateY(-1px); }
.upscale-action-button:disabled { opacity: .32; cursor: not-allowed; }
.vector-action-group { flex: 0 0 286px; display: flex; flex-direction: column; gap: 6px; }
.vector-action-button { height: 47px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #a78bfa; border-radius: 3px; padding: 0 14px; background: rgba(167,139,250,.08); color: #c4b5fd; font-size: 10px; font-weight: 700; letter-spacing: .07em; transition: .2s; }
.vector-action-button:hover:not(:disabled) { border-color: var(--orange-bright); background: rgba(124,58,237,.2); transform: translateY(-1px); }
.vector-action-button:disabled { opacity: .32; cursor: not-allowed; }
.vector-action-group small { color: #777b83; font: 9px/1.35 "DM Mono", monospace; }
.button-icon { font-size: 14px; }
.button-arrow { margin-left: auto; font-size: 17px; font-weight: 400; }
.reset-button, .download-button { background: transparent; border: 1px solid var(--line); color: #86898d; }
.reset-button { height: 47px; border-radius: 3px; padding: 0 18px; font-size: 10px; letter-spacing: .08em; }
.reset-button span, .download-button span { color: var(--orange); margin-left: 8px; font-size: 15px; }
.reset-button:hover { border-color: #69707b; color: var(--ink); }
.download-button { color: var(--ink); min-width: 194px; border-color: rgba(126,167,255,.3); }
.download-button:hover:not(.disabled) { border-color: var(--blue); color: var(--blue); }
.download-button.disabled { opacity: .35; pointer-events: none; }
.diagnostic-card { border-top: 1px solid var(--line); padding-top: 20px; }
.diagnostic-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.diagnostic-heading > span:last-child { color: #656970; font: 10px "DM Mono", monospace; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: rgba(255,255,255,.01); }
.metric { min-height: 85px; padding: 15px 17px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; color: #d4d6d3; font: 500 19px "DM Mono", monospace; margin-bottom: 8px; }
.metric span { color: #666a70; font: 9px "DM Mono", monospace; letter-spacing: .08em; }
footer { border-top: 1px solid var(--line); padding: 19px 3px 24px; display: flex; justify-content: space-between; color: #5b5f65; font: 9px "DM Mono", monospace; letter-spacing: .08em; }
footer b { color: #85898e; font-weight: 400; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 25px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #f0eee8; color: #202124; padding: 11px 16px; border-radius: 3px; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 600px); }
  .topbar { height: 76px; }
  .brand-name small { display: none; }
  .hero { padding: 47px 3px 38px; }
  .hero-note { display: none; }
  .control-row { align-items: flex-start; flex-direction: column; gap: 21px; }
  .control-group { width: 100%; align-items: flex-start; flex-direction: column; gap: 10px; }
  .segmented { width: 100%; }
  .segment { flex: 1; }
  .toggle-control { width: 100%; justify-content: space-between; }
  .control-actions { width: 100%; justify-content: space-between; margin-left: 0; }
  .preview-grid { grid-template-columns: 1fr; gap: 16px; }
  .compare-rail { flex-direction: row; width: 100%; justify-content: center; }
  .compare-rail span { height: 1px; width: 100px; }
  .compare-rail svg { transform: rotate(90deg); }
  .preview-toolbar { padding: 0 9px; }
  .zoom-select { min-width: 78px; flex-basis: 84px; }
  .pixel-control { gap: 5px; }
  .preview-stage { height: 250px; }
  .action-row { flex-wrap: wrap; }
   .primary-button, .upscale-action-button { min-width: 100%; }
   .vector-action-group { flex: 1 1 100%; min-width: 100%; }
   .reset-button, .download-button { flex: 1; }
  .diagnostic-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  footer { gap: 15px; flex-direction: column; }
}