/* ── Grill-WM · Bolzplatz trifft Panini-Album ─────────────── */

:root {
  --pitch: #1b5e33;
  --pitch-dark: #144927;
  --chalk: #f7f4ea;
  --chalk-dim: rgba(247, 244, 234, 0.72);
  --ink: #17233b;
  --ink-soft: #47506a;
  --gold: #f4b942;
  --gold-deep: #d99a1b;
  --hot: #e4572e;
  --board: #10381f;
  --line: rgba(247, 244, 234, 0.28);
  --shadow: 0 10px 24px rgba(9, 30, 17, 0.45);
  --font-display: "Bungee", "Arial Black", sans-serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--chalk);
  background-color: var(--pitch);
  background-image:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, 0.035) 0 90px,
      rgba(0, 0, 0, 0.05) 90px 180px);
  min-height: 100vh;
  line-height: 1.5;
}

::selection { background: var(--gold); color: var(--ink); }

button, input, select { font: inherit; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Hero: Anstoßpunkt mit Kreide-Mittelkreis ─────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(4rem, 10vw, 7rem) 1.5rem clamp(3.5rem, 8vw, 6rem);
  text-align: center;
  border-bottom: 4px solid var(--line);
}

/* Mittelkreis + Mittellinie in Kreide */
.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(70vw, 560px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 5px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 5px;
  background: var(--line);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }

.eyebrow {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 12vw, 7.5rem);
  line-height: 0.95;
  color: var(--chalk);
  text-shadow: 0.06em 0.06em 0 rgba(9, 30, 17, 0.55);
  animation: title-drop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.title span { color: var(--gold); }

.sub {
  margin-top: 0.9rem;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  font-weight: 600;
  color: var(--chalk-dim);
}

@keyframes title-drop {
  from { transform: translateY(-30px) scale(1.06); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Sektionen ────────────────────────────────────────────── */

main { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.section { padding: clamp(3rem, 7vw, 5rem) 0; }

.section + .section { border-top: 4px solid var(--line); }

.section-head { text-align: center; margin-bottom: 2.5rem; }

.kicker {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  color: var(--gold);
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-top: 0.4rem;
  text-shadow: 0.05em 0.05em 0 rgba(9, 30, 17, 0.45);
}

.section-note {
  max-width: 46ch;
  margin: 0.7rem auto 0;
  color: var(--chalk-dim);
}

/* ── Buttons ──────────────────────────────────────────────── */

.toolbar {
  margin-top: 1.4rem;
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.3rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(2px); }

.btn-gold {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--gold-deep);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--gold-deep); }
.btn-gold:active { box-shadow: 0 1px 0 var(--gold-deep); }

.btn-ghost {
  background: transparent;
  color: var(--chalk-dim);
  border: 2px solid var(--line);
}
.btn-ghost:hover { color: var(--chalk); border-color: var(--chalk-dim); }
.btn-ghost.armed { color: #ffd7c9; border-color: var(--hot); background: rgba(228, 87, 46, 0.18); }

.count-control {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  color: var(--chalk-dim);
}
.count-control select {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--board);
  color: var(--gold);
  font-family: var(--font-display);
  cursor: pointer;
}

.count-hint { font-size: 0.8rem; margin-top: 1rem; }

/* ── Team-Sticker (Signature-Element) ─────────────────────── */

.stickers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
  align-items: start;
}

.sticker {
  --tilt: 0deg;
  position: relative;
  background: var(--chalk);
  color: var(--ink);
  border-radius: 14px;
  padding: 1.1rem 1.1rem 1.3rem;
  border: 7px solid #fff;
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.25s ease;
}
.sticker:hover { transform: rotate(0deg) translateY(-4px); }
.sticker:nth-child(1) { --tilt: -1.4deg; }
.sticker:nth-child(2) { --tilt: 0.9deg; }
.sticker:nth-child(3) { --tilt: -0.7deg; }

.sticker-num {
  position: absolute;
  top: -16px;
  left: -14px;
  background: var(--hot);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  transform: rotate(-6deg);
  box-shadow: 0 3px 8px rgba(9, 30, 17, 0.4);
}

.sticker .flag-frame {
  height: 110px;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg,
      rgba(23, 35, 59, 0.05) 0 10px,
      transparent 10px 20px);
  border: 2px dashed rgba(23, 35, 59, 0.25);
  border-radius: 10px;
  margin-bottom: 0.9rem;
}

.flag {
  width: 132px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(23, 35, 59, 0.35);
  outline: 1px solid rgba(23, 35, 59, 0.2);
}

.flag-placeholder {
  font-family: var(--font-display);
  font-size: 2rem;
  color: rgba(23, 35, 59, 0.35);
}

.sticker label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin: 0.7rem 0 0.25rem;
}

.sticker select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 2px solid rgba(23, 35, 59, 0.25);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
.sticker select:hover { border-color: var(--ink-soft); }

.sticker-team-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  text-align: center;
  min-height: 1.4em;
  color: var(--ink);
}

/* Flaggen-Wähler */

.country-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 2px solid rgba(23, 35, 59, 0.25);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.country-btn:hover { border-color: var(--ink-soft); }
.country-btn .btn-flag { width: 28px; border-radius: 3px; flex-shrink: 0; }
.country-btn .flag-placeholder { font-size: 1rem; width: 28px; text-align: center; }
.country-btn span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-btn .chev { color: var(--ink-soft); }

.flag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.55rem;
  background: rgba(23, 35, 59, 0.06);
  border: 2px dashed rgba(23, 35, 59, 0.2);
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.flag-grid[hidden] { display: none; }

.flag-tile {
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.15rem;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.flag-tile:hover { background: #fff; border-color: rgba(23, 35, 59, 0.25); }
.flag-tile.selected { border-color: var(--gold-deep); background: #fff; }
.flag-tile:disabled { opacity: 0.3; cursor: not-allowed; }
.flag-tile .tile-flag { width: 100%; max-width: 44px; border-radius: 3px; box-shadow: 0 1px 3px rgba(23, 35, 59, 0.3); }
.flag-tile .flag-placeholder { font-size: 1.1rem; box-shadow: none; }
.flag-tile .tile-name {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

/* ── Spielplan ────────────────────────────────────────────── */

.rounds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
}

.round-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 0.9rem;
  text-align: center;
}

.matches { list-style: none; display: grid; gap: 0.8rem; }

.match {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  background: rgba(9, 30, 17, 0.35);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.match.played { border-color: var(--gold); background: rgba(9, 30, 17, 0.55); }

.match-no {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--chalk-dim);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0.25rem 0.45rem;
}
.match.played .match-no { color: var(--gold); border-color: var(--gold); }

.side {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-weight: 600;
}
.side.home { justify-content: flex-end; text-align: right; }
.side .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .flag { width: 34px; flex-shrink: 0; }
.side .flag-placeholder { font-size: 1rem; }

.scorebox { display: flex; align-items: center; gap: 0.3rem; }

.scorebox .colon { font-family: var(--font-display); color: var(--chalk-dim); }

.score {
  width: 2.6rem;
  height: 2.6rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  background: var(--board);
  border: 2px solid var(--line);
  border-radius: 8px;
  -moz-appearance: textfield;
  appearance: textfield;
}
.score::-webkit-outer-spin-button,
.score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score::placeholder { color: rgba(247, 244, 234, 0.25); }
.score:focus { border-color: var(--gold); }

/* ── Tabelle als Kreidetafel ──────────────────────────────── */

.chalkboard {
  background: var(--board);
  border: 6px solid #6b4a2f;
  border-radius: 12px;
  box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, 0.35);
  padding: clamp(1rem, 3vw, 2rem);
  overflow-x: auto;
}

.standings {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.standings th, .standings td {
  padding: 0.7rem 0.55rem;
  text-align: center;
  white-space: nowrap;
}

.standings thead th {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--chalk-dim);
  border-bottom: 3px dashed var(--line);
}

.standings tbody tr { border-bottom: 2px dashed rgba(247, 244, 234, 0.15); }
.standings tbody tr:last-child { border-bottom: none; }

.standings .c-team { text-align: left; }
.standings td.c-team {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
}
.standings .c-team .flag { width: 30px; }
.standings .c-team .players {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--chalk-dim);
}

.standings .c-pos { font-family: var(--font-display); color: var(--chalk-dim); }
.standings td.c-pts { font-family: var(--font-display); font-size: 1.1rem; color: var(--gold); }

.standings tr.qualified td.c-pos { color: var(--gold); }

.chalk-note {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--chalk-dim);
  text-align: center;
}

/* ── Finale ───────────────────────────────────────────────── */

.final-lock {
  text-align: center;
  border: 3px dashed var(--line);
  border-radius: 14px;
  padding: 2.5rem 1.5rem;
  color: var(--chalk-dim);
  font-weight: 600;
}
.final-lock .lock-icon { font-size: 2rem; display: block; margin-bottom: 0.6rem; }

.final-card {
  position: relative;
  background: linear-gradient(160deg, #23324f, var(--ink));
  border: 3px solid var(--gold);
  border-radius: 16px;
  box-shadow: var(--shadow), 0 0 40px rgba(244, 185, 66, 0.18);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}

.final-matchup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin: 1.2rem 0;
}

.finalist { display: grid; justify-items: center; gap: 0.5rem; min-width: 0; }
.finalist .flag { width: 76px; }
.finalist .fname { font-family: var(--font-display); font-size: clamp(0.9rem, 2.5vw, 1.3rem); }
.finalist .fplayers { font-size: 0.85rem; color: var(--chalk-dim); }
.finalist .seed {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.final-score { display: flex; align-items: center; gap: 0.4rem; }
.final-score .score { width: 3.4rem; height: 3.4rem; font-size: 1.6rem; }

.pens { margin-top: 0.8rem; }
.pens[hidden] { display: none; }
.pens .pens-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--hot);
  margin-bottom: 0.5rem;
}
.pens .scorebox { justify-content: center; }
.pens .score { border-color: var(--hot); color: #ffb59d; }

.winner-banner {
  margin-top: 1.6rem;
  padding: 1.2rem;
  border-radius: 12px;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--gold-deep);
  animation: winner-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.winner-banner[hidden] { display: none; }
.winner-banner .w-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}
.winner-banner .w-name {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  margin: 0.2rem 0;
}
.winner-banner .w-players { font-weight: 600; }

@keyframes winner-pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.btn-archive { margin-top: 1.2rem; }
.btn-archive[hidden] { display: none; }

/* ── Hall of Fame ─────────────────────────────────────────── */

.archive { list-style: none; display: grid; gap: 1rem; max-width: 640px; margin: 0 auto; }

.archive-entry {
  position: relative;
  background: rgba(9, 30, 17, 0.45);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 1rem 1.2rem;
}

.a-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--chalk-dim);
  margin-bottom: 0.7rem;
}
.a-head .a-score { color: var(--gold); }

.a-winner { display: flex; align-items: center; gap: 0.8rem; }
.a-winner .flag { width: 44px; }
.a-winner-text { display: grid; }
.a-winner-text .a-name { font-family: var(--font-display); font-size: 1.1rem; }
.a-winner-text .a-players { font-size: 0.85rem; color: var(--chalk-dim); }

.a-standings { margin-top: 0.7rem; font-size: 0.85rem; color: var(--chalk-dim); }

.a-delete {
  margin-top: 0.8rem;
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 8px;
  color: var(--chalk-dim);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.a-delete:hover { color: var(--chalk); border-color: var(--chalk-dim); }
.a-delete.armed { color: #ffd7c9; border-color: var(--hot); background: rgba(228, 87, 46, 0.18); }

/* ── Konfetti ─────────────────────────────────────────────── */

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.confetto {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: confetti-fall var(--dur, 3s) linear var(--delay, 0s) forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.6;
  }
}

/* ── Footer ───────────────────────────────────────────────── */

.footer {
  border-top: 4px solid var(--line);
  margin-top: 2rem;
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
  color: var(--chalk-dim);
  font-size: 0.9rem;
}

.sync-status {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--chalk-dim);
}
.sync-status.online { color: var(--gold); }

/* ── Mobil ────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .match {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "no  home"
      "no  score"
      "no  away";
    row-gap: 0.4rem;
  }
  .match-no { grid-area: no; align-self: center; }
  .side.home { grid-area: home; justify-content: flex-end; text-align: left; flex-direction: row-reverse; }
  .side.away { grid-area: away; }
  .scorebox { grid-area: score; }

  /* Tabelle kompakt: S/U/N ausblenden, damit Tore/Diff/Punkte sichtbar bleiben */
  .standings { min-width: 0; }
  .standings th:nth-child(4), .standings td:nth-child(4),
  .standings th:nth-child(5), .standings td:nth-child(5),
  .standings th:nth-child(6), .standings td:nth-child(6) { display: none; }
  .standings th, .standings td { padding: 0.6rem 0.35rem; }
}

/* ── Reduzierte Bewegung ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .title, .winner-banner { animation: none; }
  .sticker, .btn { transition: none; }
  .confetto { display: none; }
}
