/* Dr. Klain — orientační test adice (MVP beta)
   Designový princip: uživatel je presbyop BEZ brýlí.
   Kritické texty >= 22 px, interaktivní prvky >= 64 px, výsledek obřím písmem. */

:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0a6c74;
  --accent-dark: #085a61;
  --bg: #fafaf8;
  --card: #ffffff;
  --border: #e5e5e0;
  --danger: #b3261e;
  --ok: #1d7a3c;
  --warn: #b06000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* [hidden] musí vyhrát i nad .btn/.btn-col s vlastním display (UA pravidlo by prohrálo) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 22px;            /* baseline = kritický text */
  line-height: 1.45;
  min-height: 100dvh;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 120px;
}

/* ---------- obrazovky (stavový automat) ---------- */

.screen { display: none; }
.screen.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadein .2s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

h1 { font-size: 30px; line-height: 1.2; }
h2 { font-size: 26px; line-height: 1.25; }

.lead { font-size: 24px; font-weight: 600; }
.muted { color: var(--muted); font-size: 19px; }
.small { font-size: 17px; color: var(--muted); line-height: 1.5; }

.box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}

/* ---------- tlačítka: min. 64 px, spíš víc ---------- */

.btn {
  display: block;
  width: 100%;
  min-height: 72px;
  padding: 16px 20px;
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  border-radius: 18px;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled { opacity: .5; }

.btn-secondary {
  background: var(--card);
  color: var(--accent);
}
.btn-secondary:active { background: #eef4f4; color: var(--accent); }

.btn-quiet {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 22px;
  min-height: 64px;
}

/* obří ANO/NE a PŘEČTU/NEPŘEČTU */
.btn-giant {
  min-height: 96px;
  font-size: 32px;
}

.btn-col { display: flex; flex-direction: column; gap: 14px; }

/* ---------- věk: číselník ---------- */

.age-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.age-step {
  width: 96px;
  height: 96px;
  min-height: 96px;
  flex: none;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  border-radius: 22px;
  border: 2px solid var(--accent);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.age-step:active { background: #eef4f4; }
.age-value {
  min-width: 140px;
  text-align: center;
  font-size: 88px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- kalibrace kartou ---------- */

.card-rect {
  height: 0; /* výšku nastavuje JS dle poměru karty (na výšku) */
  margin: 8px auto;
  border: 3px solid var(--accent);
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, #f1f6f6, #f1f6f6 12px, #e6efef 12px, #e6efef 24px);
}
/* výška rámečku je oříznutá (srovnává se jen šířka) — naznačí přerušovaná hrana */
.card-rect.cut {
  border-bottom: 3px dashed var(--accent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

input[type="range"] {
  width: 100%;
  height: 64px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 7px;
  background: var(--border);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 56px;
  height: 56px;
  margin-top: -21px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
input[type="range"]::-moz-range-track {
  height: 14px;
  border-radius: 7px;
  background: var(--border);
}
input[type="range"]::-moz-range-thumb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* ---------- čtecí obrazovka ---------- */

.row-stage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  overflow: hidden;
}
.row-words {
  font-family: Arial, Helvetica, sans-serif; /* bezpatkové s předvídatelnou verzálkou */
  font-weight: 400;
  letter-spacing: 0.06em;
  white-space: nowrap; /* velké řádky přepne JS na normal — zalomení místo oříznutí */
  text-align: center;
  line-height: 1.3;
  text-transform: uppercase;
  color: #000;
  max-width: 100%;
}

.reading-hint {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  min-height: 76px;
}

.mic-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: 10px;
  vertical-align: baseline;
  animation: pulse 1.2s infinite;
  visibility: hidden;
}
.mic-dot.on { visibility: visible; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- výsledek ---------- */

.result-number {
  text-align: center;
  font-size: clamp(64px, 24vw, 110px);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.result-range {
  text-align: center;
  font-size: 26px;
  font-weight: 600;
}

.pairing-code {
  text-align: center;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: 0.35em;
  padding: 14px 0 14px 0.35em; /* kompenzace letter-spacing posledního znaku */
  background: #eef4f4;
  border-radius: 14px;
  color: var(--ink);
}

.progress {
  font-size: 19px;
  color: var(--muted);
  text-align: center;
}
