/* ============================================================
   Converter — dark, calm, single-accent
   ============================================================ */

:root {
  --bg:        #0b0c0e;
  --bg-2:     #101216;
  --surface:   #14171c;
  --surface-2: #181b21;
  --line:      #23272f;
  --line-2:    #2c313a;
  --ink:       #ece9e1;
  --ink-2:     #b8bac0;
  --ink-3:     #7c8088;
  --ink-4:     #565a62;
  --danger:    #ff6b6b;
  --accent:    #5ce6ff;       /* default — overridden via Tweaks */
  --accent-ink: #0b0c0e;
  --check-a:   #1a1d22;
  --check-b:   #15181d;

  /* Density — compact (default in this handoff). Comfortable values listed in :root.density-comfortable below. */
  --pad-card: 20px;
  --pad-row:  14px;
  --gap-row:  14px;
  --h-input:  38px;
  --radius:   10px;
  --radius-sm: 6px;

  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,.025), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  line-height: 1.5;
}

::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); color: var(--ink); }

/* ============================================================
   Layout
   ============================================================ */

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 80px;
}

.density-compact .shell { padding-top: 20px; }

/* ============================================================
   Header
   ============================================================ */

.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 36px;
  border-bottom: 1px dashed transparent;
}
.density-compact .hdr { padding-bottom: 24px; }

.hdr-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hdr-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 40%, transparent),
              0 0 24px -6px color-mix(in oklab, var(--accent) 60%, transparent);
}
.hdr-mark svg { display: block; }

.hdr-title {
  display: flex; flex-direction: column; gap: 2px;
  line-height: 1;
}
.hdr-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-family: var(--mono);
}
.hdr-accent { color: var(--accent); }
.hdr-title .tag {
  font-size: 12.5px;
  color: var(--ink-3);
  font-family: var(--mono);
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}

/* ============================================================
   Section labels (mono, small, uppercase)
   ============================================================ */

.sec-lbl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.sec-lbl::before {
  content: "";
  flex: 0 0 14px;
  height: 1px;
  background: var(--line-2);
}
.sec-lbl .step {
  color: var(--ink-4);
  margin-right: 2px;
}

/* ============================================================
   Upload zone
   ============================================================ */

.drop {
  position: relative;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  padding: var(--pad-card);
  transition: border-color .15s ease, background .15s ease;
  cursor: default;
}
.drop:hover { border-color: var(--line-2); }
.drop.dragging {
  border-color: var(--accent);
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--accent) 6%, var(--surface)),
    var(--bg-2));
}

.drop-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 16px 24px;
  gap: 14px;
}
.density-compact .drop-empty { padding: 22px 16px 18px; }

.drop-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  color: var(--ink-3);
}
.drop-icon svg { display: block; }

.drop-title {
  font-size: 15px;
  color: var(--ink);
}
.drop-title b { color: var(--ink); font-weight: 500; }

.drop-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.btn-link {
  appearance: none;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  padding: 0;
}
.btn-link:hover { text-decoration-color: var(--accent); }

/* Selected file pill */
.drop-filled {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 6px 6px 6px;
}
.thumb {
  width: 56px; height: 56px;
  flex: 0 0 56px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background:
    conic-gradient(from 45deg at 50% 50%, var(--check-a) 25%, var(--check-b) 0 50%, var(--check-a) 0 75%, var(--check-b) 0) 0 0/14px 14px;
  display: grid; place-items: center;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.file-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.file-name {
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.file-info {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex; gap: 12px;
}
.file-info .dot { color: var(--ink-4); }

.file-actions { display: flex; gap: 8px; }
.icon-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-3);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .12s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }
.icon-btn svg { display: block; }

.inline-err {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--danger);
  display: flex; align-items: center; gap: 8px;
}

/* ============================================================
   Options row
   ============================================================ */

.options {
  margin-top: var(--gap-row);
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-lbl {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.select-wrap { position: relative; }
.select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: var(--h-input);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: 500 13.5px var(--mono);
  padding: 0 36px 0 14px;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.select:hover { border-color: var(--line-2); background: var(--surface-2); }
.select:focus { outline: none; border-color: var(--accent); }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* Segmented radio bar — replaces the native <select> for Mode/Detail. */
.seg {
  display: flex;
  width: 100%;
  height: var(--h-input);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.seg-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 500 12px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  cursor: pointer;
  border-left: 1px solid var(--line);
  transition: background .12s ease, color .12s ease;
  user-select: none;
}
.seg-opt:first-of-type { border-left: 0; }
.seg-opt:hover { background: var(--surface-2); color: var(--ink); }
.seg input[type="radio"]:checked + .seg-opt {
  background: var(--accent);
  color: var(--accent-ink);
}
.seg input[type="radio"]:focus-visible + .seg-opt {
  box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--accent) 50%, transparent);
}

.btn-primary {
  appearance: none;
  height: var(--h-input);
  padding: 0 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 13px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform .08s ease, filter .12s ease, box-shadow .12s ease;
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 30%, transparent);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent);
}
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--ink-4);
  cursor: not-allowed;
}

.btn-primary .arrow { margin-left: -2px; }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid color-mix(in oklab, var(--accent-ink) 25%, transparent);
  border-top-color: var(--accent-ink);
  border-radius: 999px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tweak-hint {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .25s ease, transform .25s ease;
}
.tweak-hint.visible { opacity: 1; transform: translateY(0); }
.tweak-hint .kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-2);
}

/* ============================================================
   Result section
   ============================================================ */

.result {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp .35s ease forwards;
}
.density-compact .result { margin-top: 28px; padding-top: 24px; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel-hdr-l { display: flex; align-items: center; gap: 10px; }
.panel-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
}
.panel-tag.is-after {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 40%, transparent);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
}
.panel-title {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}
.panel-hdr-r {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
}

.canvas {
  flex: 1;
  min-height: 340px;
  background:
    conic-gradient(from 45deg at 50% 50%, var(--check-a) 25%, var(--check-b) 0 50%, var(--check-a) 0 75%, var(--check-b) 0) 0 0/24px 24px;
  display: grid; place-items: center;
  padding: 32px;
  position: relative;
}

.canvas-loading {
  background: var(--surface);
  background-image: none;
}

.canvas img.raster {
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 0 24px rgba(0,0,0,.3));
}
.canvas .svg-host {
  max-width: 100%;
  max-height: 100%;
  display: block;
  filter: drop-shadow(0 0 24px rgba(0,0,0,.3));
}
.canvas .svg-host svg {
  width: 100%;
  height: 100%;
  display: block;
}

.zoom-badge {
  position: absolute;
  bottom: 10px; right: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  backdrop-filter: blur(6px);
}

/* Metadata strip */
.meta {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  flex-wrap: wrap;
}
.meta-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 18px;
  flex: 1;
  min-width: 120px;
  border-right: 1px solid var(--line);
}
.meta-cell:last-child { border-right: none; }
.meta-k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.meta-v {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.meta-v .delta {
  font-size: 11.5px;
  color: var(--accent);
  margin-left: 6px;
  font-weight: 500;
}
.meta-v .engine-badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 2px 6px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  border-radius: 3px;
  margin-left: 4px;
  letter-spacing: 0.04em;
}

/* Action row */
.actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  appearance: none;
  height: var(--h-input);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font: 500 13px var(--mono);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .12s ease;
}
.btn-solid {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.btn-solid:hover { filter: brightness(1.06); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 18%, transparent); }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn-ghost.copied {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 50%, transparent);
}
.btn svg { display: block; }

/* ============================================================
   FAQ accordions
   ============================================================ */

.faq {
  margin-top: 48px;
}
.faq-item {
  border-top: 1px solid var(--line);
}
.faq-item:last-of-type {
  border-bottom: 1px solid var(--line);
}
.faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  user-select: none;
  transition: color .12s ease;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before {
  content: "+";
  flex: 0 0 14px;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  transition: transform .15s ease;
}
.faq-item[open] > summary::before {
  content: "−";
}
.faq-item > summary:hover { color: var(--ink); }
.faq-item > p {
  margin: 0 4px 20px 30px;
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.faq-item code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}

/* ============================================================
   Footer
   ============================================================ */

.ftr {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-4);
  flex-wrap: wrap;
  gap: 12px;
}
.density-compact .ftr { margin-top: 48px; }
.ftr a {
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px dashed var(--line-2);
  padding-bottom: 1px;
}
.ftr a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.ftr-icons { display: inline-flex; align-items: center; gap: 14px; }
.ftr-icons a { border-bottom: 0; padding: 0; display: inline-flex; align-items: center; color: var(--ink-4); }
.ftr-icons a:hover { color: var(--ink); border-bottom: 0; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 760px) {
  .shell { padding: 20px 18px 60px; }
  .options { grid-template-columns: 1fr 1fr; }
  .options .btn-primary { grid-column: 1 / -1; justify-content: center; }
  .compare { grid-template-columns: 1fr; }
  .canvas { min-height: 280px; padding: 24px; }
  .meta-cell { min-width: 50%; border-right: none; border-bottom: 1px solid var(--line); }
  .meta-cell:nth-last-child(-n+1) { border-bottom: none; }
  .hdr { padding-bottom: 24px; }
  .hdr-right { display: none; }
}
