/* Web pública: responsive, primero móvil. */
:root {
  --bg: #06080c; --panel: #0e1117; --card: rgba(255,255,255,0.055); --line: #1f2430;
  --text: #eef0f4; --muted: #8d94a5;
  --brand: #ff3b3b;   /* color de la web (fijo) */
  --accent: #ff3b3b;  /* color del escenario: solo en lo que se ve en el mapa (cifra, avisos, curva) */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
button, select, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* cabecera */
.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.nav { display: flex; gap: 14px; font-size: 13px; font-weight: 700; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current] { color: #fff; }
a { color: #fff; }
.logo { font: 26px/1 Anton, Impact, sans-serif; letter-spacing: .5px; color: #fff; text-decoration: none; }
.logo b { font-weight: 400; color: var(--brand); }

/* estructura: una columna en móvil */
.app { flex: 1; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; max-width: 1400px; margin: 0 auto; }
.main { padding: 14px 16px 8px; min-width: 0; }
.panel { padding: 8px 16px 24px; min-width: 0; }

/* título */
.titlebar { display: grid; gap: 8px; }
.pick select {
  width: 100%; appearance: none; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 38px 11px 14px; font-weight: 700; cursor: pointer;
}
.chip {
  justify-self: start; display: inline-flex; align-items: center; gap: 7px; background: var(--card); color: #fff; font-weight: 800; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; padding: 4px 12px; border-radius: 99px;
}
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
h1 { font: 28px/1.08 Anton, Impact, sans-serif; text-transform: uppercase; margin: 0; letter-spacing: .3px; }
h1 em, h2 em { font-style: normal; color: var(--brand); }

/* reloj y métrica principal */
.statbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 14px 0 8px; }
.statbar .right { text-align: right; }
.clock, .big { font: 34px/1 Anton, Impact, sans-serif; font-variant-numeric: tabular-nums; }
.big { color: var(--accent); text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 60%, transparent); }

/* mapa */
.stage { position: relative; width: 100%; aspect-ratio: 1040 / 856; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid rgba(255,255,255,.1); touch-action: none; }
#cv { display: block; width: 100%; height: 100%; cursor: crosshair; }
#cv.dragging { cursor: grabbing; }
.feed { position: absolute; left: 8px; top: 8px; right: 52px; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; pointer-events: none; }
.feed li {
  justify-self: start; max-width: 100%; background: rgba(12,14,20,.9); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  animation: slide .35s ease-out;
}
.feed li b { color: var(--accent); margin-right: 6px; }
.feed li:nth-last-child(2) { opacity: .7; }
.feed li:nth-last-child(3) { opacity: .4; }
.feed li:not(:last-child) { display: none; }
@keyframes slide { from { transform: translateX(-110%); } }
.hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(0,0,0,.7); border: 1px solid rgba(255,255,255,.15);
  padding: 6px 12px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; transition: opacity .4s;
}
.hint.off { opacity: 0; }
@media (max-width: 639px) { .hint { bottom: auto; top: 44px; } .transport { flex-wrap: wrap; } .transport #scrub { order: 5; flex: 1 1 100%; } }
.zoom { position: absolute; right: 8px; top: 8px; display: grid; gap: 4px; }
.pill { position: absolute; right: 8px; bottom: 12px; background: rgba(10,12,16,.88); border: 1px solid rgba(255,255,255,.2); border-radius: 99px; padding: 7px 12px; font-size: 12px; font-weight: 800; cursor: pointer; }
.pill[hidden], .start[hidden] { display: none; }
.start { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; padding-bottom: 44px; background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.6)); font-weight: 800; text-align: center; pointer-events: none; }
.start.top { justify-content: flex-start; padding: 14px 0 0; background: linear-gradient(0deg, transparent 55%, rgba(0,0,0,.6)); }
.start .big-play { pointer-events: auto; border-radius: 99px !important; font-size: 17px; font-weight: 800; padding: 12px 26px !important; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.start .sub { font-weight: 600; text-shadow: 0 1px 6px #000; }
button:disabled { opacity: .4; cursor: default; filter: none; }
#btn-reset { white-space: nowrap; }
.zoom button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15); background: rgba(10,12,16,.82); font-size: 18px; font-weight: 700; cursor: pointer; }
.busy, .result { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; }
.busy { background: rgba(0,0,0,.6); font-weight: 700; }
.busy[hidden], .result[hidden] { display: none; }
.spinner { width: 32px; height: 32px; border: 4px solid #fff3; border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { background: rgba(4,5,8,.82); animation: fade .4s ease-out; }
.result h2 { font: 30px/1.05 Anton, Impact, sans-serif; text-transform: uppercase; margin: 4px 0 0; }
.result ul { list-style: none; margin: 0; padding: 0; color: rgba(255,255,255,.85); font-weight: 600; font-size: 14px; }
.result .row { display: flex; gap: 8px; }
@keyframes fade { from { opacity: 0; } }

/* controles */
button.primary, button.ghost { border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; border: 1px solid var(--line); }
button.primary { background: var(--brand); color: #000; border-color: transparent; }
button.ghost { background: transparent; }
button:hover { filter: brightness(1.12); }
.transport { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.play { width: 44px; height: 44px; padding: 0 !important; font-size: 16px; flex: none; border-radius: 50% !important; }
#scrub { flex: 1; min-width: 0; accent-color: var(--brand); }
#scrub.loading { background: linear-gradient(90deg, transparent var(--done), rgba(255,255,255,.08) var(--done)); border-radius: 99px; }
.speed { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.speed button { background: none; border: 0; padding: 8px 9px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.speed button.on { background: var(--card); color: #fff; }
#btn-share { display: none; }

/* tarjetas y curva */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.tile { background: var(--card); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.tile .l { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font: 22px/1.1 Anton, Impact, sans-serif; margin-top: 2px; font-variant-numeric: tabular-nums; }
.chart { position: relative; margin-top: 8px; background: rgba(255,255,255,.04); border-radius: 12px; height: 64px; }
.chart span { position: absolute; left: 12px; top: 6px; font-size: 11px; font-weight: 700; color: var(--muted); }
#chart { width: 100%; height: 100%; display: block; }
.note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* panel de parámetros */
details { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
summary { cursor: pointer; font-weight: 800; }
.param { margin-top: 12px; }
.param label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: #cfd3dc; }
.param output { font-variant-numeric: tabular-nums; color: #fff; font-weight: 800; }
.param input[type=range] { width: 100%; accent-color: var(--brand); margin: 6px 0 0; }
.param label { align-items: center; }
.param .num { width: 92px; flex: none; background: #0a0c11; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.result .tip { max-width: 34ch; font-size: 13px; font-weight: 600; color: #fff; background: rgba(255,255,255,.08); border-radius: 10px; padding: 8px 12px; margin: 0; }
.result .tip:empty { display: none; }
.param select { width: 100%; margin-top: 6px; background: #0a0c11; border: 1px solid var(--line); border-radius: 8px; padding: 7px; }
#btn-defaults { margin-top: 14px; width: 100%; }
.about { margin-top: 16px; }
.about h3 { font-size: 14px; margin: 0 0 4px; }


.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot a { color: var(--muted); }
.foot a:hover { color: #fff; }

/* páginas de texto (cómo funciona, sobre, legales) */
.doc { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.doc h1 { font-size: 34px; margin-bottom: 6px; }
.doc h2 { font: 22px/1.2 Anton, Impact, sans-serif; text-transform: uppercase; letter-spacing: .3px; margin: 32px 0 8px; }
.doc h3 { font-size: 16px; margin: 20px 0 4px; }
.doc p, .doc li { color: #c9ced8; }
.doc .lead { font-size: 17px; color: #e3e6ec; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.doc .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.doc .box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 16px 0; }
.doc .links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.doc .links a { display: inline-block; background: var(--card); border-radius: 10px; padding: 8px 14px; text-decoration: none; font-weight: 700; }
.doc .updated { color: var(--muted); font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #fff; color: #000; font-weight: 700; padding: 10px 16px; border-radius: 99px; z-index: 9; }
.toast[hidden] { display: none; }

/* tablet */
@media (min-width: 640px) {
  .main { padding: 18px 24px 8px; }
  .panel { padding: 8px 24px 24px; }
  h1 { font-size: 36px; }
  .clock, .big { font-size: 44px; }
  .feed li { font-size: 13.5px; padding: 6px 12px; }
  .feed li:not(:last-child) { display: block; }
  .tile .l { font-size: 12px; }
  .tile .v { font-size: 28px; }
  #btn-share { display: inline-block; }
  .result h2 { font-size: 44px; }
}

/* escritorio: mapa grande a la izquierda, panel a la derecha */
@media (min-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr) 340px; gap: 8px; }
  .main { padding: 20px 8px 20px 28px; }
  .panel { padding: 20px 28px 20px 0; position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; }
  .titlebar { grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; }
  .titlebar .pick { grid-column: 1 / -1; max-width: 420px; }
  .titlebar h1 { grid-column: 1 / -1; }
  .stage-wrap { display: flex; justify-content: center; }
  .stage { width: min(100%, calc((100vh - 120px) * 1040 / 856)); }
}
