:root {
  --surface: rgba(14, 14, 18, 0.76);
  --surface-solid: rgba(14, 14, 18, 0.96);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f5f7;
  --muted: rgba(245, 245, 247, 0.62);
  --faint: rgba(245, 245, 247, 0.4);
  --accent: #a46ad8; /* lila del logo de GTA VI */
  --accent-rgb: 147, 86, 202;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 6px;
  --pad: max(20px, env(safe-area-inset-left));
  /* Misma familia que la tienda de Rockstar (Helvetica Now). Se usa la Helvetica del sistema; en Windows, Arial. */
  --font: "Helvetica Now Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: #0b0b0f;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

#road {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  object-fit: cover;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.muted { color: var(--muted); font-weight: 500; }

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.38) 100%);
}

/* ---------- Barra superior ---------- */
.topbar {
  z-index: 2;
  position: fixed;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px var(--pad) 40px;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.55) 0%, rgba(6, 6, 10, 0) 100%);
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 44px; height: 44px; flex: none; display: block; border-radius: 6px; border: 1px solid rgba(255, 143, 194, 0.6); box-shadow: 0 0 18px rgba(255, 95, 168, 0.35); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--muted); }

/* ---------- Cuenta atrás grande ---------- */
.hero {
  position: fixed; z-index: 1; top: 22px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  pointer-events: none; width: max-content; max-width: calc(100vw - 2 * var(--pad));
}
.hero-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}
/* El rótulo del logo pesa a la derecha: se desplaza un poco a la izquierda para que se vea centrado con el contador */
.hero-title img { display: block; height: 150px; width: auto; transform: translateX(-5%); filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.45)); }
.hero-title + .hero-eyebrow { margin-bottom: 8px; }
.hero-title {
  margin: 0 0 10px; font-size: 76px; font-weight: 800; line-height: .95; letter-spacing: -0.035em;
  color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.45), 0 0 1px rgba(0, 0, 0, 0.6);
}
.hero-cd { display: flex; gap: 10px; }
.cd-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 84px; padding: 12px 10px 10px;
  background: rgba(10, 10, 14, 0.62); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.cd-box b { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cd-box span { margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cd-box:first-child { border-color: rgba(var(--accent-rgb), 0.75); }
.cd-box:first-child b { color: var(--accent); }
.hero-sub { margin: 12px 0 0; font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6); }

.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }

.pill, .btn {
  height: 34px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 14px;
  font: 500 13px var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}
.btn { cursor: pointer; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--border-strong); background: rgba(30, 30, 36, 0.7); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); animation: pulse 2s infinite; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
#status-chip.ok .status-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
#status-chip.bad .status-dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2); }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Avisos ---------- */
/* Arriba a la izquierda, debajo del nombre y el logo; sin pisar el contador del centro */
.toasts {
  position: fixed; top: 72px; left: var(--pad);
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  pointer-events: none; z-index: 5; width: min(400px, calc(50vw - 215px));
}
.toast {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 500;
  padding: 10px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: toast-in .35s ease-out, toast-out .4s ease-in 5.6s forwards;
}
.toast::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.toast.fee::before, .toast.refuel::before { background: var(--ok); }
.toast.empty::before, .toast.deadline::before { background: var(--bad); }
.toast.stage::before { background: #60a5fa; }
.toast.arrived::before, .toast.split::before { background: var(--accent); }
.toast.buyback::before { background: #60a5fa; }
/* El aviso de recompra comparte la clase .split con el panel de abajo: se anula ese estilo */
.toast.split { flex-direction: row; gap: 10px; border-top: 1px solid var(--border); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- Panel inferior ---------- */
.dock {
  z-index: 2;
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(220px, 280px);
  gap: 12px;
  padding: 48px var(--pad) 34px;
  background: linear-gradient(0deg, rgba(6, 6, 10, 0.6) 0%, rgba(6, 6, 10, 0) 100%);
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.panel {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.value { font-size: 15px; font-weight: 600; }
.panel-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); }
.panel-foot b { color: var(--text); font-weight: 600; }

.bar { height: 6px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar-fill { height: 100%; width: 0%; border-radius: 2px; background: var(--accent); transition: width .8s ease, background .3s; }
.bar-fill.low { background: var(--bad); }
.bar.thin { height: 4px; }
.bar-fill.alt { background: var(--text); opacity: .85; }

.split { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.split-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.split-head b { color: var(--text); font-weight: 600; }

.pot-sub { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pot-promise { margin-top: 6px; font-size: 12px; font-weight: 500; color: #f5c451; }
.prize { margin: 0 0 20px; padding: 14px 16px; border-radius: 4px; border: 1px solid rgba(245, 196, 81, 0.45); background: linear-gradient(135deg, rgba(245, 196, 81, 0.12), rgba(245, 196, 81, 0.03)); }
.prize .eyebrow { color: #f5c451; }
.prize b { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; line-height: 1.4; }
.prize p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.lead { margin: 0 0 16px; font-size: 13px; color: var(--muted); }
.rules { margin-top: 16px; padding: 12px 14px; border-radius: 4px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); }
.rules b { font-size: 12px; font-weight: 600; }
.rules p { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.sub { margin: 18px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.rules.commit { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.06); }
.wallets li.empty::before { display: none; }
.wallets li.empty { padding-left: 0; }
.wallets .w-line { display: flex; justify-content: space-between; gap: 10px; }
.wallets .w-line span:last-child { color: var(--muted); white-space: nowrap; }
#buybacks li a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); }

.track { position: relative; height: 6px; }
.track-stages { display: flex; gap: 3px; height: 100%; }
.track-stages div { border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.track-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  border-radius: 2px; background: var(--text);
  transition: width .25s linear;
}
.track-marker {
  position: absolute; top: 50%; left: 0;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.25);
  transition: left .25s linear;
}
.track-labels { display: flex; gap: 3px; margin-top: -4px; }
.track-labels span {
  font-size: 11px; color: var(--faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.track-labels span.current { color: var(--text); font-weight: 600; }

.big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.verdict { font-size: 12px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.verdict::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.verdict.ok::before { background: var(--ok); }
.verdict.bad::before { background: var(--bad); }

.legal {
  z-index: 2;
  position: fixed; bottom: 10px; left: 0; right: 0; margin: 0;
  text-align: center; font-size: 11px; color: var(--faint);
  pointer-events: none;
}

/* ---------- Panel lateral ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10;
  width: min(400px, 100vw);
  overflow-y: auto;
  padding: 20px 24px 40px;
  background: var(--surface-solid);
  border-left: 1px solid var(--border);
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.drawer.open { transform: none; box-shadow: -24px 0 60px rgba(0, 0, 0, 0.4); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 8px; }
.drawer h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.drawer section { padding: 20px 0; border-top: 1px solid var(--border); }
.drawer section:first-of-type { border-top: 0; }
.drawer h3 { margin: 0 0 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; word-break: break-all; }
.facts code { font: 500 12px ui-monospace, "SF Mono", Menlo, monospace; color: var(--text); }
.facts code a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); }

.status {
  margin-top: 16px; font-size: 13px; font-weight: 500;
  padding: 10px 12px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.status.ok::before { background: var(--ok); }
.status.warn::before { background: var(--warn); }
.status.bad::before { background: var(--bad); }

.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log li { position: relative; padding: 10px 0 10px 18px; font-size: 13px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.log li::before { content: ""; position: absolute; left: 0; top: 17px; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.log li.fee::before, .log li.refuel::before { background: var(--ok); }
.log li.empty::before, .log li.deadline::before { background: var(--bad); }
.log li.stage::before { background: #60a5fa; }
.log li.arrived::before, .log li.split::before { background: var(--accent); }
.log li.buyback::before { background: #60a5fa; }
.log .meta { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); }

.steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.steps li::marker { color: var(--faint); }
.disclaimer { color: var(--faint); font-size: 12px; line-height: 1.55; margin: 16px 0 0; }

/* ---------- Pantalla de bienvenida ---------- */
.modal {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(4, 4, 8, 0.62);
  animation: fade-in .25s ease-out;
}
.modal[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } }
.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 28px 28px 24px;
  background: #121217;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: rise .3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-close { position: absolute; top: 16px; right: 16px; }
.modal-card h2 { margin: 6px 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.modal-lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.how li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.how .num {
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border-strong); color: var(--text);
}
.how b { font-size: 14px; font-weight: 600; }
.how p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.split-viz { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.sv { padding: 10px 12px; border-radius: 4px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.sv span { font-size: 12px; color: var(--muted); }
.sv b { font-size: 18px; font-weight: 600; }
.sv.pot { background: rgba(var(--accent-rgb), 0.1); border-color: rgba(var(--accent-rgb), 0.35); }
.sv.buy { background: rgba(96, 165, 250, 0.08); border-color: rgba(96, 165, 250, 0.3); }

.modal-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 22px; padding: 14px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
}
.modal-stats div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.modal-stats b { font-size: 17px; font-weight: 600; }
.modal-fine { margin: 16px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.55; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.btn.primary { background: var(--text); color: #0b0b0f; border-color: var(--text); font-weight: 600; }
.btn.primary:hover { background: #ffffff; }
.btn.ghost { background: transparent; }

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1560px) {
  .hide-sm { display: none; }
}
@media (max-width: 1100px) {
  .brand-sub { display: none; }
  .pill.live { display: none; }
  .dock { grid-template-columns: 1fr 1fr; grid-template-areas: "route route" "fuel goal"; }
  .route { grid-area: route; }
  .fuel { grid-area: fuel; }
  .goal { grid-area: goal; }
}

/* ---------- Móvil ---------- */
@media (max-width: 760px) {
  :root { --pad: 14px; }
  .topbar { grid-template-columns: 1fr auto; padding-top: 14px; gap: 10px; }
  .topbar-gap { display: none; }
  .hero { top: 60px; }
  .hero-eyebrow { font-size: 10px; }
  .hero-title { font-size: 48px; margin-bottom: 8px; }
  .hero-title img { height: 108px; }
  .hero-title + .hero-eyebrow { margin-bottom: 6px; }
  .hero-cd { gap: 6px; }
  .cd-box { min-width: 64px; padding: 9px 6px 8px; border-radius: 6px; }
  .cd-box b { font-size: 28px; }
  .cd-box span { font-size: 9px; margin-top: 4px; }
  .hero-sub { font-size: 11px; margin-top: 8px; }
  /* En móvil el contador grande ya dice los días: la tarjeta de abajo sobra y tapaba el 4x4 */
  .goal { display: none; }
  .dock { grid-template-columns: 1fr; grid-template-areas: "route" "fuel"; }
  .brand-name { font-size: 14px; }
  .logo { width: 36px; height: 36px; }
  .pill.live { display: none; }
  .btn span { display: none; }
  .btn { padding: 0 10px; }
  /* En móvil no hay sitio a la izquierda: van centrados debajo del contador */
  .toasts { top: 296px; left: 50%; transform: translateX(-50%); width: min(92vw, 460px); align-items: center; }
  .dock { gap: 8px; padding: 30px 12px 46px; }
  .panel { padding: 12px 14px; gap: 10px; }
  .big { font-size: 22px; }
  .track-labels, #fuel-cap, .hide-xs { display: none; }
  .legal { font-size: 10px; bottom: 8px; padding: 0 16px; line-height: 1.4; }
  .modal { padding: 12px; align-items: end; }
  .modal-card { padding: 22px 18px 18px; border-radius: 8px; }
  .modal-card h2 { font-size: 19px; }
  .modal-stats b { font-size: 15px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .modal-actions {
    position: sticky; bottom: -18px;
    margin: 16px -18px -18px; padding: 12px 18px 18px;
    background: linear-gradient(180deg, rgba(18, 18, 23, 0.85), #121217 30%);
    border-top: 1px solid var(--border);
  }
}
.big-unit { font-size: 0.5em; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* Portátiles con poca altura: contador algo más compacto para no tapar el paisaje */
@media (min-width: 761px) and (max-height: 760px) {
  .hero { top: 18px; }
  .hero-title { font-size: 58px; margin-bottom: 8px; }
  .hero-title img { height: 118px; }
  .hero-title + .hero-eyebrow { margin-bottom: 6px; }
  .cd-box { min-width: 70px; padding: 9px 8px 8px; }
  .cd-box b { font-size: 32px; }
  .hero-sub { margin-top: 8px; font-size: 12px; }
}

/* ?clean: solo la escena (capturas para redes) */
.clean .topbar, .clean .hero, .clean .dock, .clean .legal, .clean .toasts, .clean .modal, .clean .drawer { display: none !important; }
