/* Reto · Semana de la IA — estilo alineado a la presentación (azul marino, verde lima, rojo) */
:root {
  --bg: #1c1d36;
  --bg2: #24254a;
  --card: #ffffff;
  --ink: #1c1d36;
  --muted: #6b6d8a;
  --line: #e4e5ef;
  --lime: #a8e04e;
  --lime-d: #7dbb2a;
  --red: #e2474f;
  --soft: #f3f4fa;
  --ok: #2fa86a;
  --warn: #f2a33a;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: radial-gradient(1200px 600px at 85% -10%, #2c2e5c 0%, transparent 60%), var(--bg);
  color: #fff;
  min-height: 100vh;
  font-size: 15px;
}
a { color: var(--lime); }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
.brand { font-weight: 300; font-size: 26px; letter-spacing: -0.5px; }
.brand b { font-weight: 600; }
.lime { color: var(--lime); }
.red { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 48px 20px; }

.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h3 { color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--soft); color: var(--ink); }
.pill.lime { background: var(--lime); color: var(--ink); }
.pill.red { background: var(--red); color: #fff; }
.pill.dark { background: var(--bg2); color: #fff; }

button, .btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  background: var(--ink); color: #fff; transition: transform .05s, opacity .2s; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: .4; cursor: not-allowed; }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: var(--soft); color: var(--ink); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

input[type=email], input[type=text], textarea {
  font: inherit; width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 11px 14px; color: var(--ink); background: #fff; outline: none;
}
input:focus, textarea:focus { border-color: var(--lime-d); }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
textarea[readonly], input[readonly] { background: var(--soft); color: #555; }
label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 6px; }

/* ─── Login ─── */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 18px; }
.choice { border: 2px solid var(--line); border-radius: 16px; padding: 16px; cursor: pointer; background: #fff; color: var(--ink); text-align: left; display: block; font-weight: 500; }
.choice .big { font-size: 30px; display: block; margin-bottom: 4px; }
.choice.sel { border-color: var(--lime-d); background: #f4fbe9; box-shadow: 0 0 0 3px rgba(168, 224, 78, .35); }

/* ─── Zonas ─── */
.zonas { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.zona { border-radius: 16px; padding: 18px 8px; text-align: center; cursor: pointer; color: #1c1d36; font-weight: 700; border: 3px solid transparent; }
.zona.sel { border-color: #fff; box-shadow: 0 0 0 4px var(--lime); }
.zona small { display: block; font-weight: 500; opacity: .75; }

/* ─── Juego ─── */
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.topbar .grow { flex: 1; }
.timer { background: #fff; color: var(--red); font-weight: 800; font-size: 34px; padding: 4px 18px; border-radius: 14px; font-variant-numeric: tabular-nums; min-width: 130px; text-align: center; }
.timer.low { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }

.steps { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.step { flex: 1; min-width: 110px; height: 34px; border-radius: 999px; background: var(--bg2); color: #9a9cc0; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.step.done { background: var(--lime-d); color: var(--ink); }
.step.now { background: var(--lime); color: var(--ink); box-shadow: 0 0 0 3px rgba(168, 224, 78, .35); }

.layout { display: grid; grid-template-columns: 320px 1fr 320px; gap: 18px; align-items: start; }
.layout > .side-left { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: var(--radius); }
@media (max-width: 1180px) { .layout { grid-template-columns: 1fr 1fr; } .side-right { grid-column: 1 / -1; } }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } .zonas { grid-template-columns: repeat(2, 1fr); } .choices { grid-template-columns: 1fr; } }

.stage { position: relative; border: 2px solid transparent; }
.stage.mine { border-color: var(--lime); }
.stage.mine::before { content: 'TU TURNO'; position: absolute; top: -12px; right: 16px; background: var(--lime); color: var(--ink); font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .5px; }
.stage.locked { opacity: .55; }
.stage-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.num { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--red); box-shadow: 0 2px 8px rgba(0,0,0,.15); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.field { margin-bottom: 12px; }
.field .owner { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }

.caso dt { font-size: 12px; color: var(--muted); margin-top: 8px; }
.caso dd { margin: 0; font-weight: 500; }
.caso .sens { color: var(--red); }
.caso .sens::before { content: '🔒 '; }
.entregable { background: #f4fbe9; border-left: 4px solid var(--lime-d); padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-weight: 500; }

.prompt-preview { white-space: pre-wrap; background: var(--soft); border-radius: 12px; padding: 12px; font-size: 14px; max-height: 260px; overflow: auto; }
mark { background: #ffd6d8; color: var(--red); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.det { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.det .grow { flex: 1; }

.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.check .q { flex: 1; font-size: 14px; }
.tog { width: 40px; height: 34px; padding: 0; justify-content: center; background: var(--soft); color: var(--ink); border-radius: 10px; }
.tog.si { background: var(--ok); color: #fff; }
.tog.no { background: var(--red); color: #fff; }

.miembros { list-style: none; margin: 0; padding: 0; }
.miembros li { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c9cad8; flex: none; }
.dot.on { background: var(--ok); }
.miembros .r { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }

.chat { display: flex; flex-direction: column; height: 420px; }
.chat-log { flex: 1; overflow-y: auto; background: var(--soft); border-radius: 12px; padding: 10px; font-size: 14px; }
.msg { margin-bottom: 8px; }
.msg b { font-size: 12px; color: var(--muted); display: block; }
.msg.me { text-align: right; }
.msg span { display: inline-block; background: #fff; border-radius: 12px; padding: 6px 10px; max-width: 90%; text-align: left; word-wrap: break-word; }
.msg.me span { background: var(--lime); }
.msg.sys { text-align: center; font-size: 12px; color: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.quick button { padding: 5px 10px; font-size: 12px; background: var(--soft); color: var(--ink); }
.chat form { display: flex; gap: 6px; }
.chat form input { flex: 1; }
.teams-link { font-size: 12px; color: var(--muted); margin-top: 8px; }
.teams-link a { color: var(--muted); }

.score-big { font-size: 84px; font-weight: 800; color: var(--red); line-height: 1; }
.crit { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px dashed var(--line); }
.crit .pts { font-size: 26px; font-weight: 800; min-width: 64px; color: var(--ink); }
.crit .pts small { font-size: 14px; color: var(--muted); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600; z-index: 99; box-shadow: var(--shadow); max-width: 90vw; }
.toast.ok { background: var(--ok); }

.robot { font-size: 64px; line-height: 1; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--soft); border-top-color: var(--lime-d); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.rolecard { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-top: 6px solid var(--lime); }
.rolecard .emoji { font-size: 42px; }
.log { font-size: 12px; color: var(--muted); max-height: 140px; overflow: auto; }
.log div { padding: 2px 0; }

/* ─── Host / Pantalla ─── */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { background: var(--bg2); border-radius: 16px; padding: 16px; }
.stat .n { font-size: 36px; font-weight: 800; color: var(--lime); }
table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; }

.ahora { background: var(--bg2); border-left: 4px solid var(--lime); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; font-size: 15px; }
.relevo { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: #fff4e0; color: var(--ink); border-radius: 12px; padding: 10px 16px; margin-bottom: 12px; font-size: 14px; }

.msg.coach span { background: #fff4e0; border: 1px solid #f2c27a; }
.msg.coach b { color: #b8741a; }
.red-caida { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--warn); color: var(--ink); text-align: center; font-weight: 700; padding: 10px; }
#reloj-etapa.red { background: var(--red); }

/* Chat flotante en pantallas medianas (laptops con escala 125 %) */
.fab-chat { display: none; position: fixed; right: 16px; bottom: 16px; z-index: 60; background: var(--ink); color: #fff; border: 2px solid var(--lime); box-shadow: var(--shadow); }
.fab-chat.con-nuevos { background: var(--lime); color: var(--ink); animation: pulse 1.2s infinite; }
@media (max-width: 1180px) {
  .fab-chat { display: inline-flex; }
  .layout > .side-right { display: none; position: fixed; right: 16px; bottom: 70px; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 100px); overflow-y: auto; z-index: 55; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
  .layout > .side-right.abierto { display: block; }
  .layout > .side-right .chat { height: min(420px, calc(100vh - 330px)); }
}
.ahora.coach { border-left-color: var(--warn); background: #3a2f1c; }
.zona { font: inherit; font-weight: 700; width: 100%; }
.zona:focus-visible, button:focus-visible, .choice:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
