:root {
  --teal: #0d7796;
  --teal-dark: #0a5c74;
  --teal-soft: #e5f1f5;
  --gold: #ca9e67;
  --gold-light: #e6c07c;
  --gold-soft: #fbf4ea;
  --ink: #1d2a31;
  --muted: #5f6b72;
  --line: #e4e0d9;
  --bg: #fbf8f3;
  --card: #ffffff;
  --danger: #c0392b;
  --ok: #1e8e5a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 42, 49, 0.06), 0 8px 24px rgba(29, 42, 49, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, .display {
  font-family: 'Albert Sans', 'Inter', system-ui, sans-serif;
  letter-spacing: -0.01em;
}

a { color: var(--teal); }

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.wrap.wide { max-width: 1360px; }

/* --- Hlavička ----------------------------------------------------------- */

.hero {
  text-align: center;
  padding: 28px 0 8px;
}

.hero .logo { width: min(280px, 72vw); height: auto; display: block; margin: 0 auto 22px; }

.hero h1 {
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 800;
  line-height: 1.05;
  margin: 0 0 10px;
  color: var(--teal);
}

.hero h1 span { color: var(--gold); }

.hero p { margin: 0 auto; color: var(--muted); max-width: 30em; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

/* --- Ceny (nenápadně pod úvodem) -------------------------------------- */

.prize {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px dashed var(--gold-light);
  background: var(--gold-soft);
  font-size: 14px;
  color: var(--muted);
}

.prize-head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.prize-list { list-style: none; margin: 0; padding: 0; }
.prize-list li { display: flex; align-items: center; gap: 10px; padding: 3px 0; color: var(--ink); }
.prize-icon { flex: 0 0 34px; width: 34px; height: 16px; }
.prize-icon.emoji { height: auto; font-size: 18px; text-align: center; line-height: 1; }

.prize-note { margin: 6px 0 0; font-size: 13px; }

/* --- Karty a formulář --------------------------------------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
}

label.field { display: block; font-weight: 600; margin-bottom: 8px; }

input[type='text'], input[type='password'] {
  width: 100%;
  font: inherit;
  font-size: 17px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

input[type='text']:focus, input[type='password']:focus { border-color: var(--teal); }
input.invalid, input.invalid:focus { border-color: var(--danger); }
#nameError { font-size: 14px; }
#nameHint { margin-top: 8px; }
#nameError:empty { display: none; }

.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* --- Lišta se součtem (sticky) ----------------------------------------- */

.tally {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 248, 243, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--line);
}

.tally-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

.tally-count { font-family: 'Albert Sans', sans-serif; font-weight: 800; font-size: 26px; color: var(--ink); line-height: 1; }
.tally-count small { font-size: 16px; color: var(--muted); font-weight: 600; }
.tally-msg { font-size: 14px; font-weight: 600; color: var(--muted); text-align: right; }
.tally.full .tally-count { color: var(--ok); }
.tally.full .tally-msg { color: var(--ok); }

.seats { display: grid; grid-template-columns: repeat(21, 1fr); gap: 3px; }

.seat {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e7e3dc;
  transition: background-color 0.2s, transform 0.2s;
}

.seat.on { transform: scale(1.04); }

/* --- Strany ------------------------------------------------------------- */

.parties { list-style: none; margin: 0; padding: 0; }

.party {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.party:last-child { border-bottom: 0; }

.party.highlight {
  background: linear-gradient(90deg, var(--teal-soft), rgba(229, 241, 245, 0));
  margin: 0 -20px;
  padding: 14px 20px;
  border-radius: 0;
}

.party-logo {
  flex: 0 0 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}

.party-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.party-logo.badge {
  color: #fff;
  font-family: 'Albert Sans', sans-serif;
  font-weight: 800;
  font-size: 22px;
  border: 0;
}

.party-info { flex: 1; min-width: 0; }
.party-name { font-weight: 600; line-height: 1.25; }
.party-sub { font-size: 13px; color: var(--muted); line-height: 1.3; margin-top: 2px; }

.stepper { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--teal);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s, border-color 0.12s, transform 0.08s;
}

.stepper button:active:not(:disabled) { transform: scale(0.92); }
.stepper button.plus { background: var(--teal); border-color: var(--teal); color: #fff; }
.stepper button:disabled { opacity: 0.3; cursor: not-allowed; }

.stepper .val {
  width: 36px;
  text-align: center;
  font-family: 'Albert Sans', sans-serif;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stepper .val.zero { color: #b9b4ab; }

/* --- Tlačítka ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  padding: 15px 22px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  transition: background-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) { background: var(--teal-dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.gold { background: var(--gold); }
.btn.gold:hover:not(:disabled) { background: #b88b55; }
.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--line); }
.btn.ghost:hover:not(:disabled) { background: var(--teal-soft); }
.btn.small { font-size: 14px; padding: 8px 14px; }

.submit-bar { padding: 4px 0 24px; }

.unlock { margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--teal-soft); font-size: 14px; }
.unlock p { margin: 0 0 8px; }
.unlock .hint { margin: 6px 0 0; font-size: 13px; }
.unlock .error { margin: 6px 0 0; font-size: 14px; }
.unlock .error:empty { display: none; }
.unlock-row { display: flex; gap: 8px; }
.unlock-row input { flex: 1; min-width: 0; font-size: 16px !important; padding: 10px 12px !important; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.error { color: var(--danger); font-weight: 600; margin: 10px 0 0; min-height: 1em; }

/* --- Poděkování (vstupenka s heslem) --------------------------------- */

.thanks { text-align: center; }
.thanks .big { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.thanks h2 { margin: 0 0 6px; color: var(--teal); font-size: 26px; }

.done-line { display: flex; align-items: center; gap: 10px; justify-content: center; }
.done-line .check {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 800;
}
.done-line h2 { margin: 0; font-size: 24px; color: var(--teal); }
.who { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.ticket {
  margin: 18px 0 6px;
  padding: 16px 16px 18px;
  border-radius: 16px;
  color: #fff;
  /* vykrojené okraje jako u vstupenky */
  background:
    radial-gradient(circle at 0 62%, var(--card) 13px, transparent 14px),
    radial-gradient(circle at 100% 62%, var(--card) 13px, transparent 14px),
    linear-gradient(135deg, var(--teal), var(--teal-dark));
}
.ticket-top { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-light); }
.ticket-sub { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.ticket-cut { border-top: 2px dashed rgba(255, 255, 255, 0.35); margin: 14px 4px; }
.ticket-pass {
  display: flex; align-items: center; gap: 6px;
  background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 6px 10px 12px; text-align: left;
}
.ticket-pass code {
  flex: 1; min-width: 0;
  font: 700 clamp(13px, 3.9vw, 17px)/1.3 'JetBrains Mono', ui-monospace, monospace;
  color: var(--teal-dark);
  overflow-wrap: break-word;
}
.icon-copy {
  flex: 0 0 auto; border: 0; background: var(--teal-soft); color: var(--teal);
  cursor: pointer; font-size: 17px; width: 36px; height: 36px; border-radius: 8px;
}
.icon-copy:hover { background: #d3e8ef; }
.ticket-note { font-size: 13px; margin: 10px 0 0; opacity: 0.92; }

.mini-tip { margin-top: 16px; text-align: left; }
.mini-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mini-tip .seats { margin: 6px 0 8px; }
.mini-tip .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.mini-tip .legend span { display: inline-flex; align-items: center; gap: 5px; }
.mini-tip .legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.mini-tip .legend b { color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.thanks #editHint { font-size: 13px; margin-top: 8px; }

/* --- Patička ------------------------------------------------------------ */

.footer { margin-top: auto; padding-top: 32px; }
.footer img { display: block; width: 100%; max-width: 760px; margin: 0 auto -1px; height: auto; }
.footer p { text-align: center; color: rgba(255, 255, 255, 0.85); font-size: 13px; margin: 0; padding: 14px 16px 22px; background: var(--teal); }
.footer a { color: #fff; }

.hidden { display: none !important; }

/* --- Admin -------------------------------------------------------------- */

.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 4px; flex-wrap: wrap; }
.admin-top img { height: 34px; width: auto; }
.admin-top .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; margin: 12px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.stat { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; min-width: 120px; }
.stat b { display: block; font-family: 'Albert Sans', sans-serif; font-size: 26px; color: var(--teal); line-height: 1.1; }
.stat span { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { padding: 10px 10px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); vertical-align: bottom; background: #fcfbf8; position: sticky; top: 0; }
th.party-col { min-width: 56px; }
th .ph { display: flex; flex-direction: column; align-items: center; gap: 4px; }
th .ph i { width: 10px; height: 10px; border-radius: 50%; display: block; }
td.name, th.name { text-align: left; white-space: normal; min-width: 170px; font-weight: 600; }
td.name .pass { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
td.num { font-family: 'Albert Sans', sans-serif; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
td.num.zero { color: #c5c0b7; font-weight: 600; }
td.num.hit { background: #e3f4ea; color: var(--ok); }
td.meta { font-size: 12px; color: var(--muted); }
tr.actual td { background: var(--gold-soft); font-weight: 700; }
td.place { font-family: 'Albert Sans', sans-serif; font-weight: 800; font-size: 18px; color: var(--gold); }
tr.top1 td.place { color: #c99a2e; }
td.score { font-weight: 800; color: var(--teal); }

.icon-btn { background: none; border: 0; cursor: pointer; color: #b0aaa0; font-size: 18px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { color: var(--danger); background: #fbeaea; }

.empty { padding: 32px; text-align: center; color: var(--muted); }

.rules { font-size: 14px; color: var(--muted); }
.rules b { color: var(--ink); }

.login { max-width: 380px; margin: 10vh auto 0; }

/* Výherce a losování */

.winner-card { text-align: center; max-width: 560px; margin: 24px 0 0; position: relative; overflow: visible; border: 2px solid var(--gold-light); }
.winner-label { font-family: 'Albert Sans', sans-serif; font-weight: 800; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.winner-name { font-family: 'Albert Sans', sans-serif; font-weight: 800; font-size: clamp(26px, 6vw, 36px); color: var(--teal); margin: 6px 0 4px; line-height: 1.15; }
.winner-card .hint { margin: 4px 0 12px; }
.winner-pass { font-weight: 600; color: var(--muted); min-height: 1.5em; margin-bottom: 8px; }

.draw-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }
.draw-chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 600;
  border: 2px solid transparent;
  transition: background-color 0.12s, color 0.12s, opacity 0.4s, transform 0.12s;
}
.draw-chip.on { background: var(--teal); color: #fff; transform: scale(1.08); }
.draw-chip.won { background: var(--gold); color: #fff; border-color: var(--gold-light); transform: scale(1.12); box-shadow: 0 4px 14px rgba(202, 158, 103, 0.5); }
.draw-chip.out { opacity: 0.35; text-decoration: line-through; }

.draw-reel { min-height: 1.2em; margin: 4px 0 14px; color: #b9b4ab; }
.draw-reel.bump { animation: bump 0.18s ease-out; color: var(--teal); }
.winner-card.done .draw-reel { color: var(--gold); animation: pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }

@keyframes bump { from { transform: translateY(-8px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes pop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }

.confetti { position: absolute; left: 50%; top: 55%; width: 0; height: 0; pointer-events: none; }
.confetti i {
  position: absolute;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti 1.4s cubic-bezier(0.1, 0.7, 0.3, 1) forwards;
}
@keyframes confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 160px)) rotate(var(--r)); opacity: 0; }
}

/* Sdílené IP */
td.ip { text-align: left; white-space: nowrap; }
td.ip small { display: block; }
.ip-badge { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #fdecc8; color: #8a5a00; font-weight: 700; font-size: 11px; }
tr.shared-ip td { background: #fffaf0; }
td.name .ip-warn { display: block; font-size: 12px; font-weight: 600; color: #8a5a00; }
.stat.warn b { color: #b7791f; }
.ip-alert { text-align: left; background: #fff7e6; border: 1px solid #f3d08a; color: #6b4a00; border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; }
.ip-alert ul { margin: 4px 0 0; padding-left: 18px; }
