/* Bergfest – alpines Nachtblau mit Sonnenaufgang */
:root {
  --bg: #0c1a2b;
  --bg-2: #10233a;
  --card: #16304d;
  --card-2: #1c3a5c;
  --line: #2a4b6f;
  --text: #eef3f8;
  --muted: #9fb3c9;
  --accent: #f28c28;
  --accent-2: #ffb44d;
  --accent-ink: #2a1505;
  --green: #3f9a6d;
  --snow: #f4f7fb;
  --danger: #e5634f;
  --ok: #5cc28c;
  --gold: #f5c542;
  --silver: #c9d3dd;
  --bronze: #d08a52;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

/* ---------- Kopfbereich mit Bergpanorama ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #102641 0%, #1f4470 42%, #c4703f 82%, #f2a04a 100%);
  text-align: center;
  padding: 26px 16px 0;
}
.hero-title {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: clamp(2.4rem, 11vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--snow);
  text-shadow: 0 3px 18px rgba(5, 15, 30, 0.45);
}
.hero-sub {
  position: relative;
  z-index: 2;
  margin: 2px 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffe2bf;
}
.hero-mountains {
  display: block;
  width: calc(100% + 32px);
  max-width: 760px;
  height: auto;
  margin: -8px auto 0;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.hero { border-bottom: 10px solid #245a40; }
.hero-compact { padding-top: 14px; }
.hero-compact .hero-title { font-size: 2rem; }
.hero-compact .hero-mountains { max-height: 90px; }

.flag { transform-origin: 200px 12px; animation: wave 2.6s ease-in-out infinite; }
@keyframes wave {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50% { transform: skewY(-4deg) scaleX(0.92); }
}
.stars circle { animation: twinkle 3s ease-in-out infinite; }
.stars circle:nth-child(2n) { animation-delay: 1.2s; }
.stars circle:nth-child(3n) { animation-delay: 2.1s; }
@keyframes twinkle { 50% { opacity: 0.25; } }

/* ---------- Layout ---------- */
main { max-width: 480px; margin: 0 auto; padding: 18px 16px 48px; }
main.wide { max-width: 1120px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.card-accent { border-color: var(--accent); }

h2 { margin: 0 0 4px; font-size: 1.35rem; line-height: 1.2; }
h3 { margin: 0 0 8px; font-size: 1.1rem; }
.en { display: block; font-size: 0.82em; font-weight: 500; color: var(--muted); }
.inline-en { color: var(--muted); font-weight: 500; }
.lead { margin: 6px 0 16px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-2); }
textarea { min-height: 260px; font-size: 1rem; line-height: 1.5; resize: vertical; }
select { width: auto; }

.pin-input, .score-input {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.3em;
  font-size: 2.2rem !important;
}
.score-input { letter-spacing: 0.05em; font-size: 3rem !important; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 4px 0 #b4601a;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b4601a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-block { display: flex; width: 100%; margin-top: 14px; font-size: 1.15rem; padding: 15px 18px; flex-direction: column; gap: 0; }
.btn-block .en { color: rgba(42, 21, 5, 0.75); }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid var(--line); box-shadow: none; }
.btn-ghost:active { box-shadow: none; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 0 #9b3a2b; }
.btn-small { padding: 7px 12px; font-size: 0.9rem; box-shadow: 0 3px 0 #b4601a; }
.btn-ghost.btn-small { box-shadow: none; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 6px; }

.msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.msg:empty { display: none; }
.msg-ok { background: rgba(92, 194, 140, 0.15); color: var(--ok); }
.msg-err { background: rgba(229, 99, 79, 0.15); color: #ff9a88; }

/* ---------- Namensauswahl ---------- */
.suggestions { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.suggestion {
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.suggestion:hover, .suggestion:focus { border-color: var(--accent-2); outline: none; }

/* ---------- Bahn & Spielernummer ---------- */
.round-line { margin: 12px 0 8px; }
.slot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot-box { background: linear-gradient(135deg, #1f4a73, #173554); border-radius: 14px; padding: 12px; text-align: center; }
.slot-box-accent { background: radial-gradient(circle at 35% 25%, #ffd08a, var(--accent)); color: var(--accent-ink); }
.slot-box-accent .inline-en { color: rgba(42, 21, 5, 0.7); }
.slot-label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.slot-value { font-size: 3.4rem; font-weight: 900; line-height: 1.05; }
.slot-hint { margin: 12px 0 14px; padding: 10px 12px; border-radius: 10px; background: rgba(242, 140, 40, 0.12); }
.slot-hint .en { font-size: 0.95em; }
.team-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.team-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.team-list li.me { background: rgba(242, 140, 40, 0.18); font-weight: 700; }
.team-slot { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; color: var(--accent-ink); background: var(--accent-2); }
.member .team-slot { width: 24px; height: 24px; font-size: 0.85rem; flex: none; }

/* ---------- Bahn & Punkte ---------- */
.greeting { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; }
.lane-badge {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #1f4a73, #173554);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 14px 0;
}
.lane-number {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.3rem;
  font-weight: 900;
  color: var(--accent-ink);
  background: radial-gradient(circle at 35% 30%, #ffd08a, var(--accent));
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}
.lane-label { font-size: 1.2rem; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 0.9rem; }

.history { list-style: none; padding: 0; margin: 8px 0 0; }
.history li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.history li:last-child { border-bottom: 0; }
.history strong { font-size: 1.1rem; }

.banner { text-align: center; padding: 14px; border-radius: 12px; background: rgba(245, 197, 66, 0.12); color: var(--gold); font-weight: 700; margin-bottom: 16px; }
.waiting { text-align: center; padding: 10px 0; }
.waiting .big { font-size: 2.6rem; }

/* ---------- Siegerehrung ---------- */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 8px;
  margin: 18px 0 8px;
}
.step { text-align: center; opacity: 0; animation: rise 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards; }
.step-3 { animation-delay: 0.4s; }
.step-2 { animation-delay: 1.8s; }
.step-1 { animation-delay: 3.2s; }
.no-anim .step { animation: none; opacity: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
.step-names { font-weight: 800; font-size: 0.98rem; margin-bottom: 6px; word-break: break-word; }
.step-points { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.step-block {
  border-radius: 10px 10px 0 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-ink);
  clip-path: polygon(0 18%, 50% 0, 100% 18%, 100% 100%, 0 100%);
  padding-top: 14px;
}
.step-1 .step-block { height: 150px; background: linear-gradient(180deg, #ffe58a, var(--gold)); }
.step-2 .step-block { height: 112px; background: linear-gradient(180deg, #eef3f8, var(--silver)); }
.step-3 .step-block { height: 84px; background: linear-gradient(180deg, #f0b07c, var(--bronze)); }

.team-win { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.team-win:last-child { border-bottom: 0; }
.team-win .icon { font-size: 1.8rem; line-height: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.top-1 td { color: var(--gold); font-weight: 800; }
tr.top-2 td { color: var(--silver); font-weight: 700; }
tr.top-3 td { color: var(--bronze); font-weight: 700; }
tr.me td { background: rgba(242, 140, 40, 0.12); }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { font: inherit; font-weight: 700; color: var(--muted); background: var(--bg-2); border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; cursor: pointer; }
.tab.active { color: var(--accent-ink); background: var(--accent-2); border-color: var(--accent-2); }

.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.lane-card { background: var(--card-2); border: 2px solid var(--line); border-radius: 14px; padding: 12px; }
.lane-card.winner { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 197, 66, 0.15); }
.lane-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.lane-head strong { font-size: 1.1rem; }
.member { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.member span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member input { width: 84px; padding: 6px 8px; font-size: 1rem; text-align: right; border-radius: 8px; }
.member input.missing { border-color: rgba(229, 99, 79, 0.6); }
.round-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { display: inline-block; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 0.9rem; }
.stat strong { color: var(--accent-2); }
.toggle-big { font-size: 1.1rem; padding: 14px 22px; }
.plist { columns: 2 220px; padding-left: 18px; margin: 10px 0 0; }
.plist li { padding: 3px 0; break-inside: avoid; }
.danger-zone { border-color: rgba(229, 99, 79, 0.5); }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .score-input { font-size: 2.6rem !important; }
  th, td { padding: 8px 5px; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .flag, .stars circle { animation: none; }
  .step { animation: none; opacity: 1; }
}
