/* GoRush · Carrera de Gophers — paleta azul, dorado y magenta con el cian del gopher. */
:root {
  --azul: #002C71; --azul-osc: #001B47; --dorado: #EAAA00; --magenta: #910048;
  --texto: #2D3B45; --go: #00ADD8; --gopher: #6AD7E5; --bien: #1E9E5A; --mal: #C62839;
  --mono: 'JetBrains Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--azul-osc); }
body {
  font-family: Poppins, system-ui, sans-serif; color: #fff; line-height: 1.45;
  background: radial-gradient(circle at 15% 0%, #0b3f93 0%, var(--azul) 45%, var(--azul-osc) 100%) fixed;
}
h1, h2 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .4em; }
.ic { width: 1.2em; height: 1.2em; vertical-align: -.22em; flex: none; }
.centro { text-align: center; }
.suave { opacity: .75; }
.aviso { color: var(--mal); min-height: 1.3em; font-weight: 600; margin: .6em 0 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: rgba(0, 0, 0, .22); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.35rem; }
.logo .mini { width: 34px; }
.logo b, .marca b span { color: var(--dorado); }
.sub { font-size: .8rem; opacity: .8; text-align: right; }
body.proyector .top { display: none; }
main { padding: 16px; }

.card { background: #fff; color: var(--texto); border-radius: 18px; padding: 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.card .suave { color: #5f6b76; opacity: 1; }
.card.interna { box-shadow: none; background: #f3f6fb; text-align: left; margin-top: 16px; }

.btn {
  font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 12px 22px; cursor: pointer;
  background: var(--dorado); color: #1b2a3a; box-shadow: 0 4px 0 #b07f00; transition: transform .08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #b07f00; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.sec { background: #fff; color: var(--azul); box-shadow: 0 4px 0 #9aa8bd; }
.btn.grande { width: 100%; font-size: 1.12rem; padding: 15px; margin-top: 12px; }
.btn.icono { padding: 10px; line-height: 0; }
.btn.icono .ic { width: 26px; height: 26px; }
.acciones { display: flex; gap: 12px; margin-top: 18px; }
.acciones.centrar { justify-content: center; flex-wrap: wrap; }

.campo { display: block; font-weight: 600; margin: 12px 0; text-align: left; }
.campo input, .campo select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 1.05rem; padding: 12px 14px;
  border: 2px solid #d5dde8; border-radius: 12px; color: var(--texto); background: #fff;
}
.campo input:focus, .campo select:focus { outline: none; border-color: var(--go); }

.entrar, .config { max-width: 480px; margin: 18px auto; text-align: center; }
.config { max-width: 580px; text-align: left; }
.reanudar { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e3e8ef; }
.gopher-grande { width: 110px; margin: 0 auto 8px; color: var(--bien); }
.gopher-grande svg { width: 100%; display: block; animation: flotar 3s ease-in-out infinite; }
section.centro { max-width: 520px; margin: 24px auto; }

/* Reglas */
.reglas { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.reglas li { display: flex; gap: 10px; align-items: flex-start; }
.reglas .ic { width: 26px; height: 26px; color: var(--azul); margin-top: 1px; }

/* ── Proyector: sala de espera ── */
.lobby { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.6fr) minmax(280px, 1.2fr); gap: 18px; align-items: start; }
.unirse { text-align: center; }
.unirse p { margin: .3em 0; }
.enlace { font-weight: 800; color: var(--azul); font-size: 1.05rem; word-break: break-all; }
.pin { font-size: 3.6rem; font-weight: 800; letter-spacing: .08em; color: var(--azul); line-height: 1.1; }
.unirse .qr svg { width: 210px; height: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 80px; align-content: flex-start; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; cursor: pointer;
  background: #eef3fb; color: var(--texto); border: 0; border-radius: 999px; padding: 3px 14px 3px 4px; animation: aparecer .35s ease-out;
}
.chip .mini { width: 30px; }
.chip:hover { background: #fde8ee; text-decoration: line-through; }

/* ── Proyector: la carrera ── */
.carrera { height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 12px; }
.tablero { display: flex; align-items: center; gap: 22px; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca .mini { width: 48px; }
.marca b { font-size: 1.7rem; display: block; line-height: 1; }
.marca small { opacity: .8; }
.tarde { display: flex; align-items: center; gap: 10px; background: #fff; color: var(--texto); border-radius: 12px; padding: 6px 14px 6px 6px; }
.tarde .qr svg { width: 68px; height: auto; display: block; }
.tarde small { display: block; font-size: .72rem; color: #5f6b76; }
.tarde b { font-size: 1.5rem; color: var(--azul); letter-spacing: .06em; line-height: 1.1; }
.crono { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.crono .ic { width: 38px; height: 38px; color: var(--dorado); }
.crono.poco { color: #ff7a7a; animation: latido 1s infinite; }
.controles { display: flex; gap: 8px; }
.cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 330px; gap: 14px; }
.pista {
  min-height: 0; overflow-y: auto; border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02)), #0c2150; border: 2px solid rgba(255, 255, 255, .12);
}
.carril { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items: center; height: var(--alto, 40px); flex: none; }
.carril .nom {
  font: inherit; font-weight: 600; color: #fff; background: none; border: 0; cursor: pointer; padding: 0;
  font-size: clamp(.68rem, calc(var(--alto, 40px) * .4), 1.05rem); text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carril .nom:hover { color: #ffb3b3; text-decoration: line-through; }
.via {
  position: relative; height: 100%; border-radius: 8px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .05) 0 10%, rgba(255, 255, 255, .02) 10% 20%);
  border-bottom: 2px dashed rgba(255, 255, 255, .14);
}
.via::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 14px; border-radius: 0 8px 8px 0; opacity: .9;
  background: repeating-conic-gradient(#fff 0 25%, #1b2a3a 0 50%) 0 0 / 8px 8px;
}
.corredor {
  position: absolute; top: 0; bottom: 0; left: 0; display: flex; align-items: center; gap: 5px; z-index: 1;
  transition: left 1.4s cubic-bezier(.2, .8, .2, 1), transform 1.4s cubic-bezier(.2, .8, .2, 1);
}
.corredor .mini { height: calc(var(--alto, 40px) * .92); width: auto; }
.corredor b {
  font-size: clamp(.6rem, calc(var(--alto, 40px) * .34), .95rem); font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .45); padding: 0 7px; border-radius: 999px;
}
.corredor.turbo .mini { filter: drop-shadow(0 0 6px var(--dorado)) drop-shadow(0 0 2px var(--dorado)); }
.corredor.turbo::before {
  content: ''; position: absolute; right: 100%; width: 46px; height: 36%; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--dorado)); animation: estela .5s linear infinite alternate;
}
.corredor.boxes .mini { animation: temblor .35s linear infinite; }
.corredor.boxes b { background: var(--mal); }
.corredor.llego b { background: var(--dorado); color: #1b2a3a; }
.lateral { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.lateral .card { padding: 16px; }
.ranking { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.ranking li { counter-increment: r; display: grid; grid-template-columns: 22px 30px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #eef1f5; }
.ranking li::before { content: counter(r); font-weight: 800; color: var(--azul); }
.ranking li:first-child::before { color: var(--dorado); }
.ranking .mini { width: 30px; }
.ranking span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking b { font-variant-numeric: tabular-nums; }
.resumen { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: .88rem; margin-bottom: 8px; }
.resumen span { display: flex; align-items: center; gap: 6px; }
.resumen .ic { color: var(--azul); }
.eventos { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.eventos li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid #eef1f5; }
.eventos li:first-child { animation: aparecer .5s ease-out; font-weight: 600; }
.eventos .ic { color: var(--dorado); margin-top: 2px; }

.cuenta { position: fixed; inset: 0; display: grid; place-items: center; font-size: 34vmin; font-weight: 800; color: var(--dorado); animation: pop .9s ease-out; z-index: 5; }

/* ── Celular: pregunta ── */
.jugar { max-width: 760px; margin: 0 auto; }
.barra { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; opacity: .9; margin-bottom: 8px; }
.rc { display: flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tiempo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.riel { flex: 1; height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; }
#tbar { height: 100%; width: 100%; background: var(--gopher); border-radius: 999px; transition: width .25s linear; }
#seg { min-width: 2.4em; text-align: center; font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.tiempo.poco #tbar { background: #ff6b6b; }
.tiempo.poco #seg { color: #ff8a8a; animation: latido 1s infinite; }
.aviso-turbo {
  display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: #1b2a3a;
  background: linear-gradient(90deg, var(--dorado), #ffcf4a); border-radius: 12px; padding: 8px 12px; margin: 8px 0; animation: latido 1.2s infinite;
}
.enunciado { font-size: 1.2rem; font-weight: 600; margin: 6px 0 12px; }
pre.codigo {
  font-family: var(--mono); font-size: .92rem; line-height: 1.5; margin: 0 0 14px; padding: 14px 16px; overflow-x: auto;
  color: #e6edf3; background: #0b1726; border-radius: 12px; border-left: 4px solid var(--go); text-align: left;
}
pre.codigo.corto { font-size: .84rem; margin: 6px 0; padding: 10px 12px; }
.codigo .k { color: #ff7b72; font-weight: 700; }
.codigo .s { color: #a5d6ff; }
.codigo .n { color: #79c0ff; }
.codigo .c { color: #8b949e; font-style: italic; }
.ops { display: grid; gap: 10px; }
.op {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; font: inherit; font-size: 1rem; cursor: pointer;
  background: #fff; color: var(--texto); border: 3px solid transparent; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .28); transition: transform .08s;
}
.op:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .28); }
.op:disabled { cursor: default; }
.letra { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--azul); }
.op:nth-child(2) .letra { background: var(--magenta); }
.op:nth-child(3) .letra { background: #007d9c; }
.op:nth-child(4) .letra { background: #a36f00; }
.op .txt { align-self: center; min-width: 0; }
.op code.txt { font-family: var(--mono); font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.op .k { color: #b3261e; font-weight: 700; }
.op .s { color: #0a58ca; }
.op .n { color: #6f42c1; }
.op .c { color: #6a737d; font-style: italic; }
.op.elegida { border-color: var(--dorado); }
.op.oculta { opacity: .3; text-decoration: line-through; box-shadow: none; }
.ops.vf { grid-template-columns: 1fr 1fr; }
.ops.vf .op { flex-direction: column; align-items: center; justify-content: center; min-height: 110px; font-size: 1.25rem; font-weight: 800; }
.ops.vf .op .txt { align-self: center; }
.ops.vf .op:first-child .letra { background: var(--bien); }
.ops.vf .op:last-child .letra { background: var(--mal); }
.btn.dep {
  width: 100%; margin-top: 14px; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: transparent; color: #fff; border: 2px dashed var(--dorado); box-shadow: none; text-align: left;
}
.btn.dep .ic { width: 30px; height: 30px; color: var(--dorado); }
.btn.dep small { display: block; font-weight: 400; font-size: .78rem; opacity: .85; }
.jugar.agotado::after {
  content: 'Se acabó el tiempo'; position: fixed; inset: 0; display: grid; place-items: center; z-index: 5;
  font-size: 2rem; font-weight: 800; background: rgba(0, 27, 71, .88); animation: aparecer .3s;
}

/* ── Celular: resultado ── */
.res { max-width: 560px; margin: 14px auto; }
.res.bien { text-align: center; }
.sello { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--bien); color: #fff; animation: pop .5s ease-out; }
.sello .ic { width: 58px; height: 58px; stroke-width: 3; }
.pts { font-size: 2.6rem; font-weight: 800; color: var(--bien); margin: 0; }
.pts small { font-size: 1rem; color: #a36f00; }
.racha { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; color: #c2410c; }
.total { font-weight: 600; }
.res.mal h1 { text-align: center; color: var(--mal); }
.stk { width: min(280px, 80%); margin: -6px auto 4px; }
.sticker { width: 100%; display: block; animation: pegar .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.expl { border-radius: 12px; padding: 10px 14px; margin: 10px 0; text-align: left; }
.expl small { display: flex; align-items: center; gap: 5px; font-weight: 800; text-transform: uppercase; font-size: .72rem; letter-spacing: .04em; }
.expl p { margin: 6px 0 0; }
.expl.no { background: #fdecee; border-left: 5px solid var(--mal); }
.expl.no small { color: var(--mal); }
.expl.si { background: #e8f6ee; border-left: 5px solid var(--bien); }
.expl.si small { color: var(--bien); }
.res.mal .total { text-align: center; color: #5f6b76; }

/* ── Podio ── */
.final { text-align: center; max-width: 1100px; margin: 0 auto; }
.final h1 { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 2.2rem; }
.final h1 .ic { color: var(--dorado); }
.podio { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 26px auto 20px; }
.puesto { width: min(230px, 30vw); display: flex; flex-direction: column; align-items: center; animation: subir .8s cubic-bezier(.2, 1.2, .4, 1) both; }
.puesto .mini { width: 64px; margin-bottom: 4px; }
.puesto.p1 .mini { width: 84px; }
.quien { font-weight: 800; font-size: 1.15rem; margin-bottom: 8px; line-height: 1.2; }
.quien small { display: block; font-weight: 600; opacity: .85; }
.base { width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: center; font-size: 3rem; font-weight: 800; color: #1b2a3a; }
.p1 { animation-delay: 2.2s; } .p1 .base { height: 190px; background: var(--dorado); }
.p2 { animation-delay: 1.2s; } .p2 .base { height: 140px; background: #d9dde3; }
.p3 { animation-delay: .3s; }  .p3 .base { height: 100px; background: #d8995c; }
.menciones { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 10px 0 18px; }
.mencion {
  display: grid; justify-items: center; gap: 2px; min-width: 210px; padding: 14px 18px; border-radius: 16px;
  background: #fff; color: var(--texto); animation: aparecer .6s ease-out 3s both;
}
.mencion .ic { width: 30px; height: 30px; color: var(--dorado); }
.mencion small { font-weight: 800; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; color: var(--azul); }
.mencion span { font-size: .85rem; color: #5f6b76; }
.resto { text-align: left; }
.tabla-final { margin: 0; padding-left: 2.2em; columns: 3 260px; column-gap: 32px; }
.tabla-final li { break-inside: avoid; padding: 5px 0; border-bottom: 1px solid #eef1f5; }
.tabla-final li > * { margin-right: 8px; }
.tabla-final b { font-variant-numeric: tabular-nums; }
.tabla-final small { color: #5f6b76; }
.jugador details { text-align: left; margin-top: 16px; }
.jugador summary { cursor: pointer; font-weight: 700; }
.jugador .tabla-final { columns: 1; margin-top: 10px; }

@keyframes pop { from { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.12); } to { transform: scale(1); opacity: 1; } }
@keyframes pegar { from { transform: scale(.2) rotate(-25deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }
@keyframes subir { from { transform: translateY(80px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparecer { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes latido { 50% { transform: scale(1.06); } }
@keyframes flotar { 50% { transform: translateY(-6px); } }
@keyframes temblor { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes estela { from { opacity: .35; } to { opacity: .9; } }

@media (max-width: 900px) {
  .lobby { grid-template-columns: 1fr; }
  .cuerpo { grid-template-columns: 1fr; }
  .tablero { flex-wrap: wrap; gap: 10px; }
  .carril { grid-template-columns: 110px 1fr; }
}
@media (max-width: 480px) {
  main { padding: 10px; }
  .card { padding: 16px; }
  .enunciado { font-size: 1.08rem; }
  pre.codigo { font-size: .82rem; padding: 12px; }
  .op code.txt { font-size: .82rem; }
  .podio { gap: 8px; }
  .quien { font-size: .9rem; }
  .base { font-size: 2rem; }
  .p1 .base { height: 140px; } .p2 .base { height: 100px; } .p3 .base { height: 70px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
