/* CEDROUS: paleta extraída del archivo Espacios de cuadrícula (logo movible)211.html. */
:root {
  --bg:#0A0A0A; --panel:#121212; --panel-2:#1C1C1C;
  --text:#FFFFFF; --muted:#B8B8B8; --accent:#FFFFFF; --accent-ink:#0A0A0A;
  --bad:#E8E8E8; --warn:#D4D4D4; --star:#FFFFFF; --line:#373737;
  --radius:16px; color-scheme:dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; outline: none; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { color: var(--muted); font-size: 1.05rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button { font: inherit; color: inherit; cursor: pointer; }
.btn, .tab {
  min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); transition: transform .08s, background .15s;
}
.btn:hover:not(:disabled), .tab:hover:not(:disabled) { background: var(--line); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: not-allowed; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; display: grid; gap: 12px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stars-pick { display: flex; gap: 2px; }
.star { background: none; border: 0; font-size: 1.7rem; min-width: 44px; min-height: 44px; color: var(--line); }
.star.on { color: var(--star); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: var(--panel-2); border: 0; min-height: 44px; padding: 0 16px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.card { width: 100%; text-align: left; display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.card:hover { border-color: var(--accent); }
.card .num { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--accent); color: var(--accent-ink); }
.card .body { display: grid; gap: 2px; flex: 1; }
.card .tech { font-size: .8rem; color: var(--accent); }
.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); margin-left: 4px; }
.badge.best { color: var(--warn); border-color: var(--warn); }
.foot { margin-top: 24px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.howto { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 12px 0; }
.howto summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.howto ol { margin: 4px 0 8px; padding-left: 20px; }
.goal { font-weight: 600; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.tab { border-left: 6px solid var(--c, var(--line)); }
.tab.on { background: var(--panel); outline: 2px solid var(--c, var(--accent)); }
.tab.add { border-style: dashed; }

.map-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; margin: 8px 0; touch-action: manipulation; }
.map { display: block; width: 100%; height: auto; max-height: 70vh; }
.map .grid { stroke: var(--line); stroke-width: .06; }
.map .edge { stroke: var(--muted); stroke-width: .12; opacity: .5; }
.map .edge-w { font-size: .9px; fill: var(--muted); text-anchor: middle; }
.map .route { stroke-width: .3; stroke-linejoin: round; stroke-linecap: round; }
.map .route.ref { stroke-dasharray: .6 .5; stroke-width: .22; opacity: .9; }
.map .depot rect { fill: var(--text); }
.map .depot .node-t { fill: var(--bg); }
.map .dot { fill: var(--panel-2); stroke: var(--accent); stroke-width: .16; }
.map { cursor: pointer; }
.map .stop { cursor: pointer; }
.map .stop.marked .dot { fill: var(--accent); }
.map .stop.marked .node-t { fill: var(--accent-ink); }
.map .stop.off { cursor: default; opacity: .55; }
.map .stop:hover:not(.off) .dot { stroke-width: .35; }
.map .stop:focus-visible .dot { stroke: var(--warn); stroke-width: .4; }
.map .stop:focus, .map .stop:focus-visible { outline: none; }
.map .node-t { font-size: 1px; font-weight: 700; text-anchor: middle; fill: var(--text); pointer-events: none; }
.map .sub { font-size: .85px; fill: var(--muted); text-anchor: middle; pointer-events: none; }

.items { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { width: 100%; min-height: 72px; display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); }
.item.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.item.opt:not(.on) { outline: 2px dashed var(--warn); }

.chips { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; overflow-wrap: anywhere; }
.chips p { margin: 2px 0; }
.chips.empty { color: var(--muted); }
.chip-label { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 99px; border: 2px solid var(--c); font-size: .8rem; }

.metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.metrics div { flex: 1 1 100px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.metrics dt { font-size: .75rem; color: var(--muted); }
.metrics dd { margin: 0; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.metrics.warn dd { color: var(--bad); }

.notice { color: var(--warn); font-weight: 600; }
.hint { background: var(--panel); border-left: 4px solid var(--warn); padding: 8px 12px; border-radius: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions .btn { flex: 1 1 120px; }

.result { border-radius: var(--radius); padding: 14px; margin: 16px 0; border: 2px solid var(--line); background: var(--panel); }
.result.good { border-color: var(--accent); }
.result.bad { border-color: var(--bad); }
.result .score { font-size: 1rem; margin: 0; color: var(--muted); }
.result .score span { font-size: 3rem; font-weight: 800; color: var(--text); }
.toggle { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.result details { margin-top: 8px; }

@media (min-width: 900px) { main { max-width: 760px; padding-top: 32px; } h1 { font-size: 2rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ===== Fase 2: barra superior, bienvenida, salas ===== */
body { background: radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--accent) 14%, transparent), transparent), var(--bg); background-attachment: fixed; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.who { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.who strong { color: var(--text); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--accent); margin: 0; font-weight: 700; }
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: clamp(2.2rem, 8vw, 3.4rem); letter-spacing: -.02em; margin: 4px 0 8px; }
.modes { display: grid; gap: 12px; margin: 20px 0; }
@media (min-width: 640px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode-card { display: grid; gap: 6px; text-align: left; padding: 20px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); min-height: 150px; transition: transform .15s, border-color .15s, box-shadow .15s; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 50%, transparent); }
.mode-card strong { font-size: 1.25rem; }
.mode-card span:last-child { color: var(--muted); }
.mode-icon { font-size: 2rem; }

label { font-weight: 600; font-size: .9rem; }
.text-input { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; }
.text-input.pin { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; max-width: 160px; }
.text-input[aria-invalid="true"] { border-color: var(--bad); }
.field-col { display: grid; gap: 4px; margin: 10px 0; }
.cfg { display: grid; gap: 4px; }
@media (min-width: 640px) { .cfg { grid-template-columns: 1fr 1fr; column-gap: 12px; } .cfg .toggle, .cfg .notice { grid-column: 1 / -1; } }
.seedrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seedrow .text-input { flex: 1 1 110px; min-width: 0; }
.seed-input { flex: 1 1 110px; min-height: 44px; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; }
.seedbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; display: grid; gap: 8px; }
.badge.seed { color: var(--accent); border-color: var(--accent); }
.badge.room { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.static-stars { color: var(--star); font-size: 1.3rem; letter-spacing: 2px; }
.static-stars span { color: var(--line); }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

.room-head { margin: 8px 0 12px; }
.room-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pin-big { margin: 0; font-size: 2.6rem; font-weight: 800; letter-spacing: .25em; line-height: 1; font-variant-numeric: tabular-nums; }
.room-meta { display: grid; gap: 6px; justify-items: end; }
.online { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
.dot-on, .dot-off { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-on { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
.dot-off { background: var(--line); }
.badge.st-playing { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge.st-finished { background: var(--warn); color: #000; border-color: var(--warn); }
.panel h2 { margin: 0; }
.people { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); }
.people li.me { outline: 2px solid var(--accent); }
.people .nick { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people em { color: var(--muted); font-style: normal; font-size: .8rem; }
.pips { letter-spacing: 2px; color: var(--accent); }
.pips span { color: var(--line); }
.sc { min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }

.attempts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.attempt { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; }
.attempt span { font-size: .75rem; color: var(--muted); }
.attempt strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.attempt.now { border-color: var(--accent); }
.attempt.done strong { color: var(--accent); }
.attempts-note { grid-column: 1 / -1; margin: 0; }

.final { margin: 16px 0; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 16px 0; min-height: 200px; }
.podium .step { display: grid; justify-items: center; gap: 2px; flex: 1; max-width: 160px; text-align: center; }
.podium .medal { font-size: 2.2rem; }
.podium .pts { color: var(--muted); font-size: .85rem; }
.podium .block { width: 100%; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 10px 10px 0 0; }
.podium .s1 .block { height: 110px; } .podium .s2 .block { height: 80px; opacity: .85; } .podium .s3 .block { height: 56px; opacity: .7; }
.podium strong { overflow-wrap: anywhere; }
.table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-size: .8rem; font-weight: 600; }
.table tr.me { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.wait { margin: 8px 0; }
@media (prefers-reduced-motion: no-preference) { .mode-card, .btn { transition: transform .15s, box-shadow .15s, border-color .15s, background .15s; } }
[hidden] { display: none !important; }

/* Identidad CEDROUS · V5 */
body { background: radial-gradient(ellipse at 50% -30%, #303030 0, transparent 58%), #0A0A0A; font-family:Manrope,Inter,system-ui,sans-serif; }
main { max-width:920px; }
.topbar { padding:12px max(20px, calc((100vw - 1120px)/2)); min-height:80px; }
.brand { gap:18px; min-width:0; }
.brand-logo { width:138px; height:54px; object-fit:contain; }
.brand-title { font-size:.66rem; letter-spacing:.23em; padding-left:18px; border-left:1px solid var(--line); }
.hero { padding:48px 0 20px; }
.hero h1 { max-width:720px; font-size:clamp(2.7rem,7vw,5.2rem); line-height:1.04; letter-spacing:-.055em; margin:20px 0; }
.hero-outline { color:#B8B8B8; }
.game-name { letter-spacing:.2em; font-size:.75rem; margin-bottom:20px; }
.hero .lead { max-width:590px; line-height:1.8; }
.mode-card { position:relative; min-height:210px; padding:26px; border-radius:18px; background:linear-gradient(145deg,#1B1B1B,#101010); }
.mode-card::after { content:'↗'; position:absolute; top:23px; right:24px; font-size:1.4rem; color:var(--muted); }
.mode-icon { font-size:.72rem; letter-spacing:.14em; color:var(--muted); margin-bottom:26px; }
.mode-card span:last-child { font-size:.9rem; line-height:1.7; }
.mode-card:hover { box-shadow:0 8px 30px #0008; }
.cards { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.card { height:100%; align-items:flex-start; min-height:180px; padding:20px; }
.card .num { border-radius:10px; background:#262626; color:#fff; width:32px; height:32px; }
.card .body { min-width:0; gap:8px; }
.card .body>span:last-child { font-size:.84rem; color:var(--muted); }
.map-wrap { padding:16px; background:radial-gradient(circle at 50% 30%,#222,#111); }
.stop-list { display:flex; flex-wrap:wrap; gap:8px; border-top:1px solid var(--line); padding-top:12px; }
.stop-pick { font-size:.8rem; flex:1 0 64px; }
.map .stop.off.marked { opacity:1; }
.map .route.ref { stroke:#929292; }
.result.bad { border-style:dashed; }
.notice::before { content:'! '; }
.notice:empty::before { content:none; }
.dot-on { background:#fff; box-shadow:0 0 0 3px #ffffff20; }
.dot-off { background:#555; }
.table { display:block; overflow-x:auto; }
.btn.primary:hover:not(:disabled) { background:#D7D7D7; }
.btn.danger { color:#0A0A0A; }
@media(min-width:900px) { main { max-width:920px; padding-top:36px; } }
@media(max-width:600px) { .cards { grid-template-columns:1fr; } .brand-title{ display:none; } .who { max-width:48%; font-size:.75rem; } .hero{padding-top:28px;} .hero h1{font-size:3.1rem;} .brand-logo{width:115px;} .topbar{padding:8px 16px;} .card{min-height:150px;} }

/* Integración móvil CEDROUS */
html,body{max-width:100%;overflow-x:clip} main{padding-bottom:max(48px,env(safe-area-inset-bottom))} button,.btn{min-height:44px} input,select{font-size:16px;max-width:100%} svg,canvas{max-width:100%;height:auto} .table{display:block;overflow-x:auto} @media(max-width:380px){main{padding-inline:12px}.actions{flex-wrap:wrap}.panel{min-width:0}}
