:root {
  --bg: #0B0620; --ink: #fff; --muted: #C9B8FF; --dim: #8a78c8;
  --cyan: #2CF6FF; --mag: #FF2BD6; --lime: #B6FF3B; --yel: #FFE53B; --org: #FF8A00; --red: #FF3B6B; --vio: #9D5CFF;
  --disp: "Bungee", system-ui, sans-serif; --body: "Rubik", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  color: var(--ink); font-family: var(--body); overflow: hidden; user-select: none; -webkit-user-select: none;
  background:
    radial-gradient(120% 55% at 50% -12%, #3b0f80 0%, transparent 62%),
    radial-gradient(90% 45% at 50% 112%, #5d0a63 0%, transparent 64%),
    var(--bg);
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--yel); outline-offset: 2px; }

/* ---------- background: stars + synthwave floor ---------- */
.stars {
  position: fixed; inset: 0; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 22%, #b9f9ff 50%, transparent 51%),
    radial-gradient(1px 1px at 76% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 30%, #ffc6f4 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 68% 44%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 34%, #fff 50%, transparent 51%);
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .25; } }
.bg-grid {
  position: fixed; left: -50%; right: -50%; bottom: -2px; height: 42vh; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255,43,214,.55) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255,43,214,.55) 2px, transparent 2px);
  background-size: 54px 54px;
  transform: perspective(260px) rotateX(62deg); transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%); mask-image: linear-gradient(to top, #000 10%, transparent 85%);
  animation: gridmove 1.6s linear infinite;
}
@keyframes gridmove { to { background-position: 0 54px, 0 0; } }

/* ---------- app shell ---------- */
.app {
  position: relative; z-index: 1; max-width: 480px; height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
}
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mute {
  position: absolute; z-index: 15; top: max(8px, env(safe-area-inset-top)); right: 10px;
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid rgba(44,246,255,.5);
  background: rgba(11,6,32,.6); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 12px rgba(44,246,255,.25);
}
.mute svg { width: 22px; height: 22px; fill: var(--cyan); }
.mute svg .w, .hear svg .w { fill: none; stroke: var(--cyan); stroke-width: 2.2; stroke-linecap: round; }
.mute .ic-off { display: none; }
.mute.off .ic-on { display: none; }
.mute.off .ic-off { display: block; }
.mute.off { border-color: rgba(255,59,107,.6); }
.mute.off svg { fill: var(--red); }
.mute.off svg .w { stroke: var(--red); }

/* ---------- logo ---------- */
.logo { margin: 0; text-align: center; font: 400 clamp(38px, 12vw, 58px)/.95 var(--disp); letter-spacing: .02em; }
.logo span { display: block; }
.logo .l1 { color: #e9feff; text-shadow: 0 0 6px var(--cyan), 0 0 18px var(--cyan), 0 0 38px rgba(44,246,255,.6); }
.logo .l2 { color: #ffe9fb; text-shadow: 0 0 6px var(--mag), 0 0 18px var(--mag), 0 0 38px rgba(255,43,214,.6); animation: flicker 5s infinite; }
.logo.small { font-size: clamp(30px, 9.5vw, 44px); }
@keyframes flicker { 0%, 91%, 95%, 100% { opacity: 1; } 92%, 94% { opacity: .45; } }

/* ---------- idle ---------- */
.idle { justify-content: center; align-items: center; gap: 10px; text-align: center; }
.idle-robot { width: min(80vw, 330px); height: auto; }
.tag { margin: 0; max-width: 320px; color: var(--muted); font: 700 16px/1.35 var(--body); }

/* ---------- setup steps (level → categories → mode) ---------- */
.setup { justify-content: center; gap: 8px; padding-top: 42px; }
.logo.tiny { font-size: clamp(20px, 6.4vw, 28px); }
.logo.tiny span { display: inline; }
.s-top { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.back { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border-radius: 12px; border: 2px solid rgba(201,184,255,.4); background: rgba(11,6,32,.6); color: var(--muted); font: 700 30px/1 var(--body); cursor: pointer; }
.step { margin: 0; text-align: center; font: 900 12px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.chosen { position: absolute; right: 0; top: 50%; transform: translateY(-50%); max-width: 30%; text-align: right; font: 700 11px/1.2 var(--body); color: var(--muted); overflow-wrap: anywhere; }
.s-title { margin: 0; text-align: center; font: 400 clamp(19px, 6vw, 24px)/1.1 var(--disp); color: var(--lime); text-shadow: 0 0 10px rgba(182,255,59,.6); overflow-wrap: anywhere; }
.s-sub { margin: 0 0 4px; text-align: center; font: 500 14px/1.35 var(--body); color: var(--muted); text-wrap: balance; }
.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.lvl-btn {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px;
  min-height: 84px; padding: 9px 11px; text-align: left; cursor: pointer;
  border-radius: 16px; border: 2px solid color-mix(in srgb, var(--c) 70%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, #120733), #0e0628 70%);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 30%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 12%, transparent);
  transition: transform .12s ease, box-shadow .2s ease;
}
.lvl-btn:active, .cat-btn:active, .mode-btn:active { transform: scale(.96); }
.lvl-btn:hover { box-shadow: 0 0 22px color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 18%, transparent); }
.lvl-btn.last::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 10px var(--c); animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .2; } }
.lv-head { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-right: 12px; }
.lv-code { font: 400 22px/1 var(--disp); color: var(--c); text-shadow: 0 0 10px var(--c); }
.lv-name { font: 900 13px/1.15 var(--body); color: #fff; overflow-wrap: anywhere; }
.lv-desc { font: 500 12px/1.25 var(--body); color: var(--muted); overflow-wrap: anywhere; }
.quick {
  margin-top: 4px; min-height: 48px; padding: 8px 12px; border-radius: 14px; cursor: pointer;
  border: 2px dashed rgba(255,229,59,.6); background: rgba(255,229,59,.08); color: #fff6c2;
  font: 700 13px/1.25 var(--body); overflow-wrap: anywhere;
}
.quick b { display: block; font: 400 13px var(--disp); color: var(--yel); letter-spacing: .04em; }

.cats { display: grid; grid-template-columns: 1fr; gap: 7px; }
.cat-btn {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 40px 6px 12px; text-align: left; cursor: pointer;
  border-radius: 14px; border: 2px solid rgba(44,246,255,.35); background: rgba(44,246,255,.05);
  font: 900 15px/1.2 var(--body); color: #e8e2ff; transition: background .15s, border-color .15s, box-shadow .15s;
}
.cat-btn .ce { font-size: 22px; line-height: 1; }
.cat-btn .cn { overflow-wrap: break-word; }
.cat-btn::after {
  content: ""; position: absolute; right: 9px; top: 50%; width: 18px; height: 18px; margin-top: -11px; border-radius: 6px;
  border: 2px solid rgba(44,246,255,.5);
}
.cat-btn[aria-pressed="true"] { border-color: var(--cyan); background: rgba(44,246,255,.16); box-shadow: 0 0 14px rgba(44,246,255,.4); color: #fff; }
.cat-btn[aria-pressed="true"]::after { background: var(--cyan); border-color: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.cat-btn[aria-pressed="true"]::before { content: "✓"; position: absolute; right: 13px; top: 50%; transform: translateY(-55%); z-index: 1; font: 900 13px var(--body); color: #0B0620; }
.all-btn { align-self: center; min-height: 44px; padding: 6px 16px; border-radius: 99px; cursor: pointer; border: 2px solid rgba(201,184,255,.45); background: transparent; color: var(--muted); font: 900 13px var(--body); }
.btn-go {
  min-height: 52px; border: 0; border-radius: 16px; cursor: pointer; padding: 8px 12px;
  font: 400 clamp(16px, 5vw, 20px) var(--disp); color: #10052a;
  background: linear-gradient(90deg, var(--cyan), var(--lime)); box-shadow: 0 0 18px rgba(44,246,255,.55), 0 4px 0 #0b7f88;
}
.btn-go:disabled { opacity: .35; box-shadow: none; cursor: not-allowed; }

.modes { display: flex; flex-direction: column; gap: 10px; }
.mode-btn {
  display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 4px 12px; padding: 12px 14px; text-align: left; cursor: pointer;
  border-radius: 18px; border: 2px solid color-mix(in srgb, var(--c) 75%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, #120733), #0e0628 75%);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 30%, transparent);
}
.mode-btn .mi { grid-row: span 2; font-size: 34px; text-align: center; filter: drop-shadow(0 0 8px var(--c)); }
.mode-btn .mn { font: 400 17px/1.1 var(--disp); color: var(--c); text-shadow: 0 0 8px var(--c); overflow-wrap: anywhere; }
.mode-btn .md { font: 500 13px/1.35 var(--body); color: #e8e2ff; }
.mode-btn.last { outline: 2px dashed color-mix(in srgb, var(--c) 60%, transparent); outline-offset: 3px; }

/* ---------- play: HUD ---------- */
.play { gap: 6px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; height: 46px; padding: 0 52px 0 50px; }
.hud-l { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.lvl { padding: 2px 8px; border-radius: 8px; border: 2px solid var(--lime); color: var(--lime); font: 400 13px var(--disp); text-shadow: 0 0 8px var(--lime); box-shadow: 0 0 8px rgba(182,255,59,.35); }
.progress { color: var(--muted); font: 700 12px var(--body); white-space: nowrap; }
.score { font: 400 clamp(24px, 7.5vw, 32px)/1 var(--disp); color: #fff; text-shadow: 0 0 8px var(--mag), 0 0 22px var(--mag); font-variant-numeric: tabular-nums; }
.score.bump { animation: bump .28s ease; }
@keyframes bump { 40% { transform: scale(1.18); } }

.combo { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; height: 26px; }
.combo-label { font: 900 12px var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.combo-label b { font: 400 15px var(--disp); color: var(--yel); text-shadow: 0 0 8px var(--yel); }
.combo-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid rgba(255,229,59,.25); }
.combo-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--yel), var(--org), var(--mag)); box-shadow: 0 0 10px var(--org); transition: width .25s ease; }
.mult { min-width: 44px; text-align: center; padding: 1px 6px; border-radius: 8px; font: 400 16px var(--disp); color: #fff; background: rgba(255,255,255,.08); transition: background .2s, box-shadow .2s; }
.mult.m2 { background: #1a7fff; box-shadow: 0 0 12px #1a7fff; }
.mult.m3 { background: #8a2bff; box-shadow: 0 0 14px #8a2bff; }
.mult.m4 { background: #ff2bd6; box-shadow: 0 0 16px #ff2bd6; }
.mult.m5 { background: linear-gradient(90deg, #ff8a00, #ff2bd6); box-shadow: 0 0 20px #ff8a00; animation: pulse5 .6s ease-in-out infinite alternate; }
@keyframes pulse5 { to { transform: scale(1.08); } }

/* ---------- play: stage + robot ---------- */
.stage { flex: 1; min-height: 96px; display: flex; justify-content: center; align-items: stretch; }
.stage .robot { width: 100%; height: 100%; }
.robot { overflow: visible; }
.robot .lava { filter: drop-shadow(0 0 6px #ff2bd6); }
.robot .lava path { animation: lava 1.2s ease-in-out infinite alternate; }
@keyframes lava { to { transform: translateY(2px); } }
.robot .flyer { transition: transform .6s cubic-bezier(.3,1.4,.5,1); }
.robot .sway { transform-box: view-box; transform-origin: 150px 138px; animation: sway 3.2s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.robot .str { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.2; transition: opacity .2s; }
.robot .str.gone { opacity: 0; }
.robot .balloon { transform-box: fill-box; transform-origin: 50% 60%; filter: drop-shadow(0 0 5px var(--c)); transition: transform .35s cubic-bezier(.3,1.6,.5,1), opacity .2s; }
.robot .balloon .bob { transform-box: fill-box; animation: bob 2.4s ease-in-out infinite; animation-delay: var(--d); }
@keyframes bob { 50% { transform: translateY(-3px); } }
.robot .balloon.popped { transform: scale(0); opacity: 0; transition: transform .12s ease-in, opacity .12s; }
.robot .balloon.inflate { animation: inflate .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes inflate { from { transform: scale(0); } }
.robot .bot { transform-box: view-box; transform-origin: 150px 200px; }
.robot.cheer .bot { animation: cheer .4s ease; }
@keyframes cheer { 40% { transform: translateY(-6px) scale(1.04); } }
.robot.hurt .bot { animation: hurt .35s ease; }
@keyframes hurt { 20%, 60% { transform: translateX(-5px) rotate(-4deg); } 40%, 80% { transform: translateX(5px) rotate(4deg); } }
.robot .mouth, .robot .eyes-x, .robot .sweat { display: none; }
.robot.mood-happy .m-happy, .robot.mood-flat .m-flat, .robot.mood-worried .m-worried, .robot.mood-panic .m-panic, .robot.mood-dead .m-panic { display: inline; }
.robot.mood-worried .sweat, .robot.mood-panic .sweat { display: inline; animation: sweat 1s ease-in infinite; }
@keyframes sweat { to { transform: translateY(6px); opacity: 0; } }
.robot.mood-dead .eyes-normal { display: none; }
.robot.mood-dead .eyes-x { display: inline; }
.robot.mood-panic .eye { transform-box: fill-box; transform-origin: center; transform: scale(1.35); }
.robot .arm { transform-box: view-box; }
.robot .arm-l { transform-origin: 137px 194px; animation: wave-l 1.6s ease-in-out infinite; }
.robot .arm-r { transform-origin: 163px 194px; animation: wave-r 1.6s ease-in-out infinite; }
@keyframes wave-l { 50% { transform: rotate(14deg); } }
@keyframes wave-r { 50% { transform: rotate(-14deg); } }
.robot.mood-panic .arm-l, .robot.mood-panic .arm-r { animation-duration: .35s; }
.robot .flyer.fall { transition: transform .9s cubic-bezier(.55,0,1,.45); }
.robot.zap .bot { animation: zap .12s steps(2) 6; }
@keyframes zap { 50% { opacity: .3; filter: brightness(3); } }

/* ---------- play: clue + slots + keys ---------- */
.clue { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.clue.enter { animation: clueIn .4s cubic-bezier(.2,1.4,.4,1); }
@keyframes clueIn { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.cat { padding: 2px 10px; border-radius: 99px; border: 1.5px solid var(--mag); color: #ffd3f6; font: 400 11px var(--disp); letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 0 6px var(--mag); box-shadow: 0 0 8px rgba(255,43,214,.35); max-width: 100%; overflow-wrap: anywhere; }
.hint { margin: 0; min-height: 2.7em; font: 700 clamp(14px, 4.2vw, 17px)/1.35 var(--body); color: #f2ecff; text-wrap: balance; }
.hint::before { content: "💡"; margin-right: 6px; filter: drop-shadow(0 0 4px var(--yel)); }

.slots { --slot: 40px; --gap: 6px; display: flex; justify-content: center; gap: var(--gap); padding: 4px 0 6px; min-height: 56px; }
.slot {
  position: relative; width: var(--slot); height: calc(var(--slot) * 1.22); display: grid; place-items: center;
  border-bottom: 4px solid var(--cyan); box-shadow: 0 6px 10px -6px var(--cyan); border-radius: 4px 4px 2px 2px;
  background: linear-gradient(to top, rgba(44,246,255,.13), transparent 70%);
}
.slot b { font: 400 calc(var(--slot) * .8)/1 var(--disp); text-transform: uppercase; color: #fff; text-shadow: 0 0 6px var(--cyan), 0 0 16px var(--cyan); transform: scale(0); }
.slot.on b { transform: scale(1); animation: pop .38s cubic-bezier(.3,1.8,.5,1); }
@keyframes pop { from { transform: scale(0) rotate(-20deg); } }
.slot.missed { border-color: var(--red); box-shadow: 0 6px 10px -6px var(--red); }
.slot.missed b { transform: scale(1); color: #ffd0da; text-shadow: 0 0 6px var(--red), 0 0 14px var(--red); }
.slots.win .slot { border-color: var(--lime); box-shadow: 0 6px 14px -4px var(--lime); animation: hop .5s ease calc(var(--i) * 45ms); }
.slots.win .slot b { color: #f4ffe0; text-shadow: 0 0 6px var(--lime), 0 0 18px var(--lime); }
@keyframes hop { 40% { transform: translateY(-10px); } }

.keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding-bottom: 2px; }
.keys.abc button:nth-child(22) { grid-column-start: 2; }
.key {
  height: clamp(42px, 6.6dvh, 54px); border-radius: 10px; cursor: pointer; padding: 0;
  border: 2px solid rgba(44,246,255,.55); background: rgba(44,246,255,.07);
  font: 400 clamp(17px, 5.2vw, 22px) var(--disp); color: #eaffff; text-shadow: 0 0 6px rgba(44,246,255,.8);
  box-shadow: inset 0 0 10px rgba(44,246,255,.15), 0 3px 0 rgba(44,246,255,.35);
  transition: transform .08s ease, background .15s, opacity .2s;
}
.key:active { transform: translateY(2px); box-shadow: inset 0 0 10px rgba(44,246,255,.15), 0 1px 0 rgba(44,246,255,.35); }
.key.hit { background: var(--lime); border-color: var(--lime); color: #142100; text-shadow: none; box-shadow: 0 0 14px rgba(182,255,59,.7); }
.key.miss { border-color: rgba(255,59,107,.45); background: rgba(255,59,107,.08); color: rgba(255,120,150,.55); text-shadow: none; box-shadow: none; opacity: .55; }
.key:disabled { cursor: default; }
.key.hit:disabled { opacity: .9; }

/* ---------- overlays ---------- */
.count { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; pointer-events: none; font: 400 clamp(72px, 26vw, 120px) var(--disp); color: #fff; text-shadow: 0 0 10px var(--yel), 0 0 30px var(--org), 0 0 60px var(--mag); text-align: center; padding: 0 16px; overflow-wrap: anywhere; }
.count.pulse { animation: countIn .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes countIn { from { transform: scale(2.4); opacity: 0; } }
.particles { position: absolute; inset: 0; z-index: 9; pointer-events: none; width: 100%; height: 100%; }
.fx { position: absolute; inset: 0; z-index: 10; pointer-events: none; overflow: hidden; }
.float { position: absolute; transform: translate(-50%, -50%); font: 400 20px var(--disp); color: var(--yel); text-shadow: 0 0 8px var(--org); white-space: nowrap; animation: floatUp .9s ease-out forwards; }
.float.bad { color: #ffd0da; font-size: 26px; text-shadow: 0 0 8px var(--red), 0 0 20px var(--red); }
@keyframes floatUp { to { transform: translate(-50%, -190%); opacity: 0; } }
.banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); max-width: 92%; text-align: center;
  font: 400 clamp(28px, 10vw, 44px)/1.05 var(--disp); color: #fff; overflow-wrap: anywhere;
  text-shadow: 0 0 8px var(--c, var(--mag)), 0 0 24px var(--c, var(--mag)), 0 0 48px var(--c, var(--mag));
  animation: banner 1.1s cubic-bezier(.2,1.5,.4,1) forwards;
}
@keyframes banner { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.1) rotate(2deg); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
.flash { position: absolute; inset: 0; z-index: 8; pointer-events: none; opacity: 0; }
.flash.on { animation: flash .35s ease-out; }
.flash.ok { background: radial-gradient(circle at 50% 55%, rgba(182,255,59,.45), transparent 70%); }
.flash.bad { background: radial-gradient(circle at 50% 45%, rgba(255,59,107,.45), transparent 70%); }
.flash.combo { background: radial-gradient(circle at 50% 30%, rgba(255,229,59,.4), transparent 70%); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.app.shake { animation: shake .3s ease; }
@keyframes shake { 20% { transform: translate(-6px, 2px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-4px, 1px); } 80% { transform: translate(3px, 0); } }

/* ---------- reveal card ---------- */
.reveal { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); background: rgba(5,2,20,.62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.card {
  --c: var(--lime);
  width: 100%; max-height: 100%; overflow-y: auto; padding: 16px 16px 14px; border-radius: 22px; text-align: center;
  background: linear-gradient(170deg, #1d0a4a, #10062e 70%);
  border: 2px solid var(--c); box-shadow: 0 0 26px color-mix(in srgb, var(--c) 45%, transparent), inset 0 0 22px color-mix(in srgb, var(--c) 12%, transparent);
  animation: cardIn .42s cubic-bezier(.2,1.35,.4,1);
}
.card.bad { --c: var(--mag); }
@keyframes cardIn { from { transform: translateY(40px) scale(.94); opacity: 0; } }
.r-status { margin: 0; font: 400 clamp(20px, 6.5vw, 26px) var(--disp); color: #fff; text-shadow: 0 0 8px var(--c), 0 0 20px var(--c); overflow-wrap: anywhere; }
.r-was { margin: 4px 0 0; color: var(--muted); font: 700 13px var(--body); }
.r-word { margin: 4px 0 2px; font: 400 clamp(26px, 9vw, 40px)/1.05 var(--disp); color: #fff; text-transform: uppercase; letter-spacing: .03em; overflow-wrap: anywhere; text-shadow: 0 0 6px var(--cyan), 0 0 18px var(--cyan); }
.r-pron { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.ipa { font: 500 18px var(--body); color: var(--yel); text-shadow: 0 0 8px rgba(255,229,59,.5); user-select: text; }
.hear { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 99px; cursor: pointer; border: 2px solid var(--cyan); background: rgba(44,246,255,.1); font: 900 14px var(--body); color: #eaffff; box-shadow: 0 0 10px rgba(44,246,255,.35); }
.hear svg { width: 20px; height: 20px; fill: var(--cyan); }
.hear.talk { animation: talk .5s ease-in-out infinite alternate; }
@keyframes talk { to { box-shadow: 0 0 22px rgba(44,246,255,.8); } }
.novoice { margin: 6px 0 0; color: var(--muted); font: 500 12px var(--body); }
.r-sec { margin-top: 10px; text-align: left; }
.r-label { display: block; font: 400 11px var(--disp); letter-spacing: .08em; color: var(--mag); text-transform: uppercase; margin-bottom: 2px; }
.r-sec p { margin: 0; font: 500 15px/1.4 var(--body); color: #f2ecff; user-select: text; }
.r-sec mark { background: none; color: var(--lime); font-weight: 900; text-shadow: 0 0 8px rgba(182,255,59,.5); }
.r-bonus { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.r-bonus:empty { display: none; }
.chip { padding: 4px 10px; border-radius: 99px; background: rgba(255,229,59,.1); border: 1.5px solid rgba(255,229,59,.5); color: #fff6c2; font: 700 12px var(--body); white-space: nowrap; }
.chip b { color: var(--yel); font-weight: 900; }
.chip.total { background: var(--yel); color: #241a00; border-color: var(--yel); box-shadow: 0 0 12px rgba(255,229,59,.6); }
.chip.total b { color: #241a00; }
.chip.life { border-color: rgba(44,246,255,.6); background: rgba(44,246,255,.1); color: #dffcff; }
.btn-next {
  width: 100%; min-height: 52px; margin-top: 14px; border: 0; border-radius: 16px; cursor: pointer;
  font: 400 clamp(16px, 5vw, 20px) var(--disp); color: #10052a; overflow-wrap: anywhere; padding: 8px 12px;
  background: linear-gradient(90deg, var(--cyan), var(--lime)); box-shadow: 0 0 18px rgba(44,246,255,.55), 0 4px 0 #0b7f88;
}
.card.bad .btn-next { background: linear-gradient(90deg, var(--mag), var(--org)); box-shadow: 0 0 18px rgba(255,43,214,.55), 0 4px 0 #8a1074; }
.btn-next:active { transform: translateY(2px); }

/* ---------- small / tall screens ---------- */
@media (max-height: 620px) {
  .hint { min-height: 2.5em; font-size: 14px; }
  .key { height: 40px; }
  .combo { height: 22px; }
  .r-sec { margin-top: 6px; }
  .r-sec p { font-size: 14px; }
}
@media (min-width: 700px) {
  .reveal { align-items: center; }
  .card { max-width: 440px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grid, .stars, .logo .l2, .robot .sway, .robot .balloon .bob, .robot .arm-l, .robot .arm-r, .robot .lava path, .mult.m5 { animation: none !important; }
  .app.shake { animation: none; }
  .slots.win .slot { animation: none; }
}

/* ---------- v2: balloons counter, timer, one-line headlines ---------- */
.lives { justify-self: end; display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 6px; border-radius: 12px; border: 2px solid rgba(255,43,214,.55); background: rgba(255,43,214,.1); box-shadow: 0 0 12px rgba(255,43,214,.3); }
.lives svg { width: 18px; height: 23px; fill: var(--mag); filter: drop-shadow(0 0 4px var(--mag)); }
.lives svg .s { fill: none; stroke: #fff; stroke-width: 1.5; opacity: .7; }
.lives b { font: 400 24px/1 var(--disp); color: #fff; text-shadow: 0 0 8px var(--mag); min-width: 1ch; text-align: center; }
.lives.down { animation: livesDown .45s ease; }
.lives.up { animation: livesUp .5s ease; }
.lives.low { border-color: var(--red); box-shadow: 0 0 18px rgba(255,59,107,.7); }
.lives.low b { color: #ffd0da; text-shadow: 0 0 10px var(--red); }
@keyframes livesDown { 30% { transform: scale(1.3); background: rgba(255,59,107,.5); } }
@keyframes livesUp { 30% { transform: scale(1.3); background: rgba(182,255,59,.45); } }

.timer { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; height: 24px; }
.t-ic { font-size: 15px; }
.t-bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid rgba(44,246,255,.35); }
.t-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--lime)); box-shadow: 0 0 10px var(--cyan); }
.t-num { min-width: 52px; text-align: right; font: 400 16px var(--disp); color: #eaffff; font-variant-numeric: tabular-nums; }
.timer.warn .t-bar i { background: linear-gradient(90deg, var(--red), var(--org)); box-shadow: 0 0 12px var(--red); }
.timer.warn .t-num { color: #ffd0da; text-shadow: 0 0 8px var(--red); animation: blink .5s steps(2) infinite; }

.banner { white-space: nowrap; max-width: none; }
.r-status { white-space: nowrap; }
.float.speed { color: #dffcff; font-size: 16px; text-shadow: 0 0 8px var(--cyan), 0 0 16px var(--cyan); }
.float.time { color: #f4ffe0; font-size: 18px; text-shadow: 0 0 8px var(--lime), 0 0 16px var(--lime); }
.chip.speed { border-color: rgba(44,246,255,.6); background: rgba(44,246,255,.1); color: #dffcff; }
.chip.speed b { color: var(--cyan); }
@media (max-height: 620px) {
  .setup { gap: 6px; padding-top: 36px; }
  .lvl-btn { min-height: 74px; }
  .cat-btn { min-height: 44px; }
  .s-sub { font-size: 13px; }
}

/* ---------- v3: rounds step + change settings ---------- */
.rounds { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.rounds .round-btn { flex: 0 0 calc((100% - 20px) / 3); }
.round-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 84px; padding: 8px 4px; cursor: pointer; border-radius: 18px; border: 2px solid color-mix(in srgb, var(--c) 75%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, #120733), #0e0628 75%); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 30%, transparent); }
.round-btn b { font: 400 34px/1 var(--disp); color: #fff; text-shadow: 0 0 10px var(--c); }
.round-btn span { font: 700 12px/1.2 var(--body); color: var(--muted); text-align: center; }
.round-btn:active { transform: scale(.96); }
.round-btn.last { outline: 2px dashed color-mix(in srgb, var(--c) 60%, transparent); outline-offset: 3px; }
.round-btn:disabled { opacity: .3; box-shadow: none; cursor: not-allowed; }
.s-note { margin: 4px 0 0; text-align: center; font: 500 13px/1.35 var(--body); color: var(--yel); }
.change-set { position: absolute; z-index: 13; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); min-height: 44px; padding: 8px 18px; border-radius: 99px; cursor: pointer; border: 2px solid rgba(201,184,255,.55); background: rgba(11,6,32,.85); color: #efe9ff; font: 900 14px var(--body); white-space: nowrap; box-shadow: 0 0 14px rgba(157,92,255,.35); }
.change-set.inline { position: static; transform: none; display: block; margin: 10px auto 0; background: transparent; border-color: rgba(201,184,255,.35); color: var(--muted); font-size: 13px; min-height: 40px; }

/* ---------- v4: back arrow in game + leave confirmation ---------- */
.back-play { position: absolute; z-index: 15; top: max(8px, env(safe-area-inset-top)); left: 10px; }
.score { font-size: clamp(20px, 6.6vw, 30px); }
.confirm { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(5,2,20,.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.cf-card { width: 100%; max-width: 340px; padding: 20px 18px 16px; border-radius: 22px; text-align: center; background: linear-gradient(170deg, #1d0a4a, #10062e 70%); border: 2px solid var(--mag); box-shadow: 0 0 26px rgba(255,43,214,.45); animation: cardIn .35s cubic-bezier(.2,1.35,.4,1); display: flex; flex-direction: column; gap: 10px; }
.cf-title { margin: 0; font: 400 clamp(18px, 6vw, 22px)/1.15 var(--disp); color: #fff; text-shadow: 0 0 10px var(--mag); }
.cf-text { margin: 0 0 4px; font: 500 14px/1.4 var(--body); color: var(--muted); }
.cf-yes { min-height: 46px; border-radius: 14px; cursor: pointer; border: 2px solid rgba(255,59,107,.6); background: rgba(255,59,107,.12); color: #ffd0da; font: 900 15px var(--body); }

/* ---------- v5: keyboard layout (QWERTY default, ABC optional) ---------- */
.kb-bar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: -2px; }
.kb-label { font: 700 12px var(--body); color: var(--muted); }
.kb-seg { display: inline-flex; padding: 2px; border-radius: 99px; border: 1.5px solid rgba(44,246,255,.45); background: rgba(11,6,32,.6); }
.kb-seg button { min-height: 30px; min-width: 64px; padding: 0 10px; border: 0; border-radius: 99px; cursor: pointer; background: transparent; color: var(--muted); font: 400 11px var(--disp); letter-spacing: .04em; }
.kb-seg button[aria-pressed="true"] { background: var(--cyan); color: #0B0620; box-shadow: 0 0 10px rgba(44,246,255,.6); }
.keys.qwerty { grid-template-columns: repeat(20, 1fr); gap: 6px 4px; }
.keys.qwerty .key { grid-column: span 2; font-size: clamp(15px, 4.6vw, 20px); border-radius: 8px; }
.keys.qwerty .key:nth-child(11) { grid-column: 2 / span 2; }
.keys.qwerty .key:nth-child(20) { grid-column: 4 / span 2; }
@media (max-height: 620px) { .kb-seg button { min-height: 26px; } }
