:root {
  --bg: #090d17;
  --panel: #111827;
  --panel2: #182235;
  --line: #2b3a55;
  --text: #eef4ff;
  --muted: #9fb0c7;
  --accent: #62e6c7;
  --accent2: #f3c95c;
  --danger: #ff6577;
  --blue: #62a7ff;
  --shadow: 0 18px 55px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at top, #18233b 0, var(--bg) 52%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1280px, 100%); margin: 0 auto; padding: 22px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
h1,h2,p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.6rem, 4vw, 2.5rem); }
h2 { margin-bottom: 0; }
.eyebrow { color: var(--accent); font-size: .72rem; letter-spacing: .14em; font-weight: 900; margin-bottom: 6px; }
.battery-wrap { width: min(310px, 45vw); }
.battery-label { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 6px; }
.battery { height: 18px; padding: 3px; border: 2px solid #dce9ff; border-radius: 5px; position: relative; background: #101726; }
.battery::after { content:""; position:absolute; right:-7px; top:4px; width:5px; height:7px; background:#dce9ff; border-radius:0 2px 2px 0; }
.battery-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #62e6c7, #9ef08b); border-radius: 2px; transition: width .25s ease, background .25s ease; }
.game-layout { display:grid; grid-template-columns:minmax(0, 1.65fr) minmax(300px, .75fr); gap:18px; }
.board-panel, .side-panel { background: rgba(17,24,39,.94); border:1px solid var(--line); border-radius:18px; box-shadow: var(--shadow); }
.board-panel { padding:18px; }
.side-panel { padding:18px; display:flex; flex-direction:column; gap:20px; }
.board-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.small-btn, .close-btn { border:1px solid var(--line); background:var(--panel2); border-radius:10px; cursor:pointer; }
.small-btn { width:38px; height:38px; font-weight:900; }
.close-btn { width:34px; height:34px; font-size:1.4rem; }
.board { position:relative; display:grid; grid-template-columns:repeat(3, 1fr); grid-template-rows:repeat(2, minmax(180px, 1fr)); gap:10px; min-height:440px; padding:10px; background:#0c1321; border:2px solid #263653; border-radius:14px; overflow:hidden; }
.board::before { content:""; position:absolute; inset:0; pointer-events:none; opacity:.11; background-image:linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg,#fff 1px,transparent 1px); background-size:24px 24px; }
.room { position:relative; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:5px; min-width:0; border:2px solid #32425e; border-radius:10px; background:linear-gradient(160deg,#1b2940,#111a2b); cursor:pointer; transition:transform .15s ease,border-color .15s ease,filter .15s ease; }
.room:hover { transform:translateY(-2px); border-color:#5a749f; filter:brightness(1.08); }
.room span { font-size:2rem; }
.room b { font-size:1rem; }
.room small { color:var(--muted); font-size:.72rem; text-align:center; }
.room-current { border-color:var(--accent); box-shadow: inset 0 0 0 1px rgba(98,230,199,.25), 0 0 28px rgba(98,230,199,.12); }
.room-visited::after { content:"✓"; position:absolute; top:8px; right:9px; font-weight:900; color:var(--accent); }
.robot-token { position:absolute; z-index:5; font-size:2.2rem; pointer-events:none; transform:translate(-50%,-50%); transition:left .35s ease,top .35s ease; filter:drop-shadow(0 5px 5px rgba(0,0,0,.6)); }
.objective-card { margin-top:12px; border-left:4px solid var(--accent2); background:#171f2f; border-radius:10px; padding:12px 14px; }
.objective-card p:last-child { margin-bottom:0; }
.interaction-list { display:grid; gap:8px; }
.interaction-btn { width:100%; text-align:left; border:1px solid #33435d; background:#182235; border-radius:10px; padding:11px 12px; cursor:pointer; transition:.15s ease; }
.interaction-btn:hover:not(:disabled) { border-color:var(--accent); transform:translateX(2px); }
.interaction-btn:disabled { opacity:.4; cursor:not-allowed; }
.interaction-btn strong { display:block; margin-bottom:2px; }
.interaction-btn small { color:var(--muted); }
.inventory { display:flex; flex-wrap:wrap; gap:7px; min-height:36px; }
.item { border:1px solid #3b4e6d; background:#101827; border-radius:999px; padding:6px 9px; font-size:.78rem; }
.empty { color:var(--muted); font-style:italic; }
.log { max-height:250px; overflow:auto; display:flex; flex-direction:column; gap:7px; padding-right:4px; }
.log-entry { padding:8px 9px; border-radius:8px; background:#0e1625; color:#c9d5e8; font-size:.78rem; line-height:1.35; border-left:3px solid #34445f; }
.log-entry.good { border-color:var(--accent); }
.log-entry.warn { border-color:var(--accent2); }
.log-entry.bad { border-color:var(--danger); }
.modal { border:0; padding:0; background:transparent; color:var(--text); width:min(560px, calc(100% - 30px)); }
.modal::backdrop { background:rgba(3,7,14,.78); backdrop-filter:blur(4px); }
.modal-card { background:#111827; border:1px solid #34445e; border-radius:18px; padding:20px; box-shadow:0 22px 80px #000; }
.modal-top { display:flex; justify-content:space-between; align-items:flex-start; }
.modal-body { color:#d7e1ef; line-height:1.6; }
.modal-body code { background:#0b1220; padding:2px 6px; border-radius:5px; color:#fff1a8; }
.modal-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:18px; }
.action { border:1px solid #435677; background:#21304a; padding:9px 12px; border-radius:9px; cursor:pointer; }
.action.primary { background:#173f3c; border-color:#38a991; }
.action.danger { background:#49212a; border-color:#a64858; }
.code-row { display:flex; gap:8px; margin-top:12px; }
.code-row input { min-width:0; flex:1; border:1px solid #43516c; background:#0a111e; color:white; border-radius:9px; padding:10px 12px; text-transform:uppercase; }
.screw-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-top:12px; }
.screw-choice { border:1px solid #455a79; background:#172236; border-radius:9px; padding:10px; cursor:pointer; }
.final-screen { text-align:center; }
.final-screw { font-size:4rem; margin:10px 0; }
.coords { font-size:1.15rem; font-weight:900; letter-spacing:.06em; padding:12px; background:#09101c; border:1px solid #3d4e6a; border-radius:10px; }
@media (max-width: 850px) {
  .app-shell { padding:12px; }
  .topbar { align-items:stretch; flex-direction:column; }
  .battery-wrap { width:100%; }
  .game-layout { grid-template-columns:1fr; }
  .board { grid-template-rows:repeat(2, 145px); min-height:0; }
  .room small { display:none; }
  .robot-token { font-size:1.8rem; }
}
@media (max-width: 520px) {
  .board { grid-template-columns:repeat(2,1fr); grid-template-rows:repeat(3,130px); }
  .room { min-height:0; }
  .room span { font-size:1.65rem; }
  .room b { font-size:.86rem; }
}

/* Ayuda / solución completa */
.modal-card{max-height:min(88vh,900px);overflow:auto}
.walkthrough{font-size:.95rem}
.walkthrough ol{padding-left:1.5rem;margin:0}
.walkthrough li{margin:0 0 .9rem;padding-left:.2rem}
.walkthrough ul{margin:.45rem 0 .2rem;padding-left:1.4rem}
.walkthrough .system-result{margin-top:.55rem;padding:.7rem .8rem;border:1px solid #3b4d69;border-radius:9px;background:#0b1220}
