/* La Bomba Ñ — bomb.css (game screen). Cartoon flat style, thick outlines. */
:root {
  --night: #1B2333; --ink: #0E1420; --case: #3A4A63; --steel: #8A97AD; --panel: #EEF2F7;
  --yellow: #FFC93C; --red: #FF4D4D; --green: #3DDC84; --lcd: #0B0F17; --lcd-text: #7CFF6B; --soft: #C9D3E3;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--night); font-family: 'Fredoka', system-ui, sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
#app { max-width: 1400px; margin: 0 auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.splash { color: #fff; text-align: center; padding: 120px 20px; font-size: 24px; display: flex; flex-direction: column; align-items: center; gap: 20px; }

/* ---------- Top bar ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.tb-left { display: flex; flex-direction: column; gap: 6px; }
.plate { background: var(--yellow); border: 4px solid var(--ink); border-radius: 12px; padding: 4px 14px; font-weight: 700; font-size: 20px; letter-spacing: 1px; width: fit-content; }
.team { color: var(--soft); font-size: 17px; } .team b { color: #fff; }
.timer { background: var(--lcd); border: 5px solid var(--ink); outline: 4px solid var(--case); border-radius: 16px; padding: 2px 30px;
  font-family: 'Share Tech Mono', monospace; font-size: 68px; line-height: 1.1; color: var(--red); text-shadow: 0 0 14px rgba(255,77,77,.7); letter-spacing: 4px; }
.timer.stopwatch { color: var(--lcd-text); text-shadow: 0 0 14px rgba(124,255,107,.6); }
.timer.urgent { animation: pulse .5s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.06); background: #2a0d10; } }
.tb-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.tb-label { color: var(--soft); font-size: 13px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }
.strikes { display: flex; gap: 8px; }
.strike-box { width: 40px; height: 40px; border: 4px solid var(--ink); border-radius: 10px; background: #2B3547; display: flex; align-items: center; justify-content: center; }
.strike-box.on { background: #2A0F12; }
.strike-count { font-family: 'Share Tech Mono', monospace; color: var(--red); font-size: 32px; background: var(--lcd); border-radius: 8px; padding: 0 12px; }
.tb-tools { display: flex; gap: 10px; align-items: center; color: var(--soft); font-size: 15px; }
.tb-tools b { color: var(--yellow); }

/* ---------- Edgework ---------- */
.edgework { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: flex-end; justify-content: center; background: #151C29; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 18px; }
.edge-item { display: flex; flex-direction: column; gap: 6px; }
.batteries { display: flex; gap: 6px; min-height: 54px; align-items: center; }
.batteries .none { color: var(--soft); font-family: 'Share Tech Mono', monospace; font-size: 26px; }
.serial { background: #fff; border: 4px solid var(--ink); border-radius: 8px; padding: 4px 12px; font-family: 'Share Tech Mono', monospace; font-size: 26px; letter-spacing: 3px; }
.labels { display: flex; gap: 8px; flex-wrap: wrap; }
.label-chip { display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; border-radius: 10px; padding: 6px 10px; font-family: 'Share Tech Mono', monospace; font-size: 19px; border: 2px solid #2B3547; }
.led { width: 14px; height: 14px; border-radius: 50%; background: var(--case); }
.led.lit { background: #FFF3B0; box-shadow: 0 0 10px #FFE066; }

/* ---------- Casing & modules ---------- */
.casing { background: var(--case); border: 6px solid var(--ink); border-radius: 28px; box-shadow: 0 10px 0 var(--ink); overflow: hidden; }
.hazard { height: 20px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 20px, var(--ink) 20px 40px); border-bottom: 5px solid var(--ink); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; padding: 18px; }
.module { position: relative; background: var(--panel); border: 4px solid var(--ink); border-radius: 18px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 250px; }
.module.is-solved { background: #E3F7EA; }
.module.is-solved .mod-body { opacity: .55; pointer-events: none; }
.module.flash-red { animation: flashred .5s; }
@keyframes flashred { 0%, 60% { background: #FFD3D3; } }
.mod-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mod-title { display: flex; align-items: baseline; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.mod-title small { font-weight: 500; color: #4B5A73; font-size: 13px; letter-spacing: 0; }
.mod-num { background: var(--ink); color: #fff; border-radius: 6px; padding: 0 7px; font-size: 14px; }
.mod-tools { display: flex; align-items: center; gap: 8px; }
.swap-btn { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.swap-btn:hover { background: var(--yellow); }
.led-big { width: 20px; height: 20px; border-radius: 50%; background: #4A1C1C; border: 3px solid var(--ink); }
.led-big.on { background: var(--green); box-shadow: 0 0 12px var(--green); }
.mod-body { display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.stamp { position: absolute; right: 18px; bottom: 26px; transform: rotate(-8deg); border: 4px solid #127A43; color: #127A43; background: rgba(227,247,234,.95); border-radius: 8px; padding: 2px 12px; font-weight: 700; font-size: 20px; letter-spacing: 2px; }

/* ---------- Common controls ---------- */
.btn { border: 4px solid var(--ink); border-radius: 12px; padding: 8px 16px; font-weight: 700; font-size: 18px; color: var(--ink); background: #fff; cursor: pointer; min-height: 46px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-yellow { background: var(--yellow); }
.btn-white { background: #fff; box-shadow: 0 4px 0 var(--ink); }
.btn-white:active { box-shadow: 0 1px 0 var(--ink); }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 15px; border-width: 3px; }
.btn-xl { font-size: 26px; padding: 12px 40px; }
.btn-center { align-self: center; }
.btn-num { font-family: 'Share Tech Mono', monospace; font-size: 28px; min-height: 64px; }
.btn-key { background: var(--yellow); font-size: 32px; min-height: 70px; box-shadow: 0 5px 0 var(--ink); }
.btn-key.is-ok { background: var(--green); }
.btn-colour { font-size: 15px; min-height: 52px; padding: 4px; }
.btn-yes { background: var(--green); border-color: #fff; min-width: 86px; }
.btn-no { background: #B3261E; color: #fff; border-color: #fff; min-width: 86px; }
.lcd-panel { background: var(--lcd); border: 4px solid var(--ink); border-radius: 12px; padding: 6px 10px; }
.lcd-text { font-family: 'Share Tech Mono', monospace; color: var(--lcd-text); text-shadow: 0 0 8px rgba(124,255,107,.6); }
.lcd-big { font-size: 34px; letter-spacing: 4px; }
.lcd-mid { font-size: 23px; letter-spacing: 1px; }
.lcd-small { font-size: 20px; }
.center { text-align: center; }
.grow { flex-grow: 1; }
.row-between { display: flex; gap: 10px; align-items: stretch; justify-content: space-between; }
.row-center { display: flex; gap: 10px; justify-content: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.accent-grid { flex-grow: 1; }
.stage-bars { display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.stage-bars span { width: 18px; height: 8px; background: var(--steel); border: 2px solid var(--ink); border-radius: 2px; }
.stage-bars span.on { background: var(--green); }
.arrow-btn { width: 46px; height: 30px; border: 3px solid var(--ink); border-radius: 7px; background: var(--steel); display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.arrow-btn.big { width: 50px; height: auto; }

/* Wires */
.wires-svg { width: 100%; height: auto; }
.wire { cursor: pointer; }
.wire:hover path:first-child { stroke: #445; }
.wire.is-cut { cursor: default; }
.wire-word { font: 600 15px Fredoka, sans-serif; fill: var(--ink); }
.cb-letter { font: 700 12px Fredoka, sans-serif; fill: #fff; }

/* Password */
.pw-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pw-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pw-letter { font-size: 38px; line-height: 1.1; }

/* Simon */
.simon-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex-grow: 1; }
.simon-btn { border: 4px solid var(--ink); border-radius: 18px; font-weight: 700; font-size: 22px; min-height: 64px; cursor: pointer; filter: brightness(.7) saturate(.8); transition: filter .1s; }
.simon-btn.flash { filter: brightness(1.25) saturate(1.2); box-shadow: 0 0 22px #fff; }

/* Maze */
.maze-wrap { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.maze-svg { width: 200px; height: 200px; }
.maze-pad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.maze-pad .btn { font-size: 14px; padding: 6px 8px; }

/* Interrogation */
.id-card { background: #fff; border: 3px solid var(--ink); border-radius: 10px; padding: 6px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 14px; font-size: 15px; }
.id-row { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed #c9d3e3; }
.id-row span { color: #4B5A73; }

/* Translation */
.built-line { background: #fff; border: 3px dashed var(--ink); border-radius: 10px; min-height: 44px; padding: 8px 12px; font-size: 19px; font-weight: 600; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile { border: 3px solid var(--ink); border-radius: 10px; background: var(--yellow); font-size: 17px; font-weight: 600; padding: 6px 12px; min-height: 42px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.tile.is-used { opacity: .3; }

/* Broken sentence */
.sentence-list { display: flex; flex-direction: column; gap: 8px; }
.sentence-row { display: flex; align-items: center; gap: 10px; }
.wire-chip { width: 64px; height: 22px; border-radius: 11px; border: 4px solid var(--ink); cursor: pointer; font-weight: 700; font-size: 11px; color: #fff; padding: 0; flex-shrink: 0; }
.wire-chip.is-cut { background-image: linear-gradient(90deg, transparent 44%, var(--panel) 44%, var(--panel) 56%, transparent 56%) !important; cursor: default; }
.sentence-text { background: #fff; border: 3px solid var(--ink); border-radius: 8px; padding: 6px 10px; font-size: 17px; flex-grow: 1; }

/* ---------- Needy ---------- */
.needy-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
.needy { display: flex; align-items: center; gap: 14px; background: var(--ink); border: 4px solid #2B3547; border-radius: 18px; padding: 10px 16px; min-height: 76px; flex-wrap: wrap; }
.needy.is-active { border-color: var(--yellow); animation: needyglow 1s infinite alternate; }
@keyframes needyglow { to { box-shadow: 0 0 18px rgba(255,201,60,.6); } }
.needy-head { display: flex; flex-direction: column; min-width: 150px; }
.needy-title { color: var(--yellow); font-weight: 700; font-size: 16px; }
.needy-hint { color: var(--soft); font-size: 12px; }
.needy-clock { font-family: 'Share Tech Mono', monospace; font-size: 34px; color: var(--red); background: #000; border-radius: 8px; padding: 0 10px; min-width: 64px; text-align: center; }
.needy-body { display: flex; gap: 10px; align-items: center; flex-grow: 1; flex-wrap: wrap; color: var(--soft); }
.needy-q { color: #fff; font-size: 22px; font-weight: 600; flex-grow: 1; }

/* ---------- Effects & overlays ---------- */
body.shake #app { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
body.boom-shake #app { animation: shake .3s 3; }
.blackout { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.blackout.on { opacity: .96; pointer-events: all; }
.toast { position: fixed; left: 50%; bottom: 30px; opacity: 0; transform: translateX(-50%) translateY(100px); background: var(--yellow); border: 4px solid var(--ink); border-radius: 12px; padding: 8px 18px; font-weight: 700; transition: transform .25s, opacity .25s; z-index: 70; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.overlay { position: fixed; inset: 0; background: rgba(14,20,32,.86); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.overlay.on { display: flex; }
.ov-card { background: var(--panel); border: 6px solid var(--ink); border-radius: 26px; padding: 28px 34px; text-align: center; max-width: 620px; width: 100%; display: flex; flex-direction: column; gap: 18px; align-items: center; box-shadow: 0 10px 0 var(--ink); }
.ov-title { font-size: 44px; font-weight: 700; }
.ov-text { font-size: 19px; margin: 0; }
.ov-sub { font-size: 22px; font-weight: 600; color: #B3261E; }
.ov-stats { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; font-size: 18px; }
.ov-stats > div { display: flex; flex-direction: column; align-items: center; }
.ov-stats b { font-size: 26px; }
.ov-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.win-stamp { font-size: 54px; font-weight: 700; color: #127A43; border: 7px solid #127A43; border-radius: 14px; padding: 4px 24px; transform: rotate(-6deg); animation: stampin .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes stampin { from { transform: rotate(-6deg) scale(3); opacity: 0; } }
.boom { position: relative; animation: stampin .4s cubic-bezier(.2,1.6,.4,1); }
.boom-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; color: #fff; -webkit-text-stroke: 3px var(--ink); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 65; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg); } }

/* ---------- Tablet / small screens ---------- */
@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr 1fr; }
  .timer { grid-column: 1 / -1; grid-row: 1; justify-self: center; font-size: 52px; }
  .module-grid { grid-template-columns: 1fr; padding: 12px; }
  .needy-bar { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
