/* Colocalizer — premium dark instrument UI.
   One confident accent (periwinkle) used consistently. Green/red are reserved strictly
   for the fluorophore channels & data. No competing accent colors anywhere. */
:root {
  --bg: #0a0d12;
  --bg-2: #0d1017;
  --panel: #12161e;
  --panel-2: #171c26;
  --panel-3: #1e2430;
  --panel-grad: #10141b; /* bottom stop of the .tile/.metric panel gradient */
  --line: #262e3b;
  --line-soft: #1a212b;
  --ink: #eef1f7;
  --ink-dim: #c7cedb;
  --muted: #8b95a6;
  --muted-2: #5b6675;
  --accent: #6b8afc;
  --accent-2: #8aa3ff;
  --accent-ink: #08122b;
  --accent-dim: #2b3a63;
  --accent-glow: rgba(107,138,252,.14);
  /* Themed surfaces — full gradients/backdrops live in variables so the light/dark
     switch stays DRY (the light block below only re-declares these tokens). */
  --body-glow: #16202e;
  --topbar-bg: linear-gradient(180deg, rgba(16,20,28,.9), rgba(13,17,23,.62));
  --footer-bg: linear-gradient(180deg, rgba(10,13,18,0), rgba(13,17,23,.5));
  --option-bg: #171c26;
  --textarea-bg: #05080b;
  --green: #35d38a;   /* channel 2 (data only) */
  --red: #ff6178;     /* channel 1 (data only) */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 4px 10px -4px rgba(0,0,0,.4), 0 18px 40px -20px rgba(0,0,0,.65);
  --hair: inset 0 1px 0 rgba(255,255,255,.04);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* Brand mark — the two overlapping fluorescence channels (green ↔ red) with a hot
     colocalized core. Inlined so the standalone build (coloc.html) stays self-contained.
     Source of truth: assets/logo.svg — keep the two in sync when the mark changes. */
  --logo-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' width='512' height='512' role='img' aria-labelledby='t d'%3E %3Cdefs%3E %3CradialGradient id='cl-tile' cx='50%25' cy='2%25' r='120%25'%3E %3Cstop offset='0%25' stop-color='%231b2635'/%3E %3Cstop offset='50%25' stop-color='%230f141c'/%3E %3Cstop offset='100%25' stop-color='%23080b10'/%3E %3C/radialGradient%3E %3CradialGradient id='cl-green' cx='50%25' cy='50%25' r='50%25'%3E %3Cstop offset='0%25' stop-color='%23e2fff2'/%3E %3Cstop offset='26%25' stop-color='%235ff0b2'/%3E %3Cstop offset='66%25' stop-color='%2335d38a'/%3E %3Cstop offset='84%25' stop-color='%2333cd86' stop-opacity='.92'/%3E %3Cstop offset='100%25' stop-color='%2333cd86' stop-opacity='0'/%3E %3C/radialGradient%3E %3CradialGradient id='cl-red' cx='50%25' cy='50%25' r='50%25'%3E %3Cstop offset='0%25' stop-color='%23ffe9ed'/%3E %3Cstop offset='26%25' stop-color='%23ff8598'/%3E %3Cstop offset='66%25' stop-color='%23ff6178'/%3E %3Cstop offset='84%25' stop-color='%23fb5b72' stop-opacity='.92'/%3E %3Cstop offset='100%25' stop-color='%23fb5b72' stop-opacity='0'/%3E %3C/radialGradient%3E %3CradialGradient id='cl-hot' cx='50%25' cy='50%25' r='50%25'%3E %3Cstop offset='0%25' stop-color='%23ffffff'/%3E %3Cstop offset='26%25' stop-color='%23fff4cf'/%3E %3Cstop offset='58%25' stop-color='%23ffe294' stop-opacity='.55'/%3E %3Cstop offset='100%25' stop-color='%23ffe294' stop-opacity='0'/%3E %3C/radialGradient%3E %3Cfilter id='cl-bloom' x='-40%25' y='-40%25' width='180%25' height='180%25'%3E%3CfeGaussianBlur stdDeviation='5'/%3E%3C/filter%3E %3C/defs%3E %3Crect width='512' height='512' rx='118' fill='url(%23cl-tile)'/%3E %3Crect x='1.5' y='1.5' width='509' height='509' rx='116.5' fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='1.5'/%3E %3Cg style='mix-blend-mode:screen'%3E %3Cg filter='url(%23cl-bloom)' opacity='.4'%3E %3Ccircle cx='200' cy='256' r='115' fill='url(%23cl-green)'/%3E %3Ccircle cx='312' cy='256' r='115' fill='url(%23cl-red)'/%3E %3C/g%3E %3Ccircle cx='200' cy='256' r='115' fill='url(%23cl-green)'/%3E %3Ccircle cx='312' cy='256' r='115' fill='url(%23cl-red)'/%3E %3Ccircle cx='256' cy='256' r='92' fill='url(%23cl-hot)'/%3E %3C/g%3E %3C/svg%3E");
}

/* ---------- light theme ----------
   System-following by default (the media query); the toolbar toggle sets an explicit
   [data-theme] override. A forced-dark choice (data-theme="dark") is excluded from the
   media query, so the :root dark defaults hold — no separate dark block needed. The
   periwinkle accent and data green/red are unchanged; only surfaces/ink shift. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f7; --bg-2: #f7f9fc; --panel: #ffffff; --panel-2: #f2f5fa; --panel-3: #e7edf5;
    --panel-grad: #f4f7fc; --line: #d5dce7; --line-soft: #e6ebf2;
    --ink: #131922; --ink-dim: #333e52; --muted: #55606f; --muted-2: #6b7686;
    --accent: #4a67e8; --accent-2: #5f7cf0; --accent-ink: #ffffff; --accent-dim: #b7c4f2;
    --accent-glow: rgba(74,103,232,.12);
    --shadow-1: 0 1px 2px rgba(20,30,55,.08);
    --shadow-2: 0 4px 10px -4px rgba(20,30,55,.10), 0 18px 40px -20px rgba(20,30,55,.16);
    --hair: inset 0 1px 0 rgba(255,255,255,.7);
    --body-glow: #dfe7f6;
    --topbar-bg: linear-gradient(180deg, rgba(255,255,255,.92), rgba(247,249,252,.72));
    --footer-bg: linear-gradient(180deg, rgba(255,255,255,0), rgba(237,241,247,.6));
    --option-bg: #ffffff; --textarea-bg: #f2f5fa;
  }
}
:root[data-theme="light"] {
  --bg: #eef1f7; --bg-2: #f7f9fc; --panel: #ffffff; --panel-2: #f2f5fa; --panel-3: #e7edf5;
  --panel-grad: #f4f7fc; --line: #d5dce7; --line-soft: #e6ebf2;
  --ink: #131922; --ink-dim: #333e52; --muted: #55606f; --muted-2: #6b7686;
  --accent: #4a67e8; --accent-2: #5f7cf0; --accent-ink: #ffffff; --accent-dim: #b7c4f2;
  --accent-glow: rgba(74,103,232,.12);
  --shadow-1: 0 1px 2px rgba(20,30,55,.08);
  --shadow-2: 0 4px 10px -4px rgba(20,30,55,.10), 0 18px 40px -20px rgba(20,30,55,.16);
  --hair: inset 0 1px 0 rgba(255,255,255,.7);
  --body-glow: #dfe7f6;
  --topbar-bg: linear-gradient(180deg, rgba(255,255,255,.92), rgba(247,249,252,.72));
  --footer-bg: linear-gradient(180deg, rgba(255,255,255,0), rgba(237,241,247,.6));
  --option-bg: #ffffff; --textarea-bg: #f2f5fa;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1000px 560px at 84% -14%, var(--body-glow) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  background-attachment: fixed;
  color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  display: flex; flex-direction: column; min-height: 100vh;
}
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -.015em; }
button { font-family: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--ink); }
::selection { background: rgba(107,138,252,.3); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 24px; border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 8px; position: relative; flex: none;
  background: var(--logo-mark) center / cover no-repeat;
  box-shadow: var(--shadow-1);
}
.brand h1 { font-size: 16px; letter-spacing: -.01em; }
.brand .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
/* display is set by the view-toggle rules below (default hidden, shown once data-view="working") */
.controls { align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
#themeToggle { flex: none; padding: 7px 9px; }

/* Grouped analysis controls read as one premium module */
.ctl-group {
  display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--hair);
}
.ctl-group select { background: var(--panel-3); border-color: var(--line-soft); }
.field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.field select { padding: 6px 9px; }
.field input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.field.check { cursor: pointer; }

/* ---------- controls / buttons ---------- */
select, .btn {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 7px 13px; font-size: 13px; cursor: pointer;
  transition: border-color .14s, background .14s, color .14s, box-shadow .14s, transform .05s, opacity .14s;
}
select { box-shadow: var(--hair); }
select option, select optgroup { background: var(--option-bg); color: var(--ink); }
select:focus-visible, .btn:focus-visible, .dropzone:focus-visible,
.field.check:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:hover { border-color: var(--accent-dim); background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); background: var(--panel-2); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink);
  border-color: transparent; font-weight: 650; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 20px -10px var(--accent);
}
.btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: transparent; }
.btn.primary:disabled { background: var(--panel-2); color: var(--muted-2); box-shadow: none; font-weight: 600; opacity: 1; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }

/* ---------- layout ---------- */
main { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }

/* ---------- view toggling ----------
   No JS runs before first paint, so the correct default (landing) must hold with
   body carrying no data-view attribute at all — see setView() in app.js. Selectors
   here are deliberately attribute/class-only (no bare ID + display combo) so the
   specificity math stays predictable regardless of source order; see CLAUDE.md task
   notes for the reasoning. */
[data-when="working"] { display: none; }
[data-when="landing"] { display: flex; flex-direction: column; align-items: center; justify-content: center; }
body[data-view="working"] [data-when="landing"] { display: none; }
body[data-view="working"] .controls[data-when="working"] { display: flex; }
body[data-view="working"] #work[data-when="working"] { display: flex; }

/* ---------- landing hero ---------- */
#landing {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 40px 24px;
  gap: 22px; text-align: center;
}
#landing .dropzone { width: 100%; padding: 64px 28px; }
#landing .dropzone strong { font-size: 20px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.privacy-line { font-size: 12px; color: var(--muted-2); }

.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 32px 16px; text-align: center;
  color: var(--muted); transition: border-color .16s, background .16s, color .16s; cursor: pointer;
  background: rgba(255,255,255,.008);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-glow); color: var(--ink); }
.dropzone.drag { border-style: solid; }
.dropzone strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 15px; }
.dropzone .hint { font-size: 11.5px; margin-top: 10px; color: var(--muted-2); line-height: 1.5; }

.intake-meta { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; margin-bottom: 16px; }
.intake-meta code { color: var(--ink); background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); }
.note { font-size: 11.5px; color: var(--muted-2); border-left: 2px solid var(--line); padding: 6px 0 6px 12px; line-height: 1.55; }

/* ---------- work view / results ---------- */
#work { padding: 22px 26px 32px; min-width: 0; flex-direction: column; }
.summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.tile {
  background: linear-gradient(180deg, var(--panel), var(--panel-grad)); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px; min-width: 140px; flex: 1; box-shadow: var(--shadow-1), var(--hair);
}
.tile .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tile .v { font-size: 26px; font-family: var(--mono); font-variant-numeric: tabular-nums; margin-top: 5px; letter-spacing: -.02em; }
.tile .v small { font-size: 12px; color: var(--muted); letter-spacing: 0; }

.tablewrap { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: auto; background: var(--panel); box-shadow: var(--shadow-2); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); color: var(--muted); font-weight: 600;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; text-align: right; vertical-align: middle;
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1;
}
thead th:first-child, tbody td:first-child { text-align: left; }
/* Numeric metric columns center label + value so numbers sit under the header,
   not stranded at the right edge when a header (e.g. Pearson) is wide. */
thead th.num, tbody td.num { text-align: center; }
.th-main { display: block; }
.th-sub { display: block; margin-top: 3px; font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: .02em; color: var(--muted-2); }
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--ink); }
thead th.sortable:hover .th-sub { color: var(--muted); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); text-align: right; font-family: var(--mono); font-size: 13px; white-space: nowrap; color: var(--ink-dim); }
tbody td:first-child { font-family: var(--sans); color: var(--ink); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.sel { background: var(--accent-glow); box-shadow: inset 2px 0 0 var(--accent); }
.chsel { display: flex; gap: 7px; align-items: center; }
.chsel select { padding: 4px 8px; font-size: 12px; max-width: 190px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; box-shadow: 0 0 7px currentColor; }
.dot.r { background: var(--red); color: var(--red); } .dot.g { background: var(--green); color: var(--green); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 650; font-family: var(--sans); letter-spacing: .01em; }
.muted { color: var(--muted); } .mono { font-family: var(--mono); }
.spin { color: var(--muted); font-size: 12px; }

.progress { height: 5px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin: 4px 0 14px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .12s; }

.empty { color: var(--muted); text-align: center; padding: 80px 20px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty .mark {
  width: 48px; height: 48px; border-radius: 11px; margin-bottom: 16px;
  background: var(--logo-mark) center / cover no-repeat;
  opacity: .92;
}
.empty .big { font-size: 16px; color: var(--ink); margin-bottom: 4px; font-weight: 600; }
.empty .small { font-size: 13px; max-width: 400px; line-height: 1.55; }

/* ---------- premium: row previews, remove, sort, drop overlay ---------- */
.preview-cell { width: 1%; }
.thumb-pair { display: inline-flex; gap: 3px; }
.thumb { width: 26px; height: 26px; border-radius: 5px; object-fit: cover; display: block; background: #05080b; border: 1px solid var(--line); image-rendering: pixelated; }
.thumb.ph { background: var(--panel-3); }

/* Remove (dustbin) sits just left of the sample name; reveals on row hover/focus */
.sample-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.sample-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-rm {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--muted-2); cursor: pointer;
  opacity: 0; transition: opacity .12s, color .12s, background .12s, border-color .12s;
}
tbody tr:hover .row-rm, .row-rm:focus-visible { opacity: 1; }
.row-rm:hover { color: var(--red); background: rgba(255,97,120,.12); border-color: rgba(255,97,120,.4); }
.row-rm:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; opacity: 1; }
.row-rm svg { display: block; }

thead th.sorted { color: var(--ink); }

.toast { display: inline-flex; align-items: center; gap: 12px; }
.toast-action {
  background: rgba(0,0,0,.18); border: 1px solid rgba(0,0,0,.22); color: inherit;
  font: inherit; font-weight: 700; font-size: 12px; padding: 3px 12px; border-radius: 7px; cursor: pointer;
}
.toast-action:hover { background: rgba(0,0,0,.3); }

.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(8,11,16,.82); backdrop-filter: blur(6px);
}
.drop-overlay.show { display: flex; }
.drop-overlay-inner {
  pointer-events: none; text-align: center; color: var(--ink);
  border: 2px dashed var(--accent); border-radius: 20px; padding: 46px 62px;
  background: var(--accent-glow); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.drop-ico { font-size: 44px; color: var(--accent-2); line-height: 1; margin-bottom: 12px; }
.drop-msg { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.drop-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line); padding: 18px 26px; display: flex; align-items: center; gap: 8px 20px;
  flex-wrap: wrap; font-size: 12px; color: var(--muted-2);
  background: var(--footer-bg);
}
.footer .badge { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.footer .badge b { color: var(--ink-dim); font-weight: 600; }
.footer .tick { color: var(--green); }
.footer .sep { flex: 1; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--ink); }
/* Feedback pill — the one lightly-accented, obviously-clickable affordance in the footer */
.footer .fb-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--accent-dim); background: var(--accent-glow); color: var(--accent-2);
  font-weight: 600; font-size: 12px; transition: background .14s, color .14s, border-color .14s;
}
.footer .fb-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.footer .fb-btn svg { flex: none; }

/* ---------- detail drawer ---------- */
.drawer { position: fixed; inset: 0; background: rgba(5,7,10,.64); display: flex; justify-content: flex-end; z-index: 40; backdrop-filter: blur(4px); }
.drawer.hidden { display: none; }
.drawer .panel {
  width: min(620px, 96vw); height: 100%; overflow-y: auto; background: var(--bg-2);
  border-left: 1px solid var(--line); padding: 24px 26px 44px; box-shadow: -20px 0 60px -24px rgba(0,0,0,.7);
}
.drawer h2 { font-size: 16px; margin-bottom: 2px; overflow-wrap: anywhere; }
.drawer .close { float: right; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.metric { background: linear-gradient(180deg, var(--panel), var(--panel-grad)); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--hair); }
.metric .k { font-size: 11px; color: var(--muted); }
.metric .v { font-size: 22px; font-family: var(--mono); font-variant-numeric: tabular-nums; margin-top: 3px; letter-spacing: -.01em; }
.metric .d { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.chan-imgs { display: flex; gap: 10px; margin: 8px 0 4px; }
.chan-imgs figure { margin: 0; flex: 1; min-width: 0; }
.chan-imgs canvas { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); image-rendering: pixelated; background: #000; }
.chan-imgs figcaption { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }
.scatter-wrap { background: #05080b; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; margin-top: 8px; }
.scatter-wrap canvas { width: 100%; display: block; }
.axis-note { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 6px; gap: 12px; }

/* ---------- batch toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.toolbar .btn { padding: 6px 12px; font-size: 12px; }
.toolbar .sep { flex: 1; }

/* ---------- CSV modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(5,7,10,.64); display: flex; align-items: center; justify-content: center; z-index: 50; backdrop-filter: blur(4px); padding: 20px; }
.modal.hidden { display: none; }
.modal .box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; width: min(760px, 96vw); max-height: 90vh; display: flex; flex-direction: column; padding: 22px; box-shadow: var(--shadow-2); }
.modal h2 { font-size: 16px; margin-bottom: 4px; }
.modal .row { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; flex-wrap: wrap; }
.modal textarea { width: 100%; flex: 1; min-height: 240px; margin-top: 12px; background: var(--textarea-bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--mono); font-size: 12px; resize: vertical; white-space: pre; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: linear-gradient(180deg, #3ad98c, var(--green)); color: #04140b; padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 650; z-index: 60; box-shadow: var(--shadow-2); }
.toast.hidden { display: none; }

/* ---------- feedback modal ---------- */
.modal .box.feedback { width: min(480px, 96vw); padding: 24px; }
.feedback h2 { font-size: 18px; }
.feedback .fb-intro { font-size: 12.5px; line-height: 1.5; margin-top: 4px; }
.feedback .fb-intro a { color: var(--accent-2); }
.feedback .fb-field { display: block; margin-top: 16px; font-size: 12.5px; color: var(--ink-dim); }
.feedback .fb-label { display: block; margin-bottom: 8px; }
.feedback select,
.feedback input[type="email"],
.feedback textarea {
  display: block; width: 100%; margin-top: 6px; min-height: 0;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 11px; font: inherit; font-size: 13px;
}
.feedback textarea { resize: vertical; white-space: pre-wrap; }
.feedback select:focus,
.feedback input:focus,
.feedback textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.feedback .fb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .feedback .fb-grid { grid-template-columns: 1fr; } }

/* star rating — periwinkle when set, keeping the single-accent rule */
.feedback .stars { display: inline-flex; gap: 4px; }
.feedback .star {
  background: none; border: none; padding: 2px; cursor: pointer; line-height: 1;
  font-size: 26px; color: var(--line); transition: color .12s, transform .12s;
}
.feedback .star:hover { transform: scale(1.12); }
.feedback .star.on { color: var(--accent-2); }
.feedback .star:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* thank-you state — green success mark, consistent with the toast */
.feedback .fb-thanks { text-align: center; padding: 18px 8px 8px; }
.feedback .fb-thanks h2 { margin-top: 10px; }
.feedback .fb-thanks p { font-size: 13px; line-height: 1.55; margin: 8px 0 20px; }
.feedback .fb-check {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #3ad98c, var(--green)); color: #04140b;
  font-size: 26px; font-weight: 700;
}

/* support pane — shown after a successful analysis, before the feedback form */
.feedback .fb-support { text-align: center; padding: 6px 4px 8px; }
.feedback .fb-support h2 { margin-bottom: 8px; }
.feedback .fb-support p { font-size: 13px; line-height: 1.55; margin: 0 0 20px; }
.feedback .fb-decline-note { font-size: 12.5px; margin-top: 4px; }

.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
