/* NextVision WC26 Pool — tactical optics theme */
:root {
  --bg: #070c16;
  --bg2: #0b1322;
  --panel: #101a2e;
  --panel2: #16223a;
  --line: #1f2e4d;
  --text: #dce7f5;
  --dim: #7e93b8;
  --cyan: #38e1ff;
  --orange: #ff8a1e;
  --green: #3ddc84;
  --red: #ff5470;
  --gold: #ffd34d;
}
* { box-sizing: border-box; margin: 0; }
body {
  background:
    radial-gradient(1100px 500px at 70% -10%, #11223f 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(56,225,255,.035) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(56,225,255,.035) 39px 40px),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}
.hidden { display: none !important; }
.mono { font-family: Consolas, "SF Mono", monospace; }

/* topbar */
#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(11,19,34,.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
#topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan) 30%, var(--orange) 70%, transparent);
  opacity: .65;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--cyan); }
.reticle { filter: drop-shadow(0 0 6px rgba(56,225,255,.6)); animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-name { font-weight: 800; letter-spacing: .22em; font-size: 15px; color: var(--text); }
.brand-sub { font-size: 10px; letter-spacing: .18em; color: var(--cyan); }
.nv-wordmark { height: 26px; display: block; margin-bottom: 2px; }
.nv-logo-login { width: min(260px, 70vw); margin: 6px auto 2px; display: block; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; }
#nav a {
  color: var(--dim); text-decoration: none; padding: 7px 14px; border-radius: 6px;
  font-size: 13px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  border: 1px solid transparent;
}
#nav a:hover { color: var(--text); }
#nav a.active { color: var(--cyan); border-color: var(--line); background: var(--panel); box-shadow: 0 0 12px rgba(56,225,255,.12) inset; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; }
.brand-tr { height: 44px; width: 44px; filter: drop-shadow(0 0 8px rgba(56,225,255,.4)); }

/* giant faint kicker watermark behind everything */
.brand-watermark {
  position: fixed; right: -8vmin; bottom: -10vmin; width: 70vmin; height: 70vmin;
  opacity: .07; pointer-events: none; z-index: 0; user-select: none;
}
main { position: relative; z-index: 1; }

/* flag images (emoji flags don't render on Windows) */
.flag-img {
  width: 34px; height: auto; border-radius: 3px; vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0,0,0,.6); outline: 1px solid rgba(255,255,255,.12);
}
.flag-img.sm { width: 22px; }
.flag-ph {
  display: inline-block; width: 34px; height: 24px; border-radius: 3px; vertical-align: middle;
  background: repeating-linear-gradient(45deg, var(--panel2) 0 6px, var(--line) 6px 12px);
  outline: 1px dashed var(--line);
}
.flag-ph.sm { width: 22px; height: 15px; }

main { max-width: 1280px; margin: 0 auto; padding: 26px 22px 80px; }

/* generic — condensed stadium type (Bahnschrift ships with Win10+, Roboto Condensed on Android) */
:root { --cond: "Bahnschrift", "Bahnschrift Condensed", "Roboto Condensed", "Arial Narrow", "Segoe UI", sans-serif; }
h1 { font-family: var(--cond); font-size: 28px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; }
h2 { font-family: var(--cond); font-size: 16px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin: 26px 0 12px; }
.sub { color: var(--dim); font-size: 13px; margin-bottom: 18px; }
.panel { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.btn {
  background: linear-gradient(180deg, #1de0ff, #0db4d6); color: #03222b; border: 0; border-radius: 7px;
  padding: 9px 18px; font-weight: 700; font-size: 13px; letter-spacing: .05em; cursor: pointer; text-transform: uppercase;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--dim); border: 1px solid var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--dim); }
.btn.warn { background: linear-gradient(180deg, var(--orange), #d96e0a); color: #2a1500; }
.btn.sm { padding: 5px 10px; font-size: 11px; }
input, select {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 7px;
  padding: 9px 12px; font-size: 14px; outline: none;
}
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(56,225,255,.15); }

/* login */
.login-wrap { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: min(420px, 92vw); text-align: center; padding: 38px 32px; }
.login-card .reticle { width: 64px; height: 64px; color: var(--cyan); margin-bottom: 14px; }
.login-card h1 { letter-spacing: .2em; }
.login-card .tag { color: var(--orange); font-size: 11px; letter-spacing: .3em; margin: 6px 0 26px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.code-input { text-align: center; font-size: 26px; letter-spacing: .5em; text-transform: uppercase; font-family: Consolas, monospace; }
.login-note { color: var(--dim); font-size: 12px; margin-top: 16px; }

/* ---------- hero: next kickoff ---------- */
.hero {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  margin-bottom: 22px; padding: 20px 24px; border-radius: 14px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #102036 0%, #0c1626 55%, #1a1230 100%);
  border: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(56,225,255,.08) inset, 0 8px 28px rgba(0,0,0,.45);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 85% 0%, rgba(255,138,30,.14), transparent 60%),
              radial-gradient(500px 220px at 10% 100%, rgba(56,225,255,.12), transparent 60%);
  pointer-events: none;
}
.hero-ball { width: 84px; height: 84px; animation: ballspin 16s linear infinite; filter: drop-shadow(0 10px 18px rgba(0,0,0,.6)); }
.hero-main { flex: 1; min-width: 230px; }
.hero-label { font-family: var(--cond); font-size: 12px; letter-spacing: .28em; color: var(--orange); margin-bottom: 6px; }
.hero-teams { display: flex; align-items: center; gap: 12px; font-family: var(--cond); font-size: clamp(20px, 4.5vw, 34px); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; flex-wrap: wrap; }
.hero-teams .flag-img { width: 44px; }
.hero-vs { color: var(--cyan); font-size: .6em; opacity: .9; padding: 0 2px; }
.hero-when { color: var(--dim); font-size: 13px; margin-top: 6px; }
.hero-cd { text-align: center; min-width: 200px; }
.hero-count {
  font-family: var(--cond); font-variant-numeric: tabular-nums;
  font-size: clamp(30px, 6vw, 52px); font-weight: 700; color: var(--cyan);
  text-shadow: 0 0 22px rgba(56,225,255,.55);
}
.hero-cd-label { font-family: var(--cond); font-size: 10px; letter-spacing: .3em; color: var(--dim); margin-top: 2px; }
@keyframes ballspin { to { transform: rotate(360deg); } }

/* ambient floating balls */
.float-ball { position: fixed; pointer-events: none; z-index: 0; opacity: .09; filter: blur(1px); }
.float-ball.f1 { width: 130px; top: 16%; left: -40px; animation: drift1 36s ease-in-out infinite alternate; }
.float-ball.f2 { width: 70px; top: 64%; right: 4%; opacity: .06; animation: drift2 48s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: translate(0,0) rotate(0); } to { transform: translate(40px,-60px) rotate(160deg); } }
@keyframes drift2 { from { transform: translate(0,0) rotate(0); } to { transform: translate(-50px,40px) rotate(-200deg); } }

.login-ball { width: 104px; margin: 0 auto 14px; display: block; animation: ballspin 14s linear infinite; filter: drop-shadow(0 14px 26px rgba(0,0,0,.65)) drop-shadow(0 0 30px rgba(56,225,255,.25)); }

/* match cards */
.stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); gap: 14px; }
.match-card { padding: 14px 16px; position: relative; overflow: hidden; transition: transform .18s, border-color .18s, box-shadow .18s; }
.match-card:hover { transform: translateY(-3px); border-color: rgba(56,225,255,.5); box-shadow: 0 10px 26px rgba(0,0,0,.5), 0 0 18px rgba(56,225,255,.1); }
.match-card.locked { opacity: .92; }
.match-card .meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--dim); letter-spacing: .08em; margin-bottom: 10px; text-transform: uppercase; }
.match-card .meta span:last-child { font-family: var(--cond); font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: .06em; white-space: nowrap; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.team { display: flex; align-items: center; gap: 9px; min-width: 0; }
.team.away { flex-direction: row-reverse; text-align: right; }
.team .flag { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
.team .name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team .slot { color: var(--dim); font-size: 12px; }
.score-box { display: flex; align-items: center; gap: 6px; }
.score-box input { width: 46px; text-align: center; font-size: 18px; font-weight: 700; padding: 6px 4px; font-family: Consolas, monospace; }
.score-box .dash { color: var(--dim); }
.match-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; min-height: 24px; gap: 8px; }
.countdown { font-size: 11.5px; color: var(--dim); font-family: Consolas, monospace; }
.countdown.hot { color: var(--orange); }
.chip { font-size: 10px; font-weight: 800; letter-spacing: .12em; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; }
.chip.locked { background: rgba(255,84,112,.12); color: var(--red); border: 1px solid rgba(255,84,112,.35); }
.chip.open { background: rgba(61,220,132,.1); color: var(--green); border: 1px solid rgba(61,220,132,.3); }
.chip.late { background: rgba(255,138,30,.12); color: var(--orange); border: 1px solid rgba(255,138,30,.4); }
.chip.done { background: rgba(56,225,255,.1); color: var(--cyan); border: 1px solid rgba(56,225,255,.3); }
.chip.mult { background: rgba(255,211,77,.12); color: var(--gold); border: 1px solid rgba(255,211,77,.4); }
.result-line { font-family: Consolas, monospace; font-size: 13px; color: var(--gold); }
.pts-badge { font-family: Consolas, monospace; font-weight: 800; font-size: 13px; }
.pts-badge.pos { color: var(--green); }
.pts-badge.neg { color: var(--red); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--dim); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid rgba(31,46,77,.5); }
tr:hover td { background: rgba(56,225,255,.03); }
.rank-1 td { background: rgba(255,211,77,.07); }
.rank-1 .pl-name::after { content: " 👑"; }
.num { font-family: Consolas, monospace; text-align: right; }
.pool-table-wrap { overflow-x: auto; }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 12px 0; scrollbar-width: thin; }
.day-chip { white-space: nowrap; flex-shrink: 0; }
.day-chip.active { color: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 10px rgba(56,225,255,.2); }
.pool-table th, .pool-table td { text-align: center; padding: 7px 5px; }
.pool-table .pl {
  position: sticky; left: 0; z-index: 2; text-align: left;
  background: var(--bg2); max-width: 120px; min-width: 86px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}
.th-match { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.th-flags { display: flex; align-items: flex-end; gap: 4px; }
.th-team { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.th-code { font-family: var(--cond); font-size: 10px; letter-spacing: .08em; color: var(--text); }
.th-dash { color: var(--dim); font-size: 11px; padding-bottom: 4px; }
.th-match .flag-img.sm { width: 20px; }
.th-id { font-size: 9px; color: var(--dim); letter-spacing: .05em; }
.pool-pts { font-size: 10px; opacity: .85; }
.result-row td { color: var(--gold); font-weight: 800; font-family: Consolas, monospace; background: rgba(255,211,77,.05); }
.result-row .pl { color: var(--gold); background: var(--bg2); }
.th-score { font-family: Consolas, monospace; font-weight: 800; font-size: 13px; color: var(--gold); margin-top: 2px; }
.th-score.pending { color: var(--dim); font-weight: 400; }

/* ---------- profile + chat curtain ---------- */
#user-name { cursor: pointer; border-bottom: 1px dashed var(--line); }
#user-name:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

#chat-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--cyan);
  background: linear-gradient(180deg, var(--panel2), var(--bg2));
  font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,.5), 0 0 14px rgba(56,225,255,.25);
  transition: transform .15s;
}
#chat-toggle:hover { transform: scale(1.08); }
#chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 11px; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
  font-family: var(--cond); box-shadow: 0 0 10px rgba(255,84,112,.6);
  animation: badgepop .25s ease;
}
@keyframes badgepop { from { transform: scale(.3); } to { transform: scale(1); } }

#chat {
  position: fixed; top: 0; right: 0; height: 100dvh; width: min(380px, 94vw);
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border-left: 1px solid var(--line); z-index: 80;
  display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform .28s ease;
  box-shadow: -12px 0 36px rgba(0,0,0,.55);
}
#chat.open { transform: translateX(0); }
.chat-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--cond); letter-spacing: .18em; color: var(--cyan); font-size: 14px;
}
.chat-head button { background: none; border: 0; color: var(--dim); font-size: 26px; cursor: pointer; line-height: 1; }
.chat-head button:hover { color: var(--text); }
#chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 88%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px 10px 10px 3px; padding: 8px 11px; }
.chat-msg.mine { align-self: flex-end; border-radius: 10px 10px 3px 10px; background: rgba(56,225,255,.08); border-color: rgba(56,225,255,.3); }
.chat-who { font-size: 11px; font-weight: 700; color: var(--orange); margin-right: 8px; }
.chat-msg.mine .chat-who { color: var(--cyan); }
.chat-time { font-size: 10px; color: var(--dim); font-family: Consolas, monospace; }
.chat-body { font-size: 14px; margin-top: 3px; word-wrap: break-word; white-space: pre-wrap; }
#chat-older { margin: 8px auto 0; flex-shrink: 0; }
.chat-day {
  text-align: center; font-family: var(--cond); font-size: 10px; letter-spacing: .25em;
  color: var(--dim); text-transform: uppercase; margin: 8px 0 0;
  display: flex; align-items: center; gap: 10px;
}
.chat-day::before, .chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
#chat-form input#chat-input { flex: 1; min-width: 0; }
#chat-attach { flex-shrink: 0; padding: 5px 11px; }
.chat-img { max-width: 100%; max-height: 240px; border-radius: 8px; margin-top: 5px; cursor: pointer; display: block; }
.pool-guess { font-family: Consolas, monospace; white-space: nowrap; }
.pool-guess.exact { color: var(--green); font-weight: 800; }
.pool-guess.dir { color: var(--cyan); }
.pool-guess.wrong { color: var(--red); }
.pool-guess.pending { color: var(--orange); font-style: italic; }

/* admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.admin-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.admin-row input { width: 54px; text-align: center; }
.admin-row input.wide { width: 180px; text-align: left; }
.admin-row .label { flex: 1; min-width: 150px; font-size: 13px; }

/* toast */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--panel2); border: 1px solid var(--cyan); color: var(--text);
  padding: 11px 22px; border-radius: 8px; font-size: 14px; opacity: 0; transition: all .25s;
  box-shadow: 0 0 24px rgba(56,225,255,.25); z-index: 99; pointer-events: none; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); box-shadow: 0 0 24px rgba(255,84,112,.25); }
#toast.update-toast { pointer-events: auto; cursor: pointer; border-color: var(--orange); box-shadow: 0 0 24px rgba(255,165,0,.3); }

.group-tag { color: var(--orange); font-weight: 800; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.filter-bar .btn.ghost.active { color: var(--cyan); border-color: var(--cyan); }
/* ---------- mobile ---------- */
@media (max-width: 700px) {
  #topbar { justify-content: center; padding: 10px 10px; gap: 10px; }
  .brand-sub { display: none; }
  .nv-wordmark { height: 22px; }
  .brand-tr { height: 34px; width: 34px; }
  #nav { width: 100%; justify-content: center; }
  #nav a { padding: 8px 10px; font-size: 12px; }
  main { padding: 16px 10px 70px; }
  h1 { font-size: 19px; }
  .sub { font-size: 12px; }
  .match-card { padding: 12px 12px; }
  .team .name { font-size: 13px; }
  .team .flag { font-size: 22px; }
  .flag-img { width: 28px; }
  .score-box input { width: 52px; padding: 12px 4px; font-size: 20px; } /* fat-finger friendly */
  .btn.sm.save { padding: 9px 14px; }
  .brand-watermark { width: 90vmin; height: 90vmin; right: -20vmin; bottom: -20vmin; opacity: .05; }
  th, td { padding: 6px 6px; font-size: 12.5px; }
  .admin-row .label { min-width: 100%; }
  .hero { padding: 14px; gap: 12px; }
  .hero-ball { width: 58px; height: 58px; }
  .hero-teams .flag-img { width: 32px; }
  .hero-cd { min-width: 100%; text-align: left; }
}
/* keep touch targets sane everywhere */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  input[type="number"] { min-height: 40px; }
}
