/* Impostor — "secret dossier card dealt on the night table".
   Cream paper cards with foil-gold edges on a deep plum-ink table.
   Mono dossier labels, bold sans for the word, red for the impostor. */

:root {
  --table:      #141220;  /* deep plum-ink table */
  --table-2:    #1d1a2c;  /* raised panel */
  --table-3:    #272338;  /* control wells */
  --cream:      #f3ead7;  /* paper card face */
  --cream-2:    #e7dcc2;  /* card shadow tone */
  --ink:        #1b1726;  /* text on cream */
  --ink-soft:   #6a6076;  /* muted on cream */
  --gold:       #e7b54a;  /* foil / "starts" highlight */
  --danger:     #e0463f;  /* impostor red */
  --danger-2:   #b8322c;
  --paper-line: rgba(27, 23, 38, 0.10);
  --text:       #efeafc;  /* text on table */
  --muted:      #9a91b4;  /* muted on table */

  --sans: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "Roboto Mono", "Menlo", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #221d36 0%, var(--table) 60%);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100dvh;
  overflow-x: hidden;
}

#app { min-height: 100dvh; }

/* ---------- Screens ---------- */
.screen {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 1.6rem;
  padding: max(1.75rem, env(safe-area-inset-top)) 1.5rem max(1.75rem, env(safe-area-inset-bottom));
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}
.screen.active { display: flex; }

/* ---------- Masthead ---------- */
.masthead { text-align: center; }
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.logo {
  font-size: clamp(2.8rem, 14vw, 4.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 0.95;
  margin: 0;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.tagline { color: var(--muted); margin: 0.7rem 0 0; font-size: 0.98rem; }

/* ---------- Setup panel ---------- */
.panel {
  background: var(--table-2);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 22px;
  padding: 0.6rem 1.1rem;
  box-shadow: 0 18px 40px -24px rgba(0,0,0,0.8);
}
.control {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.control:last-child { border-bottom: none; }
.control--stack { flex-direction: column; align-items: stretch; gap: 0.85rem; }
.control-label {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.stepper { display: flex; align-items: center; gap: 0.35rem; }
.step-btn {
  width: 48px; height: 48px;
  border: none; border-radius: 13px;
  background: var(--table-3); color: var(--text);
  font-size: 1.6rem; line-height: 1;
  transition: transform 0.08s ease, background 0.15s ease;
}
.step-btn:active { transform: scale(0.9); background: #34304a; }
.step-value {
  min-width: 2.4ch; text-align: center;
  font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.control-head { display: flex; align-items: center; justify-content: space-between; }
.control-head .text-btn { padding: 0.2rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.chip:active { transform: scale(0.94); }
.chip-icon { font-size: 0.95rem; line-height: 1; }
.chip.on {
  background: var(--gold); color: #2a1f06;
  border-color: var(--gold); font-weight: 600;
}

/* ---------- Buttons ---------- */
.cta {
  border: none; border-radius: 16px;
  padding: 1.15rem; font-size: 1.12rem; font-weight: 700;
  font-family: var(--sans);
  background: var(--gold); color: #2a1f06;
  box-shadow: 0 12px 26px -14px rgba(231,181,74,0.9);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.cta:active { transform: translateY(1px) scale(0.99); filter: brightness(0.96); }
.cta--ghost {
  background: transparent; color: var(--text);
  border: 1px solid rgba(255,255,255,0.18); box-shadow: none;
}
.text-btn {
  background: none; border: none; color: var(--muted);
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 0.6rem;
}
button { cursor: pointer; }

.error { color: var(--danger); text-align: center; min-height: 1.2em; margin: -0.4rem 0 0; font-size: 0.95rem; }

/* ---------- Pass-around: the card ---------- */
.pass-counter {
  text-align: center; margin: 0;
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted);
}

.deck { perspective: 1400px; display: flex; justify-content: center; }

.card {
  position: relative;
  width: min(78vw, 320px);
  aspect-ratio: 5 / 7;
  border: none; padding: 0; background: none;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.25, 1);
  border-radius: 22px;
}
.card.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem;
  border-radius: 22px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  padding: 1.5rem;
  text-align: center;
}

/* Card BACK — foil-edged paper with a secret mark */
.card-back {
  background:
    repeating-linear-gradient(45deg, transparent 0 9px, rgba(27,23,38,0.045) 9px 10px),
    linear-gradient(160deg, var(--cream) 0%, var(--cream-2) 100%);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: 0 26px 50px -22px rgba(0,0,0,0.85), inset 0 0 0 6px rgba(231,181,74,0.18);
  justify-content: space-between;
}
.card-mark {
  font-size: 5rem; font-weight: 800; color: var(--ink);
  opacity: 0.85; flex: 1; display: grid; place-items: center;
}
.card-hint-text {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft);
}

/* Card FRONT — revealed (crew by default) */
.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, var(--cream) 0%, var(--cream-2) 100%);
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: 0 26px 50px -22px rgba(0,0,0,0.85), inset 0 0 0 6px rgba(231,181,74,0.18);
}
.card-mono {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--ink-soft);
}
.card-word {
  font-size: clamp(2rem, 9vw, 2.9rem); font-weight: 800; line-height: 1.05;
  color: var(--ink); word-break: break-word;
}

/* Celebrity photo on the card. Crew = a portrait; impostor hint = a small mugshot. */
.card-photo {
  width: 56%; aspect-ratio: 3 / 4; object-fit: cover;
  object-position: center 25%; /* bias toward faces, which sit high in portraits */
  border-radius: 14px;
  border: 2px solid rgba(27,23,38,0.18);
  box-shadow: 0 10px 20px -12px rgba(0,0,0,0.55);
  background: #cabfa9;
}
.card-front.is-impostor .card-photo {
  width: 40%; aspect-ratio: 1 / 1; border-radius: 50%;
  object-position: center 22%;
  border-color: rgba(255,255,255,0.55);
}
.card-sub {
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em;
  color: var(--ink-soft); min-height: 1.1em;
}

/* Impostor variant — the front flips to danger red */
.card-front.is-impostor {
  background: linear-gradient(165deg, var(--danger) 0%, var(--danger-2) 100%);
  border-color: #2a1010;
  box-shadow: 0 26px 50px -20px rgba(224,70,63,0.6), inset 0 0 0 6px rgba(0,0,0,0.14);
}
.card-front.is-impostor .card-mono { color: rgba(255,255,255,0.85); }
.card-front.is-impostor .card-word { color: #fff; letter-spacing: 0.02em; }
.card-front.is-impostor .card-sub { color: rgba(255,255,255,0.92); }

/* "Začínaš" badge for the first player */
.first-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 0.3rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--gold); color: #2a1f06;
  padding: 0.35rem 0.7rem; border-radius: 999px; font-weight: 700;
}

/* ---------- Round screen ---------- */
.round-title { font-size: clamp(1.7rem, 7vw, 2.3rem); margin: 0; color: var(--cream); }
.starts-badge {
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  background: var(--table-2); border: 1px solid rgba(231,181,74,0.3);
  border-radius: 18px; padding: 1.1rem;
}
.starts-label {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--gold);
}
.starts-player { font-size: 1.7rem; font-weight: 800; color: var(--text); }

.result {
  background: var(--table-2); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px; padding: 1.2rem; text-align: center;
}
.result-line { margin: 0.3rem 0; font-size: 1.15rem; }
.result-words { font-family: var(--mono); font-size: 0.92rem; color: var(--muted); letter-spacing: 0.02em; }
.round-actions { display: flex; flex-direction: column; gap: 0.7rem; }

[hidden] { display: none !important; }

/* ---------- Accessibility ---------- */
.cta:focus-visible, .step-btn:focus-visible, .chip:focus-visible,
.card:focus-visible, .text-btn:focus-visible {
  outline: 3px solid var(--gold); outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: opacity 0.2s ease; }
  .card.flipped { transform: none; }
  /* Without 3D flip, show whichever face is active by opacity */
  .card .card-front { transform: rotateY(180deg); }
  .card:not(.flipped) .card-front { opacity: 0; pointer-events: none; }
  .card.flipped .card-back { opacity: 0; }
  .card.flipped .card-front { transform: rotateY(180deg); opacity: 1; }
}
