/* ── WM-Tippspiel 2026 ─────────────────────────────────────────── */
:root {
  --bg: #0b1226;
  --bg-soft: #101a36;
  --card: #16224400;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.09);
  --card-hover: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --text-dim: #9aa7c7;
  --text-faint: #67718f;
  --green: #34d399;
  --green-deep: #059669;
  --gold: #fbbf24;
  --blue: #60a5fa;
  --red: #f87171;
  --pitch: linear-gradient(135deg, #047857 0%, #059669 50%, #10b981 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  font-size: 16px;
}

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

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(5, 150, 105, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(96, 165, 250, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Header ── */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 18, 38, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.header-inner {
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
.app-header h1 { font-size: 1.15rem; font-weight: 800; letter-spacing: 0.2px; }
.header-actions { display: flex; gap: 8px; }

.chip-btn {
  font-family: inherit; font-size: 0.85rem; font-weight: 700;
  color: var(--text); background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 7px 13px; cursor: pointer; transition: background 0.15s;
}
.chip-btn:hover { background: var(--card-hover); }
.player-chip { font-size: 1rem; }

/* ── Layout ── */
.view {
  max-width: 640px; margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar-h) + 28px);
}

/* ── Tab bar ── */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; justify-content: center; gap: 4px;
  background: rgba(11, 18, 38, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-border);
}
.tab {
  flex: 1; max-width: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: inherit; font-size: 0.7rem; font-weight: 600;
  color: var(--text-faint); background: none; border: none; cursor: pointer;
  transition: color 0.15s;
}
.tab .tab-icon { font-size: 1.35rem; filter: grayscale(1) opacity(0.6); transition: filter 0.15s; }
.tab.active { color: var(--green); }
.tab.active .tab-icon { filter: none; }

/* ── Section headings / date headers ── */
.date-header {
  display: flex; align-items: center; gap: 10px;
  margin: 22px 2px 10px; color: var(--text-dim);
  font-size: 0.83rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.date-header::after { content: ''; flex: 1; height: 1px; background: var(--card-border); }
.stage-header {
  margin: 28px 2px 4px; font-size: 1.05rem; font-weight: 800; color: var(--gold);
}

/* ── Filter chips ── */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter-chip {
  font-family: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  color: var(--text-dim); background: var(--card-bg);
  border: 1px solid var(--card-border); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; transition: all 0.15s;
}
.filter-chip.active { color: #06281c; background: var(--green); border-color: var(--green); }
.group-select { -webkit-appearance: none; appearance: none; padding-right: 18px; }
.group-select:focus { outline: none; border-color: var(--green); }
.group-select option { color: var(--text); background: var(--bg-soft); }

/* ── Match card ── */
.match-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  transition: border-color 0.15s;
}
.match-card.live { border-color: rgba(248, 113, 113, 0.45); }
.match-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.74rem; color: var(--text-faint); font-weight: 600; margin-bottom: 10px;
}
.match-meta .meta-left { display: flex; gap: 8px; align-items: center; }
.badge {
  font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge.group-badge { background: rgba(96, 165, 250, 0.16); color: var(--blue); }
.badge.ko-badge { background: rgba(251, 191, 36, 0.16); color: var(--gold); }
.badge.live-badge { background: rgba(248, 113, 113, 0.18); color: var(--red); animation: pulse 1.6s infinite; }
.badge.pts-badge { font-size: 0.78rem; }
.badge.pts-4 { background: rgba(251, 191, 36, 0.2); color: var(--gold); }
.badge.pts-3 { background: rgba(52, 211, 153, 0.18); color: var(--green); }
.badge.pts-2 { background: rgba(96, 165, 250, 0.18); color: var(--blue); }
.badge.pts-0 { background: rgba(255, 255, 255, 0.07); color: var(--text-faint); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.match-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
}
.team { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.team .flag { font-size: 2rem; line-height: 1; }
.team .tname { font-size: 0.82rem; font-weight: 700; }
.team .tname.placeholder { color: var(--text-faint); font-weight: 600; font-style: italic; }

.tip-box { display: flex; align-items: center; gap: 6px; }
.score-stepper { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.step-btn {
  width: 38px; height: 30px; border-radius: 9px;
  font-family: inherit; font-size: 1.05rem; font-weight: 800;
  color: var(--text); background: var(--card-bg); border: 1px solid var(--card-border);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.step-btn:active { background: var(--green-deep); }
.score-input {
  width: 44px; height: 44px; text-align: center;
  font-family: inherit; font-size: 1.35rem; font-weight: 800;
  color: var(--text); background: var(--bg-soft);
  border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
  -moz-appearance: textfield; appearance: textfield;
}
.score-input::-webkit-outer-spin-button, .score-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.score-input:focus { outline: none; border-color: var(--green); }
.score-sep { font-size: 1.2rem; font-weight: 800; color: var(--text-faint); padding: 0 2px; }

.locked-tip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.locked-score { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.05em; }
.locked-score.is-result { color: var(--text); }
.your-tip-line { font-size: 0.72rem; color: var(--text-dim); font-weight: 600; }

/* expanded all-tips section */
.all-tips { margin-top: 12px; border-top: 1px solid var(--card-border); padding-top: 10px; }
.tip-row-line {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px; font-size: 0.88rem;
}
.tip-row-line .who { display: flex; gap: 7px; align-items: center; font-weight: 600; }
.tip-row-line .tipval { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.tip-row-line .tipval .no-tip { color: var(--text-faint); font-weight: 500; font-style: italic; }

/* result entry */
.result-entry { margin-top: 12px; border-top: 1px dashed var(--card-border); padding-top: 12px; }
.result-entry-toggle {
  font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
  background: none; border: none; cursor: pointer; padding: 4px;
}
.result-entry-form { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.btn {
  font-family: inherit; font-size: 0.9rem; font-weight: 700;
  color: #06281c; background: var(--green); border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; cursor: pointer; transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn.secondary { color: var(--text); background: var(--card-bg); border: 1px solid var(--card-border); }

/* ── Leaderboard ── */
.lb-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); overflow: hidden;
}
.lb-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center;
  padding: 13px 16px; gap: 10px; border-bottom: 1px solid var(--card-border);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: rgba(52, 211, 153, 0.07); }
.lb-rank { font-size: 1.05rem; font-weight: 800; color: var(--text-dim); }
.lb-rank.r1 { color: var(--gold); }
.lb-rank.r2 { color: #cbd5e1; }
.lb-rank.r3 { color: #d97706; }
.lb-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-who .emoji { font-size: 1.45rem; }
.lb-who .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-who .sub { font-size: 0.72rem; color: var(--text-faint); font-weight: 600; }
.lb-pts { font-size: 1.3rem; font-weight: 800; color: var(--green); }
.lb-pts small { font-size: 0.68rem; color: var(--text-faint); font-weight: 600; display: block; text-align: right; }

.stat-legend { margin: 12px 4px; font-size: 0.75rem; color: var(--text-faint); line-height: 1.6; }

/* ── Favorites ── */
.fav-row {
  display: grid; grid-template-columns: 34px 40px 1fr 50px; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--card-border);
}
.fav-row:last-child { border-bottom: none; }
.fav-rank { font-size: 0.8rem; font-weight: 700; color: var(--text-faint); }
.fav-flag { font-size: 1.5rem; }
.fav-name-wrap { min-width: 0; }
.fav-name { font-weight: 700; font-size: 0.92rem; }
.fav-bar-track { height: 5px; background: rgba(255,255,255,0.07); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.fav-bar { height: 100%; border-radius: 99px; background: var(--pitch); }
.fav-prob { font-size: 0.9rem; font-weight: 800; text-align: right; color: var(--green); }
.fav-fifa { font-size: 0.68rem; color: var(--text-faint); font-weight: 600; }
.tier-pill { font-size: 0.62rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 2px; }
.tier-favorite { background: rgba(251,191,36,0.18); color: var(--gold); }
.tier-contender { background: rgba(52,211,153,0.15); color: var(--green); }
.tier-dark-horse { background: rgba(96,165,250,0.15); color: var(--blue); }

/* ── Bonus / cards ── */
.panel {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px;
}
.panel h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.panel p { font-size: 0.88rem; color: var(--text-dim); line-height: 1.55; }
.select {
  width: 100%; margin-top: 12px; padding: 12px 14px;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  color: var(--text); background: var(--bg-soft);
  border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
}
.select:focus { outline: none; border-color: var(--green); }

/* ── Overlay (player picker) ── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(7, 11, 24, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
.overlay.hidden, .hidden { display: none !important; }
.overlay-card {
  width: 100%; max-width: 420px;
  background: var(--bg-soft); border: 1px solid var(--card-border);
  border-radius: 24px; padding: 26px 22px;
}
.overlay-card h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 16px; text-align: center; }
.player-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.player-option {
  display: flex; align-items: center; gap: 12px;
  font-family: inherit; font-size: 1rem; font-weight: 700; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 13px 16px; cursor: pointer;
  transition: background 0.15s;
}
.player-option:hover { background: var(--card-hover); }
.player-option .emoji { font-size: 1.5rem; }
.text-input {
  width: 100%; padding: 13px 15px; margin-top: 8px;
  font-family: inherit; font-size: 1rem; font-weight: 600;
  color: var(--text); background: var(--bg);
  border: 1.5px solid var(--card-border); border-radius: var(--radius-sm);
}
.text-input:focus { outline: none; border-color: var(--green); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 12px; }
.emoji-cell {
  font-size: 1.45rem; padding: 7px 0; text-align: center;
  background: var(--card-bg); border: 1.5px solid transparent; border-radius: 10px; cursor: pointer;
}
.emoji-cell.selected { border-color: var(--green); background: rgba(52, 211, 153, 0.12); }
.form-label { display: block; margin-top: 16px; font-size: 0.8rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + 18px); left: 50%; transform: translateX(-50%);
  z-index: 200; padding: 11px 22px;
  font-size: 0.9rem; font-weight: 700; color: #06281c;
  background: var(--green); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.25s ease;
  white-space: nowrap;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.empty-note { text-align: center; color: var(--text-dim); padding: 36px 16px; font-size: 0.95rem; line-height: 1.6; }

/* ── Group cards (Teams tab) ── */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.group-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 6px 4px 4px;
}
.group-card-title {
  font-size: 0.8rem; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 14px 4px;
}
.fav-row-slim { grid-template-columns: 40px 1fr auto; padding: 8px 14px; }
.fav-row-table { grid-template-columns: 24px 36px 1fr auto 34px; padding: 8px 14px; }
.fav-row-table .fav-prob { font-size: 1rem; }
.group-card-cols {
  display: grid; grid-template-columns: 24px 36px 1fr auto 34px; gap: 10px;
  padding: 2px 14px; font-size: 0.62rem; color: var(--text-faint); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.group-card-cols span:last-child { text-align: right; }
.day-winner { border-color: rgba(251, 191, 36, 0.35); }
.day-winner h2 { color: var(--gold); }

/* ── Twemoji flag images ── */
.flag-img { width: 2.1rem; height: auto; vertical-align: middle; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35)); }
.fav-flag .flag-img { width: 1.7rem; }
.flag-img.flag-inline { width: 1.15rem; vertical-align: -3px; }

@media (min-width: 700px) {
  :root { font-size: 17px; }
  .team .flag { font-size: 2.3rem; }
}
