:root {
  --czech-blue: #11457e;
  --czech-red: #d7141a;
  --ice-white: #f5f8fc;
  --rink: #0c2340;
  --beer: #f2a900;
  --beer-dark: #c98600;
  --text: #eef3fa;
  --muted: #9fb0c9;
  --card: #132a4d;
  --card-border: #234270;
  --gold: #ffd447;
  --silver: #d9dee6;
  --bronze: #cd8a4f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--rink) 0%, #071427 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: 32px;
}

.topbar {
  padding: 20px 16px 12px;
  text-align: center;
  background: radial-gradient(circle at top, rgba(215,20,26,0.25), transparent 70%);
}

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.flag { filter: drop-shadow(0 0 4px rgba(0,0,0,0.4)); }

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ice-countdown {
  margin: 12px auto 0;
  max-width: 360px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--beer);
  background: rgba(242, 169, 0, 0.12);
  border: 1px solid var(--beer);
  border-radius: 999px;
  padding: 8px 16px;
}

.ice-times-details {
  margin: 10px auto 0;
  max-width: 360px;
  color: var(--muted);
  font-size: 0.8rem;
}

.ice-times-details summary {
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  list-style: none;
}
.ice-times-details summary::-webkit-details-marker { display: none; }
.ice-times-details summary::marker { content: ""; }

.ice-times-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.ice-time-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.78rem;
}
.ice-time-row.past { opacity: 0.4; text-decoration: line-through; }
.ice-time-row.live {
  border-color: var(--czech-red);
  color: #ffb3b3;
  font-weight: 700;
  text-decoration: none;
  opacity: 1;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(7, 20, 39, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--card-border);
}

.tab-btn {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--czech-red);
  border-color: var(--czech-red);
  color: white;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

h2 {
  font-size: 1.1rem;
  margin: 4px 0 14px;
  color: var(--beer);
}

h3 {
  font-size: 0.8rem;
  margin: 22px 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}
.status.ok::before { content: "🟢 "; }
.status.bad::before { content: "🔴 "; }

.leader-banner {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255,212,71,0.18), rgba(255,212,71,0.05));
  border: 1px solid var(--gold);
  color: var(--gold);
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.leaderboard li:nth-child(1) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.leaderboard li:nth-child(2) { border-color: var(--silver); }
.leaderboard li:nth-child(3) { border-color: var(--bronze); }

.rank {
  font-weight: 800;
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
  color: var(--muted);
}
.leaderboard li:nth-child(1) .rank { color: var(--gold); }
.leaderboard li:nth-child(2) .rank { color: var(--silver); }
.leaderboard li:nth-child(3) .rank { color: var(--bronze); }

.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 700; font-size: 1rem; }
.player-meta { font-size: 0.75rem; color: var(--muted); }

.points { font-weight: 800; font-size: 1.15rem; color: var(--beer); white-space: nowrap; }

.empty-hint {
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
  padding: 24px 8px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}

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

.link-btn {
  background: none;
  border: none;
  color: var(--beer);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.chip.selected {
  background: var(--beer);
  border-color: var(--beer);
  color: #21170a;
  font-weight: 700;
}

.place-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.place-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.place-row .pname { flex: 1; font-weight: 600; }

.place-select {
  background: var(--rink);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.custom-points {
  width: 56px;
  background: var(--rink);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 4px;
  text-align: center;
  display: none;
}

.place-row.custom .custom-points { display: inline-block; }
.place-row.custom .place-select { display: none; }

input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.primary-btn {
  width: 100%;
  background: var(--czech-red);
  color: white;
  border: none;
  padding: 13px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.primary-btn:disabled {
  background: #3a4a63;
  color: var(--muted);
  cursor: not-allowed;
}

.secondary-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 13px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.beer-result {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 22px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(242,169,0,0.25), rgba(215,20,26,0.15));
  border: 1px solid var(--beer);
  color: var(--beer);
}

.beer-result.spinning {
  animation: beer-pulse 0.15s ease-in-out infinite alternate;
}

@keyframes beer-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.03); }
}

.beer-confirm-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.count-badge {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.inline-form input { flex: 1; }
.icon-input { flex: 0 0 56px; text-align: center; }
.inline-form button {
  background: var(--beer);
  color: #21170a;
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.manage-list .name { flex: 1; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
}
.icon-btn:hover { color: var(--czech-red); }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feed li {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.feed-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.feed-activity { font-weight: 700; }
.feed-time { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }

.feed-results {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--text);
}
.feed-note {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.feed-delete {
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
.feed-delete:hover { color: var(--czech-red); border-color: var(--czech-red); }

.points-info {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.85rem;
}
.points-info summary { cursor: pointer; font-weight: 600; }
.points-info p { line-height: 1.5; }

#appToast {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 100;
}
#appToast.toast-error {
  border-color: var(--czech-red);
  color: #ffd7d7;
}
