/* Ó czy U? — Trener ortografii · style ekranowe.
   Paleta i komponenty wspólne z „Ortografią na lekcję", „Zegarem" i „Działaniami na lekcję". */
:root {
  --sky: #dff1ff;
  --cream: #fff8e6;
  --ink: #1d2b4f;
  --ink-soft: #4a5a7d;
  --paper: #ffffff;
  --line: #c9d8ea;
  --blue: #1f66d6;
  --blue-dark: #174fa8;
  --sun: #ffd23f;
  --sun-dark: #e0a800;
  --green: #2e9e5b;
  --green-bg: #dcf5e4;
  --red: #e8523f;
  --red-bg: #ffe3dd;
  --orange: #f28c28;
  --violet: #6c4bd6;
  --violet-bg: #ece6ff;
  --radius: 22px;
  --hand: "Segoe Print", "Chalkboard SE", "Comic Sans MS", "Bradley Hand", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--sky); }
body {
  margin: 0; min-height: 100vh;
  background: linear-gradient(180deg, var(--sky) 0%, #eef7ff 45%, var(--cream) 100%);
  color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.4;
  display: flex; flex-direction: column;
}
body.follow-on { padding-bottom: 120px; }
body.gra-on .seo, body.gra-on footer, body.gra-on .top .sub { display: none; }

a { color: var(--blue-dark); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font-family: var(--body); font-size: .85em; font-weight: 700;
  border: 2px solid var(--line); border-bottom-width: 3px; border-radius: 6px;
  padding: 0 6px; background: var(--paper);
}

/* ---------- nagłówek ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px 20px 6px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { width: 56px; height: 56px; flex: none; }
.top h1 { margin: 0; font-family: var(--hand); font-size: 32px; line-height: 1.1; }
.top h1 span { color: var(--blue); }
.top .sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 16px; }
.top-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; min-width: 44px; padding: 8px 20px;
  font-size: 20px; font-weight: 700; line-height: 1.15;
  border-radius: 999px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink);
  text-decoration: none; box-shadow: 0 3px 0 var(--ink);
  transition: transform .08s ease;
}
.btn:hover { background: #f3f8ff; }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible, .seg button:focus-visible, .tile:focus-visible, .choice:focus-visible,
input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 4px solid var(--blue); outline-offset: 3px;
}
.btn[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue-dark); box-shadow: 0 3px 0 var(--blue-dark); }
.btn--gold { background: var(--sun); border-color: var(--sun-dark); box-shadow: 0 3px 0 var(--sun-dark); }
.btn--gold:hover { background: #ffdc66; }
.btn--blue { background: var(--blue); color: #fff; border-color: var(--blue-dark); box-shadow: 0 3px 0 var(--blue-dark); }
.btn--blue:hover { background: #2b74e6; }
.btn--ghost { background: transparent; box-shadow: none; border-color: var(--ink-soft); }
.btn--big { font-size: 24px; min-height: 62px; padding: 10px 28px; }
.btn--huge { font-size: 30px; min-height: 74px; padding: 12px 42px; font-family: var(--hand); }
.btn--small { min-height: 42px; font-size: 17px; padding: 6px 14px; box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }

main { flex: 1; display: flex; flex-direction: column; }
.view { padding: 8px 20px 24px; }
.h-hand { font-family: var(--hand); font-size: 24px; margin: 0 0 10px; }
.note { color: var(--ink-soft); font-size: 16px; margin: 8px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row--center { justify-content: center; margin-top: 18px; }
.group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.group .lbl { color: var(--ink-soft); font-size: 16px; }

/* ---------- ekran startowy ---------- */
.view--start { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1080px; width: 100%; margin: 0 auto; }
.panel-card {
  min-width: 0; padding: 14px 18px; border-radius: var(--radius);
  background: rgba(255,255,255,.75); border: 2px dashed var(--line);
}
.seg { max-width: 100%; flex-wrap: wrap; }
.panel-card--row { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-start; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 86px; padding: 10px 6px; border-radius: 18px; border: 3px solid var(--ink);
  background: var(--paper); color: var(--ink);
  font-family: var(--hand); font-weight: 700; font-size: 26px; line-height: 1.05;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s ease;
}
.tile small { display: block; font-family: var(--body); font-size: 13px; font-weight: 500; opacity: .85; margin-top: 6px; }
.tile:hover { background: #f3f8ff; }
.tile:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.tile[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue-dark); box-shadow: 0 3px 0 var(--blue-dark); }
.modes-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.modes-grid .tile { font-size: 20px; min-height: 96px; }
.modes-grid .tile[aria-pressed="true"] { background: var(--violet); border-color: #4a2fa8; box-shadow: 0 3px 0 #4a2fa8; }

.seg { display: inline-flex; border-radius: 999px; overflow: hidden; border: 3px solid var(--ink); background: var(--paper); }
.seg button { min-height: 48px; padding: 6px 18px; border: 0; background: transparent; font-size: 18px; font-weight: 700; }
.seg button + button { border-left: 3px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.seg--big button { min-height: 56px; font-size: 21px; padding: 6px 26px; }

.team-names { display: flex; flex-wrap: wrap; gap: 8px; }
.team-names input {
  min-height: 48px; width: 150px; padding: 6px 12px; font-size: 18px;
  border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink);
}
.own summary { cursor: pointer; font-size: 19px; padding: 4px 0; min-height: 44px; display: flex; align-items: center; }
.own textarea {
  width: 100%; margin: 8px 0; padding: 10px 12px; font-size: 18px; font-family: ui-monospace, "Consolas", monospace;
  border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); resize: vertical;
}
.own code { background: var(--violet-bg); padding: 1px 6px; border-radius: 6px; font-size: .95em; }
.start-row { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.start-row .note { text-align: center; }

/* ---------- plansza gry ---------- */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hud {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px;
  width: 100%; max-width: 1100px;
}
.hud-item { margin: 0; font-weight: 700; font-size: 20px; }
.hud-item--big { font-family: var(--hand); font-size: 34px; min-width: 110px; text-align: center; }
.hud-item--big.low { color: var(--red); }
.hud-combo { color: var(--orange); }

.word-box {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 3vh, 34px); width: 100%; max-width: 1100px; padding: 10px 0 20px;
}
.context { margin: 0; font-size: clamp(18px, 2.4vw, 28px); color: var(--ink-soft); text-align: center; }
.context b { color: var(--ink); }
/* wyraz zawsze w jednej linii — app.js zmniejsza czcionkę, gdy słowo nie mieści się w szerokości */
.word {
  margin: 0; width: 100%; font-family: var(--hand); font-weight: 700; letter-spacing: .04em; text-align: center;
  font-size: clamp(56px, 16vw, 190px); line-height: 1.05; white-space: nowrap; overflow: hidden;
}
/* luka: pusty, wyraźny prostokąt w miejscu brakującej litery */
.word .tekst { display: inline-block; }
.word .gap {
  display: inline-block; color: transparent; width: .7em; margin: 0 .04em;
  border-bottom: .09em solid var(--blue); vertical-align: baseline;
}
.word--ok { color: var(--green); }
.word--bad { color: var(--red); }
.word .fill { animation: pop .3s ease; display: inline-block; }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.word--duel { font-size: clamp(50px, 12vw, 150px); }
.word--board { font-size: clamp(60px, 14vw, 200px); }

.choices { display: flex; flex-wrap: wrap; gap: clamp(12px, 3vw, 40px); justify-content: center; }
.choice {
  min-width: clamp(110px, 18vw, 230px); min-height: clamp(84px, 14vh, 150px); padding: 8px 20px;
  border-radius: 26px; border: 5px solid var(--ink); background: var(--paper); color: var(--ink);
  font-family: var(--hand); font-weight: 700; font-size: clamp(44px, 8vw, 96px); line-height: 1;
  box-shadow: 0 5px 0 var(--ink); transition: transform .08s ease;
}
.choice:hover { background: #f3f8ff; }
.choice:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.choice--ok { background: var(--green-bg); border-color: var(--green); box-shadow: 0 5px 0 var(--green); }
.choice--bad { background: var(--red-bg); border-color: var(--red); box-shadow: 0 5px 0 var(--red); }
.choice:disabled { opacity: .55; cursor: default; }
.choices--duel .choice { min-height: clamp(70px, 11vh, 120px); font-size: clamp(34px, 6vw, 68px); min-width: clamp(80px, 13vw, 160px); }
.choices--board .choice { min-height: clamp(90px, 16vh, 170px); }

.why {
  margin: 0; max-width: 900px; text-align: center; font-size: clamp(17px, 2.2vw, 26px);
  padding: 12px 20px; border-radius: 18px; background: var(--violet-bg); border: 2px solid #c9bdf5;
}
.why b { display: block; font-size: .8em; text-transform: uppercase; letter-spacing: .08em; color: var(--violet); margin-bottom: 4px; }
.why .uwaga { display: block; margin-top: 6px; font-size: .9em; color: var(--ink-soft); }
.kbd-hint { margin: 0; color: var(--ink-soft); font-size: 15px; }
@media (hover: none) { .kbd-hint { display: none; } }

/* ---------- pojedynek ---------- */
.duel-score { display: flex; gap: 10px; width: 100%; max-width: 1100px; }
.ds {
  flex: 1; text-align: center; font-family: var(--hand); font-size: clamp(20px, 3vw, 34px);
  padding: 6px 10px; border-radius: 16px; border: 3px solid var(--ink); background: var(--paper);
}
.ds--1 { border-color: var(--blue); color: var(--blue-dark); }
.ds--2 { border-color: var(--orange); color: #a85d0b; }
.ds.lead { background: var(--sun); }
.duel { display: flex; gap: 12px; width: 100%; max-width: 1100px; }
.duel-half { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: 20px; }
.duel-half--1 { background: rgba(31,102,214,.08); border: 2px dashed var(--blue); }
.duel-half--2 { background: rgba(242,140,40,.10); border: 2px dashed var(--orange); }
.duel-name { margin: 0; font-weight: 700; font-size: 19px; text-align: center; }
.duel-name small { display: block; font-weight: 500; font-size: 14px; color: var(--ink-soft); }
.duel-half.locked { opacity: .45; }

/* ---------- klasa na tablicy ---------- */
.board { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; max-width: 1100px; }
.team {
  flex: 1 1 160px; max-width: 280px; text-align: center; padding: 8px 12px;
  border-radius: 18px; border: 4px solid var(--line); background: var(--paper);
}
.team.active { border-color: var(--blue); background: #eaf2ff; }
.team .tn { display: block; font-weight: 700; font-size: clamp(16px, 2vw, 22px); overflow-wrap: anywhere; }
.team .tp { display: block; font-family: var(--hand); font-size: clamp(30px, 5vw, 54px); line-height: 1.05; }
.turn { margin: 0; font-size: clamp(20px, 3vw, 32px); font-weight: 700; text-align: center; }

/* ---------- podsumowanie ---------- */
.end-card { max-width: 820px; margin: 0 auto; background: rgba(255,255,255,.9); border-style: solid; }
.end-stats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 16px; }
.stat {
  min-width: 140px; text-align: center; padding: 10px 16px; border-radius: 18px;
  background: var(--paper); border: 3px solid var(--line);
}
.stat b { display: block; font-family: var(--hand); font-size: 38px; line-height: 1.1; }
.stat span { font-size: 15px; color: var(--ink-soft); }
.stat--win { border-color: var(--sun-dark); background: #fff6d8; }
.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mistakes li { padding: 10px 14px; border-radius: 14px; background: var(--red-bg); border: 2px solid #f3b6aa; }
.mistakes .m-word { font-family: var(--hand); font-size: 26px; font-weight: 700; }
.mistakes .m-why { display: block; font-size: 16px; color: var(--ink-soft); }
.end-h3 { font-family: var(--hand); font-size: 22px; margin: 18px 0 8px; }

/* ---------- SEO, stopka, pasek ---------- */
.seo { max-width: 900px; margin: 10px auto 0; padding: 0 20px 20px; }
.seo h2 { font-family: var(--hand); font-size: 26px; margin: 24px 0 8px; }
.seo h3 { font-size: 20px; margin: 18px 0 6px; }
.seo p, .seo li { color: #243354; }
.seo code { background: var(--violet-bg); padding: 1px 6px; border-radius: 6px; }
.other { display: flex; flex-wrap: wrap; gap: 8px; }
.faq { margin-top: 10px; padding: 14px 18px; border-radius: var(--radius); background: rgba(255,255,255,.7); border: 2px dashed var(--line); }
footer { padding: 18px 20px 26px; text-align: center; color: var(--ink-soft); font-size: 16px; }
.follow {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px;
  padding: 12px 44px 12px 18px; border-radius: 18px;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 6px 0 rgba(29,43,79,.25);
}
.follow p { margin: 0; font-size: 17px; }
.follow .close {
  position: absolute; top: 6px; right: 8px; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--paper); font-size: 20px; line-height: 1;
}
.tests { margin: 0 20px 10px; padding: 10px 14px; border-radius: 14px; background: var(--paper); border: 2px solid var(--line); font-family: ui-monospace, monospace; font-size: 15px; white-space: pre-wrap; }

/* ---------- telefon ---------- */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .top { padding: 10px 14px 4px; }
  .top h1 { font-size: 26px; }
  .brand .logo { width: 44px; height: 44px; }
  .view { padding: 6px 12px 20px; }
  .tiles, .modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-card--row { flex-direction: column; }
  .choice { min-width: 44vw; }
  .duel { flex-direction: column; }
  .team-names input { width: 100%; }
  .follow { padding-right: 18px; }
}

/* tablica interaktywna i duże ekrany poziome */
@media (min-aspect-ratio: 3/2) and (min-width: 1100px) {
  .word { font-size: clamp(90px, 13vw, 240px); }
  .choice { min-height: clamp(110px, 20vh, 190px); }
}

@media (prefers-reduced-motion: reduce) {
  .word .fill { animation: none; }
  .btn, .tile, .choice { transition: none; }
}
