/* MalariaScope — a calm, precise lab instrument. See devpost/spec.md > Look and Feel. */
:root {
  --bg: #F4F7FA;
  --bg-2: #EAF1F5;
  --surface: #FFFFFF;
  --ink: #0B1B33;
  --text: #18263D;
  --muted: #5D6B7E;
  --line: #E1E7EE;
  --line-2: #CFD8E2;
  --accent: #0D9488;
  --accent-600: #0B7F75;
  --accent-700: #0A6A62;
  --accent-soft: #E3F4F2;
  --wbc: #2563EB;
  --wbc-soft: #E6EEFE;
  --par: #DC2626;
  --par-soft: #FDECEC;
  --warn: #B45309;
  --warn-soft: #FFF4E5;
  --ok: #15803D;
  --ok-soft: #E7F6EC;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(11, 27, 51, .06);
  --shadow: 0 1px 2px rgba(11, 27, 51, .05), 0 8px 24px -8px rgba(11, 27, 51, .12);
  --shadow-lg: 0 2px 6px rgba(11, 27, 51, .06), 0 30px 60px -20px rgba(11, 27, 51, .28);
  --font: "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, #DDF1EE 0%, rgba(221, 241, 238, 0) 60%),
    radial-gradient(900px 400px at -10% 0%, #E7EEFB 0%, rgba(231, 238, 251, 0) 55%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.02em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem); line-height: 1.08; margin: 0 0 1rem; font-weight: 800; }
h2 { font-size: 1.25rem; margin: 2.25rem 0 1rem; font-weight: 700; }
h3 { font-size: 1.05rem; margin: 0 0 .35rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
.label { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.big { display: block; font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--ink); letter-spacing: -.02em; }
.muted { color: var(--muted); }
.hint { font-size: .88rem; color: var(--muted); margin: 0; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 38rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(225, 231, 238, .9);
}
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: .7rem 1.25rem; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font: 600 1.12rem var(--font); color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; letter-spacing: -.01em; }
.brand b { color: var(--accent); font-weight: 800; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); filter: drop-shadow(0 4px 8px rgba(13, 148, 136, .35)); }
.topbar-ref {
  font: 600 .82rem var(--font); color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--bg-2); padding: .25rem .6rem; border-radius: 99px;
}
.topbar-ref:empty { display: none; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.navlink, .lang {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 38px; padding: .4rem .8rem;
  border-radius: 99px; border: 1px solid transparent; background: transparent; color: var(--text);
  font: 600 .9rem var(--font); cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.navlink:hover { background: var(--bg-2); color: var(--accent-700); }
.lang { border-color: var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.lang:hover { border-color: var(--accent); color: var(--accent-700); }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .65rem 1.15rem; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font: 600 .98rem var(--font); cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #11A598 0%, var(--accent-600) 100%);
  border-color: var(--accent-700); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -6px rgba(13, 148, 136, .7);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #0F9A8E 0%, var(--accent-700) 100%); border-color: var(--accent-700); }
.btn.secondary { border-color: var(--accent); color: var(--accent-700); background: var(--accent-soft); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--surface); }
.btn.danger { background: var(--par); border-color: var(--par); color: #fff; }
.btn.small { min-height: 36px; padding: .35rem .8rem; font-size: .88rem; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.cta { min-height: 52px; font-size: 1.02rem; }
.btn:focus-visible, .tool:focus-visible, .navlink:focus-visible, .lang:focus-visible, input:focus-visible, .brand:focus-visible {
  outline: 3px solid rgba(13, 148, 136, .35); outline-offset: 2px;
}

/* ---------- Start: hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 3.5rem; align-items: center; padding: 1.5rem 0 1rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.1rem;
  font: 700 .78rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-700);
  background: var(--accent-soft); border: 1px solid #C6E9E5; padding: .35rem .8rem; border-radius: 99px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(13, 148, 136, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0); } 100% { box-shadow: 0 0 0 0 rgba(13, 148, 136, 0); } }
.hero-copy h1 { max-width: 15ch; }

.start-card {
  margin-top: 1.75rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow); max-width: 34rem;
}
.start-form { display: grid; gap: .5rem; }
.start-form label { font-weight: 700; color: var(--ink); font-size: .92rem; }
.input-row { display: flex; gap: .5rem; }
.input-row input {
  flex: 1; min-width: 0; min-height: 48px; padding: .6rem .9rem; font: 500 1rem var(--font);
  border: 1px solid var(--line-2); border-radius: 12px; color: var(--ink); background: #FBFCFD;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-row input:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(13, 148, 136, .12); outline: none; }
.or { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1.1rem 0; font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.sample {
  width: 100%; justify-content: flex-start; gap: .9rem; padding: .8rem 1rem; min-height: 64px;
  background: linear-gradient(180deg, #FFFFFF, #F6FAFB); border-color: var(--line); text-align: left; white-space: normal;
}
.btn.sample:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow); }
.sample-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ink); color: #fff; flex: none; }
.sample-icon .ico { width: 16px; height: 16px; margin-left: 2px; }
.sample-text { display: grid; gap: .1rem; }
.sample-text b { color: var(--ink); font-size: 1rem; }
.sample-text small { color: var(--muted); font-weight: 500; font-size: .84rem; }
.disclaimer {
  display: flex; gap: .55rem; align-items: flex-start; font-size: .86rem; color: var(--muted);
  margin: 1.25rem 0 0; max-width: 34rem;
}
.disclaimer .ico { color: var(--warn); margin-top: .12rem; }

.hero-visual { position: relative; padding: 2rem; }
.scope {
  position: relative; aspect-ratio: 1; border-radius: 50%;
  background: #05080D; padding: 3.5%;
  box-shadow: var(--shadow-lg), 0 0 0 10px rgba(255, 255, 255, .7), 0 0 0 11px var(--line);
}
.scope img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.scope::after { content: ""; position: absolute; inset: 3.5%; border-radius: 50%; box-shadow: inset 0 0 40px rgba(0, 0, 0, .35); pointer-events: none; }
.chip {
  position: absolute; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px; padding: .75rem 1rem; box-shadow: var(--shadow); display: grid; gap: .2rem;
}
.chip-label { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chip-value { font-size: 1.45rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.chip-value small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.chip-bar { display: block; height: 6px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; width: 150px; }
.chip-bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.chip-a { left: -.5rem; top: 12%; }
.chip-b { right: -.5rem; bottom: 16%; }
.chip-c { left: 8%; bottom: 0; grid-auto-flow: column; gap: 1rem; font-size: .85rem; font-weight: 600; color: var(--text); padding: .6rem .9rem; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 3rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow-sm); }
.feature p { color: var(--muted); font-size: .94rem; margin: 0; }
.feature-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-700); margin-bottom: .9rem; }
.feature-icon .ico { width: 22px; height: 22px; }

/* ---------- Dots / legend ---------- */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid; margin-right: .4rem; vertical-align: -1px; flex: none; }
.dot.wbc { border-color: var(--wbc); }
.dot.par { border-color: var(--par); }
.legend { display: flex; gap: 1.1rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
.legend > span { display: inline-flex; align-items: center; }

/* ---------- Counting workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.stage { min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; min-height: 30px; }
.dropzone {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; min-height: 460px;
  display: grid; place-items: center;
  background: radial-gradient(600px 300px at 50% 30%, #1A2A44 0%, #0B1220 70%);
  box-shadow: var(--shadow-lg); outline: 2px dashed transparent; outline-offset: -10px; transition: outline-color .15s;
}
.dropzone.dragging { outline-color: #5EEAD4; }
#field-canvas { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; }
.drop-empty { text-align: center; color: #E8EEF6; padding: 2.5rem; display: grid; justify-items: center; gap: .5rem; }
.drop-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); margin-bottom: .5rem; }
.drop-icon .ico { width: 28px; height: 28px; color: #5EEAD4; }
.drop-empty .hint { color: #9FB0C6; margin-bottom: .75rem; }
.drop-title { font-size: 1.3rem; font-weight: 700; margin: 0; color: #fff; }
.busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .75rem;
  background: rgba(8, 14, 25, .62); backdrop-filter: blur(3px); color: #fff; font-weight: 600; font-size: 1.05rem;
}
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #5EEAD4; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--par); font-weight: 600; margin-top: .75rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.35rem; display: grid; gap: 1.1rem; position: sticky; top: 84px; box-shadow: var(--shadow);
}
.ring-block { position: relative; width: 168px; height: 168px; margin: .25rem auto 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--accent-soft); stroke-width: 10; }
.ring-fill {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset .5s cubic-bezier(.2, .8, .2, 1), stroke .3s;
}
.ring-fill.done { stroke: var(--ok); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: .15rem; }
.ring-value { font-size: 1.65rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring-center .label { font-size: .64rem; max-width: 9rem; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.panel > *, .field-box > * { min-width: 0; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .95rem; }
.stat.par .big { color: var(--par); }
.guidance {
  display: flex; gap: .6rem; align-items: flex-start; margin: 0;
  background: var(--accent-soft); color: #0B5952; border: 1px solid #C6E9E5;
  border-radius: var(--radius); padding: .85rem 1rem; font-weight: 600; font-size: .95rem;
}
.guidance::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: .45rem; }
.guidance.done { background: var(--ok-soft); color: #14532D; border-color: #C3E8CF; }
.guidance.done::before { background: var(--ok); }

.field-box { border-top: 1px solid var(--line); padding-top: 1.1rem; display: grid; gap: .9rem; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.field-counts { display: flex; gap: 1rem; font-size: .95rem; color: var(--muted); }
.field-counts > span { display: inline-flex; align-items: center; gap: .2rem; }
.field-counts b { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 1.1rem; }
.badge { font-size: .78rem; font-weight: 700; padding: .3rem .7rem; border-radius: 99px; background: var(--ok-soft); color: var(--ok); border: 1px solid #C3E8CF; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: #F6D9B2; }
.flag { display: flex; gap: .65rem; background: var(--warn-soft); color: #7A3E06; border: 1px solid #F6D9B2; border-radius: var(--radius); padding: .85rem; font-size: .92rem; }
.flag > .ico { color: var(--warn); margin-top: .1rem; }
.flag p { margin-bottom: .6rem; }
.tools { display: grid; gap: .5rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: .3rem; }
.tool {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem; min-height: 40px; padding: .35rem .5rem;
  border-radius: 9px; border: 0; background: transparent; font: 600 .86rem var(--font); color: var(--text); cursor: pointer;
}
.tool .ico { width: 14px; height: 14px; }
.tool .dot { margin-right: .1rem; }
.tool:hover { background: rgba(255, 255, 255, .8); }
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: var(--shadow-sm); }
.actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; }

.thumbs { display: flex; gap: .75rem; overflow-x: auto; padding: 1rem .1rem .5rem; scrollbar-width: thin; }
.thumb { flex: 0 0 auto; width: 116px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: .76rem; box-shadow: var(--shadow-sm); }
.thumb img { display: block; width: 100%; height: 80px; object-fit: cover; }
.thumb span { display: block; padding: .35rem .5rem; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }

/* ---------- Result / report ---------- */
.report {
  max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 2.25rem; display: grid; gap: 1.4rem; box-shadow: var(--shadow);
}
.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.report-brand { display: flex; gap: .9rem; align-items: flex-start; }
.report-brand .brand-mark { width: 40px; height: 40px; margin-top: .2rem; }
.report-head h1 { font-size: 1.6rem; margin: .15rem 0 .2rem; }
.report-head p { margin: 0; }
.status { font-weight: 700; font-size: .82rem; padding: .4rem .8rem; border-radius: 99px; white-space: nowrap; border: 1px solid; }
.status.preliminary { background: var(--warn-soft); color: var(--warn); border-color: #F6D9B2; }
.status.reviewed { background: var(--ok-soft); color: var(--ok); border-color: #C3E8CF; }
.density {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 1.6rem 1.75rem;
  background: linear-gradient(135deg, #0B1B33 0%, #10314A 55%, #0D5B57 100%); color: #fff;
}
.density::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(94, 234, 212, .12); }
.density .label { color: #9ED9D2; }
.density-value { font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); font-weight: 800; font-variant-numeric: tabular-nums; margin: .25rem 0; letter-spacing: -.03em; color: #fff; }
.formula { color: #B8C7D9; font-variant-numeric: tabular-nums; margin: 0; font-size: .92rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:nth-child(even) td { background: #FAFBFC; }
.table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg); }
.check { display: flex; gap: .7rem; align-items: center; font-weight: 600; min-height: 48px; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--bg); }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ---------- Evaluation ---------- */
.eval { max-width: 1040px; margin: 0 auto; }
.eval h1 { font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.6rem); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); display: grid; gap: .2rem; align-content: start; }
.metric .big { margin: .15rem 0; font-size: 2rem; }
.metric .hint { font-size: .82rem; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-top: .35rem; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.eval .muted { max-width: 60rem; }
.callout { display: flex; gap: .7rem; background: var(--warn-soft); border: 1px solid #F6D9B2; color: #7A3E06; border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: 1rem; font-size: .94rem; }
.callout .ico { color: var(--warn); margin-top: .15rem; }
.failures { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.failure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); margin: 0; }
.failure img { display: block; width: 100%; background: #000; }
.failure p { padding: .9rem 1.1rem; margin: 0; font-size: .9rem; color: var(--muted); }
.failure strong { color: var(--ink); }

/* ---------- Footer / dialog ---------- */
.footer {
  max-width: 1240px; width: 100%; margin: 0 auto; padding: 1.5rem 1.25rem 2rem; display: flex; justify-content: space-between; gap: 1rem;
  color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line);
}
.footer a { color: var(--accent-700); font-weight: 600; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.6rem; max-width: 400px; color: var(--text); box-shadow: var(--shadow-lg); }
dialog p { font-weight: 600; color: var(--ink); margin-bottom: 1.2rem; }
dialog::backdrop { background: rgba(11, 27, 51, .45); backdrop-filter: blur(2px); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 1rem; }
  .hero-visual { max-width: 480px; margin: 0 auto; width: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; min-width: 0; }
}
@media (max-width: 720px) {
  main { padding: 1rem .9rem 2rem; }
  .topbar-inner { padding: .6rem .9rem; gap: .5rem; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 28px; height: 28px; }
  .navlink span { display: none; }
  .navlink { padding: .4rem .55rem; }
  .topbar-ref { display: none; }
  .actions { grid-template-columns: minmax(0, 1fr); }
  .tool { white-space: normal; text-align: left; }
  .lang { padding: .4rem .6rem; }
  .input-row { flex-direction: column; }
  .start-card { padding: 1.1rem; }
  .hero-visual { padding: 1.25rem .5rem; }
  .chip { padding: .55rem .75rem; }
  .chip-value { font-size: 1.15rem; }
  .chip-bar { width: 110px; }
  .chip-a { left: -.25rem; }
  .chip-b { right: -.25rem; }
  .chip-c { display: none; }
  .features { grid-template-columns: 1fr; margin-top: 1.5rem; }
  .dropzone { min-height: 320px; border-radius: var(--radius); }
  .stage-head .legend { font-size: .8rem; gap: .75rem; }
  .report { padding: 1.25rem; }
  .report-head { flex-direction: column; }
  .stats.three { grid-template-columns: 1fr 1fr; }
  .stats.three .stat:last-child { grid-column: 1 / -1; }
  .footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; }
  .topbar, .footer, .no-print { display: none !important; }
  main { padding: 0; }
  .report { border: 0; padding: 0; max-width: none; box-shadow: none; }
  .density { background: #fff !important; color: var(--ink); border: 2px solid var(--ink); }
  .density-value { color: var(--ink); }
  .density .label, .formula { color: var(--muted); }
  .density::after { display: none; }
  .screen:not(#screen-result) { display: none !important; }
}
