:root {
  --bg: #f4f6fb;
  --surface: #fff;
  --surface-2: #f8fafc;
  --text: #1e293b;
  --text-dim: #64748b;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-2: #db2777;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }

/* Football mouse cursor site-wide (hotspot at the centre of the ball). The SVG
   is inlined as a data-URI so there's no extra request / CSP concern. A bold
   black-and-white panelled ball reads clearly at cursor size. */
:root {
  --cursor-ball: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Ccircle cx='15' cy='15' r='13' fill='%23fff' stroke='%23111' stroke-width='1.5'/%3E%3Cpolygon points='15,9 19.3,12.1 17.7,17.1 12.3,17.1 10.7,12.1' fill='%23111'/%3E%3Cpolygon points='15,2.2 18.2,4.6 17,8.2 13,8.2 11.8,4.6' fill='%23111'/%3E%3Cpolygon points='27.4,11.8 25,15 21.2,12.8 22.4,9 26.2,9.2' fill='%23111'/%3E%3Cpolygon points='2.6,11.8 5,15 8.8,12.8 7.6,9 3.8,9.2' fill='%23111'/%3E%3Cpolygon points='22.6,26 18.2,24.6 18.6,20.4 22.6,19.4 24.8,22.8' fill='%23111'/%3E%3Cpolygon points='7.4,26 11.8,24.6 11.4,20.4 7.4,19.4 5.2,22.8' fill='%23111'/%3E%3C/svg%3E") 15 15, auto;
}
body { cursor: var(--cursor-ball); }
/* Clickable things get the same ball but signal interactivity via hover styles
   already defined; keep the ball cursor on them for a playful, consistent feel. */
a, button, .btn, .like-btn, select, [role="button"], .hero-match, .fan-row { cursor: var(--cursor-ball); }
/* Text fields keep the normal text caret for usability. */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea { cursor: text; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 460px at 85% -10%, #fdf2f8, transparent),
    radial-gradient(1100px 460px at 0% -10%, #eef2ff, transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  /* Flex column so the footer is pushed to the bottom on short pages. */
  display: flex;
  flex-direction: column;
}
body > .container { flex: 1 0 auto; }

/* Shared site footer (injected by auth.js on every page). */
footer.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 18px 26px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(6px);
}
footer.site-footer strong { color: var(--accent); font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 28px; background: rgba(255,255,255,.8);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
/* Solid dark title — NOT clipped (clipping the h1 background turned the ⚽
   emoji into a flat purple circle). The emoji renders in full colour, and a
   thin accent underline gives the wordmark a refined touch. */
header.site-header h1 {
  font-size: 19px; margin: 0; font-weight: 800; letter-spacing: -.3px;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 9px;
}
header.site-header nav { display: flex; align-items: center; gap: 14px; }
header.site-header nav a, header.site-header nav span { font-weight: 600; color: var(--text-dim); font-size: 14px; }
header.site-header nav span { color: var(--text); }
header.site-header nav a:hover { color: var(--accent); text-decoration: none; }
/* Make the last nav link (Log out / Sign up / Log in) a subtle pill. */
header.site-header nav a:last-child {
  padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  transition: border-color .15s, color .15s, background .15s;
}
header.site-header nav a:last-child:hover { border-color: var(--accent); background: var(--accent-soft); }

.container { max-width: 1120px; margin: 0 auto; padding: 26px; }
.narrow { max-width: 460px; }
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 26px; align-items: start; }
/* Leaderboard floats: stays in view as the match list scrolls. */
.layout aside { position: sticky; top: 20px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .layout aside { position: static; } }

/* ---- Animated gradient hero (home page) ---- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 20px; margin-bottom: 24px;
  padding: 30px 28px;
  color: #fff;
  background: linear-gradient(120deg, #4f46e5, #7c3aed, #db2777, #4f46e5);
  background-size: 300% 300%;
  animation: heroShift 12s ease infinite;
  box-shadow: 0 18px 40px rgba(79,70,229,.28);
}
@keyframes heroShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
/* Diagonal light sweep every few seconds. */
.hero-shine {
  position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.25), transparent);
  transform: skewX(-18deg);
  animation: heroSweep 6s ease-in-out infinite;
}
@keyframes heroSweep {
  0%, 60% { left: -60%; }
  100%    { left: 130%; }
}
.hero-inner { position: relative; z-index: 1; }
.hero-title { font-size: 30px; font-weight: 900; letter-spacing: -.5px; text-shadow: 0 2px 8px rgba(0,0,0,.18); }
.hero-sub { margin-top: 4px; font-size: 15px; font-weight: 600; opacity: .92; }
.hero-matches { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 18px; }
.hero-match {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 7px 13px; backdrop-filter: blur(4px);
  animation: heroFloat 3s ease-in-out infinite;
  transition: background .15s, transform .15s;
}
.hero-match:hover { background: rgba(255,255,255,.28); transform: translateY(-2px); text-decoration: none; }
@keyframes heroFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.hero-flag .flag { box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.hero-vs { font-size: 11px; font-weight: 800; opacity: .8; }
.hero-cta {
  background: #fff; color: var(--accent); font-weight: 800;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.hero-cta:hover { filter: none; background: #f5f3ff; }
@media (prefers-reduced-motion: reduce) {
  .hero, .hero-shine, .hero-match { animation: none; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
/* Stacked cards get vertical spacing — but NOT match cards, which sit side by
   side in a flex row (this margin was pushing the 2nd card down ~18px). */
.card + .card:not(.match-card) { margin-top: 18px; }

h2.section-title { margin: 26px 0 14px; font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--text-dim); display: flex; align-items: center; gap: 10px; }
h2.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
h2.section-title:first-child { margin-top: 0; }

/* Flexbox row that wraps: items in a row are top-aligned and share equal
   height (align-items: stretch). Each card is a fixed-basis flexible column. */
.match-grid { display: flex; flex-wrap: wrap; align-items: stretch; gap: 16px; }
.match-grid > .match-card { flex: 1 1 290px; max-width: 420px; }

/* Flex column so every card in a row is equal height and the body fills the
   remaining space — aligning the score line, prediction, and action button
   across cards regardless of how much content each one has. */
.match-card {
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
  align-self: stretch;     /* fill the row height; no height:100% (avoids a
                              circular flex-sizing bug that offset one card) */
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 30px rgba(15,23,42,.05);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.match-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(79,70,229,.10), 0 22px 48px rgba(15,23,42,.12);
  border-color: #d7d9f5;
}
/* Header band: subtle tinted gradient + a coloured top accent stripe. */
.match-card .head {
  padding: 18px 18px 16px; position: relative;
  background: linear-gradient(135deg, var(--accent-soft), #fdf2f8);
  border-bottom: 1px solid var(--border);
}
.match-card .head::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.match-card .body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; }
/* The likes block absorbs the free vertical space (margin-top below it via the
   next row), so the pick + button block sits at the bottom and lines up across
   cards of differing content height. The button keeps a fixed gap below the
   pick. */
.match-card .body > .likes-block { margin-bottom: auto; }
.match-card .body > .my-pick { margin-top: 12px; }
.match-card .body > .btn:last-child { margin-top: 14px; }
.match-card .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; }
/* VS as a small pill chip between the teams. */
.match-card .teams .vs {
  font-size: 10px; color: var(--text-dim); font-weight: 800; justify-self: center;
  background: rgba(255,255,255,.7); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 8px; letter-spacing: .5px;
}
/* Each team is a centered flag+name unit; right team mirrors so flags sit
   toward the centre line and names read outward — balanced both sides. */
.match-card .team { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; }
.match-card .team .flag { flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.15); border-radius: 3px; }
.match-card .team .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-card .meta { font-size: 13px; color: var(--text-dim); }
/* Fixed-height score/kickoff row so all cards align the rows beneath it. */
.match-card .score-line { display: flex; align-items: center; justify-content: center; min-height: 48px; margin-bottom: 6px; }
/* Big gradient scoreboard number. */
.match-card .final {
  font-size: 30px; font-weight: 900; text-align: center; letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.likes-block { margin: 12px 0 6px; }
.likes-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.support-bar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.support-bar .sa, .support-bar .sb {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; transition: width .35s ease; min-width: 0;
}
.support-bar .sa { background: var(--accent); }
.support-bar .sb { background: var(--accent-2); }
.support-bar.empty { background: var(--surface-2); }
.likes { display: flex; gap: 8px; margin: 8px 0 0; }

/* Your-pick summary on a match card */
.my-pick {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 12px;
  background: linear-gradient(135deg, var(--accent-soft), #fff);
  border: 1px solid #dcdcf6; border-radius: 11px;
  font-size: 13px;
}
.my-pick-label { color: var(--accent); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
.my-pick-val { color: var(--text); }
.pts-badge {
  margin-left: auto; font-weight: 800; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 999px; padding: 3px 11px;
  box-shadow: 0 2px 6px rgba(79,70,229,.35);
}
.like-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 8px 9px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text);
  transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
}
.like-btn .flag { flex: none; }
/* Team name takes the room it can and truncates instead of wrapping. */
.like-btn .lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
/* Count pinned to the right in its own chip — never wraps. */
.like-btn .lb-count { flex: none; font-weight: 800; background: rgba(0,0,0,.05); border-radius: 999px; padding: 1px 7px; font-size: 11.5px; }
.like-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 2px 8px rgba(79,70,229,.15); }
.like-btn.active .lb-count { background: rgba(79,70,229,.15); }
.like-btn:hover { border-color: var(--accent); transform: translateY(-1px); }

.badge { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; padding: 4px 11px; border-radius: 999px; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.badge.open { background: var(--ok-soft); color: var(--ok); }
.badge.locked { background: var(--warn-soft); color: var(--warn); }
.badge.scored { background: var(--accent-soft); color: var(--accent); }
.badge.published { background: #ede9fe; color: #6d28d9; }

.btn { display: inline-block; background: var(--accent); color: #fff; font-weight: 700; border: none; border-radius: 10px; padding: 10px 18px; cursor: pointer; font-size: 14px; transition: filter .12s, transform .12s; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #f5c2c2; }
.btn.danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.full { width: 100%; }

.form-row { margin-bottom: 15px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input, select { width: 100%; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 15px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; min-height: 14px; }
.score-inputs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.score-inputs .vs-label { padding-bottom: 11px; color: var(--text-dim); font-weight: 800; }

.notice { padding: 12px 14px; border-radius: 10px; margin: 14px 0; font-size: 14px; }
.notice.error { background: var(--danger-soft); color: #b91c1c; border: 1px solid #f5c2c2; }
.notice.ok { background: var(--ok-soft); color: #047857; border: 1px solid #a7f3d0; }
.notice.info { background: var(--warn-soft); color: #b45309; border: 1px solid #fde68a; }
.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.center { text-align: center; }
.mt { margin-top: 16px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-dim); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tbody tr:hover { background: var(--surface-2); }
.pts { font-weight: 800; color: var(--accent); }

/* Leaderboard */
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.lb-list li:last-child { border-bottom: none; }
.lb-list .rank { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 800; font-size: 12px; flex: none; }
.lb-list li:nth-child(1) .rank { background: #fef3c7; color: #b45309; }
.lb-list li:nth-child(2) .rank { background: #e5e7eb; color: #4b5563; }
.lb-list li:nth-child(3) .rank { background: #fde2cf; color: #9a3412; }
.lb-list .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list .who small { color: var(--text-dim); }

/* Win badges on the "My wins" cards. */
.win-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.win-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.win-tag.exact { background: #fef3c7; color: #b45309; }
.win-tag.winner { background: var(--ok-soft); color: #047857; }

/* Fan support by team — ranked horizontal bars (sidebar + admin dashboard). */
.fan-row { display: grid; grid-template-columns: minmax(0,1fr) 60px 30px; align-items: center; gap: 10px; padding: 7px 0; }
.fan-row + .fan-row { border-top: 1px solid var(--border); }
.fan-team { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fan-bar { height: 11px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.fan-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s ease; }
.fan-count { text-align: right; font-weight: 800; font-size: 13.5px; color: var(--text); }
/* On the wide admin dashboard, give the team column a fixed width + wider bar. */
.container > .card .fan-row { grid-template-columns: 180px 1fr 44px; gap: 12px; }
@media (max-width: 560px) { .container > .card .fan-row { grid-template-columns: 120px 1fr 34px; gap: 8px; } }

.auth-wrap { width: 100%; max-width: 420px; margin: 50px auto 0; }
.auth-wrap h2 { margin-top: 0; }

/* ---- Split-screen auth (login / signup) ---- */
.auth-split { flex: 1 0 auto; display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }

/* Left: animated gradient branding panel. */
.auth-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; padding: 56px 52px; color: #fff;
  background: linear-gradient(120deg, #4f46e5, #7c3aed, #db2777, #4f46e5);
  background-size: 300% 300%;
  animation: heroShift 14s ease infinite;
}
.auth-hero-content { position: relative; z-index: 2; max-width: 460px; }
.auth-hero-kicker { font-size: 13px; font-weight: 800; letter-spacing: 2px; opacity: .85; }
.auth-hero-title { font-size: 40px; line-height: 1.12; font-weight: 900; margin: 10px 0 14px; letter-spacing: -.5px; text-shadow: 0 3px 14px rgba(0,0,0,.2); }
.auth-hero-sub { font-size: 16px; font-weight: 500; opacity: .92; line-height: 1.5; }
.auth-hero-flags { display: flex; gap: 12px; margin-top: 28px; }
.auth-hero-flags .hf { animation: heroFloat 3s ease-in-out infinite; }
.auth-hero-flags .hf .flag { width: 38px; height: 25px; box-shadow: 0 3px 10px rgba(0,0,0,.35); border-radius: 4px; }
/* Big translucent soccer ball drifting in the corner. */
.auth-hero-ball { position: absolute; right: -40px; bottom: -50px; font-size: 280px; opacity: .12; animation: ballSpin 24s linear infinite; z-index: 1; }
@keyframes ballSpin { to { transform: rotate(360deg); } }
.auth-hero-shine {
  position: absolute; top: 0; left: -60%; width: 45%; height: 100%; z-index: 1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-18deg); animation: heroSweep 7s ease-in-out infinite;
}

/* Right: the form pane. */
.auth-form-pane { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card-title { margin: 0 0 4px; font-size: 26px; font-weight: 800; }

/* Inputs with a leading icon + optional trailing toggle. */
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .ii-glyph { position: absolute; left: 12px; font-size: 15px; opacity: .7; pointer-events: none; }
.input-icon input { padding-left: 38px; }
.input-icon .ii-toggle { position: absolute; right: 8px; background: none; border: none; cursor: pointer; font-size: 15px; opacity: .6; padding: 4px; }
.input-icon .ii-toggle:hover { opacity: 1; }

/* Submit button loading state (spinner). */
.auth-submit { position: relative; margin-top: 6px; }
.auth-submit.loading .btn-label { visibility: hidden; }
.auth-submit.loading::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px;
  margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .auth-hero, .auth-hero-shine, .auth-hero-ball, .auth-hero-flags .hf { animation: none; }
}
/* Stack on small screens — hero becomes a slim banner on top. */
@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; min-height: 0; }
  .auth-hero { padding: 36px 28px; }
  .auth-hero-title { font-size: 30px; }
  .auth-hero-ball { font-size: 180px; right: -30px; bottom: -30px; }
  .auth-form-pane { padding: 32px 24px 48px; }
}
.winners-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .winners-grid { grid-template-columns: 1fr; } }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); }

/* Flags */
.flag { width: 26px; height: 17px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.12); vertical-align: middle; background: #ddd; }
.flag.lg { width: 40px; height: 27px; border-radius: 4px; }
.team-flag { display: inline-flex; align-items: center; gap: 7px; }

/* ============================================================
   Responsive
   ============================================================ */

/* Wide tables scroll horizontally instead of overflowing the page. */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tablet and below */
@media (max-width: 768px) {
  .container { padding: 18px 14px; }
  header.site-header { padding: 12px 16px; flex-wrap: wrap; gap: 6px 12px; }
  header.site-header h1 { font-size: 16px; }
  header.site-header nav { gap: 12px; flex-wrap: wrap; }

  /* Tables scroll sideways inside their own block so they never widen the
     page. The table becomes a scroll container; cells keep readable width. */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }
  table thead, table tbody { display: table; width: 100%; min-width: 520px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .winners-grid { grid-template-columns: 1fr; }
}

/* Phone */
@media (max-width: 480px) {
  html, body { overflow-x: hidden; }
  .container { padding: 14px 10px; }
  header.site-header { justify-content: center; text-align: center; }
  header.site-header nav { justify-content: center; width: 100%; }

  .match-grid > .match-card { flex-basis: 100%; max-width: none; }   /* one card per row */
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* Standalone action rows (not inside tables) stack full-width for tapping. */
  .card > .actions-row { flex-direction: column; align-items: stretch; }
  .card > .actions-row .btn { width: 100%; }

  .auth-wrap { margin-top: 24px; }
  .score-inputs { gap: 8px; }
  .final-score { font-size: 34px !important; }
  h2 { font-size: 20px; }
}
