/* Backbone — estilos.
   Capas: canvas a pantalla completa (el mapa), HUD de centro de operaciones encima, y pantallas/diálogos.
   Paleta: gris azulado de sala de servidores; los colores con significado (protocolos, cables, alertas)
   salen de tokens que el canvas también lee. */
:root {
  --bg: #e7ecef; --sea: #d5e1e9;
  --land: #f1f3f2; --foreign: #e2e6e6; --coast: #a9bccb; --mount: #cdbf9f;
  --grid: #c6d0d7; --ink: #16212a; --muted: #5a6975; --node: #f8fafb;
  --panel: rgba(248, 250, 251, .94); --panel-line: #c3cdd4;
  --danger: #d0342a; --warn: #df7a00; --ack: #16924f; --udp: #d97a06; --dns: #7a4fd4; --crit: #e0244a;
  --cable: #0a97a5; --cable10: #c09000; --sub: #24497a; --sat: #6b5bb8; --wifi: #5f7f9e; --fw: #b4531b;
  --voip: #1f6fd1; --stream: #b0369f; --backup: #7d8b96; --order: #c2410c; --vpn: #8a4fc4;
  --sn1: #2f63c9; --sn2: #c4466f; --sn3: #a2762a; --sn4: #6c7d1e; --sn5: #8a5a44; --sn6: #4d6b85;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1418; --sea: #0a1217;
    --land: #16222a; --foreign: #111a20; --coast: #2c4150; --mount: #3b3a2c;
    --grid: #1c2930; --ink: #dce6ec; --muted: #80939f; --node: #0d1418;
    --panel: rgba(18, 28, 34, .94); --panel-line: #263741;
    --danger: #ff5a4e; --warn: #ffa23a; --ack: #36c57c; --udp: #ffab40; --dns: #a888ff; --crit: #ff4d6d;
    --cable: #2dc9d6; --cable10: #f2c94c; --sub: #7fa8e0; --sat: #a99bff; --wifi: #8eaecb; --fw: #f08a4b;
    --voip: #5aa8ff; --stream: #e57ad6; --backup: #8796a2; --order: #ff8a3d; --vpn: #c08cff;
    --sn1: #6a98ff; --sn2: #ff7aa3; --sn3: #e0b062; --sn4: #a9c04a; --sn5: #c98f72; --sn6: #8eb0cc;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1418; --sea: #0a1217;
  --land: #16222a; --foreign: #111a20; --coast: #2c4150; --mount: #3b3a2c;
  --grid: #1c2930; --ink: #dce6ec; --muted: #80939f; --node: #0d1418;
  --panel: rgba(18, 28, 34, .94); --panel-line: #263741;
  --danger: #ff5a4e; --warn: #ffa23a; --ack: #36c57c; --udp: #ffab40; --dns: #a888ff; --crit: #ff4d6d;
  --cable: #2dc9d6; --cable10: #f2c94c; --sub: #7fa8e0; --sat: #a99bff; --wifi: #8eaecb; --fw: #f08a4b;
    --voip: #5aa8ff; --stream: #e57ad6; --backup: #8796a2; --order: #ff8a3d; --vpn: #c08cff;
  --sn1: #6a98ff; --sn2: #ff7aa3; --sn3: #e0b062; --sn4: #a9c04a; --sn5: #c98f72; --sn6: #8eb0cc;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.45 var(--font-body);
  overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: 0; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--cable); outline-offset: 2px; }
svg { overflow: visible; }

.eyebrow { font: 500 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ───────── Botones ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 8px; cursor: pointer;
  font: 700 16px var(--font-display); letter-spacing: .1em; text-transform: uppercase;
  border: 1.5px solid var(--panel-line); background: var(--panel); color: var(--ink);
  transition: border-color .15s, transform .1s;
}
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--node); border-color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--panel-line); background: var(--panel);
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }

/* ───────── HUD ───────── */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  padding-top: calc(12px + var(--safe-t)); padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lvl { display: flex; flex-direction: column; min-width: 0; }
.lvl-name { font: 700 22px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.clock { font: 400 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
.stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 1px; font-family: var(--font-mono); }
.stat b { font-size: 19px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.sla { width: 92px; }
.sla .bar { height: 5px; border-radius: 3px; background: var(--grid); overflow: hidden; margin-top: 3px; }
.sla .bar i { display: block; height: 100%; width: 100%; background: var(--ack); transition: width .3s; }
.sla.low .bar i { background: var(--danger); }
.sla.low b { color: var(--danger); }
.money.neg b { color: var(--danger); }
.speed { display: flex; border: 1px solid var(--panel-line); border-radius: 6px; overflow: hidden; background: var(--panel); }
.speed button { font: 500 12px var(--font-mono); background: transparent; border: 0; min-width: 38px; height: 34px; cursor: pointer; }
.speed button + button { border-left: 1px solid var(--panel-line); }
.speed button[aria-pressed="true"] { background: var(--ink); color: var(--node); }

.log {
  position: absolute; z-index: 2; right: var(--gutter-r); top: calc(76px + var(--safe-t));
  width: 310px; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--panel-line);
  font: 400 11px/1.55 var(--font-mono); color: var(--muted); pointer-events: none;
}
.log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log .bad { color: var(--danger); }
.log .ok { color: var(--ack); }
.log .warn { color: var(--warn); }
.log .city { color: var(--ink); font-weight: 500; }
.log:empty { display: none; }

/* ───────── Barra de herramientas y leyenda ───────── */
.toolbar {
  position: absolute; z-index: 3; left: var(--gutter-l); bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--panel-line); max-width: calc(100% - 32px); flex-wrap: wrap;
}
.toolbar-label { font: 500 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 4px 0 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent; background: transparent; font: 600 14px var(--font-display); letter-spacing: .08em; text-transform: uppercase;
}
.tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool svg .fill { fill: currentColor; stroke: none; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--node); }
.tool.icon { padding: 6px 10px; }
.tool:hover:not([aria-pressed="true"]) { border-color: var(--panel-line); }
.toolbar .sep { width: 1px; height: 24px; background: var(--panel-line); }

.legend {
  position: absolute; z-index: 3; left: var(--gutter-l); bottom: calc(76px + var(--safe-b));
  width: min(560px, calc(100% - 32px)); max-height: calc(100% - 180px); overflow: auto;
  display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center;
  padding: 12px 14px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 10px;
  font-size: 13px; color: var(--muted); box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.legend h3 { margin: 0; font: 500 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.legend .row { display: flex; gap: 5px 14px; flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--ink); }
.legend svg { width: 14px; height: 14px; fill: none; stroke: var(--ink); stroke-width: 2.2; }
.legend svg .fill { fill: var(--ink); stroke: none; }
.legend .cab { width: 18px; height: 4px; border-radius: 2px; background: var(--cable); }
.legend .cab.c10 { height: 7px; background: var(--cable10); }
.legend .cab.sub { background: var(--sub); }
.legend .cab.lan { background: var(--sn1); height: 3px; }
.legend .cab.dot { height: 0; border-top: 3px dotted var(--wifi); background: none; border-radius: 0; }
.legend .cab.vpn { height: 0; border-top: 3px dashed var(--vpn); background: none; border-radius: 0; }
.legend .cab.lacp { height: 9px; background: repeating-linear-gradient(180deg, var(--cable) 0 3px, transparent 3px 6px); }
.legend-note { grid-column: 1 / -1; margin: 4px 0 0; font-size: 13px; line-height: 1.4; }

/* ───────── Avisos ───────── */
.tip {
  position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); top: calc(84px + var(--safe-t));
  width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--node); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.tip-step { grid-column: 1; font: 500 10px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.tip p { grid-column: 1; margin: 0; font-size: 15px; line-height: 1.4; text-wrap: pretty; }
.tip button { grid-column: 2; grid-row: 1 / span 2; background: transparent; border: 1px solid currentColor; border-radius: 6px; color: inherit; opacity: .75; padding: 6px 10px; font: 500 12px var(--font-mono); cursor: pointer; min-height: 36px; }
.tip button:hover { opacity: 1; }

.banner {
  position: absolute; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(80px + var(--safe-b));
  width: max-content; max-width: min(560px, calc(100% - 32px)); text-align: center; text-wrap: balance;
  padding: 10px 16px; border-radius: 10px; font-weight: 500; line-height: 1.35;
  background: var(--node); color: var(--danger); border: 2px solid var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 25%, transparent); } }
.toast {
  position: absolute; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(84px + var(--safe-t));
  width: max-content; max-width: min(560px, calc(100% - 32px)); text-align: center; text-wrap: balance;
  padding: 9px 16px; border-radius: 18px; font-size: 14px; line-height: 1.35; pointer-events: none;
  background: var(--danger); color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.info { background: var(--ink); color: var(--node); }
.toast.warn { background: var(--warn); color: #1a1205; }
.tip:not([hidden]) ~ .toast { top: calc(170px + var(--safe-t)); }

/* ───────── Menú contextual ───────── */
.menu {
  position: absolute; z-index: 6; min-width: 240px; max-width: calc(100% - 32px); padding: 6px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--panel-line); box-shadow: 0 10px 28px rgba(0,0,0,.2);
  display: flex; flex-direction: column; gap: 2px; backdrop-filter: blur(6px);
}
.menu header { font: 600 15px var(--font-display); letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px 2px; }
.menu p { margin: 0; padding: 0 8px 6px; font: 400 11px/1.5 var(--font-mono); color: var(--muted); }
.menu button { text-align: left; font: 500 14px var(--font-body); background: transparent; border: 0; border-radius: 6px; padding: 10px 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.menu button small { font: 500 12px var(--font-mono); color: var(--muted); }
.menu button:hover:not(:disabled) { background: var(--grid); }
.menu button:disabled { color: var(--muted); cursor: default; }
.menu button.del { color: var(--danger); }

/* ───────── Pantallas ───────── */
.screen { position: absolute; inset: 0; z-index: 7; overflow: auto; }
.title {
  display: grid; align-items: center;
  padding: calc(24px + var(--safe-t)) var(--gutter-r) calc(24px + var(--safe-b)) var(--gutter-l);
  background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 94%, transparent) 0%, color-mix(in srgb, var(--bg) 78%, transparent) 38%, color-mix(in srgb, var(--bg) 0%, transparent) 72%);
}
.title-inner { max-width: 600px; display: flex; flex-direction: column; gap: 14px; padding-left: clamp(0px, 4vw, 48px); }
.wordmark {
  margin: 0; font: 700 clamp(56px, 11vw, 150px)/.85 var(--font-display); letter-spacing: .06em; text-transform: uppercase;
  align-self: flex-start; width: max-content; max-width: 100vw; padding-right: .1em;
  background: linear-gradient(180deg, var(--ink) 55%, color-mix(in srgb, var(--ink) 55%, var(--cable)) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; font-size: 18px; line-height: 1.5; color: var(--muted); max-width: 42ch; text-wrap: pretty; }
.title-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 10px; }
.title-actions .btn.primary { min-width: 260px; font-size: 18px; min-height: 52px; }
.title-actions > .btn { min-width: 260px; }
.title-row { display: flex; gap: 4px; flex-wrap: wrap; }
.footnote { margin: 6px 0 0; font: 400 12px var(--font-mono); color: var(--muted); }
@media (max-width: 640px) {
  .title { align-items: end; background: linear-gradient(0deg, color-mix(in srgb, var(--bg) 96%, transparent) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 55%, color-mix(in srgb, var(--bg) 0%, transparent) 100%); }
  .title-inner { padding-left: 0; }
  .title-actions, .title-actions > .btn, .title-actions .btn.primary { width: 100%; min-width: 0; }
  .tagline { font-size: 16px; }
}

.levels {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: calc(20px + var(--safe-t)) var(--gutter-r) calc(24px + var(--safe-b)) var(--gutter-l);
}
.levels-inner { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.levels-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.levels-head h2 { margin: 0; font: 700 40px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; flex: 1; }
.stars-total { font: 500 14px var(--font-mono); color: var(--muted); }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.level-card {
  position: relative; text-align: left; cursor: pointer; padding: 18px; border-radius: 12px;
  border: 1.5px solid var(--panel-line); background: var(--node); display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, transform .15s; min-width: 0;
}
.level-card:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-2px); }
.level-card .num { font: 500 12px var(--font-mono); color: var(--muted); letter-spacing: .1em; }
.level-card h3 { margin: 0; font: 700 30px/1 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.level-card .tag { align-self: flex-start; font: 500 11px var(--font-mono); color: var(--ink); padding: 3px 8px; border-radius: 4px; background: var(--grid); }
.level-card p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.level-card .card-stars { font-size: 20px; letter-spacing: .15em; color: var(--muted); margin-top: auto; }
.level-card .card-stars .on { color: var(--cable10); }
.level-card:disabled { cursor: not-allowed; opacity: .55; }
.level-card .lock { font: 500 11px var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.level-card.free { background: transparent; border-style: dashed; }

/* ───────── Diálogos ───────── */
.modal {
  position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; overflow: auto;
  padding: calc(16px + var(--safe-t)) var(--gutter-r) calc(16px + var(--safe-b)) var(--gutter-l);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}
.card {
  width: min(500px, 100%); padding: 24px; border-radius: 14px; background: var(--node);
  border: 1px solid var(--panel-line); box-shadow: 0 18px 50px rgba(0,0,0,.22);
  display: flex; flex-direction: column; gap: 14px;
}
.card.narrow { width: min(380px, 100%); }
.card.wide { width: min(820px, 100%); }
.card h2 { margin: 0; font: 700 36px/1 var(--font-display); letter-spacing: .05em; text-transform: uppercase; text-wrap: balance; }
.card p { margin: 0; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card .stack { display: flex; flex-direction: column; gap: 8px; }
.card .stack .btn { width: 100%; }
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rules li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; line-height: 1.45; }
.rules li::before { content: "▸"; color: var(--muted); }
.rules li.new::before { content: "Nuevo"; font: 600 10px var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--node); background: var(--ink); padding: 2px 5px; border-radius: 3px; }
.diff-pick { display: flex; flex-direction: column; gap: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--panel-line); border-radius: 8px; overflow: hidden; }
.seg button {
  min-height: 44px; border: 0; background: transparent; cursor: pointer;
  font: 700 15px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.seg button + button { border-left: 1.5px solid var(--panel-line); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--node); }
.seg button[data-diff="pesadilla"][aria-checked="true"] { background: var(--danger); color: #fff; }
.diff-note { font-size: 14px; }
.level-card .diff-stars { display: flex; flex-direction: column; gap: 2px; margin-top: auto; font: 500 11px var(--font-mono); color: var(--muted); }
.level-card .diff-stars div { display: flex; justify-content: space-between; gap: 8px; }
.level-card .diff-stars b { font-weight: 400; letter-spacing: .15em; font-size: 14px; }
.level-card .diff-stars .on { color: var(--cable10); }
.goal { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-radius: 8px; background: var(--grid); }
.goal p { color: var(--ink); }
.stars { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.stars li { display: flex; gap: 10px; align-items: baseline; color: var(--muted); }
.stars li b { font-size: 18px; width: 20px; color: var(--muted); font-weight: 400; }
.stars li.got { color: var(--ink); }
.stars li.got b { color: var(--cable10); }
.stars.big li b { font-size: 24px; width: 26px; }
.stars.big li.got b { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.stars.big li:nth-child(2).got b { animation-delay: .25s; }
.stars.big li:nth-child(3).got b { animation-delay: .5s; }
@keyframes pop { from { transform: scale(0); } }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .choices { grid-template-columns: 1fr; } }
.choice {
  text-align: left; padding: 16px; border-radius: 10px; cursor: pointer; min-height: 44px;
  border: 1.5px solid var(--panel-line); background: transparent; display: flex; flex-direction: column; gap: 6px;
}
.choice:hover, .choice:focus-visible { border-color: var(--ink); }
.choice b { font: 700 19px var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
.choice span { font-size: 14px; color: var(--muted); line-height: 1.4; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-family: var(--font-mono); }
.kv div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kv span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 12px; }
.field span, .check span { font-weight: 500; }
.field input { width: 100%; accent-color: var(--ink); min-height: 32px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
.help { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px 24px; }
.help h3 { margin: 0 0 6px; font: 700 18px var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.help p { margin: 0 0 8px; font-size: 14.5px; }

/* ───────── Aviso de cookies ─────────
   El comportamiento viene de cookies.js (común a social&games): abre el aviso añadiendo .is-open. */
.cookie-modal {
  position: fixed; inset: 0; z-index: 50; display: none; place-items: center; overflow: auto;
  padding: calc(16px + var(--safe-t)) var(--gutter-r) calc(16px + var(--safe-b)) var(--gutter-l);
}
.cookie-modal.is-open { display: grid; }
.cookie-modal-arcade__backdrop { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 72%, transparent); }
.cookie-card { position: relative; width: min(480px, 100%); animation: cookie-in .25s ease-out both; }
.cookie-card strong { color: var(--ink); font-weight: 600; }
@keyframes cookie-in { from { transform: translateY(10px); } }  /* sin opacidad: si la animación no corre, el aviso sigue visible */
.cookie-opts { display: flex; flex-direction: column; border-top: 1px solid var(--panel-line); }
.cookie-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--panel-line);
}
label.cookie-opt { cursor: pointer; }
.cookie-opt div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cookie-opt span:not(.cookie-chip):not(.cookie-switch) { font-size: 14px; color: var(--muted); line-height: 1.4; }
.cookie-chip {
  flex-shrink: 0; font: 500 11px var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 4px 8px; border-radius: 4px; background: var(--grid);
}
.cookie-switch { position: relative; flex-shrink: 0; width: 46px; height: 26px; }
.cookie-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.cookie-switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--grid); border: 1px solid var(--panel-line); transition: background .15s; pointer-events: none; }
.cookie-switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--node); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s;
}
.cookie-switch input:checked + i { background: var(--cable); border-color: var(--cable); }
.cookie-switch input:checked + i::after { transform: translateX(20px); }
.cookie-switch input:focus-visible + i { outline: 2px solid var(--cable); outline-offset: 2px; }
@media (max-width: 480px) {
  .cookie-card .actions .btn { flex: 1 1 100%; }
}

@media (max-width: 1000px) { .log { display: none; } }
@media (max-width: 720px) {
  .clock { white-space: normal; }
  .stats { gap: 12px; }
  .stat b { font-size: 16px; }
  .sla { width: 76px; }
  .lvl-name { font-size: 19px; }
  .toolbar-label { display: none; }
  .card { padding: 20px; }
  .card h2 { font-size: 30px; }
  .levels-head h2 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
