/* Kronikarze — wspólny wygląd: uczeń (laptop 1366×768), nauczyciel (rzutnik), moderacja (telefon) */
:root {
  --tlo: #f3ead4;
  --papier: #fffaf0;
  --atrament: #2a2016;
  --szary: #7d7262;
  --ramka: #d8c79f;
  --czerwien: #a8322a;
  --czerwien-j: #f6dcd6;
  --zloto: #b98a26;
  --zielen: #2f7a46;
  --zielen-j: #dcefe1;
  --niebieski: #2d5a9a;
  --cien: 0 2px 0 rgba(60, 40, 10, .12), 0 6px 18px rgba(60, 40, 10, .10);
  --zaokr: 14px;
  --szeryf: Georgia, 'Times New Roman', serif;
  --bez: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--tlo); color: var(--atrament); font-family: var(--bez); font-size: 18px; line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--szeryf); font-weight: 700; margin: 0; }
[hidden] { display: none !important; }

.btn { border: 2px solid var(--atrament); background: var(--papier); border-radius: 12px; padding: 10px 18px; cursor: pointer;
  font-weight: 700; box-shadow: 0 3px 0 var(--atrament); transition: transform .05s; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--atrament); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-glowny { background: var(--czerwien); border-color: #6e1d17; color: #fff; box-shadow: 0 3px 0 #6e1d17; }
.btn-zielony { background: var(--zielen); border-color: #1b4d2b; color: #fff; box-shadow: 0 3px 0 #1b4d2b; }
.btn-maly { padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.btn-duzy { padding: 16px 28px; font-size: 24px; }
.karta { background: var(--papier); border: 2px solid var(--ramka); border-radius: var(--zaokr); box-shadow: var(--cien); }
.komunikat { background: var(--czerwien-j); border: 2px solid var(--czerwien); color: #6e1d17; border-radius: 10px; padding: 8px 12px; font-weight: 600; }
.cicho { color: var(--szary); }
.logo { font-family: var(--szeryf); font-size: 54px; letter-spacing: .02em; color: var(--czerwien); }
.logo small { display: block; font-family: var(--bez); font-size: 18px; letter-spacing: 0; color: var(--szary); font-weight: 400; margin-top: 4px; }
.pasek-polaczenia { position: fixed; top: 0; left: 0; right: 0; background: var(--czerwien); color: #fff; text-align: center; padding: 6px; font-weight: 700; z-index: 50; }

/* ───────── uczeń ───────── */
.u-gora { display: flex; align-items: center; gap: 18px; padding: 8px 18px; border-bottom: 2px solid var(--ramka); background: var(--papier); height: 50px; }
.u-gora .nazwa { font-family: var(--szeryf); font-weight: 700; color: var(--czerwien); font-size: 22px; }
.u-gora .ja { font-weight: 700; }
.u-gora .odstep { flex: 1; }
.u-srodek { min-height: calc(100vh - 50px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.u-start { width: min(520px, 100%); padding: 32px; text-align: center; display: grid; gap: 18px; }
.u-kod { font-size: 54px; letter-spacing: .3em; text-align: center; width: 100%; padding: 10px 0 10px .3em; border: 3px solid var(--atrament); border-radius: 14px; background: #fff; }
.u-role { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; width: min(900px, 100%); }
.u-rola { padding: 26px; text-align: left; display: grid; gap: 10px; cursor: pointer; border: 3px solid var(--ramka); }
.u-rola:hover { border-color: var(--atrament); }
.u-rola h2 { font-size: 34px; color: var(--czerwien); }
.u-rola .klasy { font-weight: 700; }
.u-info { width: min(720px, 100%); padding: 32px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.u-info .wielki { font-family: var(--szeryf); font-size: 44px; color: var(--czerwien); }

/* ekran zadania: [narzędzia] [płótno] [panel] */
.u-zadanie { display: grid; grid-template-columns: 150px minmax(0, 1fr) 280px; grid-template-rows: minmax(0, 1fr); gap: 14px; padding: 12px 14px; height: calc(100vh - 50px); overflow: hidden; }
.u-zadanie.bez-narzedzi { grid-template-columns: minmax(0, 1fr) 340px; }
.u-plotno-ramka { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.u-plotno-ramka canvas { width: 100%; height: auto; max-height: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; border: 3px solid var(--atrament); border-radius: 8px; touch-action: none; display: block; }
.u-plotno-ramka canvas.rysowanie { cursor: crosshair; }
.u-narzedzia { display: grid; align-content: start; gap: 8px; min-height: 0; overflow-y: auto; }
.u-kolory { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.u-kolor { aspect-ratio: 1; border-radius: 8px; border: 2px solid rgba(0,0,0,.35); cursor: pointer; padding: 0; }
.u-kolor.wybrany { outline: 4px solid var(--atrament); outline-offset: 1px; }
.u-grubosci { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.u-grubosc { aspect-ratio: 1; border-radius: 8px; border: 2px solid var(--ramka); background: var(--papier); display: grid; place-items: center; cursor: pointer; padding: 0; }
.u-grubosc span { display: block; border-radius: 50%; background: var(--atrament); }
.u-grubosc.wybrany { border-color: var(--atrament); background: #fff; }
.u-narz { display: grid; gap: 6px; }
.u-narz .btn { padding: 5px 8px; font-size: 15px; width: 100%; box-shadow: 0 2px 0 var(--atrament); }
.u-narz .btn.wybrany { background: var(--atrament); color: #fff; }
.u-panel { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.u-polecenie { padding: 14px; display: grid; gap: 8px; }
.u-polecenie .co { font-weight: 700; color: var(--szary); text-transform: uppercase; font-size: 14px; letter-spacing: .06em; }
.u-polecenie .tekst { font-family: var(--szeryf); font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.u-polecenie canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; background: #fff; border: 2px solid var(--ramka); border-radius: 6px; }
.u-zegar { padding: 10px 14px; display: grid; gap: 6px; }
.u-zegar .liczba { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.u-zegar .belka { height: 10px; background: var(--ramka); border-radius: 6px; overflow: hidden; }
.u-zegar .belka i { display: block; height: 100%; background: var(--zielen); transition: width .2s linear; }
.u-zegar.malo .liczba { color: var(--czerwien); }
.u-zegar.malo .belka i { background: var(--czerwien); }
.u-panel .wypelniacz { flex: 1; }
.u-panel .btn-gotowe { font-size: 26px; padding: 14px; }
.u-opis { width: 100%; font-size: 24px; padding: 12px; border: 3px solid var(--atrament); border-radius: 12px; background: #fff; resize: none; font-family: var(--szeryf); }
.u-licznik { text-align: right; font-size: 14px; }
.u-wybor { width: min(1150px, 100%); display: grid; gap: 18px; }
.u-wybor .opcje { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.u-opcja { padding: 24px 18px; font-family: var(--szeryf); font-size: 24px; text-align: left; cursor: pointer; border: 3px solid var(--ramka); min-height: 170px; }
.u-opcja:hover { border-color: var(--atrament); background: #fff; }
.u-sluchaj { display: flex; gap: 8px; align-items: center; }
.u-tak-nie { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: min(760px, 100%); }
.u-tak-nie .btn { font-size: 48px; padding: 28px; }
.u-tak-nie .btn.zaznaczone { outline: 6px solid var(--zloto); outline-offset: 3px; }
.btn-tak { background: var(--zielen); color: #fff; border-color: #1b4d2b; box-shadow: 0 4px 0 #1b4d2b; }
.btn-nie { background: var(--czerwien); color: #fff; border-color: #6e1d17; box-shadow: 0 4px 0 #6e1d17; }
.u-pytanie { font-family: var(--szeryf); font-size: 34px; text-align: center; max-width: 900px; }

/* ───────── nauczyciel (rzutnik) ───────── */
.n-ekran { height: 100vh; display: flex; flex-direction: column; }
.n-gora { display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: var(--papier); border-bottom: 2px solid var(--ramka); }
.n-gora .nazwa { font-family: var(--szeryf); font-weight: 700; color: var(--czerwien); font-size: 26px; }
.n-gora .odstep { flex: 1; }
.n-tresc { flex: 1; padding: 18px 28px; display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; }
.n-ustawienia { width: min(620px, 100%); margin: 30px auto; padding: 28px; display: grid; gap: 16px; }
.n-ustawienia label { display: grid; gap: 6px; font-weight: 700; }
.n-ustawienia input[type=password], .n-ustawienia select { padding: 10px; border: 2px solid var(--atrament); border-radius: 10px; background: #fff; font-weight: 400; }
.n-ustawienia fieldset { border: 2px solid var(--ramka); border-radius: 10px; padding: 10px 14px; display: grid; gap: 6px; }
.n-ustawienia legend { font-weight: 700; padding: 0 6px; }
.n-ustawienia fieldset label { display: flex; gap: 8px; align-items: baseline; font-weight: 400; }
.n-lobby { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 26px; flex: 1; }
.n-wejscie { padding: 26px; display: grid; gap: 12px; align-content: center; text-align: center; }
.n-wejscie .adres { font-size: clamp(26px, 3vw, 44px); font-weight: 800; }
.n-wejscie .kod { font-size: clamp(90px, 12vw, 180px); font-weight: 800; letter-spacing: .12em; line-height: 1; color: var(--czerwien); font-variant-numeric: tabular-nums; }
.n-listy { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-content: start; }
.n-lista { padding: 16px; display: grid; gap: 8px; align-content: start; }
.n-lista h3 { font-size: 24px; }
.n-gracz { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: #fff; border: 2px solid var(--ramka); font-weight: 700; }
.n-gracz .kropka { width: 12px; height: 12px; border-radius: 50%; background: var(--zielen); flex: none; }
.n-gracz.offline { opacity: .55; border-style: dashed; }
.n-gracz.offline .kropka { background: var(--szary); }
.n-gracz.gotowy { background: var(--zielen-j); border-color: var(--zielen); }
.n-gracz .usun { margin-left: auto; border: 0; background: none; color: var(--czerwien); cursor: pointer; font-size: 14px; text-decoration: underline; }
.n-przyciski { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.n-runda-glowa { display: flex; align-items: baseline; gap: 24px; }
.n-runda-glowa h2 { font-size: clamp(34px, 4vw, 54px); }
.n-runda-glowa .zegar { font-size: clamp(54px, 7vw, 100px); font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; }
.n-runda-glowa .zegar.malo { color: var(--czerwien); }
.n-siatka { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; align-content: start; }
.n-siatka .n-gracz { font-size: 20px; padding: 10px 12px; }

.n-scena { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 22px; min-height: 0; align-items: center; }
.n-scena.sama { grid-template-columns: minmax(0, 1fr); }
.n-krok { padding: 18px; display: grid; gap: 10px; align-content: start; }
.n-krok canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; max-height: calc(100vh - 350px); object-fit: contain; background: #fff; border: 2px solid var(--ramka); border-radius: 8px; display: block; }
.n-krok .podpis { font-weight: 700; color: var(--szary); }
.n-krok .tekst { font-family: var(--szeryf); font-size: clamp(26px, 3vw, 46px); line-height: 1.2; overflow-wrap: anywhere; }
.n-krok.maly .tekst { font-size: clamp(18px, 1.8vw, 26px); }
.n-krok .rozp { color: var(--zielen); font-weight: 800; font-size: clamp(18px, 1.8vw, 26px); }
.n-krok .rozp.zero { color: var(--szary); font-weight: 600; }
.n-krok.pusty .tekst { color: var(--szary); font-style: italic; }
.n-krok.haslo { border-color: var(--zloto); }
.n-pasek { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; }
.n-miniatura { flex: none; width: 128px; height: 72px; border: 2px solid var(--ramka); border-radius: 6px; background: #fff; overflow: hidden; font-size: 11px; padding: 4px; line-height: 1.15; }
.n-miniatura.teraz { border-color: var(--czerwien); border-width: 3px; }
.n-miniatura canvas { width: 100%; height: 100%; display: block; }
.n-ciekawostka { padding: 28px 34px; display: grid; gap: 16px; max-width: 1200px; margin: 0 auto; width: 100%; }
.n-ciekawostka .etykieta { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--zloto); }
.n-ciekawostka .haslo { font-family: var(--szeryf); font-size: clamp(22px, 2.2vw, 32px); color: var(--szary); }
.n-ciekawostka .tresc { font-family: var(--szeryf); font-size: clamp(28px, 3.2vw, 48px); line-height: 1.25; }
.n-ciekawostka .pytanie { font-family: var(--szeryf); font-size: clamp(34px, 4vw, 58px); line-height: 1.2; }
.n-ciekawostka .odp { font-size: clamp(40px, 5vw, 72px); font-weight: 800; }
.n-ciekawostka .odp.tak { color: var(--zielen); }
.n-ciekawostka .odp.nie { color: var(--czerwien); }
.n-sterowanie { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.n-sterowanie .odstep { flex: 1; }
.n-podia { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.n-podium { padding: 24px; display: grid; gap: 12px; align-content: start; }
.n-podium h2 { font-size: clamp(28px, 3vw, 42px); color: var(--czerwien); }
.n-miejsce { display: flex; align-items: center; gap: 16px; font-size: clamp(24px, 2.6vw, 36px); font-weight: 800; padding: 10px 14px; border-radius: 12px; background: #fff; border: 2px solid var(--ramka); }
.n-miejsce .nr { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--zloto); color: #fff; flex: none; }
.n-miejsce .pkt { margin-left: auto; color: var(--szary); }

/* ───────── moderacja (telefon) ───────── */
.m-ekran { max-width: 640px; margin: 0 auto; padding: 12px; display: grid; gap: 12px; }
.m-ekran .n-ustawienia { margin: 10px 0; }
.m-krok { padding: 12px; display: grid; gap: 8px; }
.m-krok canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; background: #fff; border: 2px solid var(--ramka); border-radius: 6px; }
.m-krok .tekst { font-family: var(--szeryf); font-size: 22px; overflow-wrap: anywhere; }
.m-krok.zablokowany { border-color: var(--czerwien); background: var(--czerwien-j); }
.m-krok.zablokowany canvas, .m-krok.zablokowany .tekst { filter: blur(6px); opacity: .6; }
.m-krok .wiersz { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.m-krok .wiersz .odstep { flex: 1; }
.m-gracze { padding: 12px; display: grid; gap: 6px; }

@media (max-height: 800px) {
  .n-pasek { display: none; }
  .n-krok canvas { max-height: calc(100vh - 262px); }
}
@media (max-width: 900px) {
  .n-lobby, .n-podia, .n-scena { grid-template-columns: 1fr; }
  .u-role, .u-wybor .opcje { grid-template-columns: 1fr; }
}
