@font-face {
  font-family: 'Fredoka';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/fredoka-700.woff2') format('woff2');
}

:root {
  --bg: #0c0a24;
  --bg-glow-1: #3a1d7a;
  --bg-glow-2: #12205c;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f6f3ff;
  --muted: #a8a1cc;
  --primary: #ff4fa3;
  --primary-2: #ff7ac2;
  --primary-press: #e93d8f;
  --primary-text: #ffffff;
  --primary-soft: rgba(255, 79, 163, 0.16);
  --accent: #9b7bff;
  --accent-soft: rgba(155, 123, 255, 0.18);
  --success: #3fe0a6;
  --success-soft: rgba(63, 224, 166, 0.14);
  --danger: #ff5c7a;
  --warning-bg: rgba(255, 196, 77, 0.16);
  --warning: #ffd27a;
  --shadow: 0 10px 30px rgba(4, 2, 20, 0.45);
  --glow: 0 8px 28px rgba(255, 79, 163, 0.38);
  --radius: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 0% 0%, var(--bg-glow-1) 0%, transparent 60%),
    radial-gradient(100% 60% at 100% 100%, var(--bg-glow-2) 0%, transparent 65%),
    var(--bg);
  background-attachment: fixed;
}
body.flash::after {
  content: ''; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: var(--primary); animation: flash 1.6s ease-out forwards;
}
@keyframes flash {
  0%, 30%, 60% { opacity: 0.85; }
  15%, 45%, 100% { opacity: 0; }
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 2.8rem; letter-spacing: -0.02em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; margin-bottom: 10px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
p { margin: 0; }
.muted { color: var(--muted); }
.small, small { font-size: 0.85rem; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ---------- horní lišta */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  max-width: 480px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(12, 10, 36, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.logo { width: 28px; height: 28px; color: #ffffff; }
.game-chip { font-size: 0.85rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.game-chip b { color: var(--text); letter-spacing: 0.08em; }
.lang { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; font-weight: 700; font-size: 0.8rem; padding: 6px 10px; cursor: pointer; }
.offline { background: var(--warning-bg); color: var(--warning); text-align: center; font-size: 0.85rem; padding: 6px 16px; }

/* ---------- tlačítka */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface-strong); color: var(--text);
  font: inherit; font-weight: 700; border-radius: 14px; padding: 12px 18px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
}
.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  border-color: transparent; color: var(--primary-text); box-shadow: var(--glow);
}
.btn.primary:active { background: var(--primary-press); }
.btn.big { width: 100%; min-height: 60px; font-size: 1.15rem; border-radius: 16px; }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 0.9rem; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); border-color: rgba(255, 92, 122, 0.35); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn .icon { width: 24px; height: 24px; }
.link { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; padding: 4px 0; cursor: pointer; align-self: flex-start; }

/* ---------- úvod */
.hero { text-align: center; padding: 28px 0 10px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.hero h1 { font-size: 4.4rem; line-height: 1; margin-top: 6px; }
.wordmark { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 700; letter-spacing: 0.01em; color: #ffffff; }
.wordmark .go { color: var(--primary); }
.brand .wordmark { font-size: 1.3rem; }
.hero .wordmark { text-shadow: 0 6px 30px rgba(155, 123, 255, 0.45); }
.hero .wordmark .go { text-shadow: 0 6px 30px rgba(255, 79, 163, 0.6); }
.hero-symbols { display: flex; gap: 6px; font-size: 3rem; margin-bottom: 6px; filter: drop-shadow(0 6px 18px rgba(155, 123, 255, 0.45)); }
.hero-symbols .symbol { font-size: 3rem; }
.hero-symbols img.symbol { height: 96px; border-radius: 16px; }
.hero-symbols img.symbol:nth-child(2) { transform: translateY(-10px) rotate(-4deg); }
.choices { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.choice {
  appearance: none; text-align: left; border: 0; border-radius: var(--radius); padding: 20px; cursor: pointer;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%); color: var(--primary-text);
  font: inherit; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--glow);
}
.choice.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.choice-title { font-size: 1.25rem; font-weight: 800; }
.choice-sub { opacity: 0.85; font-size: 0.92rem; }

/* ---------- formuláře */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.95rem; }
input:not([type]), input[type='text'], .form input[name] {
  font: inherit; font-size: 1.1rem; padding: 14px; border-radius: 12px; border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.07); color: var(--text); width: 100%;
}
input::placeholder { color: rgba(168, 161, 204, 0.6); }
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.code-input { text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; }
.form label.check { flex-direction: row; align-items: flex-start; gap: 12px; font-weight: 400; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.form label.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* ---------- karty */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card.hint.blocked { background: rgba(255, 196, 77, 0.1); border-color: rgba(255, 196, 77, 0.35); }
.card.hint h3 { margin: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.card.hint { background: var(--accent-soft); border-color: rgba(155, 123, 255, 0.35); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.hello { font-weight: 700; color: var(--muted); }
.section-title { margin: 6px 0 -4px; }

.waiting .pulse { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); animation: pulse 2s ease-in-out infinite; }
.waiting .pulse .logo { width: 44px; height: 44px; }
@keyframes pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 79, 163, 0.45); } 50% { transform: scale(1.05); box-shadow: 0 0 0 18px rgba(255, 79, 163, 0); } }
.paused { background: rgba(255, 255, 255, 0.03); }

/* ---------- kolo */
.round-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; width: 100%; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.3rem; background: #ffffff; color: var(--bg); border-radius: 10px; padding: 2px 10px; }
.countdown.urgent { background: var(--primary); color: #fff; }
.round-card, .success-card { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.round-card { background: linear-gradient(180deg, rgba(155, 123, 255, 0.16) 0%, var(--surface) 55%); }
.instruction { font-weight: 600; font-size: 1.05rem; }
.symbol { line-height: 1; display: inline-block; }
/* postavičky mají bílé pozadí – zobrazují se jako zaoblená karta */
img.symbol { object-fit: contain; background: #fff; border-radius: 20px; aspect-ratio: 349 / 438; width: auto; }
.symbol-xl { font-size: 9rem; filter: drop-shadow(0 10px 30px rgba(255, 122, 194, 0.35)); }
img.symbol-xl { height: min(38vh, 280px); border-radius: 24px; box-shadow: 0 0 0 5px var(--primary-soft), 0 14px 40px rgba(255, 79, 163, 0.3); filter: none; }
.symbol-md { font-size: 4.5rem; }
img.symbol-md { height: 120px; }
.symbol-sm { font-size: 1.8rem; }
img.symbol-sm { height: 46px; border-radius: 10px; flex: none; }
.partial { background: var(--success-soft); color: var(--success); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 0.92rem; }
.qr-block { width: 100%; border-top: 1px dashed var(--border); padding-top: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* QR zůstává černobílý na bílém podkladu kvůli spolehlivému skenování */
.qr { width: 70%; max-width: 240px; background: #fff; padding: 10px; border-radius: 16px; box-shadow: 0 0 0 4px var(--primary-soft); }
.qr svg { display: block; width: 100%; height: auto; }
.connect-code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.08em; }
.success-card { background: linear-gradient(180deg, rgba(63, 224, 166, 0.2) 0%, var(--surface) 70%); border-color: rgba(63, 224, 166, 0.35); }
.success-card h2 { color: var(--success); font-size: 1.8rem; }
.points-big { font-size: 1.5rem; font-weight: 800; color: var(--success); }
.final .points-big { color: var(--primary-2); font-size: 1.15rem; }
.result-row { display: flex; align-items: center; gap: 12px; }

/* ---------- pořadí */
.board { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.board li { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.board li.me { background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(255, 79, 163, 0.4); font-weight: 700; }
.board .rank { width: 2.2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.board .top1 .rank { color: #ffd166; font-weight: 800; }
.board .top2 .rank { color: #d6dcf0; font-weight: 800; }
.board .top3 .rank { color: #f0a774; font-weight: 800; }
.board .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.board .pts { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- body po kolech */
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.history li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.history .round-no { width: 4.2em; flex: none; font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.history .detail { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 0.92rem; }
.history .who { min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.history small.ok { color: var(--success); font-weight: 700; }
.history .pts { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--success); }
.history .pts.zero { color: var(--muted); }
.history-total { display: flex; justify-content: space-between; padding-top: 10px; font-size: 1.05rem; }
.symbol-xs { font-size: 1.4rem; }
.secondary-action { border-color: rgba(255, 79, 163, 0.5); color: var(--primary-2); }
.scheduled { background: linear-gradient(180deg, rgba(155, 123, 255, 0.22) 0%, var(--surface) 70%); border-color: rgba(155, 123, 255, 0.4); }
.scheduled .hourglass { font-size: 2.6rem; animation: tilt 2.4s ease-in-out infinite; }
@keyframes tilt { 0%, 40% { transform: rotate(0); } 50%, 90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.scheduled .countdown { font-size: 1rem; }
.schedule-error { background: rgba(255, 92, 122, 0.14); color: var(--danger); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 0.92rem; }
/* ---------- obnovení přístupu */
.requests { border-color: rgba(255, 79, 163, 0.55); background: var(--primary-soft); }
.request { display: flex; flex-direction: column; gap: 10px; padding: 6px 0; }
.request + .request { border-top: 1px solid var(--border); padding-top: 12px; }
.request .row { display: flex; gap: 8px; }
.pulse-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); animation: pulse 1.6s ease-in-out infinite; }
.modal { position: fixed; inset: 0; z-index: 25; background: rgba(7, 6, 26, 0.8); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-card { width: 100%; max-width: 420px; background: #1a1540; }
.modal-card .qr { width: 75%; }
.backup { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.backup h3 { margin-bottom: 0; }
.backup-url { font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; word-break: break-all; color: var(--muted); }
.warning { color: var(--warning); }
/* ---------- patička a dokumenty */
.footer { text-align: center; margin-top: 24px; font-size: 0.85rem; }
.footer a, .doc a { color: var(--primary-2); }
.doc { gap: 10px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.15rem; margin-top: 14px; }
.doc ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.doc .btn { text-decoration: none; color: var(--text); margin-top: 12px; }
.topbar a.brand, .topbar a.lang { text-decoration: none; color: var(--text); }
.round-banner { display: flex; flex-direction: column; gap: 8px; border-color: rgba(63, 224, 166, 0.35); }
.round-banner .progress { margin: 4px 0 0; }
.round-banner .btn { align-self: flex-start; }
.banner-ok { display: flex; align-items: center; gap: 10px; color: var(--success); font-weight: 700; }
img.symbol-xs { height: 38px; border-radius: 8px; flex: none; }

/* ---------- organizátor */
.share { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; background: linear-gradient(135deg, rgba(155, 123, 255, 0.22) 0%, rgba(255, 79, 163, 0.14) 100%); }
.game-code { font-size: 2.6rem; font-weight: 800; letter-spacing: 0.18em; font-family: ui-monospace, 'SF Mono', Menlo, monospace; color: #ffffff; }
.progress { height: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width 0.4s; }
.groups, .players { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.groups li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.groups li.ok { background: var(--success-soft); }
.groups .names { flex: 1; min-width: 0; font-size: 0.92rem; overflow-wrap: anywhere; }
.groups .status { font-size: 0.85rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.groups li.ok .status { color: var(--success); }
.players li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.players li:last-child { border-bottom: 0; }
.players .name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.players .is-paused .name { opacity: 0.5; }
.tag { background: var(--accent-soft); color: #c9b8ff; border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: 0.72rem; }
.icon-btn { appearance: none; border: 0; background: none; color: var(--muted); font-size: 1.1rem; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; }
.icon-btn:disabled { opacity: 0.3; }

.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.18); border-radius: 99px; transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.35); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: 0.5; }

/* ---------- skener */
.scanner { position: fixed; inset: 0; z-index: 20; background: #07061a; color: #fff; display: flex; flex-direction: column; }
.scanner-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; font-weight: 700; }
.viewfinder { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder .frame { position: relative; width: min(70vw, 280px); aspect-ratio: 1; border: 4px solid var(--primary); border-radius: 24px; box-shadow: 0 0 0 100vmax rgba(7, 6, 26, 0.55), 0 0 30px rgba(255, 79, 163, 0.5); }
.camera-error { position: relative; padding: 16px; text-align: center; max-width: 280px; }
.manual { background: #14113a; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.manual .row { display: flex; gap: 8px; }
.manual input { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: 0.06em; padding: 12px; border-radius: 12px; border: 1.5px solid var(--border); background: rgba(255, 255, 255, 0.08); color: #fff; font-size: 1.05rem; }

/* ---------- toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  max-width: calc(100% - 32px); width: max-content; z-index: 30;
  background: #ffffff; color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 700;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--success); color: #062a1d; }
.toast.error { background: var(--danger); color: #ffffff; }
