/* ============================================================
   Desítka — styly
   Optimalizováno pro tablet/mobil (dotyk), funguje i na desktopu.
   ============================================================ */

:root {
  --orange:       #F5871F;
  --orange-dk:    #D9700C;
  --orange-lt:    #FFA33F;
  --ink:          #1B1B1D;
  --paper:        #FBFAF7;
  --cap:          #303034;
  --cap-hi:       #4A4A50;
  --green:        #2FAE4E;
  --green-dk:     #1E8A3B;
  --red:          #E14B3C;
  --muted:        #7A7A80;

  --pad: 14px;
  --radius: 18px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--ink);
  font-family: "Nunito", "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- obrazovky ---------- */
.screen {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  display: none;
  flex-direction: column;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
  background: var(--paper);
}
.screen.is-active { display: flex; }

/* ---------- tlačítka ---------- */
.btn {
  font: inherit;
  font-weight: 800;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn--primary {
  background: linear-gradient(180deg, var(--orange-lt), var(--orange));
  color: #fff;
  box-shadow: 0 6px 0 var(--orange-dk), 0 10px 20px rgba(0,0,0,.18);
}
.btn--primary:active { box-shadow: 0 3px 0 var(--orange-dk); transform: translateY(3px) scale(.99); }
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 2px solid #E2E0DA;
}
.btn--big { font-size: 20px; padding: 18px 34px; width: 100%; max-width: 420px; }

.iconbtn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; background: transparent;
  font-size: 26px; line-height: 1; color: var(--muted);
  cursor: pointer; border-radius: 50%;
}
.iconbtn--spacer { pointer-events: none; }

/* ---------- horní lišta ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px var(--pad);
  flex: 0 0 auto;
}
.topbar__title { font-size: 18px; margin: 0; font-weight: 900; }
.topbar__mid {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 0; flex: 1;
}
.topbar__progress { font-size: 14px; font-weight: 800; color: var(--muted); letter-spacing: .02em; }
.topbar__set {
  font-size: 12px; font-weight: 700; color: var(--orange-dk);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================================================
   ÚVODNÍ OBRAZOVKA
   ============================================================ */
#screen-home {
  background: radial-gradient(120% 90% at 50% 0%, var(--orange-lt), var(--orange) 60%, var(--orange-dk));
}
.home {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: var(--pad);
}
.home__logo { text-align: center; color: #fff; }
.home__logo-text {
  display: block;
  font-size: clamp(48px, 14vw, 86px);
  font-weight: 900; letter-spacing: .02em; line-height: 1;
  text-shadow: 0 4px 0 rgba(0,0,0,.22);
}
.home__logo-sub { display: block; margin-top: 10px; font-weight: 700; opacity: .9; }

.home__dots {
  position: relative;
  width: min(58vw, 220px);
  height: min(58vw, 220px);
}
.home__dots i {
  position: absolute;
  width: 20%; height: 20%;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--cap-hi), var(--cap));
  box-shadow: 0 4px 10px rgba(0,0,0,.28);
  transform: translate(-50%, -50%);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-50%, -50%) scale(.86); }
}
.home__actions { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
#screen-home .btn--ghost { color: #fff; border-color: rgba(255,255,255,.55); }

/* ============================================================
   NASTAVENÍ
   ============================================================ */
.setup {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px var(--pad) calc(var(--pad) + 20px);
}
.setup__label {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 20px 0 10px;
}
.setup__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.setup__note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.setup__note.is-warn { color: var(--red); font-weight: 800; }
.linkbtn {
  font: inherit; font-size: 13px; font-weight: 800;
  background: none; border: 0; padding: 4px 0;
  color: var(--orange-dk); cursor: pointer; text-decoration: underline;
}

/* okruhy otázek uvnitř tématu */
.setgrid { display: grid; gap: 8px; }
.setcard {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 14px;
  border: 2px solid #E7E5DE; background: #fff;
  text-align: left; font: inherit; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.setcard:active { transform: scale(.99); }
.setcard.is-on { border-color: var(--green); background: #F3FBF5; }
.setcard__box {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 7px; border: 2px solid #D6D4CD; background: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 900; color: #fff;
}
.setcard.is-on .setcard__box { background: var(--green); border-color: var(--green); }
.setcard__emoji { font-size: 19px; line-height: 1; }
.setcard__name { flex: 1; min-width: 0; font-weight: 800; }
.setcard__count { font-size: 13px; font-weight: 800; color: var(--muted); }
.setup__start { margin: 28px auto 0; display: block; }

.deckgrid { display: grid; gap: 10px; }
.deckcard {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--radius);
  border: 2px solid #E7E5DE; background: #fff;
  text-align: left; font: inherit; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.deckcard:active { transform: scale(.98); }
.deckcard.is-on { border-color: var(--orange); background: #FFF6EC; }
.deckcard__emoji { font-size: 28px; line-height: 1; }
.deckcard__name { font-weight: 900; }
.deckcard__meta { font-size: 13px; color: var(--muted); }

.seg { display: flex; gap: 8px; }
.seg__btn {
  flex: 1; padding: 14px 0; font: inherit; font-weight: 900; font-size: 18px;
  border-radius: 14px; border: 2px solid #E7E5DE; background: #fff; cursor: pointer;
  transition: .15s;
}
.seg__btn.is-on { border-color: var(--orange); background: var(--orange); color: #fff; }

.players { display: grid; gap: 8px; margin-top: 10px; }
.playerrow { display: flex; align-items: center; gap: 10px; }
.playerrow__dot {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
}
.playerrow input {
  flex: 1; font: inherit; font-weight: 700;
  padding: 13px 14px; border-radius: 14px;
  border: 2px solid #E7E5DE; background: #fff;
  -webkit-user-select: text; user-select: text;
}
.playerrow input:focus { outline: none; border-color: var(--orange); }

.switch { display: flex; align-items: center; gap: 12px; margin-top: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 52px; height: 30px; border-radius: 999px; background: #DDDBD4;
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch__knob {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.25); transition: transform .18s;
}
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track .switch__knob { transform: translateX(22px); }
.switch__text { font-weight: 800; }

/* ============================================================
   HRA
   ============================================================ */
#screen-game { background: var(--paper); }

.scores {
  display: flex; gap: 6px; padding: 2px var(--pad) 0;
  flex: 0 0 auto;
}
.scorepill {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 4px; border-radius: 14px;
  background: #F0EEE8; border: 2px solid transparent;
  transition: .18s;
}
.scorepill.is-on {
  background: #fff; border-color: var(--pc, var(--orange));
  box-shadow: 0 3px 12px rgba(0,0,0,.14);
}
.scorepill__name {
  font-size: 12px; font-weight: 800; color: var(--muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.scorepill.is-on .scorepill__name { color: var(--pc, var(--orange-dk)); }
.scorepill__score { font-size: 20px; font-weight: 900; line-height: 1; }
.scorepill__score.bump { animation: bump .45s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); color: var(--green); }
  100% { transform: scale(1); }
}

.turnbar {
  text-align: center; padding: 8px var(--pad) 4px;
  flex: 0 0 auto; line-height: 1.35;
}
.turnbar__who { font-weight: 900; font-size: 19px; }
.turnbar__hint { display: block; font-size: 13px; color: var(--muted); }
.turnbar__hint b { color: var(--green-dk); }

/* ---------- deska ---------- */
/* Pozor: rozměry desky a velikosti písma uvnitř ní nastavuje JS
 * (UI.layoutBoard). Dřív se to počítalo přes container queries,
 * jenže ty Safari umí až od verze 16 — na starším iPadu se deska
 * scvrkla na nulu a texty se naskládaly na sebe.
 * Ze stejného důvodu se tu nepoužívá aspect-ratio; čtvercové prvky
 * mají výšku v procentech, což funguje, protože deska sama je čtverec. */
.boardwrap {
  flex: 1 1 0;
  min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 3px;
  overflow: hidden;
}
.board {
  position: relative;
  width: 100%;   /* skutečnou velikost dopočítá JS */
  background: linear-gradient(150deg, var(--orange-lt), var(--orange) 55%, var(--orange-dk));
  border-radius: 26px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2), inset 0 0 60px rgba(0,0,0,.06);
}

/* velký bílý kruh s položkami */
.board__ring {
  position: absolute;
  top: 16%; right: 16%; bottom: 16%; left: 16%;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #F4F2ED);
  box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
/* prostřední kruh s otázkou */
.board__hub {
  position: absolute; left: 50%; top: 50%;
  width: 31%; height: 31%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--orange);
  display: flex; align-items: center; justify-content: center;
  padding: 3%;
  z-index: 3;
}
.board__question {
  margin: 0; text-align: center; font-weight: 900; line-height: 1.15;
  font-size: 15px;   /* přepíše JS */
  /* bez hyphens — dělení jako „Phi-neas“ se u jmen čte hůř
     než zalomení mezi slovy; break-word ošetří extrémně dlouhá slova */
  overflow-wrap: break-word;
}
/* paprsek mezi textem a krytkou */
.spoke {
  position: absolute; left: 50%; top: 50%;
  width: 7%; height: 2px;
  background: rgba(0,0,0,.45);
  transform-origin: 0 50%;
  z-index: 2;
}

/* text položky */
.label {
  position: absolute;
  width: 25%;
  text-align: center;
  transform: translate(-50%, -50%);
  font-weight: 700; line-height: 1.15;
  z-index: 2;
  overflow-wrap: break-word; hyphens: auto;
  transition: color .25s;
}
/* konkrétní velikost písma dosadí JS podle velikosti desky */
.label--l, .label--m, .label--s { font-size: 12px; }
.label.is-yes { color: var(--green-dk); font-weight: 900; }
.label.is-no  { color: var(--red); opacity: .65; text-decoration: line-through; }

/* pozice krytky + výsledek pod ní */
.pos {
  position: absolute;
  width: 16.5%; height: 16.5%;
  transform: translate(-50%, -50%);
  z-index: 4;
  border: 0; padding: 0; background: none;
  cursor: pointer;
  touch-action: manipulation;
}
.pos:disabled { cursor: default; }

.slot {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.18);
}
.slot__mark {
  width: 76%; height: 76%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 900;
  font-size: 20px;   /* přepíše JS */
  transform: scale(0);
  transition: transform .3s cubic-bezier(.2,1.5,.5,1);
}
.pos.is-open .slot__mark { transform: scale(1); }
/* dokryto jako řešení, nikdo na to netipoval */
.pos.is-solution .slot { background: rgba(255,255,255,.35); }
.pos.is-solution .slot__mark { opacity: .45; }
.label.is-yes.is-solution, .label.is-no.is-solution { opacity: .5; }
.slot__mark.yes { background: var(--green); }
.slot__mark.no  { background: var(--red); }

.cap {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 32% 26%, var(--cap-hi), var(--cap) 60%, #17171A);
  box-shadow: 0 5px 12px rgba(0,0,0,.35), inset 0 -3px 6px rgba(0,0,0,.5), inset 0 2px 3px rgba(255,255,255,.14);
  transition: transform .38s cubic-bezier(.5,-0.3,.6,1), opacity .3s ease .08s;
}
.pos:not(:disabled):active .cap { transform: scale(.92); }
@media (hover: hover) {
  .pos:not(:disabled):hover .cap { transform: translateY(-3px) scale(1.04); }
}
.pos.is-open .cap {
  transform: scale(.2) rotate(70deg) translateY(-40%);
  opacity: 0;
  pointer-events: none;
}

/* vybraná (ještě neodkrytá) položka */
.pos.is-picked .cap {
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--orange), 0 6px 16px rgba(0,0,0,.4);
  animation: picked 1.1s ease-in-out infinite;
}
@keyframes picked {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.09); }
}
.label.is-picked {
  color: var(--orange-dk); font-weight: 900;
  text-decoration: underline; text-underline-offset: 2px;
}

/* ---------- spodní tray: tip ANO / NE ---------- */
.tray {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  padding: 4px var(--pad) 10px;
}
/* Řádek s ANO/NE a řádek s tlačítkem „další“ mají shodnou výšku,
   jinak by se spodní lišta měnila a deska nad ní by skákala. */
.guess { width: 100%; max-width: 460px; --btns-h: 58px; }
.guess__btns, .tray__next { min-height: var(--btns-h); }
.guess__pick {
  margin: 0 0 6px; text-align: center;
  font-size: 14px; font-weight: 800; color: var(--muted);
  /* pevná výška: text se po výběru zvětší a lišta by jinak povyrostla,
     což by zmenšilo desku nad ní */
  height: 22px; line-height: 22px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.guess__pick.is-set { color: var(--ink); font-size: 16px; }
.guess__btns { display: flex; gap: 10px; }
.gbtn {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font: inherit; padding: 10px 4px; border-radius: 16px;
  border: 3px solid #DFDDD6; background: #F2F0EA; color: #B9B7B0;
  cursor: pointer; touch-action: manipulation;
  transition: transform .12s, background .15s, color .15s, border-color .15s;
}
.gbtn b { font-size: 22px; font-weight: 900; line-height: 1.05; }
.gbtn span { font-size: 12px; font-weight: 700; }
.gbtn:disabled { cursor: default; }
.gbtn--yes:not(:disabled) {
  background: #EAF9EE; border-color: var(--green); color: var(--green-dk);
}
.gbtn--no:not(:disabled) {
  background: #FDEDEB; border-color: var(--red); color: #C23A2C;
}
.gbtn:not(:disabled):active { transform: scale(.95); }
@media (hover: hover) {
  .gbtn--yes:not(:disabled):hover { background: var(--green); color: #fff; }
  .gbtn--no:not(:disabled):hover  { background: var(--red); color: #fff; }
}
.tray__next { display: flex; justify-content: center; align-items: center; width: 100%; }

/* ============================================================
   PŘEKRYV S VÝSLEDKEM TAHU
   ============================================================ */
.sheet[hidden], [hidden] { display: none !important; }
.sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  background: rgba(20,18,16,.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: var(--pad);
  padding-bottom: calc(var(--pad) + var(--safe-b));
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet__card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 24px;
  padding: 22px 20px 20px;
  text-align: center;
  box-shadow: 0 -6px 40px rgba(0,0,0,.3);
  animation: rise .28s cubic-bezier(.2,.9,.3,1);
  border-top: 6px solid var(--green);
}
.sheet__card.is-no { border-top-color: var(--red); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet__mark {
  width: 56px; height: 56px; margin: -46px auto 10px;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; font-weight: 900; color: #fff;
  background: var(--green);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.sheet__card.is-no .sheet__mark { background: var(--red); }
.sheet__title { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.sheet__note { margin: 0 0 18px; color: #55555B; line-height: 1.4; font-size: 15px; }
#sheet-btn { width: 100%; }

/* ============================================================
   VÝSLEDKY
   ============================================================ */
#screen-result {
  background: radial-gradient(120% 90% at 50% 0%, var(--orange-lt), var(--orange) 60%, var(--orange-dk));
}
.result {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: var(--pad); color: #fff; overflow-y: auto;
}
.result__title { font-size: clamp(28px, 8vw, 44px); margin: 0; text-align: center; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.result__list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 420px; display: grid; gap: 10px; }
.result__row {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.95); color: var(--ink);
  border-radius: 16px; padding: 14px 16px; font-weight: 800;
}
.result__row--win { background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); transform: scale(1.03); }
.result__medal { font-size: 24px; width: 30px; text-align: center; }
.result__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result__pts { font-size: 20px; font-weight: 900; }
.result__actions { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
#screen-result .btn--ghost { color: #fff; border-color: rgba(255,255,255,.55); }

/* ============================================================
   Tablet naležato — kolem desky se ubere, ať zbude co nejvíc na ni
   ============================================================ */
@media (orientation: landscape) and (max-height: 820px) {
  .scorepill { padding: 4px 4px; }
  .scorepill__score { font-size: 17px; }
  .turnbar { padding: 4px var(--pad) 2px; }
  .turnbar__who { font-size: 17px; }
  .tray { padding: 2px var(--pad) 6px; }
  .guess { --btns-h: 48px; }
  .guess__pick { margin-bottom: 4px; }
  .gbtn { padding: 7px 4px; }
  .gbtn b { font-size: 19px; }
}

/* ============================================================
   Malá výška (landscape na telefonu) — ubereme okolo desky
   ============================================================ */
@media (max-height: 520px) {
  .guess { --btns-h: 42px; }
  .turnbar { padding: 3px var(--pad) 0; }
  .turnbar__who { font-size: 15px; }
  .turnbar__hint { font-size: 11px; }
  .scorepill__score { font-size: 16px; }
  .tray { min-height: 52px; padding: 4px var(--pad) 6px; }
  .btn { padding: 10px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
