/* ============================================================
   VM 2026 Tipping – Stilark
   ============================================================ */

:root {
  --bg:         #f5f5f7;
  --surface:    #ffffff;
  --surface-2:  #ffffff;
  --surface-3:  #ebebf0;
  --border:     rgba(0,0,0,0.08);
  --border-med: rgba(0,0,0,0.14);
  --gold:       #b8860b;
  --gold-light: #d4a017;
  --gold-dark:  #9a6e0e;
  --gold-dim:   rgba(184,134,11,0.09);
  --text:       #1d1d1f;
  --text-2:     rgba(29,29,31,0.72);
  --text-muted: rgba(29,29,31,0.42);
  --green:      #1a8c42;
  --green-dim:  rgba(26,140,66,0.09);
  --red:        #c00010;
  --red-dim:    rgba(192,0,16,0.08);
  --yellow:     #b86e00;
  --yellow-dim: rgba(184,110,0,0.09);
  --blue:       #0071e3;
  --nav-h:      54px;
  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--gold); text-decoration: none; }
input, select, button { font-family: inherit; }

/* ---- Base ---- */
html {
  overflow-x: clip;
  overscroll-behavior-x: none;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Barlow', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 900;
  letter-spacing: 0.2px;
  line-height: 1.1;
}
h1 { font-size: 2.6rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 0.95rem; }
.gold  { color: var(--gold); }
.muted { color: var(--text-muted); }
code   { font-family: 'SF Mono', monospace; font-size: 0.85em; color: var(--gold); }

/* ---- Layout ---- */
#root { min-height: 100vh; display: flex; flex-direction: column; }
.page { display: none; flex: 1; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }
.container { max-width: 680px; margin: 0 auto; padding: 0 16px; width: 100%; }
.hidden { display: none !important; }

/* ================================================================
   AUTH SCREEN
   ================================================================ */

.full-screen {
  min-height: 100svh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: var(--bg);
}

.wc-logo-area {
  text-align: center;
  margin-bottom: 14px;
}
.wc-trophy {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.wc-trophy-img {
  height: 28px;
  width: auto;
  display: block;
}
.wc-trophy svg {
  width: 52px;
  height: 52px;
  stroke: var(--gold);
  stroke-width: 1.5;
}
.wc-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  line-height: 1;
}
.wc-title .line1 {
  display: block;
  font-size: 2.4rem;
  letter-spacing: 3px;
  color: var(--gold);
}
.wc-title .line2 {
  display: block;
  font-size: 1.2rem;
  letter-spacing: 4px;
  color: var(--text);
  margin-top: 2px;
}
.wc-subtitle {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ---- Auth box ---- */
.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-3);
  border-radius: calc(var(--radius) + 2px);
  padding: 3px;
  margin-bottom: 14px;
  position: relative;
}
.auth-tabs::before {
  content: '';
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: calc((100% - 8px) / 2);
  border-radius: calc(var(--radius) - 1px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: none;
}
.auth-tabs.tab-right::before {
  transform: translateX(calc(100% + 2px));
}
.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 1px);
  transition: color 0.22s ease;
  position: relative;
  z-index: 1;
}
.auth-tab.active {
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

/* ================================================================
   FORMS
   ================================================================ */

.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  background: var(--surface-3);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  background: var(--surface);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,134,11,0.10);
}
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }

/* ---- PIN pad ---- */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 4px 0 12px;
}
.pin-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--border-med);
  transition: all 0.15s;
}
.pin-dot.filled { background: var(--gold); border-color: var(--gold); }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 216px;
  margin: 0 auto;
}
.pin-key {
  aspect-ratio: 1;
  background: var(--surface-3);
  border: none;
  border-radius: 50%;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  transition: background 0.12s, transform 0.08s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow', sans-serif;
  touch-action: manipulation;
}
.pin-key:active { background: var(--gold); color: #fff; transform: scale(0.88); }
.pin-key.del    { color: var(--text-muted); font-size: 1.6rem; }
.pin-key.confirm { background: var(--gold); color: #fff; }
.pin-key.confirm:active { background: var(--gold-light); }

/* ---- Score inputs ---- */
.score-input {
  width: 48px;
  background: var(--surface-3);
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 6px 4px;
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color 0.18s, background 0.18s;
}
.score-input:focus {
  background: var(--surface);
  border-color: var(--gold);
}
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.08s;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-gold    { background: var(--gold);     color: #fff; }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline { background: var(--surface);  color: var(--text); border: 1px solid var(--border-med); }
.btn-ghost   { background: transparent;     color: var(--text-muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text-2); }
.btn-danger  { background: var(--red-dim);  color: var(--red); border: none; }

.btn-sm   { padding: 6px 13px; font-size: 0.8rem; border-radius: 7px; }
.btn-full { width: 100%; }

/* ================================================================
   CARDS & SURFACES
   ================================================================ */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card-sm { padding: 13px 15px; }

/* ---- Alerts ---- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.alert-error   { background: var(--red-dim);    color: var(--red);    border-color: rgba(192,0,16,0.18); }
.alert-success { background: var(--green-dim);  color: var(--green);  border-color: rgba(26,140,66,0.18); }
.alert-info    { background: var(--gold-dim);   color: var(--gold);   border-color: rgba(184,134,11,0.18); }
.alert-warning { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(184,110,0,0.18); }

/* ================================================================
   APP SHELL
   ================================================================ */

#page-app { background: var(--bg); }

.app-header {
  position: sticky;
  top: 0; z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(50px + env(safe-area-inset-top, 0px));
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}
.header-sub {
  font-size: 0.52rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-frist {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--red);
  text-align: center;
  white-space: nowrap;
  padding: 0 4px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  color: var(--text);
  white-space: nowrap;
  min-width: 0;
}
.header-logo svg {
  width: 18px; height: 18px;
  stroke: var(--gold);
  stroke-width: 2;
  flex-shrink: 0;
}
.header-trophy-img {
  width: 14px;
  height: auto;
  flex-shrink: 0;
}
.header-user { display: flex; align-items: center; gap: 10px; justify-self: end; }
.user-badge  { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }

.app-content { padding-bottom: calc(var(--nav-h) + 20px); }

/* ---- Bottom nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Barlow', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: color 0.15s;
}
.nav-btn.active { color: var(--gold); }
.nav-btn:hover:not(.active) { color: var(--text-2); }
.nav-btn svg {
  width: 22px; height: 22px;
  stroke-width: 1.75;
  flex-shrink: 0;
}


/* ================================================================
   TABS
   ================================================================ */

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 100px;
  color: var(--text-muted);
  font-family: 'Barlow', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn.active { background: var(--gold); border-color: var(--gold); color: #fff; animation: tab-pop 0.22s cubic-bezier(0.34, 1.5, 0.64, 1); }
.tab-btn:hover:not(.active) { color: var(--text); background: var(--surface-3); }
@keyframes tab-pop {
  0%   { transform: scale(0.88); }
  70%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ================================================================
   MATCH CARDS
   ================================================================ */

.match-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.match-card.played  { border-color: var(--border); }
.match-card.locked  { opacity: 0.72; }

.match-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.match-meta > span { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }

.group-badge, .stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.group-badge { background: var(--gold-dim);              color: var(--gold); }
.stage-badge { background: rgba(0,113,227,0.09);         color: var(--blue); }

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.team-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.team-side.home { align-items: flex-start; }
.team-side.away { align-items: flex-end; }

.team-flag {
  width: 32px; height: 23px;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  flex-shrink: 0;
}
.flag-emoji { font-size: 1.4rem; }

.team-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
}

.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 56px;
  gap: 1px;
}
.score-vs {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 2px;
}
.score-display {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
}
.score-display.played { color: var(--gold); }

/* ---- Prediction row ---- */
.pred-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pred-label { font-size: 0.74rem; color: var(--text-muted); font-weight: 500; }
.pred-result { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pred-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}
.pts-badge {
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
}
.pts-exact   { background: var(--green-dim);  color: var(--green); }
.pts-outcome { background: var(--yellow-dim); color: var(--yellow); }
.pts-zero    { background: var(--red-dim);    color: var(--red); }
.pts-pending { background: var(--surface-3);  color: var(--text-muted); }

/* ---- Auto-save status ---- */
.save-status          { font-size: 0.78rem; font-weight: 700; min-width: 18px; text-align: center; }
.save-status.saving   { color: var(--text-muted); }
.save-status.ok       { color: var(--green); }
.save-status.error    { color: var(--red); }

/* ---- Penalty picker ---- */
.penalty-picker {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--gold-dim);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(184,134,11,0.28);
}
.pen-question {
  font-size: 0.71rem;
  color: var(--text-muted);
  font-weight: 600;
}
.pen-choices {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.pen-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1.5px solid var(--border-med);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.pen-btn:hover { border-color: var(--gold); }
.pen-btn.selected { background: var(--gold-dim); border-color: var(--gold); color: var(--gold-dark); }

/* ---- Bracket note ---- */
.bracket-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: var(--surface-3);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* ================================================================
   LEADERBOARD
   ================================================================ */

.leaderboard {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.lb-header, .lb-row {
  display: grid;
  grid-template-columns: 44px 1fr 52px 52px 60px;
  align-items: center;
  padding: 12px 16px;
  gap: 6px;
}
.lb-header {
  background: var(--surface-3);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  line-height: 1.25;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.lb-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.lb-row:last-child { border-bottom: none; }
.lb-row:hover { background: var(--surface-3); }
.lb-row.me    { background: rgba(184,134,11,0.05); }
.lb-row.lb-last { background: rgba(192,0,16,0.04); }
.lb-rank.rank-last { color: var(--red); }
.lb-pts.rank-last  { color: var(--red); }

.lb-rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
  color: var(--text-muted);
}
.rank-1 { color: #b8860b; }
.rank-2 { color: #8e8e93; }
.rank-3 { color: #a05c1a; }

.lb-name { font-weight: 600; font-size: 0.93rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lb-pts  {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem; font-weight: 400;
  color: var(--text); text-align: center;
}
.lb-pts.rank-1 { font-weight: 900; color: #b8860b; font-size: 1.25rem; }
.lb-pts.rank-2 { font-weight: 900; color: #8e8e93; font-size: 1.25rem; }
.lb-pts.rank-3 { font-weight: 900; color: #a05c1a; font-size: 1.25rem; }
.lb-cell { text-align: center; color: var(--text-muted); font-size: 0.87rem; }

/* ================================================================
   DASHBOARD
   ================================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.stat-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
}
.stat-value.stat-plain { font-weight: 700; font-size: 1.9rem; }
.stat-value.rank-1    { color: #b8860b; font-weight: 900; }
.stat-value.rank-2    { color: #8e8e93; font-weight: 900; }
.stat-value.rank-3    { color: #a05c1a; font-weight: 900; }
.stat-value.rank-last { color: var(--red); font-weight: 900; }
.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* ---- Section title ---- */
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: block;
  width: 3px; height: 13px;
  background: var(--gold);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ---- Progress bar ---- */
.progress-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ================================================================
   SCORING TABLE (Tabell page)
   ================================================================ */

.scoring-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.scoring-summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  user-select: none;
}
.scoring-summary::-webkit-details-marker { display: none; }
.scoring-summary::before { content: '▶'; font-size: 0.58rem; color: var(--gold); transition: transform 0.2s; }
details[open] .scoring-summary::before  { transform: rotate(90deg); }
.scoring-toggle-hint { color: var(--text-muted); font-weight: 400; font-size: 0.76rem; }
details[open] .scoring-toggle-hint { display: none; }

.scoring-table-wrap { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.scoring-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 12px 0;
}
.scoring-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.scoring-table th:not(:first-child) { text-align: center; }
.scoring-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.scoring-table td:not(:first-child) {
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--gold);
}
.scoring-table tr.final-row td:not(:first-child) { font-size: 1.3rem; }
.scoring-table tr:last-child td { border-bottom: none; }
.scoring-note { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; line-height: 1.5; }

/* ================================================================
   PLAYER STATS TABLE
   ================================================================ */

.ps-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.ps-header, .ps-row {
  display: grid;
  grid-template-columns: 28px 1fr 40px 40px 44px 44px 52px;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  text-align: center;
}
.ps-header {
  background: var(--surface-3);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ps-row { border-bottom: 1px solid var(--border); font-size: 0.87rem; }
.ps-row:last-child { border-bottom: none; }
.ps-row.me   { background: rgba(184,134,11,0.05); }
.ps-rank { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1rem; color: var(--text-muted); }
.ps-name { text-align: left; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ps-pts  { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; color: var(--gold); font-size: 1.1rem; }

/* ================================================================
   GROUP STANDINGS TABLE (Stats page)
   ================================================================ */

.gs-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.85rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.gs-header, .gs-row {
  display: grid;
  grid-template-columns: 26px 1fr 28px 28px 28px 28px 32px 32px 36px;
  align-items: center;
  gap: 2px;
  padding: 9px 12px;
  text-align: center;
}
.gs-header {
  background: var(--surface-3);
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.gs-header > div:nth-child(2) { text-align: left; }
.gs-row { border-bottom: 1px solid var(--border); }
.gs-row:last-child { border-bottom: none; }
.gs-pos { font-family: 'Barlow Condensed', sans-serif; font-weight: 900; font-size: 1rem; color: var(--text-muted); }
.gs-pos.qualified { color: var(--green); }
.gs-pos.third     { color: var(--yellow); }
.gs-team { display: flex; align-items: center; gap: 6px; text-align: left; font-weight: 600; overflow: hidden; white-space: nowrap; }
.gs-team img { flex-shrink: 0; }

/* ================================================================
   PROFILE AVATAR
   ================================================================ */

.profile-avatar {
  width: 72px;
  height: 72px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.profile-avatar svg {
  width: 34px;
  height: 34px;
  stroke: var(--text-muted);
  stroke-width: 1.75;
}

/* ================================================================
   EMPTY STATES
   ================================================================ */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; color: var(--text-2); }

/* ================================================================
   SPINNER / LOADING
   ================================================================ */

.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border-med);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 40px; }

/* ================================================================
   ADMIN
   ================================================================ */

.admin-match-row {
  display: grid;
  grid-template-columns: 1fr 80px 20px 80px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.admin-match-row:last-child { border-bottom: none; }
.admin-team { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 6px; }
.admin-team.away { flex-direction: row-reverse; }

/* ================================================================
   UTILITIES
   ================================================================ */

.divider    { height: 1px; background: var(--border); margin: 20px 0; }
.text-right { text-align: right; }
.countdown  { font-family: 'Barlow Condensed', sans-serif; font-size: 0.85rem; color: var(--yellow); font-weight: 700; }

.mb-8  { margin-bottom: 8px;  }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.w-full { width: 100%; }

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (min-width: 640px) {
  .lb-row, .lb-header { padding: 13px 20px; }
  .match-card { padding: 20px; }
  .team-name  { font-size: 1.15rem; }
}
@media (max-width: 480px) {
  h2 { font-size: 1.6rem; }
  .lb-header, .lb-row { grid-template-columns: 36px 1fr 44px 44px 52px; }
  .score-display { font-size: 1.6rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ================================================================
   FLAG SIZE VARIANTS
   ================================================================ */

.flag-sm { width: 26px; height: 19px; border-radius: 3px; object-fit: cover; display: block; flex-shrink: 0; }
.flag-xs { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; display: block; flex-shrink: 0; }

/* ================================================================
   COMPACT MATCH CARD (inline layout)
   ================================================================ */

.match-meta-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.match-meta-sm > span { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }

.match-inline-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}
.team-inline.home { justify-content: flex-end; }
.team-inline.away { justify-content: flex-start; }

.team-name-sm {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.match-input-center {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.match-score-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 62px;
  gap: 1px;
}

.score-pred {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-muted);
}

.score-dash {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.pred-row-sm {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ================================================================
   PREDICTIONS OVERVIEW – GROUP TABLES
   ================================================================ */

.overview-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.ov-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ov-group-header {
  background: var(--surface-3);
  padding: 5px 10px;
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ov-group-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--border);
}
.ov-group-row:last-child { border-bottom: none; }
.ov-pos { font-size: 0.67rem; font-weight: 700; color: var(--text-muted); width: 10px; flex-shrink: 0; }
.ov-name { font-size: 0.76rem; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ov-pts { font-size: 0.72rem; font-weight: 700; color: var(--gold); flex-shrink: 0; }
.ov-group-row.ov-qual  { background: rgba(26,140,66,0.13); }
.ov-group-row.ov-third { background: rgba(184,110,0,0.11); }
.ov-incomplete { color: var(--text-muted); font-size: 0.67rem; font-style: italic; padding: 3px 10px 5px; }

/* ================================================================
   KNOCKOUT BRACKET TREE
   ================================================================ */

.bracket-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  padding-bottom: 8px;
  margin-bottom: 24px;
  max-width: 100%;
}
.bracket-grid {
  display: flex;
  align-items: stretch;
  min-width: 500px;
  height: 850px;
}

/* ---- Best thirds card (same visual language as group standings) ---- */
.ov-thirds-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.ov-thirds-header, .ov-thirds-row {
  display: grid;
  grid-template-columns: 22px 1fr 32px 26px 26px 26px 32px;
  align-items: center;
  padding: 5px 10px;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.ov-thirds-row:last-child { border-bottom: none; }
.ov-thirds-header {
  background: var(--surface-3);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.ov-thirds-rank { font-size: 0.67rem; font-weight: 700; color: var(--text-muted); text-align: center; }
.ov-thirds-name { display: flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; overflow: hidden; min-width: 0; }
.ov-thirds-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ov-thirds-stat { font-size: 0.72rem; text-align: right; color: var(--text-muted); }
.ov-thirds-stat strong { color: var(--gold); }
.ov-thirds-advance { background: rgba(26,140,66,0.08); }
.ov-thirds-cut { height: 2px; background: var(--yellow); }
.bt-gd-pos { color: var(--green); font-weight: 700; }
.bt-gd-neg { color: var(--red); font-weight: 700; }

/* ---- Tiebreaker – extends the shared thirds-card with a button column ---- */
.ov-thirds-tied { background: rgba(184,110,0,0.09) !important; }
.ov-thirds-tb .ov-thirds-header,
.ov-thirds-tb .ov-thirds-row {
  grid-template-columns: 22px 1fr 32px 26px 26px 26px 32px 54px;
}
.ov-thirds-btns { display: flex; gap: 3px; justify-content: flex-end; align-items: center; }
.tb-btn {
  background: var(--surface-3);
  border: 1px solid var(--border-med);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 0.65rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s;
  touch-action: manipulation;
}
.tb-btn:hover:not(:disabled) { background: var(--surface); }
.tb-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.bracket-round {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 90px;
}
.bracket-round-label {
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 0 0 5px;
  flex-shrink: 0;
}
.bracket-round-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 0 3px;
}
.bracket-pair {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.bracket-pair-linked {
  position: relative;
  padding-right: 8px;
}
.bracket-pair-linked::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 8px;
  border-top: 1px solid var(--border-med);
  border-right: 1px solid var(--border-med);
  border-bottom: 1px solid var(--border-med);
  border-radius: 0 3px 3px 0;
}
.bracket-match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.bracket-team {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.bracket-team:last-child { border-bottom: none; }
.bracket-team.winner { background: var(--gold-dim); color: var(--gold-dark); font-weight: 700; }
.bracket-team.tbd { color: var(--text-muted); font-style: italic; font-weight: 400; }
.bracket-team span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* ================================================================
   SCROLLBAR
   ================================================================ */

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

/* Flag fallback */
img.flag-img[src=""] { display: none; }

/* ================================================================
   SPLASH SCREEN
   ================================================================ */

#splash-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}
#splash-img {
  width: 90px;
  max-width: 30vw;
  height: auto;
  position: relative;
  z-index: 1;
}

.splash-shrimp {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  animation: shrimp-rise linear forwards;
}

@keyframes shrimp-rise {
  0%   { transform: translateY(0) translateX(0) rotate(-15deg); }
  40%  { transform: translateY(-38vh) translateX(14px) rotate(10deg); }
  70%  { transform: translateY(-70vh) translateX(-10px) rotate(-8deg); }
  100% { transform: translateY(-115vh) translateX(6px) rotate(5deg); }
}
