/* Thị Lực Online — calm, high-contrast, light. Tests themselves run on pure white. */
:root {
  --bg: #f5f7f6;
  --paper: #ffffff;
  --ink: #102a27;
  --copy: #34504c;
  --muted: #61807b;
  --line: #dbe5e2;
  --brand: #0d7a6c;
  --brand-ink: #075c51;
  --brand-soft: #e3f3ef;
  --ok: #18794e;
  --ok-soft: #e6f6ee;
  --watch: #9a6200;
  --watch-soft: #fff5df;
  --see: #b4232a;
  --see-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 42, 39, 0.06), 0 6px 24px rgba(16, 42, 39, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1080px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--copy);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--brand); }
a:hover { color: var(--brand-ink); }
img, svg, canvas { display: block; }
.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.lead { font-size: 1.12rem; }
.center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Header / footer ------------------------------------------------------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--brand); text-decoration: none; font-size: 1.15rem; font-weight: 600; }
.brand span { color: var(--ink); }
.brand b { color: var(--brand); font-weight: 700; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { text-decoration: none; color: var(--copy); padding: 8px 12px; border-radius: 999px; font-size: 0.95rem; }
.site-nav a:hover { background: var(--brand-soft); color: var(--brand-ink); }
.site-nav a[aria-current="page"] { background: var(--brand); color: #fff; }
.site-footer { margin-top: 56px; padding: 28px 0 36px; border-top: 1px solid var(--line); background: var(--paper); font-size: 0.92rem; }
.site-footer p:last-child { margin: 0; }
body.testing .site-header, body.testing .site-footer { display: none; }

/* Layout ---------------------------------------------------------------- */
.page-head { padding: 40px 0 8px; }
.page-head p { max-width: 64ch; }
.section { padding: 24px 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.tests { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Hero ------------------------------------------------------------------ */
.hero { padding: 48px 0 24px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.hero p.lead { max-width: 52ch; }
.hero-art { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); }
.hero-chart { font-weight: 700; color: var(--ink); text-align: center; letter-spacing: 0.25em; line-height: 1.15; font-family: Arial, sans-serif; }
.hero-chart div:nth-child(1) { font-size: 64px; }
.hero-chart div:nth-child(2) { font-size: 40px; }
.hero-chart div:nth-child(3) { font-size: 26px; }
.hero-chart div:nth-child(4) { font-size: 17px; }
.hero-chart div:nth-child(5) { font-size: 11px; }
.steps-inline { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps-inline li { counter-increment: s; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 8px; font-size: 0.92rem; }
.steps-inline li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700; margin-right: 8px; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 28px; } .hero-art { display: none; } }

/* Test cards ------------------------------------------------------------ */
.test-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.test-card:hover { transform: translateY(-2px); border-color: var(--brand); color: inherit; }
.test-card .icon { width: 52px; height: 52px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand); }
.test-card h3 { margin: 4px 0 0; }
.test-card p { margin: 0; font-size: 0.95rem; }
.test-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.tag { font-size: 0.78rem; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* Buttons & forms ------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 1rem; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 46px; }
.btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); color: #fff; }
.btn.lg { padding: 14px 28px; font-size: 1.08rem; min-height: 54px; }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--see); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
label.field { display: grid; gap: 6px; font-weight: 600; color: var(--ink); }
input[type="number"], input[type="text"] { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; color: var(--ink); }
input[type="range"] { width: 100%; accent-color: var(--brand); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 0.92rem; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--copy); }
.chip[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 0.95rem; border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; color: var(--copy); }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

/* Notices & verdicts ---------------------------------------------------- */
.notice { border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; border: 1px solid; font-size: 0.95rem; }
.notice.info { background: var(--brand-soft); border-color: #b9e0d7; color: var(--brand-ink); }
.notice.warn { background: var(--watch-soft); border-color: #f3d79b; color: #6b4400; }
.notice a { font-weight: 600; }
.verdict { border-radius: 12px; padding: 14px 16px; border-left: 5px solid; background: var(--bg); }
.verdict + .verdict { margin-top: 10px; }
.verdict p { margin: 0; }
.verdict-eye { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--muted); }
.verdict-title { font-weight: 700; color: var(--ink); font-size: 1.1rem; }
.verdict.ok { border-color: var(--ok); background: var(--ok-soft); }
.verdict.watch { border-color: var(--watch); background: var(--watch-soft); }
.verdict.see { border-color: var(--see); background: var(--see-soft); }

/* Test stage ------------------------------------------------------------ */
.test-shell { max-width: 920px; margin: 0 auto; }
.stage { background: #fff; border-radius: var(--radius); border: 1px solid var(--line); position: relative; overflow: hidden; display: grid; place-items: center; min-height: 360px; touch-action: none; }
.stage canvas { max-width: 100%; }
body.testing .stage { min-height: clamp(260px, calc(100vh - 330px), 900px); }
.stage-bar { display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; font-size: 0.92rem; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; flex: 1; min-width: 120px; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width 0.2s; }
.answer-pad { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 64px); gap: 8px; justify-content: center; margin: 16px auto 0; }
.answer-pad button { font-size: 1.6rem; }
.answer-pad .up { grid-column: 2; grid-row: 1; }
.answer-pad .left { grid-column: 1; grid-row: 2; }
.answer-pad .unsure { grid-column: 2; grid-row: 2; font-size: 0.82rem; }
.answer-pad .right { grid-column: 3; grid-row: 2; }
.answer-pad .down { grid-column: 2; grid-row: 3; }
.letter-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; max-width: 460px; margin: 16px auto 0; }
.letter-pad button { font-size: 1.3rem; font-family: Arial, sans-serif; min-height: 54px; }
.letter-pad .wide { grid-column: span 5; font-size: 0.95rem; }
.eye-intro { text-align: center; max-width: 560px; margin: 24px auto; }
.eye-intro .eye-icon { display: flex; justify-content: center; color: var(--brand); margin: 8px 0 16px; }
.step-count { font-size: 0.82rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 4px; }
.flash-ok { animation: flash 0.25s; }
@keyframes flash { from { box-shadow: inset 0 0 0 6px var(--brand-soft); } to { box-shadow: none; } }

/* Calibration ----------------------------------------------------------- */
.card-sizer { display: grid; place-items: center; padding: 28px 0; overflow: hidden; }
.virtual-card { background: linear-gradient(135deg, #2b6f8f, #13324a); border-radius: 3.18mm; position: relative; color: #fff; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18); }
.virtual-card::before { content: ""; position: absolute; left: 10%; top: 34%; width: 14%; height: 20%; border-radius: 4px; background: linear-gradient(135deg, #f8e3a0, #c9a54d); }
.virtual-card span { position: absolute; left: 8%; bottom: 10%; font-size: 12px; letter-spacing: 0.1em; opacity: 0.8; }
.virtual-ruler { height: 46px; background: #fffbe9; border: 1px solid #c9b86c; position: relative; }
.virtual-ruler i { position: absolute; bottom: 0; width: 1px; background: #6b5d1c; }
.virtual-ruler b { position: absolute; top: 2px; font-size: 11px; transform: translateX(-50%); color: #6b5d1c; }
.sizer-controls { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.blindspot-stage { height: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); position: relative; overflow: hidden; }
.blindspot-stage .fix { position: absolute; width: 18px; height: 18px; background: #111; top: 50%; margin-top: -9px; }
.blindspot-stage .dot { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #e11; top: 50%; margin-top: -11px; margin-left: -11px; }
.big-number { font-size: 2.4rem; font-weight: 700; color: var(--ink); line-height: 1.1; }

/* Plates / grids -------------------------------------------------------- */
.plate-row { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 16px; }
.number-entry { display: flex; flex-direction: column; gap: 10px; min-width: 220px; max-width: 300px; width: 100%; }
.number-entry input { font-size: 1.6rem; text-align: center; letter-spacing: 0.2em; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.numpad button { min-height: 44px; font-size: 1.15rem; padding: 6px; }
.clock-wrap { position: relative; }
.choice-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* Results --------------------------------------------------------------- */
.result-card h3 { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.result-card h3 small { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.kv div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kv dt { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kv dd { margin: 0; font-weight: 700; color: var(--ink); font-size: 1.15rem; }
table.simple { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.simple th, table.simple td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: 0.4em; }

@media print {
  .site-header, .site-footer, .actions, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
.dist-label { margin: 16px 0 0; }
@media (max-width: 600px) {
  .site-header { position: static; }
  .header-inner { padding: 8px 0; gap: 6px; }
  .site-nav a { padding: 6px 10px; font-size: 0.88rem; }
  body { font-size: 16px; }
  .card { padding: 18px; }
}
