/* Vzhled všech tří obrazovek. Barvy podle brandu MAHOON (PLAN.md, bod 9) – nikdy čistá černá. */
:root {
  --dark: #121F30;
  --dark-raised: #1B2B41;
  --dark-line: #2A3D58;
  --cream: #EBE9E6;
  --white: #FFFFFF;
  --blue: #3E5BE3;
  --muted: #A9A7A5;
  --good: #3FB37F;
  --warn: #E6B84A;
  --bad: #E0645A;
  --opt-a: #3E5BE3;
  --opt-b: #D8574D;
  --opt-c: #2E9E6B;
  --opt-d: #D99A2B;
  --opt-e: #8A5BD6;
  --opt-f: #2AA3B8;
  --radius: 16px;
  --gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--dark);
  color: var(--cream);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { display: flex; flex-direction: column; min-height: 100dvh; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.2; color: var(--white); }
h2 { font-size: 20px; line-height: 1.3; color: var(--white); }
p { font-size: 18px; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* --- hlavička ------------------------------------------------------------------------ */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gap);
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar .logo { height: 24px; }
.topbar .title { font-weight: 600; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .badge { margin-left: auto; font-size: 14px; color: var(--muted); white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.on { background: var(--good); }
.dot.off { background: var(--bad); }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--gap);
  padding-bottom: max(var(--gap), env(safe-area-inset-bottom));
}
main.middle { justify-content: center; }

/* --- stavební prvky ------------------------------------------------------------------ */
.card {
  background: var(--dark-raised);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card.good { box-shadow: inset 0 0 0 2px var(--good); }
.card.warn { box-shadow: inset 0 0 0 2px var(--warn); }
.card.bad { box-shadow: inset 0 0 0 2px var(--bad); }

.button {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  min-height: 64px;
  padding: 10px 24px;
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  color: var(--white);
  background: var(--blue);
  cursor: pointer;
  touch-action: manipulation;
}
.button:active { filter: brightness(0.9); }
.button:disabled { opacity: 0.4; cursor: default; }
.button.ghost { background: var(--dark-raised); box-shadow: inset 0 0 0 2px var(--dark-line); }
.button.danger { background: var(--bad); }
.button.slim { min-height: 48px; font-size: 17px; padding: 8px 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; }

label { font-size: 16px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
input[type="text"], input[type="password"], input[type="number"] {
  width: 100%;
  min-height: 60px;
  border-radius: var(--radius);
  border: 2px solid var(--dark-line);
  background: var(--dark);
  color: var(--white);
  font: inherit;
  font-size: 22px;
  padding: 8px 16px;
}
input:focus { outline: none; border-color: var(--blue); }
.error { color: var(--bad); font-size: 16px; min-height: 22px; }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; font-size: 16px; text-decoration: underline; padding: 12px; cursor: pointer; }

.pill {
  white-space: nowrap;
  flex: none;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--dark-line);
  color: var(--cream);
  font-size: 14px;
  font-weight: 600;
}
.pill.good { background: var(--good); color: var(--dark); }
.pill.warn { background: var(--warn); color: var(--dark); }
.pill.bad { background: var(--bad); color: var(--white); }

.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--white); }
.timer.low { color: var(--warn); }

/* --- možnosti A–F (telefon i projektor) ---------------------------------------------- */
.options { display: grid; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  color: var(--white);
  font: inherit;
  font-size: 20px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.option .letter {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(18, 31, 48, 0.35);
  display: grid;
  place-items: center;
  font-size: 22px;
}
.option.o0 { background: var(--opt-a); }
.option.o1 { background: var(--opt-b); }
.option.o2 { background: var(--opt-c); }
.option.o3 { background: var(--opt-d); }
.option.o4 { background: var(--opt-e); }
.option.o5 { background: var(--opt-f); }
.option.dim { opacity: 0.35; }
.option.picked { box-shadow: 0 0 0 4px var(--white); }
.option:disabled { cursor: default; }

/* --- telefon týmu ---------------------------------------------------------------------- */
.status {
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 600;
  background: var(--dark-raised);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.status.sending { box-shadow: inset 0 0 0 2px var(--warn); }
.status.sent { box-shadow: inset 0 0 0 2px var(--good); }
.status.failed { box-shadow: inset 0 0 0 2px var(--bad); }
.question-text { font-size: 22px; line-height: 1.35; color: var(--white); font-weight: 600; }
.big-number { font-size: 64px; font-weight: 800; color: var(--white); line-height: 1; }
.answer-row { display: flex; gap: 12px; align-items: center; }
.answer-row .unit { font-size: 20px; color: var(--muted); white-space: nowrap; }

.result-list { display: flex; flex-direction: column; gap: 10px; }
.result { background: var(--dark-raised); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 4px; }
.result .head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.result .q { font-size: 15px; color: var(--muted); }
.result .correct { font-size: 18px; color: var(--white); font-weight: 600; }
.result .mine { font-size: 16px; }

/* --- moderátor ------------------------------------------------------------------------- */
body.host main { max-width: 720px; padding-bottom: 150px; }
.sticky-next {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px var(--gap) max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--dark) 70%, rgba(18, 31, 48, 0));
  display: flex;
  justify-content: center;
}
.sticky-next .inner { width: 100%; max-width: 688px; display: grid; gap: 8px; }
.sticky-next #next { min-height: 76px; font-size: 24px; width: 100%; }
.sticky-next .slim { white-space: nowrap; padding: 8px; }
.section-title { font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.team-list { display: grid; gap: 8px; }
.team {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  background: var(--dark-raised);
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--cream);
  font: inherit;
  font-size: 17px;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.team .name { color: var(--white); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team .sub { font-size: 14px; color: var(--muted); grid-column: 2 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group { background: var(--dark); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.group.fuzzy { box-shadow: inset 0 0 0 2px var(--warn); }
.group .sample { font-size: 19px; color: var(--white); font-weight: 600; overflow-wrap: anywhere; }
.verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.verdicts .button { min-height: 48px; font-size: 16px; padding: 6px; }
.verdicts .button.on.accept { background: var(--good); color: var(--dark); box-shadow: none; }
.verdicts .button.on.half { background: var(--warn); color: var(--dark); box-shadow: none; }
.verdicts .button.on.reject { background: var(--bad); box-shadow: none; }
table.standings { width: 100%; border-collapse: collapse; font-size: 17px; }
table.standings td { padding: 8px 6px; border-bottom: 1px solid var(--dark-line); }
table.standings td:first-child { width: 36px; color: var(--muted); }
table.standings td:last-child { text-align: right; font-weight: 700; color: var(--white); white-space: nowrap; }

dialog {
  border: 0;
  border-radius: var(--radius);
  background: var(--dark-raised);
  color: var(--cream);
  padding: 20px;
  width: min(92vw, 440px);
}
dialog::backdrop { background: rgba(18, 31, 48, 0.75); }
dialog form, dialog .stack { display: grid; gap: 12px; }
.code-big { font-size: 56px; font-weight: 800; letter-spacing: 0.15em; text-align: center; color: var(--white); }
input[type="range"] { width: 100%; accent-color: var(--blue); min-height: 40px; }

/* --- projektor: 16:9, čitelné z 10 m – nejmenší text 48 px při 1080p (2,5 vw) ------------ */
body.screen { overflow: hidden; height: 100vh; }
body.screen .topbar { padding: 1.5vw 2.5vw; gap: 1.5vw; }
body.screen .topbar .logo { height: 2.6vw; }
body.screen .topbar .title, body.screen .topbar .badge { font-size: 2.5vw; }
body.screen .topbar .badge { color: var(--cream); }
body.screen main {
  max-width: none;
  padding: 1vw 4vw 3vw;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2vw;
  min-height: 0;
}
body.screen h1 { font-size: 5.5vw; }
body.screen h2 { font-size: 3.4vw; }
body.screen p, body.screen .text { font-size: 2.6vw; }
body.screen .kicker { font-size: 2.5vw; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
body.screen .question-text { font-size: 3.6vw; line-height: 1.25; max-width: 86vw; }
body.screen .question-text.compact { font-size: 2.8vw; }
body.screen .timer { font-size: 5vw; }
body.screen .options { grid-template-columns: 1fr 1fr; gap: 1.2vw; width: 86vw; }
body.screen .option { font-size: 2.6vw; min-height: 6.5vw; padding: 1vw 1.6vw; gap: 1.4vw; border-radius: 1.2vw; cursor: default; }
body.screen .option .letter { width: 4.2vw; height: 4.2vw; font-size: 2.6vw; border-radius: 0.9vw; }
body.screen .option.correct { box-shadow: 0 0 0 0.5vw var(--white); }

.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  text-align: center;
}
.start-overlay .button { font-size: 3vw; min-height: 7vw; padding: 1vw 4vw; border-radius: 1.4vw; }
.progress { width: 40vw; height: 1.2vw; border-radius: 1vw; background: var(--dark-raised); overflow: hidden; }
.progress > div { height: 100%; background: var(--blue); width: 0; transition: width 0.3s; }

.lobby { display: grid; grid-template-columns: auto 1fr; gap: 5vw; align-items: center; text-align: left; }
.lobby .qr { width: 30vw; height: 30vw; background: var(--white); border-radius: 1.5vw; padding: 1vw; }
.lobby .qr img { width: 100%; height: 100%; display: block; }
.lobby .code { font-size: 7vw; font-weight: 800; color: var(--white); letter-spacing: 0.12em; line-height: 1.1; }
.chips { display: flex; flex-wrap: wrap; gap: 1vw; justify-content: center; }
.chip { background: var(--dark-raised); border-radius: 999px; padding: 0.6vw 1.8vw; font-size: 2.5vw; color: var(--white); animation: pop 0.4s ease-out; }

.media-box { display: grid; place-items: center; max-height: 46vh; }
.media-box img, .media-box video { height: 46vh; width: auto; max-width: 80vw; object-fit: contain; border-radius: 1.2vw; display: block; }
.media-box img.blur { transition: filter 1s linear; }
.note { font-size: 9vw; line-height: 1; animation: sway 2s ease-in-out infinite alternate; }
.note.paused { animation-play-state: paused; opacity: 0.5; }
.meta-row { display: flex; gap: 4vw; align-items: center; justify-content: center; }

.reveal-answer { font-size: 4.6vw; font-weight: 800; color: var(--white); background: var(--blue); padding: 0.8vw 3vw; border-radius: 1.4vw; animation: pop 0.5s ease-out; }
.rows { display: grid; gap: 0.8vw; width: 78vw; }
.rows .line {
  display: grid;
  grid-template-columns: 4vw 1fr 1fr auto;
  gap: 2vw;
  align-items: center;
  background: var(--dark-raised);
  border-radius: 1vw;
  padding: 0.7vw 2vw;
  font-size: 2.5vw;
  text-align: left;
  animation: slide 0.5s ease-out backwards;
}
.rows .line .rank { color: var(--muted); }
.rows .line .name { color: var(--white); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .line .value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .line .pts { font-weight: 800; color: var(--white); white-space: nowrap; }
.rows .line.scored { box-shadow: inset 0 0 0 0.25vw var(--good); }
.rows .line.winner { background: var(--blue); }
.rows .line.winner .rank { color: var(--white); }
.rows.dense .line { font-size: 2.5vw; padding: 0.45vw 2vw; }

.snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.snow i {
  position: absolute;
  top: -2vw;
  width: 0.5vw;
  height: 0.5vw;
  border-radius: 50%;
  background: var(--cream);
  opacity: 0.25;
  animation: fall linear infinite;
}
body.screen .topbar, body.screen main { position: relative; z-index: 2; }

@keyframes fall { to { transform: translateY(110vh) translateX(3vw); } }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slide { from { transform: translateY(2vw); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }

@media (prefers-reduced-motion: reduce) {
  .snow { display: none; }
  * { animation-duration: 0.01s !important; }
}

/* Odkaz, který vypadá jako tlačítko (stažení a tisk u moderátora). */
.linkbutton { display: grid; place-items: center; text-decoration: none; text-align: center; }
