/* Shared look for Octagon Labs pages. Tokens first; components only read tokens. */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #151a2d;
  --muted: #596079;
  --line: #d6dbe4;
  --accent: #0e6f63;
  --accent-ink: #ffffff;
  --accent-soft: #d7efe9;
  --mark: #d9771a;
  --mark-soft: #fbe9d6;
  --mid: #9aa3b5;
  --bad: #b3261e;
  --font-display: "Baloo 2", "Mukta", system-ui, sans-serif;
  --font-body: "Mukta", system-ui, -apple-system, "Segoe UI", "Noto Sans Devanagari", sans-serif;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1020; --surface: #161a2c; --ink: #e8ebf6; --muted: #9aa1bb; --line: #2a3048;
    --accent: #37b9a4; --accent-ink: #06201c; --accent-soft: #133a35; --mark: #f0a04b; --mark-soft: #3a2a17; --mid: #6b7390; --bad: #ff8a80;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1020; --surface: #161a2c; --ink: #e8ebf6; --muted: #9aa1bb; --line: #2a3048;
  --accent: #37b9a4; --accent-ink: #06201c; --accent-soft: #133a35; --mark: #f0a04b; --mark-soft: #3a2a17; --mid: #6b7390; --bad: #ff8a80;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 17px; line-height: 1.55;
  padding-inline: 16px; padding-block: 0 40px;
}
.wrap { max-width: 640px; margin: 0 auto; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 14px; max-width: 640px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand > span { white-space: nowrap; }
.brand small { font-family: var(--font-body); font-weight: 500; color: var(--muted); font-size: 0.85rem; }

/* language switch */
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; }
.lang button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; line-height: 1.3;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.note { border-left: 3px solid var(--mark); padding: 2px 0 2px 12px; color: var(--muted); font-size: 0.95rem; }

/* buttons */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 12px; font: inherit; font-weight: 600;
  padding: 12px 18px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-link { background: none; border: 0; color: var(--accent); padding: 8px 4px; min-height: auto; font-weight: 600; }
.btn-block { width: 100%; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

/* length picker */
.lengths { display: grid; gap: 10px; }
.length {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--surface);
}
.length input { grid-row: span 2; accent-color: var(--accent); width: 20px; height: 20px; margin: 0; }
.length strong { font-weight: 600; }
.length .tag { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-left: 6px; }
.length:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }

/* test screen */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; color: var(--muted); font-size: 0.9rem; }
.qtext { font-size: 1.2rem; font-weight: 500; }
.series { display: flex; flex-wrap: wrap; gap: 8px; }
.series span {
  font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; min-width: 48px; text-align: center;
  padding: 6px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums;
}
.series span.q { background: var(--mark-soft); border-color: var(--mark); color: var(--mark); }

.matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 330px; width: 100%; margin: 0 auto; }
.matrix .cell { aspect-ratio: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; max-width: 100%; }
.matrix .cell.q { background: var(--mark-soft); border: 2px dashed var(--mark); color: var(--mark); font-family: var(--font-display); font-size: 2rem; font-weight: 700; }
.matrix svg, .opt svg { width: 100%; height: 100%; display: block; }

.opts { display: grid; gap: 10px; }
.opts.text { grid-template-columns: 1fr; }
.opts.visual { grid-template-columns: repeat(4, 1fr); }
.opt {
  position: relative; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px;
  font: inherit; text-align: left; padding: 12px 14px; cursor: pointer; min-height: 52px; display: flex; align-items: center; gap: 12px;
}
.opt .key { font-size: 0.8rem; font-weight: 600; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; flex: none; }
.opts.visual .opt { aspect-ratio: 1; padding: 6px; flex-direction: column; justify-content: center; gap: 0; }
.opts.visual .opt .key { position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; font-size: 0.68rem; background: var(--surface); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt[aria-pressed="true"] .key { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.navbar { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.navbar .btn:disabled { visibility: hidden; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.dots { padding-top: 4px; }
.dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; padding: 0; background: var(--line); cursor: pointer; }
.dots button.done { background: var(--accent); }
.dots button.cur { outline: 2px solid var(--mark); outline-offset: 1px; }

/* forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
select, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 10px 12px; min-height: 48px; width: 100%;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { border: 1.5px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; background: var(--surface); }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chips label:has(input:focus-visible) { outline: 3px solid var(--mark); outline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 500; padding: 0; margin-bottom: 6px; }
.error { color: var(--bad); font-weight: 500; }

/* results */
.score-hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.score-hero .big { font-family: var(--font-display); font-size: 3.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.cmp { display: grid; gap: 14px; }
.cmp-row { display: grid; gap: 6px; }
.cmp-row .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 0.95rem; }
.bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.sect { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.sect .bar { grid-column: 1 / -1; height: 8px; }
.iq-box { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.iq-box .big { font-family: var(--font-display); font-size: 2rem; font-weight: 700; }

.footer { max-width: 640px; margin: 28px auto 0; color: var(--muted); font-size: 0.85rem; display: flex; gap: 14px; flex-wrap: wrap; }

@media (min-width: 560px) {
  .lengths { grid-template-columns: repeat(3, 1fr); }
  .length { grid-template-columns: 1fr; text-align: left; }
  .length input { grid-row: auto; }
  .opts.text { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  .brand small { display: block; line-height: 1.1; }
  .lang button { padding: 4px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
