@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #120A22;
  --panel: #1B1030;
  --surface: #1E1233;
  --surface-2: #26173F;
  --border: #3A2A5C;
  --border-strong: #56408A;
  --text: #F5F2FB;
  --text-dim: #B7A9D8;
  --text-faint: #7C6C9E;

  --accent: #FF2D78;
  --accent-strong: #FF548F;
  --accent-dim: rgba(255,45,120,.14);
  --accent-ink: #3A0A20;

  --alive: #2CFF97;
  --alive-dim: rgba(44,255,151,.13);
  --out: #FF5C5C;
  --out-dim: rgba(255,92,92,.14);
  --pending: #FFB020;
  --pending-dim: rgba(255,176,32,.14);
  --live: #4CB2FF;
  --live-dim: rgba(76,178,255,.14);
  --gold: #FFD23D;
  --gold-dim: rgba(255,210,61,.14);

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 10px 30px -12px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); }

.lms-root {
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(255,45,120,.10), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(76,178,255,.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.display { font-family: 'Anton', sans-serif; font-weight: 400; text-transform: uppercase; letter-spacing: .01em; }
.mono { font-family: 'IBM Plex Mono', monospace; }

/* ---------- top nav ---------- */
.navbar {
  display:flex; align-items:center; gap:26px;
  padding: 16px 24px; background: rgba(18,10,34,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.navbar .brand {
  font-family:'Anton',sans-serif; font-size:19px; letter-spacing:.02em; text-transform:uppercase;
  color: var(--text); cursor:pointer; display:flex; align-items:center; gap:9px;
}
.navbar .brand::before { content:""; width:10px; height:10px; background: var(--accent); display:inline-block; transform: rotate(45deg); box-shadow: 0 0 12px rgba(255,45,120,.7); }
.navbar .nav-link {
  font-size:12.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color: var(--text-faint); cursor:pointer;
  padding: 6px 2px; border-bottom: 2px solid transparent;
}
.navbar .nav-link:hover { color: var(--text); }
.navbar .nav-link.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.navbar .spacer { flex:1; }
.navbar .who { font-size:13px; color: var(--text-dim); font-weight:500; }
.navbar .nav-link.logout { color: var(--text-faint); }
.navbar .nav-link.logout:hover { color: var(--out); }

/* ---------- layout ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 28px 20px 60px; }
.eyebrow {
  font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-strong); margin-bottom: 10px;
}
.hero {
  position: relative; overflow:hidden; text-align:center; padding: 52px 24px; margin-bottom: 22px;
  border-radius: var(--radius); background: linear-gradient(160deg, #2A1245, #180B2C 60%);
  border: 1px solid var(--border);
}
.hero::before {
  content:""; position:absolute; inset:0; opacity:.5; pointer-events:none;
  background: repeating-linear-gradient(-35deg, transparent, transparent 26px, rgba(255,45,120,.05) 26px, rgba(255,45,120,.05) 27px);
}
.hero h1 { font-family:'Anton',sans-serif; text-transform:uppercase; font-size: 34px; margin: 0 0 10px; letter-spacing:.01em; position:relative; }
.hero p { color: var(--text-dim); font-size: 14.5px; margin:0; max-width: 440px; margin-inline:auto; line-height:1.55; position:relative; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-title { font-family:'Anton',sans-serif; text-transform:uppercase; font-size: 16px; margin: 0 0 4px; letter-spacing:.01em; }
.card-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 14px; line-height:1.5; }

/* ---------- forms ---------- */
label.lbl { display:block; font-size: 11.5px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; color: var(--text-faint); margin-bottom:7px; }
input, select {
  background: var(--panel); border: 1.5px solid var(--border-strong); color: var(--text);
  font-family:'Inter',sans-serif; padding: 11px 13px; border-radius: var(--radius-sm);
  width:100%; font-size: 14.5px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--text-faint); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
option { background: var(--panel); color: var(--text); }

/* ---------- buttons ---------- */
button.btn {
  font-family:'Inter',sans-serif; font-weight: 800; font-size: 13px; letter-spacing:.03em; text-transform: uppercase;
  border: 1.5px solid var(--accent); background: var(--accent); color: #1A0210;
  padding: 11px 20px; border-radius: 6px; cursor: pointer;
  transition: background .12s, border-color .12s, transform .05s, box-shadow .12s;
}
button.btn:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); box-shadow: 0 0 20px rgba(255,45,120,.35); }
button.btn:active:not(:disabled) { transform: scale(.98); }
button.btn:disabled { opacity: .35; cursor: not-allowed; }
button.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

button.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
button.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-faint); box-shadow:none; }
button.btn.amber { background: var(--pending); border-color: var(--pending); color: #2B1900; }
button.btn.amber:hover:not(:disabled) { background: #FFC24D; box-shadow: 0 0 20px rgba(255,176,32,.3); }
button.btn.danger { background: transparent; color: var(--out); border-color: var(--out-dim); }
button.btn.danger:hover:not(:disabled) { background: var(--out-dim); border-color: var(--out); box-shadow:none; }
button.btn.small { padding: 8px 14px; font-size: 11.5px; }
button.btn.block { width: 100%; }

.two-col { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.segment { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:14px; }

/* ---------- tabs ---------- */
.tabs { display:flex; gap: 24px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tabs .tab {
  font-size: 12.5px; font-weight: 800; letter-spacing:.04em; text-transform:uppercase; padding: 0 0 12px; color: var(--text-faint); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- rolling score ticker ---------- */
.ticker-wrap {
  overflow:hidden; white-space:nowrap; background: var(--panel);
  border-bottom: 1px solid var(--border); border-top: 1px solid var(--border);
  padding: 9px 0;
}
.ticker-track { display:inline-block; animation: ticker-scroll 30s linear infinite; }
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker-item { display:inline-flex; align-items:center; gap:9px; margin-right:40px; font-family:'IBM Plex Mono',monospace; font-weight:600; font-size:13px; }
.ticker-item .t-dot { width:6px; height:6px; border-radius:50%; display:inline-block; flex-shrink:0; }
.ticker-item .t-score { font-family:'Anton',sans-serif; color: var(--text); letter-spacing:.02em; }
.ticker-item .t-status { color: var(--text-faint); font-family:'Inter',sans-serif; font-weight:700; font-size:10.5px; letter-spacing:.04em; text-transform:uppercase; }

/* ---------- fixture strip ---------- */
.fixture-strip { display:flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin: 0 -2px 4px; scrollbar-width: thin; }
.fixture-strip::-webkit-scrollbar { height: 6px; }
.fixture-strip::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.fixture-card {
  flex: 0 0 auto; min-width: 152px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; border-top: 2px solid var(--border-strong);
}
.fixture-card .fc-status { font-family:'Anton',sans-serif; font-size: 10.5px; letter-spacing:.06em; margin-bottom: 7px; display:inline-block; }
.fixture-card .fc-team { display:flex; justify-content:space-between; align-items:center; font-size: 13px; font-weight:600; padding: 2px 0; }
.fixture-card .fc-score { font-family:'Anton',sans-serif; font-size:14px; }

/* ---------- team pick grid ---------- */
.grid-teams { display:grid; grid-template-columns: repeat(2,1fr); gap:9px; }
.team-btn {
  display:flex; align-items:center; gap:11px; justify-content:flex-start; text-align:left;
  font-family:'Inter',sans-serif; color: var(--text);
  border: 1.5px solid var(--border); background: var(--panel);
  padding: 14px 15px; border-radius: var(--radius-sm); cursor: pointer; width: 100%;
  transition: border-color .12s, background .12s;
}
.team-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-dim); }
.team-btn.selected { border-color: var(--accent); background: var(--accent-dim); color: var(--accent-strong); }
.team-btn:disabled { opacity: .35; cursor: not-allowed; }
.team-btn:disabled .team-name { text-decoration: line-through; }
.team-name { font-size: 16.5px; font-weight: 800; line-height: 1.25; }
.chip { width:12px; height:12px; border-radius: 3px; display:inline-block; flex-shrink:0; }

/* ---------- round numeral ---------- */
.round-head { display:flex; align-items:center; gap:14px; margin-bottom: 4px; }
.round-numeral {
  font-family:'Anton',sans-serif; font-size: 40px; line-height:1; color: var(--accent);
  text-shadow: 0 0 24px rgba(255,45,120,.35);
}
.round-head-text .card-title { margin-bottom:2px; }

/* ---------- standings ---------- */
.standing-row {
  position: relative; display:flex; align-items:center; gap:12px; padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.standing-row:last-child { border-bottom: none; }
.standing-row.is-out { opacity: .5; }
.badge-sq {
  width: 32px; height: 32px; border-radius: 6px; display:flex; align-items:center; justify-content:center;
  font-family:'Anton',sans-serif; font-size: 14px; color: #150a24; flex-shrink:0;
}
.standing-row .s-name { font-weight: 700; font-size: 14px; flex: 1; }
.standing-row .s-name .you-tag { font-weight:800; color: var(--accent-strong); font-size: 10.5px; letter-spacing:.05em; margin-left: 7px; }
.stamp {
  font-family:'Anton',sans-serif; font-size: 11px; letter-spacing:.08em; color: var(--out);
  border: 2px solid var(--out); border-radius: 4px; padding: 2px 8px;
  transform: rotate(-6deg); display:inline-block; text-transform: uppercase;
}

/* ---------- pills ---------- */
.pill {
  display:inline-flex; align-items:center; gap:5px; font-size: 11px; font-weight: 800; letter-spacing:.02em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; text-transform:uppercase;
}
.pill.alive { background: var(--alive-dim); color: var(--alive); }
.pill.out { background: var(--out-dim); color: var(--out); }
.pill.pending { background: var(--pending-dim); color: var(--pending); }
.pill.live { background: var(--live-dim); color: var(--live); }
.pill.owner { background: var(--gold-dim); color: var(--gold); }
.pill.banned { background: var(--out-dim); color: var(--out); }
.pill .dot { width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ---------- winner banner ---------- */
.winner-banner {
  position:relative; overflow:hidden; text-align:center; padding: 34px 20px; border-radius: var(--radius); margin-bottom: 16px;
  background: linear-gradient(160deg, #3A2205, #1B1030 65%);
  border: 1px solid #6B4A0E;
}
.winner-banner::before {
  content:""; position:absolute; inset:0; opacity:.4; pointer-events:none;
  background: repeating-linear-gradient(35deg, transparent, transparent 20px, rgba(255,210,61,.08) 20px, rgba(255,210,61,.08) 21px);
}
.winner-banner .wb-trophy { font-size: 30px; margin-bottom: 8px; position:relative; }
.winner-banner .wb-text { font-family:'Anton',sans-serif; text-transform:uppercase; font-size: 19px; color: var(--gold); letter-spacing:.01em; position:relative; }

/* ---------- pool code display ---------- */
.code-display {
  font-family:'Anton',sans-serif; font-size: 30px; letter-spacing: 8px;
  color: var(--accent); background: var(--accent-ink); border: 1px dashed var(--accent);
  border-radius: var(--radius-sm); padding: 13px 16px; text-align:center; margin-bottom: 8px;
}

/* ---------- pool cards (home list) ---------- */
.pool-card {
  display:flex; justify-content:space-between; align-items:center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 15px 17px; margin-bottom: 8px;
  cursor: pointer; background: var(--surface); transition: border-color .12s, box-shadow .12s;
  border-left: 3px solid var(--border-strong);
}
.pool-card:hover { border-color: var(--accent); border-left-color: var(--accent); }
.pool-card .pc-name { font-weight: 700; font-size: 14.5px; display:flex; align-items:center; gap:8px; }
.pool-card .pc-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }

/* ---------- admin table ---------- */
table.admin-table { width:100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th {
  text-align:left; color: var(--text-faint); text-transform: uppercase; letter-spacing:.06em;
  font-size: 10.5px; font-weight: 800; padding: 9px 10px; border-bottom: 1px solid var(--border);
}
table.admin-table td { padding: 13px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.admin-table tr:last-child td { border-bottom: none; }

/* ---------- misc ---------- */
.subtle { color: var(--text-dim); font-size: 13px; line-height:1.5; }
.faint { color: var(--text-faint); font-size: 12.5px; }
.err { font-size: 13px; color: var(--out); margin-bottom: 10px; background: var(--out-dim); padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid rgba(255,92,92,.3); }
.ok { font-size: 13px; color: var(--alive); margin-bottom: 10px; }
.log-line { font-family:'IBM Plex Mono',monospace; font-size: 12px; color: var(--text-dim); padding: 3px 0; }
.empty-state { text-align:center; padding: 34px 16px; color: var(--text-faint); font-size: 13.5px; }

details > summary { cursor: pointer; font-size: 13px; font-weight: 800; letter-spacing:.03em; text-transform:uppercase; color: var(--text-dim); list-style: none; display:flex; align-items:center; gap:7px; }
details > summary::-webkit-details-marker { display:none; }
details > summary::before { content:"▸"; display:inline-block; transition: transform .15s; color: var(--accent); font-size:12px; }
details[open] > summary::before { transform: rotate(90deg); }

/* ---------- high contrast mode ---------- */
:root.high-contrast {
  --bg: #000000;
  --panel: #0D0D0D;
  --surface: #141414;
  --surface-2: #1E1E1E;
  --border: #8C8C8C;
  --border-strong: #FFFFFF;
  --text: #FFFFFF;
  --text-dim: #E6E6E6;
  --text-faint: #BFBFBF;

  --accent: #FF7FBE;
  --accent-strong: #FF9DCB;
  --accent-dim: rgba(255,127,190,.30);
  --accent-ink: #3A0A20;

  --alive: #5CFFB0;
  --alive-dim: rgba(92,255,176,.28);
  --out: #FF9494;
  --out-dim: rgba(255,148,148,.28);
  --pending: #FFD166;
  --pending-dim: rgba(255,209,102,.28);
  --live: #8FCBFF;
  --live-dim: rgba(143,203,255,.28);
  --gold: #FFE066;
  --gold-dim: rgba(255,224,102,.28);
}
.high-contrast .lms-root { background: var(--bg); }
.high-contrast .hero, .high-contrast .winner-banner { background: var(--surface); }
.high-contrast .hero::before, .high-contrast .winner-banner::before { display: none; }
.high-contrast .round-numeral { text-shadow: none; }
.high-contrast .navbar { background: var(--bg); backdrop-filter: none; }
.high-contrast .card,
.high-contrast .fixture-card,
.high-contrast .pool-card,
.high-contrast input,
.high-contrast select {
  border-width: 2px;
}
.high-contrast button.btn { border-width: 2px; }
.high-contrast button.btn:hover:not(:disabled) { box-shadow: none; }
.high-contrast .code-display { border-width: 2px; }
.high-contrast .stamp { border-width: 2.5px; }
.high-contrast .badge-sq { color: #fff; }

/* ---------- high contrast mode — white background variant ---------- */
:root.high-contrast-light {
  --bg: #FFFFFF;
  --panel: #F2F2F2;
  --surface: #FFFFFF;
  --surface-2: #E9E9E9;
  --border: #4A4A4A;
  --border-strong: #000000;
  --text: #000000;
  --text-dim: #262626;
  --text-faint: #525252;

  --accent: #B3125A;
  --accent-strong: #8C0E47;
  --accent-dim: rgba(179,18,90,.14);
  --accent-ink: #FBE1EC;

  --alive: #0B7A3D;
  --alive-dim: rgba(11,122,61,.14);
  --out: #B3261E;
  --out-dim: rgba(179,38,30,.14);
  --pending: #8A5A00;
  --pending-dim: rgba(138,90,0,.14);
  --live: #0B5FA5;
  --live-dim: rgba(11,95,165,.14);
  --gold: #8A6D00;
  --gold-dim: rgba(138,109,0,.14);
}
.high-contrast-light .lms-root { background: var(--bg); }
.high-contrast-light .lms-root::before { display: none; }
.high-contrast-light .hero, .high-contrast-light .winner-banner { background: var(--surface); }
.high-contrast-light .hero::before, .high-contrast-light .winner-banner::before { display: none; }
.high-contrast-light .round-numeral { text-shadow: none; }
.high-contrast-light .navbar { background: var(--bg); backdrop-filter: none; }
.high-contrast-light .card,
.high-contrast-light .fixture-card,
.high-contrast-light .pool-card,
.high-contrast-light input,
.high-contrast-light select {
  border-width: 2px;
}
.high-contrast-light button.btn { border-width: 2px; color: #fff; }
.high-contrast-light button.btn.ghost,
.high-contrast-light button.btn.danger { color: var(--text); }
.high-contrast-light button.btn:hover:not(:disabled) { box-shadow: none; }
.high-contrast-light .code-display { border-width: 2px; }
.high-contrast-light .stamp { border-width: 2.5px; }
.high-contrast-light .badge-sq { color: #fff; }

/* Persistent toggle — fixed, always legible regardless of current theme */
#contrast-toggle {
  position: fixed; bottom: 16px; right: 16px; z-index: 200;
  font-family: 'Inter', sans-serif; font-weight: 800; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  background: #000; color: #fff; border: 2px solid #fff;
  padding: 10px 15px; border-radius: 999px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#contrast-toggle:hover { background: #fff; color: #000; }
#contrast-toggle:focus-visible { outline: 3px solid #FF7FBE; outline-offset: 2px; }

@media (max-width: 480px) {
  .hero { padding: 36px 18px; }
  .hero h1 { font-size: 27px; }
  .grid-teams { grid-template-columns: 1fr; }
  .round-numeral { font-size: 32px; }
}
