:root {
  --bg: #0b1020; --panel: #141b31; --panel2: #1c2541; --ink: #f4f6fb; --muted: #9aa5c4;
  --accent: #e5484d; --teal: #2ec4b6; --ok: #3dd68c; --bad: #ff6b6b; --line: #2a3456;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; padding-bottom: 88px; }
#top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(11,16,32,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
#me { font-size: 14px; color: var(--muted); }
#me b { color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); }
.dot.on { background: var(--ok); }
main { padding: 18px 16px; max-width: 560px; margin: 0 auto; }
h1 { font-size: 22px; line-height: 1.25; margin: 4px 0 14px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.kicker { color: var(--accent); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.center { text-align: center; padding: 40px 10px; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 16px; font-size: 17px; font-weight: 700;
  background: var(--accent); color: #fff; cursor: pointer; }
.btn:disabled { opacity: .45; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.opt { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 14px; padding: 16px; font-size: 16px; margin: 10px 0; cursor: pointer; transition: transform .08s, border-color .15s, background .15s; }
.opt:active { transform: scale(.98); }
.opt.sel { border-color: var(--teal); background: #12333a; }
.opt.good { border-color: var(--ok); background: #123527; }
.opt.badc { border-color: var(--bad); background: #3a1a1f; }
input[type=text], textarea { width: 100%; font-size: 17px; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 18px; }
.teams .opt { text-align: center; margin: 0; font-weight: 700; }
.ctx { background: var(--panel); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.ctx div { padding: 3px 0; }
.status { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--panel2); font-size: 15px; text-align: center; }
.status.ok { background: #123527; } .status.bad { background: #3a1a1f; }
.timer { float: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--teal); }
.reveal { margin-top: 16px; background: var(--panel); border-left: 4px solid var(--teal); border-radius: 10px; padding: 12px 14px; font-size: 15px; }
.reveal b { display: block; margin-bottom: 4px; }
/* Tarjetas para deslizar */
.card { background: var(--panel2); border-radius: 18px; min-height: 180px; padding: 22px; display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: 21px; font-weight: 600; touch-action: pan-y; transition: transform .2s, opacity .2s; user-select: none; }
.card.l { transform: translateX(-120%) rotate(-12deg); opacity: 0; } .card.r { transform: translateX(120%) rotate(12deg); opacity: 0; }
.swbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.swbtns .opt { text-align: center; font-weight: 700; margin: 0; }
.progress { color: var(--muted); font-size: 13px; text-align: center; margin: 8px 0; }
.res { display: grid; gap: 6px; margin-top: 10px; }
.res div { display: flex; justify-content: space-between; background: var(--panel); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
/* Deslizador */
.bigval { font-size: 44px; font-weight: 800; text-align: center; margin: 18px 0 6px; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); }
.rangeLabels { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
/* Calibrador */
.ecoWrap { position: relative; width: 100%; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; }
.ecoWrap canvas { display: block; width: 100%; height: auto; }
.loupe { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 2px solid var(--teal); pointer-events: none; overflow: hidden; display: none; box-shadow: 0 4px 18px rgba(0,0,0,.6); }
.mmread { text-align: center; font-size: 28px; font-weight: 800; margin: 10px 0; font-variant-numeric: tabular-nums; }
/* Clasificar */
.sortItem { background: var(--panel); border-radius: 14px; padding: 12px; margin: 10px 0; }
.sortItem p { margin: 2px 0 10px; font-weight: 600; }
.bins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bins .opt { margin: 0; padding: 10px 6px; font-size: 13px; text-align: center; }
/* Preguntas */
.fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 999px; padding: 14px 20px;
  background: var(--panel2); color: var(--ink); font-weight: 700; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.45); border: 1px solid var(--line); }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; z-index: 10; }
.sheet[hidden] { display: none; }
.sheet-card { width: 100%; background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.final { background: linear-gradient(160deg, #1c2541, #141b31); border-radius: 18px; padding: 22px; text-align: center; }
.final .rank { font-size: 56px; font-weight: 800; color: var(--teal); }
.msgs { text-align: left; margin-top: 16px; }
.msgs div { background: var(--panel); border-radius: 12px; padding: 12px; margin: 8px 0; font-size: 15px; }
