:root {
  --bg: #000604;
  --panel: rgba(4, 22, 14, .82);
  --panel-solid: #04150d;
  --line: rgba(57, 255, 120, .22);
  --line-strong: rgba(57, 255, 120, .55);
  --g: #39ff78;
  --g-soft: #c8ffdc;
  --g-dim: #4f9e6c;
  --warn: #ffc23d;
  --bad: #ff4d5e;
  --text: #dfffea;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--mono);
  font-size: 15px; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; position: fixed; inset: 0; }
body::after { /* scanlines */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(57,255,120,.035) 0 1px, transparent 1px 3px);
}
button { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--g-dim); }
.small-text { font-size: 12px; line-height: 1.6; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.brand { font-weight: 800; letter-spacing: .22em; color: var(--g); text-shadow: 0 0 12px rgba(57,255,120,.6); font-size: 17px; }
.brand span { color: var(--g-dim); font-weight: 500; letter-spacing: .12em; font-size: .7em; margin-left: 4px; }
.brand.big { font-size: 34px; text-align: center; }
.section-title { font-size: 12px; letter-spacing: .24em; color: var(--g); margin: 14px 0 8px; display: flex; gap: 10px; align-items: baseline; }
.section-title .muted { letter-spacing: .1em; font-size: 11px; }

.field { width: 100%; background: rgba(0, 20, 10, .9); border: 1px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 12px 14px; font: inherit; font-size: 16px; outline: none; }
.field:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(57,255,120,.12); }
.field::placeholder { color: var(--g-dim); }

.btn { border: 1px solid var(--line-strong); background: rgba(57,255,120,.08); color: var(--g); border-radius: 12px;
  padding: 11px 14px; letter-spacing: .14em; font-size: 13px; font-weight: 700; display: inline-flex; gap: 8px;
  align-items: center; justify-content: center; cursor: pointer; }
.btn:active { transform: scale(.98); background: rgba(57,255,120,.16); }
.btn.primary { background: var(--g); color: #00170a; border-color: var(--g); box-shadow: 0 0 22px rgba(57,255,120,.35); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.danger { border-color: rgba(255,77,94,.6); color: var(--bad); background: rgba(255,77,94,.08); }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--g-dim); text-decoration: underline; font-size: 12px; margin-top: 14px; display: inline-block; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid transparent; background: none; color: var(--g);
  display: grid; place-items: center; }
.icon-btn.solid { background: var(--panel); border-color: var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.icon-btn.on { border-color: var(--line-strong); box-shadow: 0 0 12px rgba(57,255,120,.3); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--g); box-shadow: 0 0 8px var(--g); display: inline-block; }
.dot.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.dot.busy { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

/* ---------------- login ---------------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; z-index: 20; }
#loginFx { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-card { position: relative; width: min(380px, 100%); text-align: center; padding: 28px 22px;
  background: rgba(0, 12, 6, .55); border: 1px solid var(--line); border-radius: 22px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sub { font-size: 11px; letter-spacing: .3em; color: var(--g-dim); margin: 8px 0 22px; }
.hint { font-size: 13px; color: var(--g-soft); line-height: 1.5; margin: 0 0 12px; }
.setup { margin-top: 6px; }
.setup .field { text-align: center; letter-spacing: .3em; }
.msg { min-height: 20px; margin-top: 14px; font-size: 12px; color: var(--warn); letter-spacing: .06em; }

/* ---------------- app shell ---------------- */
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.top { padding: calc(var(--safe-t) + 8px) 14px 8px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(0,20,10,.9), rgba(0,6,4,.7)); z-index: 5; }
.top-right { display: flex; align-items: center; gap: 4px; }
.top-right .dot { margin-right: 6px; }
#muteBtn.muted-on { color: var(--g-dim); }
#muteBtn.muted-on #muteWave { display: none; }

.screen { position: absolute; top: calc(var(--safe-t) + 57px); bottom: calc(var(--tabs-h) + var(--safe-b)); left: 0; right: 0;
  display: none; overflow: hidden auto; -webkit-overflow-scrolling: touch; }
.screen.active { display: block; }
.pad { padding: 0 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: 1fr 1fr 84px 1fr 1fr; align-items: center; z-index: 6;
  background: linear-gradient(0deg, rgba(0,10,6,.98), rgba(0,14,8,.92)); border-top: 1px solid var(--line); }
.tab { background: none; border: 0; color: var(--g-dim); display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; letter-spacing: .18em; padding: 8px 0; }
.tab.active { color: var(--g); text-shadow: 0 0 8px rgba(57,255,120,.6); }
.mic { width: 64px; height: 64px; margin: -26px auto 0; border-radius: 50%; border: 2px solid var(--g); color: #00170a;
  background: radial-gradient(circle at 50% 40%, #8dffb2, var(--g) 55%, #11a845); box-shadow: 0 0 26px rgba(57,255,120,.55);
  display: grid; place-items: center; }
.mic .ico { width: 28px; height: 28px; stroke-width: 2; }
.mic.listening { animation: pulse 1s ease-in-out infinite; background: radial-gradient(circle, #fff, var(--g) 60%); }
.mic.thinking { background: radial-gradient(circle, #ffe08a, var(--warn) 60%); border-color: var(--warn); box-shadow: 0 0 26px rgba(255,194,61,.5); }
.mic.speaking { background: radial-gradient(circle, #c8ffdc, #2ad46a 60%); }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(57,255,120,.18), 0 0 34px rgba(57,255,120,.8); } }

/* ---------------- core ---------------- */
#tab-core.active { display: flex; flex-direction: column; overflow: hidden; }
.reactor-wrap { position: relative; flex: 0 0 auto; height: min(38vh, 300px); }
#reactor { width: 100%; height: 100%; display: block; }
.core-state { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-size: 11px; letter-spacing: .4em; color: var(--g-dim); }
.log { flex: 1 1 auto; overflow-y: auto; padding: 8px 14px 4px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.line { max-width: 88%; padding: 10px 12px; border-radius: 14px; line-height: 1.45; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.line.me { align-self: flex-end; background: rgba(57,255,120,.12); border: 1px solid var(--line); color: var(--g-soft); }
.line.glitch { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.line.glitch::before { content: "GLITCH //"; display: block; font-size: 10px; letter-spacing: .24em; color: var(--g); margin-bottom: 4px; }
.line.err { border-color: rgba(255,77,94,.5); color: #ffc9cf; }
.ask { display: flex; gap: 8px; padding: 8px 14px 10px; }
.ask.slim { padding: 0 0 8px; }
.ask .btn { flex: 0 0 48px; padding: 0; }

/* ---------------- sports ---------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: rgba(0,20,10,.8); color: var(--g-soft); border-radius: 999px;
  padding: 8px 14px; font-size: 11.5px; letter-spacing: .16em; }
.chips.small .chip { padding: 6px 12px; font-size: 11px; }
.chip.active { background: var(--g); color: #00170a; border-color: var(--g); font-weight: 700; }
.ticker { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 10px; scrollbar-width: none; }
.ticker::-webkit-scrollbar { display: none; }
.game { flex: 0 0 auto; min-width: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--panel);
  font-size: 12px; line-height: 1.5; }
.game.live { border-color: var(--bad); box-shadow: 0 0 10px rgba(255,77,94,.25); }
.game .st { font-size: 10px; letter-spacing: .14em; color: var(--g-dim); }
.game.live .st { color: var(--bad); }
.game .row { display: flex; justify-content: space-between; gap: 10px; }
.game b { color: var(--g-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; padding: 4px 14px 24px; }
.team { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 10px 6px 8px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 108px; }
.team:active { border-color: var(--line-strong); background: rgba(57,255,120,.1); }
.team img, .logo-ph { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(57,255,120,.25)); }
.logo-ph { display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--g); font-weight: 800; font-size: 13px; }
.team .nm { font-size: 10.5px; letter-spacing: .06em; line-height: 1.25; color: var(--g-soft); }
.event-row { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 12px; display: flex;
  justify-content: space-between; align-items: center; gap: 10px; grid-column: 1 / -1; }
.event-row .nm { font-size: 13px; color: var(--g-soft); line-height: 1.35; }
.event-row .st { font-size: 10px; color: var(--g-dim); letter-spacing: .12em; margin-top: 3px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--g-dim); padding: 30px 10px; font-size: 13px; line-height: 1.5; }

/* ---------------- modal sheets ---------------- */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; }
.modal-card { position: relative; width: 100%; max-height: 88vh; overflow-y: auto; background: var(--panel-solid);
  border-top: 1px solid var(--line-strong); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b));
  box-shadow: 0 -10px 40px rgba(57,255,120,.12); animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.close { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; border: 0; background: none; color: var(--g); font-size: 28px; line-height: 1; }
.team-head { display: flex; align-items: center; gap: 14px; margin-right: 36px; }
.team-head img, .team-head .logo-ph { width: 64px; height: 64px; }
.team-head .nm { font-size: 18px; font-weight: 800; letter-spacing: .06em; }
.team-head .rec { font-size: 12px; color: var(--g-dim); letter-spacing: .12em; margin-top: 4px; }
.facts { display: grid; gap: 8px; margin: 14px 0 6px; }
.fact { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; }
.fact .k { font-size: 10px; letter-spacing: .2em; color: var(--g-dim); display: block; margin-bottom: 2px; }
.fact.live { border-color: var(--bad); }
.fact.live .k { color: var(--bad); }
.video-card { padding-top: 14px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.clips { display: grid; gap: 8px; margin-top: 10px; }
.clip { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: none; text-align: left; }
.clip.active { border-color: var(--line-strong); background: rgba(57,255,120,.08); }
.clip img { background: #021009; width: 112px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.clip .t { font-size: 12.5px; line-height: 1.35; color: var(--g-soft); }
.clip .c { font-size: 10.5px; color: var(--g-dim); margin-top: 3px; letter-spacing: .06em; }
.mem { display: grid; gap: 6px; }
.mem .item { display: flex; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; align-items: center; }
.mem .item button { flex: 0 0 auto; }

/* ---------------- nav ---------------- */
#tab-nav { overflow: hidden; }
.map { position: absolute; inset: 0; background: #010a06; }
.leaflet-container { background: #010a06; font-family: var(--mono); }
.map .base-tiles { filter: sepia(1) hue-rotate(95deg) saturate(2.3) brightness(.82) contrast(1.15); }
.leaflet-control-attribution { background: rgba(0,10,6,.7) !important; color: var(--g-dim) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--g-dim) !important; }
.leaflet-control-zoom { display: none; }
.nav-search { position: absolute; top: 10px; left: 12px; right: 64px; z-index: 500; }
.nav-search .field { background: var(--panel); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.map-tools { position: absolute; top: 10px; right: 12px; z-index: 500; display: grid; gap: 8px; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 600; max-height: 55%; overflow-y: auto; background: var(--panel-solid);
  border-top: 1px solid var(--line-strong); border-radius: 18px 18px 0 0; padding: 12px 14px 14px; }
.place { display: block; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: none; padding: 10px 12px; margin-bottom: 8px; }
.place .nm { font-size: 14px; color: var(--g-soft); }
.place .ad { font-size: 11.5px; color: var(--g-dim); margin-top: 3px; line-height: 1.35; }
.eta { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.eta .big { font-size: 28px; font-weight: 800; color: var(--g); text-shadow: 0 0 10px rgba(57,255,120,.5); }
.eta .delay { font-size: 12px; color: var(--warn); }
.eta .delay.clear { color: var(--g-dim); }
.dest { font-size: 13px; color: var(--g-soft); margin: 4px 0 10px; }
.next-step { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: rgba(57,255,120,.06); }
.next-step .arrow { font-size: 26px; color: var(--g); width: 32px; text-align: center; }
.next-step .tx { font-size: 14px; line-height: 1.35; }
.next-step .mi { font-size: 11px; color: var(--g-dim); margin-top: 3px; }
.route-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.route-row .chip { padding: 7px 12px; }
.steps { font-size: 12.5px; line-height: 1.45; color: var(--g-soft); padding-left: 18px; margin: 8px 0 0; }
.steps li { margin-bottom: 6px; }
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--g); border: 3px solid #001a0b; box-shadow: 0 0 0 6px rgba(57,255,120,.25), 0 0 18px var(--g); }
.pin { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #fff; border: 3px solid var(--g); box-shadow: 0 0 14px var(--g); }
.toast { position: absolute; left: 14px; right: 14px; top: 64px; z-index: 700; padding: 10px 12px; border-radius: 12px;
  background: rgba(30, 10, 10, .92); border: 1px solid rgba(255,77,94,.5); color: #ffd6da; font-size: 12.5px; line-height: 1.45; }

/* reply bubble on sports / nav */
.bubble { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); z-index: 25;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; padding: 10px 12px; font-size: 13.5px;
  line-height: 1.45; box-shadow: 0 0 24px rgba(57,255,120,.18); max-height: 30vh; overflow-y: auto; }
.bubble .who { font-size: 10px; letter-spacing: .24em; color: var(--g); display: block; margin-bottom: 3px; }

@media (prefers-reduced-motion: reduce) { .mic.listening { animation: none; } .modal-card { animation: none; } }
