:root {
  --bg: #eef1f8; --card: #fff; --ink: #0a1f52; --mute: #6a7596; --line: #e4e8f2;
  --blue: #1f5eff; --blue-d: #0f3fd1; --navy: #0a1f52; --navy-2: #12318a; --yellow: #ffc933;
  --green: #12a15f; --green-bg: #dff5ea; --red: #e0442f; --red-bg: #fde8e4;
  --jordan: #ff6b9a; --guy: #3ddc97; --matt: #ffc933;
  --r: 18px; --shadow: 0 1px 2px rgba(10,31,82,.06), 0 6px 18px rgba(10,31,82,.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, button, input, a, label { touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; }
input { font-size: 16px; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
.top {
  position: sticky; top: 0; z-index: 10; color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  box-shadow: 0 2px 12px rgba(10,31,82,.25);
}
.brand img { height: 30px; display: block; }
.clock-top { font-size: 12px; font-weight: 700; color: #cdd8ff; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 8px; text-decoration: none; color: var(--mute); font-size: 11px; font-weight: 700;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--blue); }
.tabbar a.on span { position: relative; }
.tabbar a.on span::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 16px; height: 3px; margin-left: -8px; border-radius: 3px; background: var(--yellow); }
main { max-width: 640px; margin: 0 auto; padding: 14px 14px 20px; display: grid; gap: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
h2 { margin: 0 0 12px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); font-weight: 800; }
.hidden { display: none !important; }
.muted { color: var(--mute); }
.small { font-size: 12px; }

/* status + team */
.status { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 5px 11px; border-radius: 999px; background: var(--bg); color: var(--ink); }
.pill.live { background: var(--red); color: #fff; }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.team { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--bg); border-radius: 14px; padding: 10px 12px; border-bottom: 3px solid var(--yellow); }
.stat b { display: block; font-size: 17px; letter-spacing: -.4px; white-space: nowrap; }
.stat span { font-size: 10.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* lanes */
.lane { background: linear-gradient(160deg, var(--navy), var(--navy-2)); color: #fff; padding-bottom: 12px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.lane-head b { font-size: 14px; letter-spacing: .12em; display: flex; align-items: center; gap: 8px; }
.lane-head b::before { content: ""; width: 8px; height: 18px; border-radius: 3px; background: var(--yellow); }
.lane-head span { font-size: 12px; font-weight: 700; color: #cdd8ff; background: rgba(255,255,255,.1); padding: 3px 10px; border-radius: 999px; }
.scale { position: relative; height: 16px; margin: 0 30px; font-size: 10px; color: #9fb2ee; font-weight: 700; }
.scale i { position: absolute; transform: translateX(-50%); font-style: normal; }
.scale .tg { transform: translateX(-100%); font-weight: 600; opacity: .8; }
.track {
  position: relative; margin: 0 30px; height: 138px; border-radius: 8px;
  background: linear-gradient(180deg, #2a6bff, #1c4fd1);
  box-shadow: inset 0 2px 8px rgba(0,0,0,.25);
}
.row { position: absolute; left: 0; right: 0; height: 46px; border-bottom: 2px dashed rgba(255,255,255,.35); }
.row.last { border-bottom: 0; }
.q { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed rgba(255,255,255,.4); }
.q.m { border-left: 2px dotted rgba(255,201,51,.7); }
.start { position: absolute; top: 0; bottom: 0; left: -3px; width: 3px; background: #fff; border-radius: 2px; }
.finish {
  position: absolute; top: 0; bottom: 0; right: -10px; width: 10px; border-radius: 0 4px 4px 0;
  background-image:
    linear-gradient(45deg, #0a1f52 25%, transparent 25%, transparent 75%, #0a1f52 75%),
    linear-gradient(45deg, #0a1f52 25%, transparent 25%, transparent 75%, #0a1f52 75%);
  background-size: 10px 10px; background-position: 0 0, 5px 5px; background-color: #fff;
}
.marker {
  position: absolute; width: 38px; height: 38px; margin-left: -19px; z-index: 2;
  transition: left .9s cubic-bezier(.3,.8,.3,1);
}
.marker img { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 40%, #fff); object-fit: cover; padding: 0; display: block; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.marker .n {
  position: absolute; top: 50%; left: 100%; transform: translateY(-50%); margin-left: 4px;
  font-size: 11px; font-weight: 800; background: var(--c); color: var(--navy); padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.marker.flip .n { left: auto; right: 100%; margin-left: 0; margin-right: 4px; }

/* people */
.person { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; padding-top: 0; }
.person img.av { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 40%, #fff); object-fit: cover; padding: 0; }
.person .nm { font-weight: 800; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bac { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.chip { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--mute); }
.chip.ahead { background: var(--green-bg); color: var(--green); }
.chip.behind { background: var(--red-bg); color: var(--red); }

/* staff */
.keeper { border: 2px solid var(--yellow); }
.kp { padding: 12px 0; border-top: 1px solid var(--line); }
.kp:first-of-type { border-top: 0; padding-top: 0; }
.kp h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.kp h3 img { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 40%, #fff); object-fit: cover; }
.btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.big {
  appearance: none; border: 0; border-radius: 14px; background: linear-gradient(180deg, #3b7bff, var(--blue-d)); color: #fff;
  font: inherit; font-weight: 800; font-size: 17px; min-height: 70px; padding: 6px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
  box-shadow: 0 3px 0 #0a2b9a;
}
.big small { font-size: 12px; font-weight: 600; opacity: .85; }
.big:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a2b9a; }
.big:disabled { opacity: .55; }
.undo { margin-top: 8px; width: 100%; background: var(--bg); color: var(--ink); min-height: 42px; font-size: 14px; flex-direction: row; box-shadow: none; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed time { color: var(--blue); font-variant-numeric: tabular-nums; font-weight: 800; min-width: 42px; }
.feed .who { font-weight: 800; }
.feed .x { margin-left: auto; display: flex; gap: 4px; }

/* forms + buttons */
button, input { font: inherit; }
.btn {
  appearance: none; border: 0; border-radius: 12px; background: var(--blue); color: #fff;
  font-weight: 800; padding: 13px 18px; cursor: pointer; box-shadow: 0 3px 0 var(--blue-d);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-d); }
.btn.ghost { background: var(--bg); color: var(--ink); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; box-shadow: none; }
.btn.danger { background: var(--red-bg); color: var(--red); box-shadow: none; }
.btn:disabled { opacity: .5; }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 12px; font-weight: 800; color: var(--mute); }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; background: #f8f9fd; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(31,94,255,.15); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.msg { margin: 8px 0 0; font-size: 13px; font-weight: 700; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.foot { text-align: center; }
.foot button { background: none; border: 0; color: var(--mute); font-size: 13px; padding: 8px; }

/* board */
.hero { text-align: center; color: #fff; padding: 26px 14px; background: radial-gradient(circle at 80% 0%, #3b7bff, transparent 60%), linear-gradient(160deg, var(--navy), var(--navy-2)); }
.hero small { text-transform: uppercase; letter-spacing: .16em; font-weight: 800; color: #9fb2ee; font-size: 11px; }
.hero b { display: block; font-size: 60px; letter-spacing: -2px; line-height: 1.05; color: var(--yellow); }
.hero span { font-size: 13px; color: #cdd8ff; font-weight: 600; }
.entry { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.entry:first-of-type { border-top: 0; padding-top: 0; }
.entry.mine { background: #fff8de; margin: 0 -16px; padding: 11px 16px; border-radius: 12px; }
.entry.dim { opacity: .6; }
.rank { width: 30px; height: 30px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.rank.first { background: var(--yellow); color: var(--navy); }
.entry .guess { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.entry .nm { font-weight: 800; }
.entry .win { font-size: 12px; font-weight: 800; color: var(--green); }
.adm { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pay { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-bottom: 8px; }
.pay div { background: #eaf0ff; border-radius: 12px; padding: 10px 12px; border-bottom: 3px solid var(--yellow); }
.pay span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.pay b { font-size: 20px; letter-spacing: .02em; color: var(--blue-d); font-variant-numeric: tabular-nums; }
.editnote { margin: 0 0 12px; font-size: 13px; font-weight: 700; color: var(--ink); }

/* overlay + toast */
.overlay { position: fixed; inset: 0; z-index: 50; background: linear-gradient(160deg, var(--navy), var(--navy-2)); display: grid; place-items: center; padding: 20px; }
.overlay .card { width: 100%; max-width: 340px; text-align: center; padding: 24px 18px; }
.overlay img { height: 34px; margin-bottom: 14px; }
.overlay input { text-align: center; font-size: 22px; letter-spacing: .3em; }
.overlay .btn { width: 100%; margin-top: 2px; }
.overlay .btn.ghost { margin-top: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 60;
  max-width: 90vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 6px 20px rgba(10,31,82,.35);
  border: 1px solid var(--yellow);
}
.toast.show { opacity: 1; }

/* bet steppers */
.bet-metrics { display: grid; gap: 12px; margin-bottom: 12px; }
.bm { background: #f4f7ff; border-radius: 14px; padding: 12px; border: 1.5px solid var(--line); }
.bm-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bm-top b { font-size: 16px; }
.tt { font-size: 13px; font-weight: 800; color: var(--blue-d); background: #dfe7ff; padding: 3px 10px; border-radius: 999px; }
.tt b { font-size: 15px; }
.pr { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.pav { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 40%, #fff); object-fit: cover; }
.pn { font-weight: 800; }
.stepper { display: grid; grid-template-columns: 44px 104px 44px; gap: 6px; align-items: stretch; }
.st { appearance: none; border: 0; border-radius: 11px; background: var(--blue); color: #fff; font-size: 24px; font-weight: 800; min-height: 44px; cursor: pointer; box-shadow: 0 3px 0 var(--blue-d); padding: 0; }
.st:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--blue-d); }
.val { display: flex; align-items: baseline; justify-content: center; gap: 4px; background: #fff; border: 1.5px solid var(--line); border-radius: 11px; padding: 0 8px; }
.val:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,94,255,.15); }
.val input { width: 3.6ch; min-width: 0; border: 0; background: none; text-align: right; font-size: 20px; font-weight: 800; color: var(--ink); padding: 8px 0; -moz-appearance: textfield; }
.val input::-webkit-outer-spin-button, .val input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.val input:focus { outline: none; }
.val em { font-style: normal; font-size: 13px; font-weight: 800; color: var(--mute); }
.meter { height: 6px; border-radius: 6px; background: #dfe7ff; margin-top: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--yellow)); border-radius: 6px; transition: width .2s; }

.conn { position: sticky; top: 0; z-index: 40; background: var(--yellow); color: var(--navy); text-align: center; font-weight: 800; font-size: 13px; padding: 6px 10px; }
