/* 3BO Downhill Tracker Simulator — theme-aware UI (tokens.css). */

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--3bo-font-body);
  background: var(--3bo-bg);
  color: var(--3bo-ink);
  transition: background .2s ease, color .2s ease;
}

#stage {
  background: var(--3bo-bg);
}

.sim-ink { color: var(--3bo-ink); }
.sim-muted { color: var(--3bo-muted); }
.sim-overlay { background: var(--3bo-overlay); }

.sim-card {
  background: var(--3bo-panel-bg-strong);
  border: 1px solid var(--3bo-panel-border);
  border-radius: 18px;
  padding: 1.5rem 1.35rem 1.6rem;
  box-shadow: var(--3bo-card-shadow);
  color: var(--3bo-text-on-panel);
  max-width: 32rem;
  width: calc(100% - 2rem);
}

.sim-card .sim-ink { color: var(--3bo-text-on-panel); }
.sim-card .sim-muted { color: var(--3bo-muted); }
.sim-card h1, .sim-card h2 { color: var(--3bo-text-on-panel); }

.hud-brand, .hud-stats { color: var(--3bo-ink); }
a.hud-brand { text-decoration: none; cursor: pointer; }
a.hud-brand:hover { color: var(--3bo-cyan); }
.hud-sep { color: var(--3bo-muted); }
.hud-link {
  background: transparent; border: none; color: var(--3bo-muted);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.hud-link:hover { color: var(--3bo-ink); }

#hud-top {
  background: var(--3bo-hud-scrim);
}

.story-chip {
  color: var(--3bo-cyan);
}

.btn-primary {
  display: inline-block; padding: 0.7rem 1.4rem; border-radius: 9999px;
  background: var(--3bo-cyan); color: #01374d; font-weight: 700;
  font-family: var(--3bo-font-body); text-decoration: none; border: none;
  cursor: pointer; transition: transform .08s ease, background .15s ease;
}
.btn-primary:hover { background: var(--3bo-cyan-soft); }
.btn-primary:active { transform: scale(.97); }

.btn-secondary {
  display: inline-block; padding: 0.7rem 1.4rem; border-radius: 9999px;
  background: transparent; color: var(--3bo-ink);
  border: 1px solid var(--3bo-panel-border); font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn-secondary:hover { border-color: var(--3bo-cyan); }

.btn-ghost {
  display: inline-block; padding: 0.55rem 1.1rem; border-radius: 9999px;
  background: transparent; color: var(--3bo-muted); border: none;
  font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { color: var(--3bo-ink); }

.steer-pad {
  width: 4.5rem; height: 4.5rem; border-radius: 9999px;
  background: rgba(64,168,207,0.20); border: 1px solid var(--3bo-panel-border);
  color: var(--3bo-ink); font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.steer-pad:active { background: rgba(64,168,207,0.38); }

.panic-fab {
  position: absolute; right: 1rem; bottom: 1.5rem; z-index: 20;
  width: 3.6rem; height: 3.6rem; border-radius: 9999px;
  background: #c0292c; color: #fff; font-size: 1.4rem;
  border: 2px solid rgba(255,255,255,.4);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
}
.panic-fab:active { transform: scale(.95); }

.walkthrough {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.walkthrough.hidden { display: none; }
.wt-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 12, 20, 0.72);
  backdrop-filter: blur(4px);
}
.wt-panel {
  position: relative; margin: 0 auto;
  max-width: 560px; width: min(100%, 560px);
  max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--3bo-panel-bg-strong);
  border: 1px solid var(--3bo-panel-border);
  border-radius: 18px; padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  color: var(--3bo-text-on-panel);
  z-index: 1;
}
.wt-panel:has(.wa-dual),
.wt-panel.wt-panel--dual {
  max-width: 880px;
  width: min(100%, 880px);
}
.wt-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: .8rem;
}
#wt-title { color: var(--3bo-text-on-panel); }
.wt-body { display: flex; flex-direction: column; gap: .9rem; }

.wt-explainer {
  font-size: .92rem; line-height: 1.5;
  color: var(--3bo-explainer-text);
  background: var(--3bo-explainer-bg);
  border-left: 3px solid var(--3bo-cyan);
  padding: .7rem .85rem; border-radius: 8px;
}
.wt-explainer strong { color: var(--3bo-text-on-panel); }
.wt-explainer em { color: var(--3bo-cyan); font-style: normal; font-weight: 600; }
.wt-step-actions { display: flex; justify-content: center; margin-top: .3rem; }

.wa-phone {
  background: #0b141a; border: 1px solid #1f2c33; border-radius: 14px;
  padding: .8rem; max-width: 26rem; margin: 0 auto;
}
.wa-device-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--3bo-cyan); margin-bottom: .45rem;
}
.wa-template-badge {
  font-size: .68rem; font-weight: 700; line-height: 1.35;
  color: #01374d; background: rgba(64,168,207,.28);
  border: 1px dashed rgba(64,168,207,.55);
  border-radius: 8px; padding: .35rem .5rem; margin-bottom: .5rem;
}
html[data-3bo-theme="dark"] .wa-template-badge {
  color: #e8f6fc; background: rgba(64,168,207,.18);
}
.wa-dual {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
}
.wa-dual .wa-phone {
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  position: relative;
  z-index: 0;
}
.wa-phone-waiting { opacity: .85; border-style: dashed; }
.wa-waiting-body {
  color: #8696a0; font-size: .82rem; line-height: 1.45; padding: .35rem 0 .2rem;
}
.wa-link-hint {
  font-size: .68rem; color: #8696a0; word-break: break-all; text-align: center; margin-top: .15rem;
}
@media (max-width: 820px) {
  .wa-dual { grid-template-columns: 1fr; }
}
.wa-header {
  display: flex; align-items: center; gap: .5rem;
  padding-bottom: .5rem; border-bottom: 1px solid #1f2c33; margin-bottom: .6rem;
}
.wa-avatar {
  width: 2rem; height: 2rem; border-radius: 9999px;
  background: var(--3bo-cyan); display: flex; align-items: center; justify-content: center;
  color: #01374d; font-weight: 800; font-size: .8rem;
}
.wa-name { font-weight: 600; font-size: .9rem; color: #e9edef; }
.wa-sub { font-size: .7rem; color: #8696a0; }
.wa-bubble {
  background: #005c4b; color: #e9edef; border-radius: 10px;
  padding: .6rem .75rem; font-size: .85rem; white-space: pre-wrap;
  line-height: 1.4; margin-bottom: .5rem;
}
.wa-bubble.owner { background: #1f2c33; }
.wa-buttons { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
.wa-btn {
  background: rgba(64,168,207,.16); color: var(--3bo-cyan);
  border: 1px solid rgba(64,168,207,.35); border-radius: 8px;
  padding: .5rem .7rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; text-align: center;
}
.wa-btn:hover { background: rgba(64,168,207,.28); }
.wa-btn.clickable {
  background: var(--3bo-cyan); color: #01374d; border-color: var(--3bo-cyan);
  font-weight: 700; box-shadow: 0 0 0 3px rgba(64,168,207,.25);
}
.wa-btn.clickable:hover { background: var(--3bo-cyan-soft); }
.wa-btn.disabled {
  opacity: .42; cursor: not-allowed; border-style: dashed;
}

.ff-section { margin-top: .2rem; }
.ff-title { font-size: .82rem; font-weight: 700; color: var(--3bo-cyan); margin-bottom: .5rem; }
.ff-list { display: flex; flex-direction: column; gap: .5rem; }
.ff-row {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .7rem; border: 1px solid var(--3bo-panel-border); border-radius: 10px;
}
.ff-row .dot { width: .55rem; height: .55rem; border-radius: 9999px; background: var(--3bo-cyan); }
.ff-row .dot.sent { background: #4ade80; }
.ff-name { font-size: .875rem; color: var(--3bo-text-on-panel); }
.ff-sub { font-size: .75rem; color: var(--3bo-muted); }

.wa-bubble.ff-bubble {
  background: #1a2a1f; border: 1px solid rgba(74,222,128,.3); color: #e9edef;
}

/* Interactive spoofed live tracker (Leaflet + HUD) */
.tracker-app {
  border: 1px solid var(--3bo-panel-border); border-radius: 14px; overflow: hidden;
  background: #0a1620; color: #fff;
}
.tracker-hud {
  background: rgba(1, 55, 77, 0.96);
  border-bottom: 1px solid rgba(64,168,207,.3);
  padding: .65rem .75rem;
}
.tracker-hud-status {
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: start;
}
.tracker-signal { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 3rem; }
.tracker-signal .bars {
  width: 1.4rem; height: 1rem;
  background: linear-gradient(90deg, #f44336 0 20%, #ff9800 20% 45%, #ff9800 45% 70%, rgba(255,255,255,.2) 70%);
  border-radius: 2px;
}
.tracker-signal .badge {
  font-size: .65rem; font-weight: 800; letter-spacing: .04em;
  padding: .1rem .35rem; border-radius: 4px;
}
.tracker-signal .badge.lost { color: #ff8a80; background: rgba(244,67,54,.18); }
.tracker-signal .badge.live { color: #69f0ae; background: rgba(76,175,80,.18); }
.tracker-label { font-size: .65rem; letter-spacing: .08em; color: rgba(255,255,255,.55); font-weight: 700; }
.tracker-name { font-size: 1.05rem; font-weight: 800; line-height: 1.15; margin: .1rem 0 .2rem; }
.tracker-clock { font-size: .7rem; color: rgba(255,255,255,.45); font-family: ui-monospace, monospace; }
.tracker-coords { font-size: .82rem; color: #ff8a65; font-weight: 700; margin-top: .25rem; }
.tracker-meta { font-size: .68rem; color: rgba(255,255,255,.4); margin-top: .15rem; }
.tracker-battery { text-align: center; color: #69f0ae; font-weight: 700; font-size: .8rem; }
.tracker-battery .bat-icon { display: block; font-size: 1rem; line-height: 1; }
.tracker-map-wrap { position: relative; }
.tracker-map { height: 280px; width: 100%; background: #0a1620; }
.tracker-map-legend {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  padding: .35rem .7rem; background: #0b1a22; color: #b8c4cc; font-size: .68rem;
}
.tracker-map-legend .leg-dot {
  display: inline-block; width: .45rem; height: .45rem; border-radius: 9999px; margin-right: .25rem;
}
.tracker-map-legend .leg-dot.cyan { background: #40a8cf; }
.tracker-map-legend .leg-dot.path { background: #40a8cf; opacity: .5; }
.tracker-map-legend .leg-hint { margin-left: auto; opacity: .7; }
.tracker-controls {
  background: rgba(1, 55, 77, 0.96);
  border-top: 1px solid rgba(64,168,207,.25);
  padding: .55rem .75rem .7rem;
}
.tracker-controls-title {
  font-size: .65rem; letter-spacing: .06em; color: rgba(255,255,255,.5);
  font-weight: 700; margin: .35rem 0 .3rem;
}
.tracker-controls-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.tc-btn {
  font-size: .72rem; font-weight: 600; padding: .35rem .55rem; border-radius: 6px;
  background: rgba(255,255,255,.06); color: #d7e8ef;
  border: 1px solid rgba(64,168,207,.25); cursor: pointer;
}
.tc-btn.active { background: rgba(64,168,207,.25); border-color: #40a8cf; color: #fff; }
.tc-btn:disabled { opacity: .55; cursor: default; }
.tracker-path-toggle {
  margin-top: .45rem; font-size: .75rem; color: #69f0ae; font-weight: 600;
}
.tracker-pin { background: transparent !important; border: none !important; }
.tracker-pin-dot {
  position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.tracker-pin-core {
  width: 28px; height: 28px; border-radius: 9999px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.45);
  position: relative; z-index: 1;
}
.tracker-pin-pulse {
  position: absolute; inset: 0; border-radius: 9999px;
  background: rgba(64,168,207,.45);
  animation: pinPulse 1.8s ease-out infinite;
}
@keyframes pinPulse {
  0% { transform: scale(.6); opacity: .8; }
  100% { transform: scale(1.6); opacity: 0; }
}
.wt-tracker-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem;
  margin-top: .6rem;
}
@media (max-width: 520px) {
  .tracker-map { height: 220px; }
}

.hud-heart { width: 18px; height: 18px; image-rendering: pixelated; transition: opacity .2s ease; }

.toast {
  position: absolute; top: 4.5rem; left: 50%; transform: translateX(-50%);
  z-index: 25; background: rgba(1,55,77,.96); color: #fff;
  border: 1px solid var(--3bo-cyan); border-radius: 9999px;
  padding: .5rem 1.1rem; font-size: .85rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); pointer-events: none;
}
.toast.hidden { display: none; }

#theme-toggle {
  background: transparent; border: 1px solid var(--3bo-panel-border);
  border-radius: 8px; padding: .2rem .45rem; color: var(--3bo-ink); cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary, .btn-secondary, body { transition: none; }
}

/* Layout utilities formerly supplied by Tailwind CDN (production must not use cdn.tailwindcss.com) */
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }
.inset-x-0 { left: 0; right: 0; }
.top-0 { top: 0; }
.bottom-0 { bottom: 0; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.flex { display: flex; }
.hidden { display: none !important; }
.block { display: block; }
.w-screen { width: 100vw; }
.h-screen { height: 100vh; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-8 { height: 2rem; }
.w-8 { width: 2rem; }
.h-14 { height: 3.5rem; }
.w-14 { width: 3.5rem; }
.h-20 { height: 5rem; }
.w-20 { width: 5rem; }
.select-none { user-select: none; -webkit-user-select: none; }
.touch-none { touch-action: none; }
.overflow-hidden { overflow: hidden; }
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.pb-5 { padding-bottom: 1.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-wider { letter-spacing: 0.05em; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }
.max-w-md { max-width: 28rem; }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.font-body { font-family: var(--3bo-font-body); }
.font-display { font-family: var(--3bo-font-display); }
@media (min-width: 640px) {
  .sm\:inline { display: inline; }
  .sm\:hidden { display: none !important; }
  .sm\:pb-7 { padding-bottom: 1.75rem; }
  .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
}

