/* Stránka hráče. Paleta, stavový pruh, hláška a stránka bez tokenu jsou v mobile.css. */

.status[data-conn="kicked"] { background: var(--bad-soft); }
.status[data-conn="kicked"] .conn i { color: var(--bad); }
.status[data-conn="kicked"] .ctx { color: var(--text); }

/* Obrazovky */
.screen { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }
.screen h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.5rem; }
.screen p { margin: 0; line-height: 1.5; }
#off { align-items: center; text-align: center; padding-top: 48px; }
.screen-icon { font-size: 64px; color: var(--accent); }

.screen-hint {
  display: flex; align-items: center; gap: 8px; margin-top: auto;
  color: var(--text); font-size: .9rem;
}
.screen-hint i { font-size: 20px; color: var(--muted); flex: none; }

/* Zadání kódu místnosti (online stránka bez kódu nebo s neznámým kódem) */
.room-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; }
.room-form input {
  height: 64px; padding: 0 14px; border-radius: 14px; text-align: center;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font-family: var(--display); font-weight: 800; font-size: 1.8rem; letter-spacing: .2em; text-transform: uppercase;
}
.room-form input::placeholder { color: var(--muted); letter-spacing: .1em; }
.room-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.room-form input[aria-invalid="true"] { border-color: var(--bad); }
.room-entry .room-error { color: var(--bad); font-weight: 700; }

/* Připojení: přezdívka a tým */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 700; font-size: .95rem; }
.nick {
  width: 100%; height: 56px; padding: 0 14px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.1rem; /* aspoň 16 px, jinak iOS při fokusu zvětší stránku */
}
.nick:focus { outline: none; border-color: var(--accent); }
.nick:disabled { opacity: .55; }

.team-list { display: grid; gap: 8px; }
.team-pick {
  --team: var(--border);
  min-height: 56px; width: 100%; padding: 0 14px; border-radius: 14px; text-align: left;
  border: 2px solid var(--border); border-left: 10px solid var(--team); background: var(--surface);
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 1.05rem;
}
.team-emoji { font-size: 1.6rem; line-height: 1; flex: none; }
.team-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-pick[aria-checked="true"] { border-color: var(--accent); border-left-color: var(--team); background: var(--accent-soft); }
.team-pick[aria-checked="true"]::after { content: "✓"; flex: none; font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.team-pick:disabled { opacity: .55; cursor: default; }
.no-teams {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); font-weight: 600;
}
.no-teams .ph { font-size: 20px; color: var(--muted); }

/* Nefunkční stavy (hra vypnutá, novější verze): vystředěná ikona stavu, nadpis a tlačítko, schéma podle systému. */
#outdated { align-items: center; text-align: center; padding: 48px 16px; }
#outdated .btn-main { align-self: stretch; }

/* Připojení: zvířátko a barva (návrh: faze-5-design.md § 4.2). Barva hráče je vždy výplň nebo kruh, nikdy barva textu. */
.join { flex: 1; --pp-ink: #14201a; } /* tmavý inkoust na světlých barvách hráčů (kontrast ≥ 6,2:1) */
.pp-avatar {
  --size: 64px;
  display: inline-grid; place-items: center; flex: none; width: var(--size); height: var(--size); border-radius: 50%;
  background: var(--player, var(--accent)); font-size: calc(var(--size) * .62); line-height: 1;
  border: 2px solid rgba(0, 0, 0, .28);
}
.avatar-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.avatar-pick {
  position: relative; aspect-ratio: 1; min-height: 48px; border-radius: 14px; padding: 0;
  border: 2px solid var(--border); background: var(--surface);
  display: grid; place-items: center; font-size: 1.7rem; line-height: 1;
}
.avatar-pick[aria-checked="true"] {
  background: var(--player, var(--accent-soft)); border: 3px solid var(--text);
}
.avatar-pick[aria-checked="true"]::after {
  content: "✓"; position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: .8rem; font-weight: 800;
}
.avatar-pick:disabled, .color-pick:disabled { opacity: .55; cursor: default; }

.color-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.color-pick {
  width: 100%; height: 48px; display: grid; place-items: center; background: transparent; border: 0; padding: 0;
}
.color-pick::before {
  content: ""; grid-area: 1 / 1; width: 44px; height: 44px; border-radius: 50%; background: var(--c);
  border: 2px solid rgba(0, 0, 0, .25);
}
.color-pick .ph { grid-area: 1 / 1; font-size: 22px; color: var(--pp-ink); visibility: hidden; }
.color-pick[aria-checked="true"]::before { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--text); }
.color-pick[aria-checked="true"] .ph { visibility: visible; }


/* Přezdívka s živým avatarem (barva a zvířátko podle volby; nahrazuje dřívější náhled „Takhle tě uvidí televize“) */
.nick-field { position: relative; }
.nick-field .pp-avatar { --size: 40px; position: absolute; left: 8px; top: 8px; pointer-events: none; }
.nick-field .pp-avatar:not([hidden]) + .nick { padding-left: 58px; }

/* Pruh ilustrace režimu nad formulářem (jen párty), dole se ztrácí do pozadí */
.join-hero { display: none; }
body[data-mode="party"] .join-hero {
  display: block; height: 96px; margin: -8px calc(-1 * var(--side)) -12px;
  background: url("/vendor/art/rezim-telefony.webp") center 30% / cover no-repeat;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
}

@media (prefers-color-scheme: dark) { body[data-mode="party"] .join-hero { opacity: .55; } }

/* Tlačítko formuláře je přilepené dole (nad klávesnicí díky interactive-widget=resizes-content) */
.join-actions {
  position: sticky; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: 8px;
  margin: auto calc(-1 * var(--side)) calc(-1 * max(12px, env(safe-area-inset-bottom)));
  padding: 10px var(--side) max(14px, env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
}
.btn-main {
  min-height: 56px; padding: 0 18px; border-radius: 14px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.05rem;
}
.btn-main:disabled { opacity: .4; cursor: default; }
.btn-main:not(:disabled):active { filter: brightness(1.1); }
.btn-ghost {
  min-height: 48px; min-width: 48px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border); background: transparent; font-weight: 600;
}
.btn-ghost:active { background: var(--accent-soft); border-color: var(--accent); }

/* Hra */
.game { flex: 1; }
.me { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.me-emoji { font-size: 2rem; line-height: 1; flex: none; }
.me-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.me-team, .me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-team { font-weight: 700; }
.me-name { color: var(--muted); font-size: .95rem; }

.buzz-area { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-block: 8px; }
.buzz-texts { text-align: center; min-height: 4.5em; }
.buzz-title { font-family: var(--display); font-weight: 800; font-size: 1.5rem; }
.buzz-sub { margin-top: 4px; color: var(--text); }

/* Bzučák: stisknutelný vypadá jen stav armed (plná plocha, stín, ikona); ostatní jsou čárkované a bez stínu */
.buzz {
  width: min(72vw, 320px); aspect-ratio: 1; min-width: 160px; min-height: 160px;
  border-radius: 50%; padding: 0; display: grid; place-items: center;
  border: 6px dashed var(--border); background: var(--surface); color: var(--muted);
  font-size: clamp(56px, 18vw, 96px);
}
.buzz:disabled { cursor: default; opacity: 1; }
.buzz i { opacity: .5; }

.buzz[data-state="lobby"],
.buzz[data-state="wait"],
.buzz[data-state="sent"],
.buzz[data-state="closed"] { border-color: var(--muted); }
.buzz[data-state="penalty"] { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.buzz[data-state="locked"] { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.buzz[data-state="mine"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.buzz[data-state="mine"] i,
.buzz[data-state="team"] i { opacity: 1; }
.buzz[data-state="team"] { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.buzz[data-state="other"] { border-color: var(--border); background: var(--bg); }
.buzz[data-state="wait"] i,
.buzz[data-state="sent"] i { opacity: .8; }

.buzz[data-state="armed"] {
  border: 6px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  box-shadow: var(--shadow), 0 0 0 10px var(--accent-soft);
  cursor: pointer;
}
.buzz[data-state="armed"] i { opacity: 1; }
.buzz[data-state="armed"]:active { transform: scale(.96); filter: brightness(1.1); }

@media (prefers-reduced-motion: no-preference) {
  .buzz[data-state="armed"] { animation: buzz-pulse 1.2s ease-in-out infinite; }
}
@keyframes buzz-pulse {
  50% { box-shadow: var(--shadow), 0 0 0 20px var(--accent-soft); }
}

/* Přepínání bloků podle režimu hry (výchozí je bzučák) */
#game:not([data-mode="party"]) #ask,
#game[data-mode="party"] #buzz-area,
#game[data-mode="party"] .me,
.ask[hidden],
.ask-image[hidden] { display: none; }

/* Otázka na mobilu (párty): obsah se zalamuje a stránka se posouvá, nic se neřeže */
.ask { display: flex; flex-direction: column; gap: 14px; margin-block: 8px; }
.ask-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; align-items: center; font-size: .95rem; }
.ask-timer { font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.ask-count { grid-column: 1 / -1; color: var(--muted); min-height: 1.4em; }
.ask-bar { --left: 0; height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.ask-bar::before {
  content: ""; display: block; height: 100%; border-radius: inherit; background: var(--accent);
  width: calc(var(--left) * 100%);
}
.ask-question {
  font-family: var(--display); font-weight: 700; font-size: 1.2rem; line-height: 1.4;
  overflow-wrap: anywhere; white-space: pre-line;
}
/* postupná hádanka: neodkryté indicie drží místo, aby se tlačítka neposouvala */
.ask-clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: clue; }
.ask-clues li {
  counter-increment: clue; display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); font-size: .98rem; line-height: 1.35; overflow-wrap: anywhere;
}
.ask-clues li::before { content: counter(clue); font-weight: 700; color: var(--muted); min-width: 1.1em; text-align: center; }
.ask-clues li.locked { visibility: hidden; }
.ask-image {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); font-size: .95rem;
}
.ask-image i { font-size: 22px; color: var(--muted); flex: none; }

.ask-answers { display: flex; flex-direction: column; gap: 10px; }
.ask-answer {
  width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 14px; text-align: left;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  display: flex; align-items: center; gap: 12px;
  font: inherit; font-weight: 600; font-size: 1.05rem; line-height: 1.35; cursor: pointer;
}
.ask-answer:not(:disabled):active { border-color: var(--accent); background: var(--accent-soft); transform: scale(.99); }
.ask-letter {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--display); font-weight: 800; font-size: 1.15rem;
}
.ask-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ask-answer::after { flex: none; font-size: 1.4rem; font-weight: 800; }

.ask-answer:disabled { cursor: default; opacity: .6; }
.ask-answer.mine { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.ask-answer.mine .ask-letter { background: var(--accent); color: var(--accent-ink); }

.ask-texts { text-align: center; min-height: 3.5em; }
.ask-title { font-family: var(--display); font-weight: 800; font-size: 1.35rem; }
.ask-sub { margin-top: 4px; }

/* Stavy: v lobby a wait se otázka ani tlačítka neukazují */
.ask[data-state="lobby"] .ask-meta,
.ask[data-state="lobby"] .ask-question,
.ask[data-state="lobby"] .ask-clues,
.ask[data-state="lobby"] .ask-image,
.ask[data-state="lobby"] .ask-answers,
.ask[data-state="wait"] .ask-meta,
.ask[data-state="wait"] .ask-question,
.ask[data-state="wait"] .ask-clues,
.ask[data-state="wait"] .ask-image,
.ask[data-state="wait"] .ask-answers { display: none; }
.ask[data-state="lobby"] .ask-texts,
.ask[data-state="wait"] .ask-texts { padding-block: 24px; }
.ask[data-state="missed"] .ask-title { color: var(--warn); }

/* Telefon na šířku: bzučák vedle textů */
@media (orientation: landscape) and (max-height: 500px) {
  .screen { padding-top: 0; }
  .game { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; align-content: start; align-items: center; }
  .game > * { grid-column: 1 / -1; }
  .game .buzz-area { grid-column: 1 / -1; flex-direction: row; justify-content: center; margin-block: 0; }
  .buzz { width: clamp(160px, 52dvh, 220px); font-size: 64px; }
  .buzz-area .buzz-texts { text-align: left; flex: 1; min-width: 0; }
  .buzz[data-state="armed"] { box-shadow: var(--shadow), 0 0 0 6px var(--accent-soft); }
  .team-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
