/* =============================================================
   LOCKED — shared Tron-themed stylesheet
   All pages import this. Keep this the single source of style truth.
   ============================================================= */

:root {
  --bg:            rgb(5 10 22 / 1);
  --bg-deep:       rgb(2 6 16 / 1);
  --panel:         rgb(10 18 35 / 0.75);
  --panel-solid:   rgb(10 18 35 / 1);
  --panel-deep:    rgb(6 12 24 / 0.9);
  --border:        rgb(60 100 140 / 0.4);
  --border-hot:    rgb(50 220 255 / 1);
  --text:          rgb(230 245 255 / 1);
  --text-muted:    rgb(147 171 195 / 1);
  --text-dim:      rgb(107 127 151 / 1);
  --cyan:          rgb(50 220 255 / 1);
  --cyan-dim:      rgb(50 220 255 / 0.3);
  --cyan-soft:     rgb(50 220 255 / 0.08);
  --gold:          rgb(245 190 80 / 1);
  --gold-glow:     rgb(245 190 80 / 0.5);
  --bronze:        rgb(205 135 85 / 1);
  --bronze-glow:   rgb(205 135 85 / 0.4);
  --silver:        rgb(200 210 230 / 1);
  --magenta:       rgb(255 75 200 / 1);
  --success:       rgb(95 255 180 / 1);
  --success-glow:  rgb(95 255 180 / 0.35);
  --danger:        rgb(255 85 110 / 1);
  --danger-glow:   rgb(255 85 110 / 0.35);

  /* Type scale — 8 steps. Every font-size in the app maps to one
     of these. rem-based, so they respect the user's browser zoom
     and font settings. Change a value here to resize that whole
     tier at once. */
  --fs-label: 0.8rem;    /* 12.8px — uppercase mini-labels, badges, table headers */
  --fs-small: 0.85rem;   /* 13.6px — hints, captions, pills */
  --fs-body:  0.95rem;   /* 15.2px — paragraphs, table cells */
  --fs-md:    1.05rem;   /* 16.8px — buttons, emphasized text, small sub-heads */
  --fs-lg:    1.5rem;    /* 24px   — section titles */
  --fs-xl:    2rem;      /* 32px   — page titles, round headers */
  --fs-2xl:   2.75rem;   /* 44px   — big page headings */
  --fs-hero:  5rem;      /* 80px   — hero moments (the confirmation lock) */

  /* Standard max content width — matches the home page. Admin,
     Receipts, Leaderboard and future pages should use this. */
  --content-width: 1200px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.4;
  padding-bottom: 100px;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at center top, rgb(20 50 100 / 0.4) 0%, transparent 60%),
    radial-gradient(ellipse at center bottom, rgb(30 10 70 / 0.3) 0%, transparent 60%);
  background-attachment: fixed;
}

/* =============================================================
   HEADER
   ============================================================= */
.site-header {
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: rgb(5 10 22 / 0.88);
  z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.35em;
  text-decoration: none;
  text-shadow: 0 0 12px var(--cyan-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

/* Auto-inject the lock icon as a ::before pseudo-element. ANY page with
   <a class="brand">L O C K E D</a> automatically gets the lock — no need
   to put inline SVG in every page's HTML.
   Uses mask-image so the icon picks up its color from background-color, which
   we set to currentColor — meaning the lock inherits whatever color .brand has
   (cyan by default, gold in champion contexts, etc.).
   The .brand-lock element selector below is kept for backwards compatibility
   with pages that still have the inline <svg class="brand-lock"> markup. */
.brand::before {
  content: '';
  display: inline-block;
  width: 1.4em;
  height: 1.4em;
  flex-shrink: 0;
  background-color: currentColor;
  filter: drop-shadow(0 0 6px var(--cyan-dim));
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M 20 28 L 20 18 A 12 12 0 0 1 44 18 L 44 28'/><rect x='14' y='28' width='36' height='28' rx='3'/><circle cx='32' cy='40' r='3' fill='black' stroke='none'/><line x1='32' y1='40' x2='32' y2='48'/></svg>");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M 20 28 L 20 18 A 12 12 0 0 1 44 18 L 44 28'/><rect x='14' y='28' width='36' height='28' rx='3'/><circle cx='32' cy='40' r='3' fill='black' stroke='none'/><line x1='32' y1='40' x2='32' y2='48'/></svg>");
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

/* Hide any inline <svg class="brand-lock"> markup that older pages still have —
   the ::before pseudo above already injected the lock, so we don't want a
   duplicate. New pages should just use <a class="brand">L O C K E D</a>. */
.brand .brand-lock { display: none; }

/* =============================================================
   SITE NAV TABS
   =============================================================
   Nav tabs sit in the header, right-aligned. Public tabs (Leaderboard,
   Receipts) are always visible. Private tabs ([data-private]) are hidden
   by default and only revealed by the auth.js shim when localStorage has
   a token. The "active" tab gets the cyan underline.
*/
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-tab {
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; /* compensate for header's 1px border so underline aligns */
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.nav-tab:hover {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-dim);
}

.nav-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan-dim);
}

/* Private tabs: hidden until JS reveals them after detecting a token.
   Using visibility/display:none means they take no layout space when hidden. */
.nav-tab[data-private] { display: none; }
.nav-tab[data-private].is-revealed { display: inline-flex; align-items: center; }

/* Tiny "(log out)" inline link that appears beside My Bracket when revealed.
   Subtle — small, dim, parenthesized — because logging out is an edge case
   not a primary action. */
.nav-logout {
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: lowercase;
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  margin-left: -0.25rem;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.15s;
}

.nav-logout::before { content: '('; }
.nav-logout::after { content: ')'; }
.nav-logout:hover { color: var(--magenta); }
.nav-logout[data-private] { display: none; }
.nav-logout[data-private].is-revealed { display: inline-block; }

/* Mobile: stack the header — full LOCKED wordmark on top, nav
   tabs on a second row underneath. Friendlier than a hamburger
   for a small friends pool and keeps the brand prominent. */
@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.875rem;
  }
  .brand {
    font-size: var(--fs-md);
    letter-spacing: 0.28em;
  }
  .brand::before {
    width: 1.4em;
    height: 1.4em;
  }
  .site-nav {
    gap: 0.2rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  .nav-tab {
    font-size: var(--fs-label);
    padding: 0.4rem 0.6rem;
    letter-spacing: 0.1em;
  }
  .nav-logout { display: none !important; } /* hide (log out) on phone — session-only logout */
}

/* progress-label legacy: keep the rule available for pages that still use it,
   but new pages should use .site-nav above. Will eventually delete. */
.progress-label {
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-label);
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 500;
}

.progress-label strong { color: var(--cyan); font-weight: 700; }

/* =============================================================
   LAYOUT
   ============================================================= */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

main.wide { max-width: 1200px; }
main.narrow { max-width: 680px; }

.page-title {
  font-family: 'Jura', sans-serif;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-dim);
  font-size: var(--fs-xl);
  margin: 0 0 0.5rem;
}

.page-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: var(--fs-lg);
}

.section-label {
  font-family: 'Jura', sans-serif;
  font-weight: 700;
  font-size: var(--fs-label);
  color: var(--text-muted);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-label::before, .section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 40%, var(--border) 60%, transparent);
}

/* =============================================================
   PANELS & CARDS
   ============================================================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(4px);
}

.panel + .panel { margin-top: 1rem; }

.panel.cyan { border-color: rgb(50 220 255 / 0.4); }
.panel.gold { border-color: rgb(245 190 80 / 0.4); background: linear-gradient(135deg, rgb(245 190 80 / 0.06), var(--panel)); }
.panel.bronze { border-color: rgb(205 135 85 / 0.4); }

/* =============================================================
   BUTTONS
   ============================================================= */
.btn {
  padding: 0.75rem 1.25rem;
  border-radius: 3px;
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  min-height: 44px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover { border-color: var(--cyan); color: var(--cyan); }

.btn-primary {
  background: var(--cyan);
  color: var(--bg-deep);
  box-shadow: 0 0 24px var(--cyan-dim);
  font-weight: 700;
}

.btn-primary:hover { box-shadow: 0 0 32px var(--cyan-dim); transform: translateY(-1px); }

.btn-primary.disabled, .btn-primary:disabled {
  background: rgb(50 220 255 / 0.15);
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-gold {
  background: var(--gold);
  color: rgb(30 20 10 / 1);
  box-shadow: 0 0 24px var(--gold-glow);
}

.btn-lg {
  padding: 1rem 1.75rem;
  font-size: var(--fs-small);
  letter-spacing: 0.25em;
}

/* =============================================================
   BOTTOM STEP NAV
   ============================================================= */
.step-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgb(5 10 22 / 0.94);
  border-top: 1px solid var(--border);
  padding: 0.875rem 1rem;
  z-index: 15;
  backdrop-filter: blur(12px);
}

.step-nav .inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
}

.step-nav .btn-primary {
  flex-grow: 1;
  max-width: 320px;
}

/* =============================================================
   FORMS
   ============================================================= */
.field { margin-bottom: 1rem; }

.field-label {
  display: block;
  font-family: 'Jura', sans-serif;
  font-size: var(--fs-label);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

.field-hint {
  font-size: var(--fs-body);
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  background: rgb(0 0 0 / 0.35);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: var(--fs-md);
  transition: border-color 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-dim);
}

/* =============================================================
   UTILITIES
   ============================================================= */
.mono-num { font-variant-numeric: tabular-nums; }

.glow-cyan { text-shadow: 0 0 10px var(--cyan-dim); }
.glow-gold { text-shadow: 0 0 10px var(--gold-glow); }
.glow-bronze { text-shadow: 0 0 10px var(--bronze-glow); }

.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: var(--fs-small);
  margin: 1rem 0;
  letter-spacing: 0.05em;
}

/* =============================================================
   FOOTER
   ============================================================= */
.site-footer {
  max-width: 1000px;
  margin: 2rem auto 0;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: var(--fs-small);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  margin: 0 0.5rem;
}

.site-footer a:hover { color: var(--cyan); }

/* =============================================================
   FLAGS — Twemoji SVGs sized to behave like inline emoji
   =============================================================
   Flag <img> tags use these classes. Sized in em so they scale
   with the surrounding text. Vertical-align tuned to sit on the
   baseline like an emoji glyph would.
*/
.flag {
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.2em;
  display: inline-block;
  flex-shrink: 0;
  /* Subtle drop-shadow lifts pale flags off dark Tron backdrop */
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
}

.flag-sm { width: 1em;   height: 1em;   vertical-align: -0.15em; }
.flag-lg { width: 1.6em; height: 1.6em; vertical-align: -0.3em; }
.flag-xl { width: 2.2em; height: 2.2em; vertical-align: -0.5em; }

/* Fallback pill for unknown country codes */
.flag-unknown {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  font-size: 0.7em;
  text-align: center;
  line-height: 1.2em;
  background: rgb(60 100 140 / 0.3);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  font-family: 'Jura', sans-serif;
  font-weight: 700;
  vertical-align: -0.15em;
}

/* =============================================================
   WC TROPHY (embedded SVG)
   ============================================================= */
.wc-trophy {
  display: inline-block;
  vertical-align: -0.15em;
}
.wc-trophy svg { width: 100%; height: 100%; fill: currentColor; }
