/* ============================================================
   Chcete být milionářem – vlastní vizuální styl
   ============================================================ */

:root {
  --bg-1: #05061a;
  --bg-2: #14093b;
  --bg-3: #240a4d;
  --panel: rgba(10, 12, 45, 0.85);
  --panel-border: rgba(120, 160, 255, 0.45);
  --gold: #ffcf5c;
  --gold-2: #ff9f1c;
  --text: #eef2ff;
  --muted: #9fb0d9;
  --ok: #35d07f;
  --bad: #ff4d5e;
  --sel: #ff9f1c;
  --radius: 14px;
  --shadow-glow: 0 0 30px rgba(90, 130, 255, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 50% -10%, var(--bg-3), transparent 65%),
    radial-gradient(900px 600px at 10% 110%, #1b0b46, transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 60%, #0a0526);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

.footer {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.75;
}

/* --- světelné paprsky v pozadí --- */
.rays {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0;
}
.rays::before, .rays::after {
  content: ""; position: absolute; top: -30%; left: 50%;
  width: 60vw; height: 160vh;
  background: conic-gradient(from 180deg at 50% 0%,
    transparent 0deg, rgba(110,150,255,0.10) 12deg, transparent 24deg,
    rgba(180,120,255,0.10) 40deg, transparent 60deg);
  transform: translateX(-50%);
  animation: spin 60s linear infinite;
}
.rays::after { animation-direction: reverse; opacity: .6; }
@keyframes spin { to { transform: translateX(-50%) rotate(360deg); } }

.app { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ============ ÚVODNÍ OBRAZOVKA ============ */
.screen { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px);} to {opacity:1; transform:none;} }

.start-wrap { text-align: center; padding: 24px 8px 48px; }

.logo {
  margin: 24px auto 8px;
  font-size: clamp(28px, 6vw, 58px);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6d4, var(--gold) 45%, var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 180, 60, .45));
}
.tagline { color: var(--muted); margin-bottom: 28px; }

.btn {
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(40,60,140,.9), rgba(15,20,60,.9));
  color: var(--text);
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 16px; font-weight: 700; letter-spacing: 1px;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: var(--shadow-glow);
}
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.15); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: #2a1500; border-color: #ffe9a8;
}
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 22px; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(6px);
}
.info-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); text-align: left; margin-top: 18px; }
.info-grid h3 { margin: 0 0 8px; color: var(--gold); font-size: 15px; letter-spacing: 1px; }
.info-grid ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }

.settings-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.settings-row input[type="number"] {
  width: 80px; padding: 6px 8px; border-radius: 8px;
  border: 1px solid var(--panel-border); background: #0d1030; color: var(--text);
}
.status { margin-top: 14px; font-size: 15px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--bad); }

.errors { margin-top: 14px; text-align: left; max-height: 220px; overflow: auto; }
.errors li { color: #ffb3ba; font-size: 13px; line-height: 1.5; }

/* ============ HERNÍ OBRAZOVKA ============ */
.topbar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.topbar .pill {
  border: 1px solid var(--panel-border); border-radius: 999px;
  padding: 8px 16px; background: rgba(10,12,45,.7); font-weight: 700;
}
.pill.money { color: var(--gold); }
.timer { min-width: 92px; text-align: center; }
.timer.warn { color: var(--bad); animation: pulse .6s infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }

.game-layout { display: grid; grid-template-columns: 1fr 250px; gap: 16px; align-items: start; }

.lifelines { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.lifeline {
  min-width: 92px; height: 54px; border-radius: 999px;
  border: 2px solid var(--panel-border);
  background: radial-gradient(circle at 50% 30%, rgba(80,120,255,.5), rgba(10,15,50,.95));
  color: var(--text); font-weight: 800; font-size: 12px; padding: 0 10px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, filter .2s;
}
.lifeline:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.3); }
.lifeline.used { opacity: .3; text-decoration: line-through; cursor: not-allowed; }

.question-panel {
  border: 2px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(16,20,70,.95), rgba(8,10,35,.95));
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 700;
  min-height: 110px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glow);
}
.category { text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0 14px; letter-spacing: 1px; }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 2px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(20,26,80,.9), rgba(8,10,35,.9));
  color: var(--text);
  border-radius: 999px; padding: 14px 18px;
  font-size: clamp(14px, 1.7vw, 18px); font-weight: 600;
  transition: transform .12s ease, background .25s, border-color .25s;
}
.answer .letter { color: var(--gold); font-weight: 900; min-width: 22px; }
.answer:hover:not(:disabled):not(.locked) { transform: translateY(-2px); background: linear-gradient(180deg, rgba(45,60,160,.95), rgba(15,20,60,.95)); }
.answer.selected { background: linear-gradient(180deg, var(--sel), #d97b00); color: #2a1500; border-color: #ffd9a0; animation: blink .45s steps(2) 4; }
.answer.selected .letter { color: #2a1500; }
.answer.correct { background: linear-gradient(180deg, var(--ok), #178a52); color: #04180d; border-color: #a8ffd0; animation: pop .4s ease; }
.answer.correct .letter { color: #04180d; }
.answer.wrong { background: linear-gradient(180deg, var(--bad), #a8121f); color: #fff; border-color: #ffb3ba; animation: shake .4s ease; }
.answer.removed { visibility: hidden; }
.answer:disabled { cursor: default; }
@keyframes blink { 50% { filter: brightness(.55);} }
@keyframes pop { 0%{transform:scale(1)} 50%{transform:scale(1.06)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

.bottom-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* --- žebříček --- */
.ladder { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column-reverse; gap: 4px; }
.ladder li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted);
}
.ladder li .idx { opacity: .7; }
.ladder li.safe { color: #fff; font-weight: 700; }
.ladder li.passed { color: var(--ok); }
.ladder li.current {
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  color: #2a1500; font-weight: 900;
  box-shadow: 0 0 18px rgba(255,180,60,.5);
}

/* --- panel nápovědy (publikum / telefon) --- */
.hint-box { margin-top: 14px; }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; height: 130px; }
.bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar {
  width: 100%; border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #7fb0ff, #2b4bd0);
  transition: height .6s ease;
}
.bar-label { font-size: 12px; color: var(--muted); }

/* --- konec hry --- */
.end-wrap { text-align: center; padding: 30px 10px; }
.end-title { font-size: clamp(26px, 6vw, 52px); font-weight: 900; letter-spacing: 2px; margin-bottom: 8px; }
.end-title.win { color: var(--gold); text-shadow: 0 0 24px rgba(255,190,70,.6); animation: pop .6s ease; }
.end-title.lose { color: var(--bad); }
.end-detail { text-align: left; max-width: 620px; margin: 20px auto; }
.end-detail p { margin: 8px 0; color: var(--muted); }
.end-detail b { color: var(--text); }
.prize { font-size: clamp(22px, 5vw, 40px); font-weight: 900; color: var(--gold); margin: 10px 0 4px; }

/* konfety pro výhru */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 14px; opacity: .9;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

/* ============ ADMIN / CSV EDITOR ============ */
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.admin-toolbar input[type="text"], .admin-toolbar select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel-border);
  background: #0d1030; color: var(--text);
}
.table-wrap { overflow: auto; max-height: 60vh; border-radius: var(--radius); border: 1px solid var(--panel-border); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(120,160,255,.18); }
th { position: sticky; top: 0; background: #131a4d; color: var(--gold); z-index: 1; }
tr:hover td { background: rgba(90,130,255,.08); }
td.correct-cell { color: var(--ok); font-weight: 700; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3,4,18,.8);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20;
}
.modal { width: min(700px, 100%); max-height: 90vh; overflow: auto; }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--panel-border);
  background: #0d1030; color: var(--text); font-family: inherit; font-size: 14px;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: rgba(10,14,45,.95); border: 1px solid var(--panel-border);
  padding: 12px 20px; border-radius: 999px; z-index: 50; box-shadow: var(--shadow-glow);
  max-width: 90vw; text-align: center; font-size: 14px;
}

/* ============ RESPONZIVITA ============ */
@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .ladder { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .ladder li { font-size: 12px; padding: 4px 10px; }
  .ladder li .idx { display: none; }
}
@media (max-width: 640px) {
  .answers { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .lifeline { min-width: 78px; height: 48px; font-size: 12px; }
  .app { padding: 10px; }
}
