/* Nostradamus — "The Oracle's Almanac" theme: dark celestial sports aesthetic. */

/* ============================================================= TOKENS */
:root {
  --bg: #0b0e1a;
  --bg-2: #11152a;
  --surface: #161b33;
  --surface-2: #1d2342;
  --surface-3: #252c52;
  --line: #2c3461;
  --line-soft: #232a4d;

  --ink: #eef1ff;
  --ink-muted: #a6adcf;
  --ink-faint: #6b73a0;

  --gold: #f5c451;
  --gold-deep: #d9a533;
  --gold-soft: rgba(245, 196, 81, 0.14);
  --vision: #5cd6e6;
  --vision-soft: rgba(92, 214, 230, 0.14);

  --win: #4ade80;
  --warn: #fbbf24;
  --lose: #f87171;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;

  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 10px 40px -12px rgba(245, 196, 81, 0.35);

  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;

  --nav-h: 64px;
  --maxw: 1120px;
}

/* ============================================================= RESET */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient colour glows on a fixed layer. We render these on a pinned
   pseudo-element rather than `background-attachment: fixed`, which iOS Safari
   handles badly — it desyncs tap targets from the visible content on scroll. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1200px 600px at 12% -8%, rgba(92, 214, 230, 0.10), transparent 60%),
    radial-gradient(1000px 700px at 92% 0%, rgba(245, 196, 81, 0.10), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(99, 80, 200, 0.12), transparent 60%);
}

/* Faint constellation grain over the whole page (also pinned). */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255, 255, 255, 0.20), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255, 255, 255, 0.16), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(245, 196, 81, 0.25), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(92, 214, 230, 0.22), transparent),
    radial-gradient(1px 1px at 10% 70%, rgba(255, 255, 255, 0.14), transparent),
    radial-gradient(1.5px 1.5px at 55% 15%, rgba(255, 255, 255, 0.12), transparent);
  background-size: 600px 600px;
  opacity: 0.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--vision);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--gold);
}

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

::selection {
  background: var(--gold);
  color: #1a1408;
}

button {
  font-family: var(--font-body);
}

/* ============================================================= LAYOUT */
.page {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 32px) 20px 56px;
}

.page--narrow {
  max-width: 560px;
}

.page--auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-block: calc(var(--nav-h) + 24px) 40px;
}

.grid-3 {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ============================================================= TYPE */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0;
}

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 10px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.page-head .sub {
  color: var(--ink-muted);
  margin-top: 8px;
  max-width: 60ch;
}

.gold-text {
  color: var(--gold);
}

/* ============================================================= NAVBAR */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(11, 14, 26, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}

.nav__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.04em;
}

.brand:hover {
  color: var(--ink);
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: radial-gradient(circle at 50% 35%, #fff, #cfd3e8);
  border: 1.5px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 196, 81, 0.12), var(--shadow-gold);
  padding: 1px;
}

.brand__word b {
  color: var(--gold);
  font-weight: 700;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav__link {
  flex: none;
  white-space: nowrap;
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease;
  cursor: pointer;
}

.nav__link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav__user {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid rgba(245, 196, 81, 0.3);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Cap the display name on desktop so the nav width stays bounded (it's shown
   in full inside the burger menu on mobile — see the breakpoint override). */
.nav__user span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__user::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

/* Dropdown (CSS only: hover + focus-within) */
.dropdown {
  position: relative;
  flex: none;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.dropdown:hover .dropdown__menu,
.dropdown:focus-within .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__label {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 8px 10px 4px;
}

.dropdown__item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.dropdown__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.dropdown__empty {
  padding: 6px 12px 10px;
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-style: italic;
}

.dropdown__divider {
  height: 1px;
  background: var(--line-soft);
  margin: 6px 4px;
}

/* Mobile nav: hamburger toggles via :checked */
.nav__toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav__burger {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav__burger span,
.nav__burger span::before,
.nav__burger span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  content: "";
}

.nav__burger span {
  position: relative;
}

.nav__burger span::before {
  position: absolute;
  top: -6px;
  left: 0;
}

.nav__burger span::after {
  position: absolute;
  top: 6px;
  left: 0;
}

/* The full nav needs ~950px once it carries the profile chip and two
   dropdowns; collapse to the burger above that so it never wraps mid-row. */
@media (max-width: 980px) {
  .nav__burger {
    display: inline-flex;
  }

  .nav__links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin: 0;
    padding: 14px 16px calc(env(safe-area-inset-bottom) + 18px);
    background: rgba(11, 14, 26, 0.97);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }

  .nav__toggle:checked ~ .nav__links {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav__link,
  .nav__user {
    width: 100%;
    justify-content: flex-start;
  }

  .nav__user {
    order: -1;
    margin-bottom: 4px;
  }

  /* Full name in the menu — there's room here. */
  .nav__user span {
    max-width: none;
  }

  /* On phones the dropdowns are a desktop hover convenience: unfurling every
     competition twice just clutters the menu (and a hidden-but-present menu
     used to float over the page and steal taps). Drop the sub-menus, the
     now-redundant Competitions entry (Home is the competitions hub), and the
     chevrons — leaving clean top-level destinations. */
  .dropdown__menu {
    display: none;
  }

  .dropdown--mobile-hide {
    display: none;
  }

  .nav__link .fa-chevron-down {
    display: none;
  }
}

/* ============================================================= CARDS */
.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 60%),
    var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.card__head h2,
.card__head h3 {
  font-size: 1.1rem;
}

.card__icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--vision-soft);
  color: var(--vision);
  font-size: 1rem;
}

.card__body {
  padding: 22px;
}

.card__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-faint);
  font-size: 0.84rem;
}

/* ============================================================= LISTS */
.tile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 600;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.tile:hover {
  color: var(--ink);
  border-color: var(--vision);
  background: var(--surface-2);
  transform: translateX(3px);
}

.tile__arrow {
  color: var(--ink-faint);
  transition: transform 0.18s ease, color 0.18s ease;
}

.tile:hover .tile__arrow {
  color: var(--vision);
  transform: translateX(3px);
}

.tile--past {
  opacity: 0.72;
}

/* ============================================================= QUOTE */
.prophecy {
  position: relative;
  z-index: 1;
  margin: 44px auto 0;
  max-width: 640px;
  text-align: center;
  font-family: var(--font-display);
  color: var(--ink-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  padding: 0 16px;
}

.prophecy::before {
  content: "\201C";
  display: block;
  font-size: 3rem;
  line-height: 0.4;
  color: var(--gold);
  opacity: 0.6;
  margin-bottom: 14px;
}

.prophecy cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.68rem;
  color: var(--gold);
}

/* ============================================================= BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--font-body);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
  text-align: center;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #1a1408;
  box-shadow: var(--shadow-gold);
}

.btn--primary:hover {
  color: #1a1408;
  box-shadow: 0 14px 44px -10px rgba(245, 196, 81, 0.55);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.btn--ghost:hover {
  color: var(--ink);
  border-color: var(--vision);
  background: var(--surface-3);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 16px 28px;
  font-size: 1.02rem;
}

/* ============================================================= FORMS */
.field {
  margin-bottom: 18px;
}

.field__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.field__opt {
  font-weight: 400;
  text-transform: none;
  color: var(--ink-faint);
}

.input,
.select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input::placeholder {
  color: var(--ink-faint);
}

.input:focus,
.select:focus {
  outline: none;
  border-color: var(--vision);
  box-shadow: 0 0 0 4px var(--vision-soft);
  background: var(--surface);
}

.select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 2px),
    calc(100% - 15px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--gold);
}

.input-group .input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.field-error {
  display: block;
  margin-top: 7px;
  color: var(--lose);
  font-size: 0.82rem;
}

.input--invalid {
  border-color: var(--lose);
}

/* Form-level error (e.g. bad credentials), shown inside the form itself. */
.form-alert {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: var(--lose);
  font-size: 0.88rem;
  font-weight: 500;
}

.form-alert i {
  flex: none;
}

.form-aside {
  margin-top: 18px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.form-grid .field--full {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================= MESSAGES */
.messages {
  position: relative;
  z-index: 40;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 16px) 20px 0;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 12px;
  font-size: 0.94rem;
  animation: slide-down 0.4s ease both;
}

.alert__icon {
  flex: none;
  font-size: 1.05rem;
  line-height: 1.4;
}

.alert__text {
  flex: 1;
}

.alert--success {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.08);
  color: #bdf3cf;
}

.alert--success .alert__icon {
  color: var(--win);
}

.alert--error,
.alert--danger {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
  color: #f6c7c7;
}

.alert--error .alert__icon,
.alert--danger .alert__icon {
  color: var(--lose);
}

.alert--info {
  border-color: rgba(92, 214, 230, 0.4);
  background: rgba(92, 214, 230, 0.08);
  color: #c3edf4;
}

.alert--info .alert__icon {
  color: var(--vision);
}

.alert--warning {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
  color: #f6e2b0;
}

.alert--warning .alert__icon {
  color: var(--warn);
}

.alert__close {
  flex: none;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 4px;
}

.alert__close:hover {
  opacity: 1;
}

/* ============================================================= FOOTER */
.footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  border-top: 1px solid var(--line-soft);
  margin-top: 48px;
  padding: 26px 20px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.82rem;
}

.footer__brand {
  font-family: var(--font-display);
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.footer__credit {
  margin-top: 6px;
  font-size: 0.74rem;
  opacity: 0.7;
}

.footer__credit a {
  color: var(--ink-faint);
}

.footer__credit a:hover {
  color: var(--ink-muted);
}

/* ============================================================= SCORING LEGEND */
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.legend__pts {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(245, 196, 81, 0.3);
}

.legend__label {
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.3;
}

.legend__note {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--ink-faint);
  text-align: center;
  padding-top: 4px;
}

.legend__note b {
  color: var(--vision);
}

/* ============================================================= PREDICT */
.round {
  margin-bottom: 26px;
  /* Keep the date header clear of the fixed navbar when jumped to. */
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

/* Floating "jump to today" / "back to top" bubbles, kept clear of the save bar. */
.page-fabs {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.15s ease, color 0.2s ease,
    border-color 0.2s ease;
}

.fab:hover {
  color: var(--gold);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.fab--hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

@media (max-width: 560px) {
  .page-fabs {
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom) + 132px);
  }
}

.round__date {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 12px;
}

.round__date::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.matches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s ease;
}

.match:focus-within {
  border-color: var(--line);
}

.match--locked {
  opacity: 0.62;
  background: var(--surface);
}

.match--playoff {
  border-color: rgba(245, 196, 81, 0.35);
  background:
    linear-gradient(180deg, var(--gold-soft), transparent 70%),
    var(--bg-2);
}

.match__team {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  font-size: 0.96rem;
}

.match__team--home {
  justify-content: flex-end;
  text-align: right;
}

.match__team--away {
  justify-content: flex-start;
  text-align: left;
}

.match__team span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.scorebox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-input {
  width: 54px;
  height: 54px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 0;
  -moz-appearance: textfield;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-input:focus {
  outline: none;
  border-color: var(--vision);
  background: var(--bg-2);
  box-shadow: 0 0 0 4px var(--vision-soft);
}

.score-input.needs-pair {
  border-color: var(--warn);
  animation: pulse-warn 1.1s ease-in-out infinite;
}

/* Autosave feedback on the row's score inputs. */
.match.is-saved .score-input {
  border-color: var(--win);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}

.match.is-error .score-input {
  border-color: var(--lose);
}

.score-sep {
  color: var(--ink-faint);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.score-readonly {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 48px;
  padding: 0 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.score-readonly--empty {
  color: var(--ink-faint);
  font-size: 1rem;
}

.match__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.match__time {
  color: var(--ink-faint);
}

.match__result {
  color: var(--win);
  font-weight: 700;
}

.match__result span {
  font-family: var(--font-display);
}

.peek {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--ink-faint);
  background: transparent;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.peek:hover {
  color: var(--vision);
  background: var(--vision-soft);
  transform: scale(1.08);
}

.chip-playoff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(245, 196, 81, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
}

.predict-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 24px;
  padding: 14px 0 calc(env(safe-area-inset-bottom) + 6px);
  background: linear-gradient(180deg, transparent, var(--bg) 40%);
}

/* Compact status bar: not full-width on desktop, full-width tap target on phones. */
.savebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px 10px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.savebar__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink-muted);
  transition: color 0.2s ease;
}

.savebar__status[data-state="saving"] {
  color: var(--vision);
}

.savebar__status[data-state="saved"] {
  color: var(--win);
}

.savebar__status[data-state="error"] {
  color: var(--lose);
}

.savebar__btn {
  flex: none;
}

@media (max-width: 560px) {
  .savebar {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
    border-radius: var(--radius);
    padding: 12px;
    gap: 12px;
  }

  .savebar__status {
    justify-content: center;
  }

  .savebar__btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .match {
    gap: 6px;
    padding: 10px;
  }

  .match__team {
    font-size: 0.85rem;
    gap: 5px;
  }

  .score-input {
    width: 46px;
    height: 48px;
    font-size: 1.2rem;
  }
}

/* ============================================================= LEADERBOARD */
.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.board thead th {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.board thead th.col-player {
  text-align: left;
}

.board tbody td {
  padding: 13px 10px;
  text-align: center;
  border-bottom: 1px solid var(--line-soft);
}

.board tbody tr:last-child td {
  border-bottom: none;
}

.board tbody tr {
  transition: background 0.15s ease;
}

.board tbody tr:hover {
  background: var(--surface-2);
}

.board .col-player {
  text-align: left;
  font-weight: 600;
}

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.rank--1 {
  background: linear-gradient(135deg, #f7d877, #d9a533);
  color: #1a1408;
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
}

.rank--2 {
  background: linear-gradient(135deg, #e6e9f5, #aab1cc);
  color: #1a1d2e;
  border-color: #c7cce0;
}

.rank--3 {
  background: linear-gradient(135deg, #e0a572, #b5703a);
  color: #2a1505;
  border-color: #d08b54;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player__avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--vision);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.points {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--gold);
}

.col-stat {
  color: var(--ink-muted);
}

@media (max-width: 700px) {
  .col-stat {
    display: none;
  }
}

/* ============================================================= BETS */
.scoreline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}

.scoreline__team {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 600;
  flex: 1;
  min-width: 90px;
}

.scoreline__team--home {
  text-align: right;
}

.scoreline__team--away {
  text-align: left;
}

.scoreline__score {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 7vw, 2.4rem);
  color: var(--gold);
}

.scoreline__pending {
  flex: none;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}

.bet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.bet-row + .bet-row {
  margin-top: 8px;
}

.bet-row__user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.bet-row__user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bet-row__pred {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  min-width: 60px;
  text-align: center;
}

.verdict {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 96px;
  justify-content: flex-end;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot--exact {
  background: var(--win);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.dot--goal-diff {
  background: var(--vision);
  box-shadow: 0 0 8px rgba(92, 214, 230, 0.5);
}

.dot--winner {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(245, 196, 81, 0.5);
}

.verdict__label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.verdict--zilch .verdict__label {
  color: var(--lose);
}

.verdict--zilch .miss {
  color: var(--lose);
  font-weight: 700;
}

.verdict--pending .verdict__label {
  color: var(--ink-faint);
  font-style: italic;
}

.hidden-orb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 110px;
  height: 110px;
  margin: 8px auto 20px;
  border-radius: 50%;
  font-size: 3rem;
  background: radial-gradient(circle at 38% 32%, rgba(92, 214, 230, 0.35), rgba(99, 80, 200, 0.18) 60%, transparent 75%);
  border: 1px solid var(--line);
  box-shadow: 0 0 50px -8px rgba(92, 214, 230, 0.35);
  animation: float 4.5s ease-in-out infinite;
}

.center-note {
  text-align: center;
  color: var(--ink-muted);
  max-width: 46ch;
  margin: 0 auto;
}

/* ============================================================= 404 */
.notfound {
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}

.notfound__code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 22vw, 9rem);
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--gold), var(--vision));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}

.notfound h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin-bottom: 14px;
}

.notfound p {
  color: var(--ink-muted);
  margin-bottom: 26px;
}

/* ============================================================= AUTH */
.auth-card {
  width: 100%;
  max-width: 460px;
}

.auth-card--wide {
  max-width: 640px;
}

.auth-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, #cfd3e8);
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-gold);
  padding: 2px;
}

.auth-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-head h1 {
  font-size: 1.7rem;
}

.auth-head p {
  color: var(--ink-muted);
  margin: 8px 0 0;
  font-size: 0.92rem;
}

/* ============================================================= UTIL */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--ink-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.empty-note {
  color: var(--ink-faint);
  font-style: italic;
  padding: 8px 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulse-warn {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.0);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25);
  }
}

.reveal {
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.13s; }
.reveal-3 { animation-delay: 0.21s; }

/* ============================================================= LIGHT THEME */
/* Daylight palette — selected automatically by the viewer's local sunrise/
   sunset (see the bootstrap in base.html) or pinned via the nav toggle. */
html[data-theme="light"] {
  --bg: #f3efe4;
  --bg-2: #ece6d6;
  --surface: #fffdf8;
  --surface-2: #f6f1e5;
  --surface-3: #ece5d4;
  --line: #d9cfb8;
  --line-soft: #e6ddc8;

  --ink: #20242f;
  --ink-muted: #525a6e;
  --ink-faint: #8b8473;

  --gold: #b07d12;
  --gold-deep: #8a6210;
  --gold-soft: rgba(176, 125, 18, 0.12);
  --vision: #0e7d92;
  --vision-soft: rgba(14, 125, 146, 0.10);

  --win: #1f9d57;
  --warn: #b9831b;
  --lose: #cf3b36;

  --shadow: 0 18px 50px -26px rgba(60, 50, 30, 0.30);
  --shadow-gold: 0 10px 40px -16px rgba(176, 125, 18, 0.30);
}

html[data-theme="light"] body::before {
  background-image:
    radial-gradient(1200px 600px at 12% -8%, rgba(14, 125, 146, 0.08), transparent 60%),
    radial-gradient(1000px 700px at 92% 0%, rgba(176, 125, 18, 0.10), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(120, 110, 200, 0.07), transparent 60%);
}

/* No starfield in daylight. */
html[data-theme="light"] body::after { opacity: 0; }

html[data-theme="light"] .nav { background: rgba(255, 253, 248, 0.82); }

html[data-theme="light"] .alert--success { color: #1c7a43; }
html[data-theme="light"] .alert--error,
html[data-theme="light"] .alert--danger { color: #b5302b; }
html[data-theme="light"] .alert--info { color: #0e6b7d; }
html[data-theme="light"] .alert--warning { color: #8a6410; }

@media (max-width: 980px) {
  html[data-theme="light"] .nav__links { background: rgba(255, 253, 248, 0.97); }
}

/* ============================================================= THEME TOGGLE */
.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease,
    transform 0.25s ease;
}

.theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
  transform: rotate(20deg);
}

/* ============================================================= AVATARS */
.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  vertical-align: middle;
}

.avatar--sm { width: 26px; height: 26px; }
.avatar--md { width: 60px; height: 60px; }
.avatar--lg { width: 84px; height: 84px; }

/* The nav profile chip carries its own avatar, so drop the status dot. */
.nav__user::before { display: none; }
.nav__user span { color: inherit; }

.avatar-picker {
  border: 0;
  margin: 0 0 20px;
  padding: 0;
}

.avatar-picker legend {
  padding: 0;
  margin-bottom: 12px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 12px;
}

.avatar-option {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.avatar-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-option .avatar {
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;
}

.avatar-option:hover .avatar { transform: translateY(-2px); }

.avatar-option input:checked + .avatar {
  outline-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 0 0 3px var(--gold-soft);
}

.avatar-option input:focus-visible + .avatar { outline-color: var(--vision); }

/* ============================================================= FLAGS */
.flag {
  flex: none;
  display: inline-block;
  width: 22px;
  height: auto;
  margin: 0 2px;
  border-radius: 3px;
  vertical-align: -3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ============================================================= FOOTER META */
.footer__meta { font-size: 0.8rem; }

.footer__credit {
  color: var(--ink-faint);
  opacity: 0.5;
  font-size: 0.92em;
}

.footer__credit:hover {
  opacity: 1;
  color: var(--ink-muted);
}

/* ============================================================= PROFILE PAGE */
.profile-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1.6fr 1fr;
  align-items: start;
}

@media (max-width: 760px) {
  .profile-grid { grid-template-columns: 1fr; }
}
