:root {
  --bg: #020b14; --card: #001729; --card2: #00223d; --line: #12324f;
  --text: #e6eef7; --muted: #8aa0b5; --blue: #0072ce; --cyan: #38bdf8;
  --green: #22c55e; --red: #ef4444; --amber: #f59e0b;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Menlo, monospace; }
.hidden { display: none !important; }

/* shell */
.shell { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: 76px; }
header.top { position: sticky; top: 0; z-index: 10; background: rgba(0, 24, 41, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; }
.logo { width: 26px; height: 26px; transform: rotate(45deg); background: #fff; border: 2px solid #000; display: grid; place-items: center; flex: none; }
.logo i { display: block; width: 10px; height: 10px; background: var(--blue); }
header.top h1 { font-size: 16px; letter-spacing: .08em; text-transform: uppercase; }
header.top .who { margin-left: auto; font-size: 12px; color: var(--muted); }
main { width: 100%; max-width: 980px; margin: 0 auto; padding: 16px; flex: 1; }
nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: #001829; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.tabs button { flex: 1; background: none; border: 0; padding: 9px 2px 8px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; cursor: pointer; }
nav.tabs button b { font-size: 19px; line-height: 1; font-weight: 400; }
nav.tabs button.on { color: #fff; box-shadow: inset 0 2px 0 var(--blue); }
@media (min-width: 720px) {
  .shell { padding-bottom: 0; }
  nav.tabs { position: sticky; top: 51px; bottom: auto; border: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  nav.tabs button { flex: none; flex-direction: row; gap: 8px; padding: 12px 18px; font-size: 14px; box-shadow: none; border-bottom: 2px solid transparent; }
  nav.tabs button.on { box-shadow: none; border-bottom-color: var(--blue); }
  .shell { display: block; }
}

/* basics */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card.hero { background: linear-gradient(140deg, var(--card2), #000e1a); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.stack > * + * { margin-top: 10px; }
input, select, textarea { width: 100%; background: #001124; border: 1px solid #1d4163; border-radius: 12px; padding: 11px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.btn { background: var(--blue); border: 0; color: #fff; font-weight: 600; padding: 11px 16px; border-radius: 12px; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: #0d2a44; }
.btn.danger { background: #7f1d1d; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #0d2a44; color: var(--cyan); }
.pill.live { background: var(--red); color: #fff; }
.pill.live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.err { color: #fca5a5; font-size: 13px; min-height: 18px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* match hero */
.scoreline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; padding: 14px 0 6px; }
.team { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; }
.team img { width: 54px; height: 54px; object-fit: contain; }
.team span { font-size: 14px; }
.score { white-space: nowrap; font-size: clamp(28px, 9vw, 42px); font-weight: 800; letter-spacing: .04em; background: #000e1a; border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; }
.matchnav { display: flex; justify-content: space-between; align-items: center; }
.matchnav button { background: none; border: 0; color: var(--cyan); font-size: 22px; cursor: pointer; padding: 0 8px; }
.matchnav button:disabled { color: #2a4157; cursor: default; }

/* goals */
.goal { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: baseline; }
.goal:first-of-type { border-top: 0; }
.goal .min { min-width: 42px; font-weight: 700; color: var(--cyan); }
.goal.hsv .min { color: var(--green); }

/* probability */
.probbar { display: flex; height: 26px; border-radius: 99px; overflow: hidden; border: 1px solid var(--line); background: #000e1a; font-size: 12px; font-weight: 700; }
.probbar div { display: grid; place-items: center; transition: width .7s; min-width: 0; overflow: hidden; white-space: nowrap; }
.probbar .w { background: linear-gradient(90deg, #0a5aa8, #38bdf8); }
.probbar .d { background: #475569; }
.probbar .l { background: linear-gradient(90deg, #b91c1c, #ef4444); }

/* pitch */
.pitch { border-radius: 14px; border: 2px solid rgba(74, 222, 128, .3); background: #0b3d1b repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 36px, transparent 36px 72px); padding: 16px 6px; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-height: 400px; box-shadow: inset 0 0 50px rgba(0,0,0,.55); }
.pitch .line { display: flex; justify-content: space-around; }
.pl { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; width: 74px; text-align: center; }
.pl i { font-style: normal; width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #00223d; border: 2px solid var(--blue); font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.pl.gk i { background: var(--amber); border-color: #fde68a; color: #1c1100; }
.pl span { margin-top: 3px; font-size: 11px; font-weight: 700; background: rgba(2, 11, 20, .85); padding: 1px 6px; border-radius: 6px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 600; text-align: center; padding: 8px 4px; }
td { padding: 9px 4px; text-align: center; border-top: 1px solid #0c2740; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-right: 8px; }
tr.hsv td { background: rgba(0, 114, 206, .22); font-weight: 700; }
tr.hsv td:first-child { box-shadow: inset 4px 0 var(--blue); }
.form { display: inline-flex; gap: 2px; }
.form b { width: 16px; height: 16px; border-radius: 4px; font-size: 9px; line-height: 16px; color: #fff; }
.form .S { background: #16a34a; } .form .U { background: #64748b; } .form .N { background: #dc2626; }
.hide-sm { display: none; }
@media (min-width: 560px) { .hide-sm { display: table-cell; } }
.fixture { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid #0c2740; font-size: 14px; cursor: pointer; }
.fixture:first-of-type { border-top: 0; }
.fixture .d { width: 92px; color: var(--muted); font-size: 12px; flex: none; }
.fixture .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fixture .r { font-weight: 800; min-width: 44px; text-align: right; }
.fixture.next { background: rgba(0, 114, 206, .15); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }

/* tipping */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #001124; border: 1px solid #1d4163; border-radius: 99px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip.on { background: rgba(0, 114, 206, .35); border-color: var(--cyan); font-weight: 700; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.scoreinput { display: flex; align-items: center; gap: 10px; justify-content: center; }
.scoreinput input { width: 64px; text-align: center; font-size: 22px; font-weight: 800; }
.rank { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; }
.rank.me { background: rgba(0, 114, 206, .25); }
.rank .n { width: 26px; height: 26px; border-radius: 50%; background: #1e293b; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.rank:nth-child(1) .n { background: #fbbf24; color: #1c1100; }
.rank:nth-child(2) .n { background: #cbd5e1; color: #0f172a; }
.rank:nth-child(3) .n { background: #b45309; color: #fff; }
.rank .p { margin-left: auto; font-weight: 800; }

/* pass */
.pass { background: linear-gradient(135deg, #001c33, #002b49 60%, #004578); border: 1px solid rgba(56, 189, 248, .3); border-radius: 22px; padding: 18px; box-shadow: 0 18px 40px -14px rgba(0, 114, 206, .5); }
.seatgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; background: rgba(0, 0, 0, .3); border-radius: 14px; padding: 10px; margin: 12px 0; }
.seatgrid small { display: block; font-size: 10px; text-transform: uppercase; color: #7dd3fc; }
.seatgrid b { font-size: 17px; }
.qr { background: #fff; border-radius: 12px; padding: 6px; display: inline-block; }
.qr img { display: block; width: 190px; height: 190px; }

/* chat */
.chatbox { height: 52dvh; overflow-y: auto; padding: 6px 2px; }
.msg { margin-bottom: 10px; }
.msg .meta { font-size: 11px; color: var(--muted); }
.msg .bub { display: inline-block; max-width: 92%; background: #0d2a44; padding: 8px 12px; border-radius: 6px 16px 16px 16px; word-break: break-word; }
.msg.mine { text-align: right; }
.msg.mine .bub { background: #0b4f8c; border-radius: 16px 6px 16px 16px; text-align: left; }

/* auth */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% -10%, #00355d, var(--bg) 60%); }
.auth .card { width: 100%; max-width: 400px; padding: 24px; }
.seg { display: flex; background: #001124; border-radius: 12px; padding: 3px; }
.seg button { flex: 1; background: none; border: 0; padding: 8px; border-radius: 9px; color: var(--muted); cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--blue); color: #fff; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 30px); opacity: 0; transition: .3s; background: #0b1f33; border: 1px solid var(--blue); padding: 10px 16px; border-radius: 12px; z-index: 50; pointer-events: none; max-width: 90vw; font-size: 14px; }
#toast.on { transform: translate(-50%, 0); opacity: 1; }

.pl.empty i { background: rgba(255,255,255,.12); color: #fff; border: 2px dashed rgba(255,255,255,.55); font-size: 20px; }
.pl.active i { outline: 3px solid var(--cyan); outline-offset: 2px; transform: scale(1.1); }
.pl:disabled { cursor: default; }
.seatgrid div:not(.taken) b { color: var(--muted); font-weight: 400; }
.seatgrid .taken { background: rgba(14, 165, 233, .15); border-radius: 8px; padding: 2px; }
nav.tabs button { min-width: 0; }
