/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: 'Courier New', 'SimHei', monospace;
  background: #02040e; height: 100dvh;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  color: #fff;
}

/* ===== Canvases ===== */
canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#bgCanvas { z-index: 0; }
#fxCanvas { z-index: 15; }
#bgCanvas, #fxCanvas {
  transition: transform .4s ease, filter .6s ease;
}
body.slowmo #bgCanvas, body.slowmo #fxCanvas {
  transform: scale(1.06); transform-origin: 22% 72%;
}
body.frost #bgCanvas, body.frost #fxCanvas {
  filter: saturate(.35) brightness(1.12);
}
body.rewind #bgCanvas { filter: grayscale(1) brightness(.75); }
body.dead-scene #bgCanvas, body.dead-scene #fxCanvas, body.dead-scene .stage {
  filter: grayscale(.78) brightness(.62);
}
body.frozen .char, body.frozen .brick { animation-play-state: paused !important; }

/* ===== Word Sign (木牌吊牌) ===== */
.word-stage {
  position: fixed;
  top: calc(max(56px, env(safe-area-inset-top) + 48px));
  left: 50%; transform: translateX(-50%);
  z-index: 20; text-align: center; pointer-events: none;
  width: min(94vw, 440px); transition: opacity .3s ease;
}
.word-stage.shake { animation: shake .5s ease; }
.sign {
  position: relative; display: inline-block;
  min-width: min(78vw, 340px); max-width: 94vw;
  padding: 12px 22px 14px;
  background: linear-gradient(180deg, #241812, #160d08 55%, #0d0705);
  border: 3px solid var(--glow); border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06), inset 0 -3px 0 rgba(0,0,0,.6),
              0 0 22px -4px var(--glow), 0 10px 26px rgba(0,0,0,.55);
  transition: border-color .6s, box-shadow .6s;
}
.sign::before, .sign::after {
  content: ''; position: absolute; top: -15px; width: 3px; height: 15px;
  background: repeating-linear-gradient(0deg, #6b5a3d 0 3px, #3a2f1e 3px 6px);
  box-shadow: 0 0 6px rgba(255,180,71,.35);
}
.sign::before { left: 20%; }
.sign::after { right: 20%; }
.sign.hot {
  box-shadow: inset 0 2px 0 rgba(255,255,255,.06), inset 0 -3px 0 rgba(0,0,0,.6),
              0 0 34px rgba(255,200,40,.55), 0 10px 26px rgba(0,0,0,.55);
}
.sign.final {
  border-color: #ffd700;
  animation: finalPulse .7s ease-in-out infinite alternate;
}
.sign.double-armed {
  border-color: #ffd700;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.08), inset 0 -3px 0 rgba(0,0,0,.6),
              0 0 28px rgba(255,215,0,.45), 0 10px 26px rgba(0,0,0,.55);
}
.word-bonus {
  position: absolute; right: 8px; top: 7px; opacity: 0;
  color: #171006; background: #ffd700; border-radius: 4px;
  padding: 2px 6px; font-size: 10px; font-weight: bold;
  transform: translateY(-5px); transition: opacity .18s, transform .18s;
}
.word-bonus.on { opacity: 1; transform: translateY(0); }
.sign.skipping .prompt-word { animation: skippedWord .5s ease forwards; }
.sign.pop { animation: bIn .35s ease; }
.sign-dir { font-size: 11px; color: var(--glow); letter-spacing: 3px; margin-bottom: 3px; opacity: .85; transition: color .6s; }
.prompt-word {
  font-size: clamp(24px, 6.4vw, 38px); font-weight: bold; color: #fff;
  text-shadow: 0 0 14px var(--glow), 0 2px 6px rgba(0,0,0,.9);
  letter-spacing: 2px; line-height: 1.35; word-break: break-word;
}

/* ===== Letter slots ===== */
.slot-hint { margin-top: 8px; display: flex; gap: 4px; justify-content: center; min-height: 12px; flex-wrap: wrap; }
.slot {
  width: 9px; height: 12px; border-radius: 2px;
  background: rgba(255,255,255,.14);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.4);
  transition: background .1s, box-shadow .1s;
}
.slot.f { background: #ffd700; box-shadow: 0 0 9px rgba(255,215,0,.9); }
.slot.burst { background: #ffd700; box-shadow: 0 0 10px rgba(255,215,0,.9); animation: slotBurst .5s ease forwards; }

/* ===== Timer ===== */
.timer-wrap { position: relative; margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.timer-bar {
  flex: 1; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.1); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.timer-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, #45e6ff, #7df9ff);
  border-radius: 3px; transition: width .1s linear;
}
.timer-num {
  font-size: 13px; font-weight: bold; color: #9adfff;
  min-width: 36px; text-align: right;
  text-shadow: 0 0 8px rgba(69,230,255,.5);
}
.timer-wrap.warn .timer-fill { background: linear-gradient(90deg, #ff3b30, #ff9a3c); }
.timer-wrap.warn .timer-num { color: #ff5e3a; text-shadow: 0 0 10px rgba(255,60,0,.8); animation: numPulse .5s ease infinite alternate; }
.timer-wrap.max .timer-num { animation-duration: .22s; }
.timer-status {
  position: absolute; right: 0; top: calc(100% + 3px);
  color: #d9f7ff; font-size: 11px; font-weight: bold;
  opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s;
  text-shadow: 0 0 10px rgba(125,225,255,.85);
}
.timer-status.on { opacity: 1; transform: translateY(0); }
.timer-wrap.frozen .timer-bar {
  background: rgba(185,235,255,.18);
  box-shadow: inset 0 0 0 1px rgba(220,250,255,.42), 0 0 14px rgba(105,210,255,.5);
}
.timer-wrap.frozen .timer-fill {
  background: repeating-linear-gradient(135deg, #f4fdff 0 7px, #6dd8ff 7px 14px);
  animation: frozenTimer 1s linear infinite;
}
.timer-wrap.frozen .timer-num { color: #e9fbff; animation: none; }

/* ===== Combo line ===== */
.combo-line {
  margin-top: 8px; min-height: 24px;
  font-size: clamp(14px, 3.4vw, 18px); font-weight: bold;
  color: #ff7b3c; text-shadow: 0 0 12px rgba(255,120,40,.6);
  opacity: 0; transition: opacity .2s, transform .2s; transform: scale(.8);
}
.combo-line.on { opacity: 1; transform: scale(1); }
.combo-line.t1 { font-size: clamp(16px, 4vw, 21px); }
.combo-line.t2 { font-size: clamp(18px, 4.6vw, 24px); color: #ff4d6d; text-shadow: 0 0 16px rgba(255,60,90,.8); animation: comboFire .35s ease infinite alternate; }
.combo-line.t3 { font-size: clamp(20px, 5.2vw, 27px); color: #ffd700; text-shadow: 0 0 20px rgba(255,215,0,.9); animation: comboFire .24s ease infinite alternate; }

/* ===== Character & Stage ===== */
.stage { position: fixed; inset: 0; z-index: 6; pointer-events: none; transition: filter .6s ease; }
.char {
  position: absolute; left: 17%; bottom: 14%; width: 48px; height: 64px;
  animation: charBob .3s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 10px rgba(69,230,255,.45));
}
.char-inner { position: absolute; inset: 0; transform-origin: 50% 100%; will-change: transform; }
.abyss-cloud {
  position: absolute; left: -29px; bottom: -24px; z-index: 3;
  width: 106px; height: 24px; opacity: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #44334e, #211927 72%);
  box-shadow: 0 7px 14px rgba(0,0,0,.68), inset 0 5px 8px rgba(156,111,176,.22),
              -20px 3px 0 -5px #2c2234, 20px 4px 0 -6px #18131e;
  transition: opacity .3s;
}
.abyss-cloud::before {
  content: ''; position: absolute; left: 14px; top: -14px;
  width: 36px; height: 28px; border-radius: 50% 54% 42% 48%;
  background: linear-gradient(145deg, #4d3958, #2d2235);
  box-shadow: 29px 5px 0 -3px #382a41, 54px 10px 0 -7px #261c2d;
}
body[data-phase="2"] .abyss-cloud { opacity: 1; animation: abyssCloudDrift 1.3s ease-in-out infinite alternate; }
.qt-player {
  position: absolute; left: 50%; bottom: -2px; z-index: 2;
  width: 123px; height: 123px; object-fit: contain;
  transform: translateX(-50%); transform-origin: 50% 100%;
  pointer-events: none; opacity: 0; visibility: hidden;
  transition: opacity .18s ease; will-change: filter, transform;
}
.char.qt-ready .qt-player { opacity: 1; visibility: visible; }
.char.qt-ready .px { visibility: hidden; }
.char.qt-ready .ghost { visibility: hidden; }
.char.qt-ready .board { bottom: -8px; z-index: -1; }
.char.qt-ready.panic .qt-player { filter: saturate(.72) brightness(.9); }
.char.qt-ready.turbo .qt-player { filter: drop-shadow(0 0 10px rgba(255,215,0,.82)); }
.char.qt-ready.dark {
  filter: drop-shadow(0 0 16px rgba(255,145,30,.9)) drop-shadow(0 0 7px rgba(255,215,0,.6));
}
.char.qt-ready.dark .qt-player {
  width: 132px; height: 132px;
  filter: drop-shadow(0 0 14px rgba(255,170,30,.9));
}
.char .px { position: absolute; width: 4px; height: 4px; }
.char .ghost { position: absolute; width: 4px; height: 4px; opacity: 0; transition: opacity .5s; }
.char .g1 { left: -10px; }
.char .g2 { left: -20px; }
.char .board {
  position: absolute; left: -29px; bottom: -8px; width: 106px; height: 15px;
  display: none; box-sizing: border-box; overflow: visible; isolation: isolate;
  border: 1px solid rgba(214,247,255,.84);
  border-radius: 48% 52% 34% 32% / 72% 74% 40% 42%;
  background:
    radial-gradient(ellipse at 9% 12%, rgba(255,255,255,.86) 0 7%, transparent 9%),
    radial-gradient(ellipse at 91% 12%, rgba(255,255,255,.72) 0 7%, transparent 9%),
    linear-gradient(180deg, #40506d 0 18%, #17223b 20% 58%, #090f20 61% 100%);
  box-shadow: inset 0 2px 2px rgba(255,255,255,.34), inset 0 -3px 3px rgba(0,0,0,.54),
              0 3px 0 -1px rgba(4,8,18,.95), 0 0 12px rgba(69,230,255,.42);
  transform-origin: 50% 68%;
}
.char .board::before {
  content: ''; position: absolute; left: 9px; right: 9px; top: 2px; height: 6px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(112deg, rgba(255,255,255,.28) 0 2px, transparent 2px 8px),
    linear-gradient(90deg, rgba(255,45,149,.92), rgba(69,230,255,.94) 52%, rgba(147,92,255,.9));
  box-shadow: inset 0 1px 1px rgba(255,255,255,.44), 0 0 5px rgba(69,230,255,.38);
}
.char .board::after {
  content: ''; position: absolute; left: 17px; bottom: -7px; z-index: -1;
  width: 13px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle at 42% 35%, #f8ffff 0 10%, #5be9ff 18% 42%, #10192c 48% 100%);
  box-shadow: 0 0 0 1px #050a14, 59px 0 0 #45dff8, 59px 0 0 1px #050a14,
              0 0 7px rgba(69,230,255,.72), 59px 0 7px rgba(255,45,149,.68);
}
.char[data-mode="skate"] { animation: charBob .45s ease-in-out infinite alternate; }
.char[data-mode="skate"] .board { display: block; animation: boardTilt .8s ease-in-out infinite alternate; }
.char[data-mode="glide"] { animation: glideBob 1.15s ease-in-out infinite alternate; }
.char[data-mode="jet"] { animation: jetBob .55s ease-in-out infinite alternate; }
.char.panic { animation: charBob .15s ease-in-out infinite alternate; }
.char.turbo { filter: drop-shadow(0 0 14px rgba(255,215,0,.8)) drop-shadow(0 0 6px rgba(69,230,255,.5)); }
.char.turbo .g1 { opacity: .22; }
.char.turbo .g2 { opacity: .1; }
.char.dark { filter: drop-shadow(0 0 16px rgba(255,30,60,.9)) brightness(.48) saturate(1.6); }
.char.dark .g1 { opacity: .3; }
.char.dark .g2 { opacity: .16; }
.char.jump { animation: charJump .52s ease-out; }
.char.fly { animation: charFly 3.4s ease-in-out; }
.char.flip { animation: charFlip .8s ease-in-out; }
.char.djump { animation: charDjump .9s ease-in-out; }
.char.dash .g1 { opacity: .42; }
.char.dash .g2 { opacity: .22; }
.char.die { animation: charDie 1.1s ease-in forwards; }

/* ===== Dragon companion (keeps #brick as the gameplay hit target) ===== */
.brick {
  position: absolute; left: calc(17% - 140px);
  bottom: min(calc(var(--kb) + env(safe-area-inset-bottom) + 300px), calc(var(--vvh)*0.56));
  width: 328px; height: 140px;
  --dragon-particle: #ffd45c;
  --dragon-particle-core: #fff7bd;
  --dragon-particle-glow: rgba(255,195,48,.94);
  --dragon-magic-soft: rgba(255,182,30,.28);
  --dragon-aura-main: rgba(255,199,70,.84);
  --dragon-aura-alt: rgba(255,241,151,.76);
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; box-shadow: none;
  transform-origin: 64% 55%;
  isolation: isolate; overflow: visible;
}
.brick::before,
.brick::after {
  display: none;
}
.dragon-flight-rig {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  transform-origin: 64% 55%; isolation: isolate; pointer-events: none;
  will-change: transform;
  animation: dragonEscortFlight 5.8s cubic-bezier(.45,.05,.35,1) infinite;
}
.dragon-wake {
  position: absolute; left: -20%; top: 12%; z-index: 0;
  width: 92%; height: 76%; pointer-events: none; opacity: .58;
  transform-origin: 100% 50%; mix-blend-mode: screen;
  animation: dragonWakeBreath 1.25s ease-in-out infinite alternate;
}
.dragon-wake::before,
.dragon-wake::after {
  content: ''; position: absolute; right: 0; pointer-events: none;
  border-radius: 50%; border-style: solid; border-color: transparent;
}
.dragon-wake::before {
  top: 5%; width: 92%; height: 74%;
  border-top-width: 2px; border-top-color: var(--dragon-aura-main);
  filter: drop-shadow(0 0 5px var(--dragon-particle-glow));
  transform: rotate(-7deg) skewX(-17deg);
  animation: dragonWakeArc 1.55s ease-in-out infinite;
}
.dragon-wake::after {
  top: 30%; width: 70%; height: 45%;
  border-bottom-width: 1px; border-bottom-color: var(--dragon-aura-alt);
  filter: blur(.2px) drop-shadow(0 0 4px var(--dragon-particle-glow));
  transform: rotate(5deg) skewX(-20deg);
  animation: dragonWakeArc 1.55s ease-in-out -.72s infinite reverse;
}
.dragon-wake i {
  position: absolute; right: 3%; top: var(--wake-y);
  width: var(--wake-width); height: 2px; opacity: 0; border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--dragon-particle-glow) 62%, var(--dragon-particle-core));
  filter: drop-shadow(0 0 4px var(--dragon-particle-glow));
  transform-origin: right center;
  animation: dragonWakeLine 1.08s cubic-bezier(.2,.72,.25,1) var(--wake-delay) infinite;
}
.dragon-aura {
  position: absolute; left: 10%; bottom: -2%; z-index: 1;
  width: 80%; height: 25%; border: 1.4px solid var(--dragon-aura-main);
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at center, var(--dragon-aura-main) 0 7%, var(--dragon-magic-soft) 28%, transparent 72%);
  box-shadow: 0 0 13px var(--dragon-aura-main), inset 0 0 10px var(--dragon-aura-alt);
  transform-origin: 50% 50%;
  animation: dragonAuraPulse 1.35s ease-in-out infinite;
}
.dragon-aura::before,
.dragon-aura::after {
  content: ''; position: absolute; pointer-events: none; border-radius: 50%;
}
.dragon-aura::before {
  inset: 18% 13%; border: 1px dashed var(--dragon-aura-alt);
  opacity: .74; transform: rotate(-8deg);
}
.dragon-aura::after {
  inset: -35% -12%;
  background:
    radial-gradient(circle at 14% 42%, var(--dragon-aura-main) 0 2px, transparent 3px),
    radial-gradient(circle at 31% 18%, var(--dragon-aura-alt) 0 1.5px, transparent 3px),
    radial-gradient(circle at 69% 26%, var(--dragon-aura-main) 0 1.7px, transparent 3px),
    radial-gradient(circle at 88% 57%, var(--dragon-aura-alt) 0 2px, transparent 3px),
    radial-gradient(ellipse, var(--dragon-aura-alt) 0 3%, transparent 46%);
  opacity: .45; filter: blur(3px);
}
.dragon-trail {
  position: absolute; left: -7%; top: 25%; z-index: 1;
  width: 62%; height: 68%; pointer-events: none; overflow: visible;
}
.dragon-trail i {
  position: absolute; display: block; width: var(--particle-size); height: var(--particle-size);
  border-radius: 50%; background: var(--dragon-particle);
  box-shadow: 0 0 8px var(--dragon-particle-glow), 0 0 2px var(--dragon-particle-core);
  opacity: 0;
  animation: dragonTailParticle var(--particle-duration) cubic-bezier(.18,.66,.28,1) var(--particle-delay) infinite;
}
.dragon-magic {
  position: absolute; inset: 2% 1% 0; z-index: 3;
  pointer-events: none; overflow: visible;
}
.dragon-magic::before {
  content: ''; position: absolute; inset: 12% 3% 13%;
  border-radius: 50%; opacity: .34;
  background:
    radial-gradient(ellipse at 27% 64%, var(--dragon-magic-soft), transparent 52%),
    radial-gradient(ellipse at 60% 54%, var(--dragon-magic-soft), transparent 58%),
    radial-gradient(ellipse at 84% 38%, var(--dragon-magic-soft), transparent 46%);
  animation: dragonMagicBreath 1.8s ease-in-out infinite;
}
.dragon-magic i {
  position: absolute; display: block; width: var(--magic-size); height: var(--magic-size);
  border-radius: 50%; background: var(--dragon-particle-core);
  box-shadow: 0 0 5px var(--dragon-particle-core), 0 0 10px var(--dragon-particle-glow);
  opacity: 0;
  animation: dragonMagicParticle var(--magic-duration) ease-out var(--magic-delay) infinite;
}
.dragon-magic i:nth-child(3n) {
  border-radius: 18%; background: var(--dragon-particle);
}
.dragon-companion {
  position: relative; z-index: 2; display: block; width: 100%; height: 100%; object-fit: contain;
  image-rendering: auto; pointer-events: none;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.48)) drop-shadow(0 0 5px var(--dragon-particle-glow));
  transition: filter .25s ease, opacity .25s ease, width .28s ease, height .28s ease;
  -webkit-mask-image: radial-gradient(ellipse 50% 54% at 50% 50%, #000 68%, rgba(0,0,0,.82) 84%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 54% at 50% 50%, #000 68%, rgba(0,0,0,.82) 84%, transparent 100%);
}
.brick.danger { animation: dragonDangerPulse .52s ease-in-out infinite; }
.brick.bump { animation: dragonStrike .48s cubic-bezier(.16,.82,.2,1); }
.brick[data-form="dark"] .dragon-flight-rig,
.brick[data-form="danger"] .dragon-flight-rig {
  animation-name: dragonDarkPatrol; animation-duration: 4.7s;
}
.brick[data-form="turning"] .dragon-flight-rig,
.brick[data-form="blade-transform"] .dragon-flight-rig {
  animation-name: dragonTransformOrbit; animation-duration: 2.2s;
}
.brick[data-form="blade"] .dragon-flight-rig {
  animation-name: swordEscortFlight; animation-duration: 3.45s;
  animation-timing-function: cubic-bezier(.4,.02,.24,1);
}
.brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig {
  z-index: 4;
  animation: dragonForwardRush 1.4s cubic-bezier(.18,.72,.18,1) both;
}
.brick.sword-rush .dragon-flight-rig {
  animation-name: swordForwardRush;
  animation-duration: 1.05s;
  animation-timing-function: cubic-bezier(.12,.78,.14,1);
}
.brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::before,
.brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::after {
  content: ''; position: absolute; pointer-events: none; mix-blend-mode: screen;
}
.brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::before {
  right: 2%; top: 7%; z-index: 5; width: 46px; height: 86%;
  border: 3px solid var(--dragon-aura-alt); border-radius: 50%;
  box-shadow: 0 0 10px var(--dragon-particle-core), 0 0 24px var(--dragon-particle-glow), inset 0 0 12px var(--dragon-aura-main);
  opacity: 0;
  animation: dragonRushShockRing 1.4s ease-out both;
}
.brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::after {
  left: -42%; top: 24%; z-index: -1; width: 82%; height: 52%;
  background: linear-gradient(90deg, transparent 0 5%, var(--dragon-magic-soft) 32%, var(--dragon-aura-main) 72%, var(--dragon-particle-core) 100%);
  clip-path: polygon(0 44%, 100% 0, 93% 49%, 100% 100%, 0 58%);
  filter: blur(5px) drop-shadow(0 0 10px var(--dragon-particle-glow));
  opacity: 0;
  animation: dragonRushEnergyCone 1.4s ease-out both;
}
.brick.sword-rush .dragon-flight-rig::before,
.brick.sword-rush .dragon-flight-rig::after {
  animation-duration: 1.05s;
}
.brick:is(.dragon-rush, .sword-rush) .dragon-wake {
  left: -48%; width: 142%; opacity: 1; scale: 1.42 .82;
  filter: saturate(1.4) brightness(1.25);
}
.brick:is(.dragon-rush, .sword-rush) .dragon-wake i {
  height: 3px;
  animation-duration: .34s;
}
.brick:is(.dragon-rush, .sword-rush) .dragon-wake::before { border-top-width: 4px; animation-duration: .46s; }
.brick:is(.dragon-rush, .sword-rush) .dragon-wake::after { border-bottom-width: 3px; animation-duration: .52s; }
.brick:is(.dragon-rush, .sword-rush) .dragon-trail { left: -28%; width: 88%; scale: 1.34; transform-origin: 100% 50%; }
.brick:is(.dragon-rush, .sword-rush) .dragon-trail i { animation-duration: .46s; }
.brick:is(.dragon-rush, .sword-rush) .dragon-magic { scale: 1.16; filter: brightness(1.34) saturate(1.25); }
.brick:is(.dragon-rush, .sword-rush) .dragon-magic i { animation-duration: .66s; }
.brick[data-form="blade"].bump {
  animation: swordStrike .62s cubic-bezier(.1,.86,.16,1);
}
.brick.sweat .dragon-companion { animation: dragonUrgent .16s ease-in-out infinite; }
.brick.sleepy .dragon-companion { opacity: .68; filter: grayscale(.22) drop-shadow(0 3px 4px rgba(0,0,0,.44)); }
.brick[data-form="turning"] .dragon-companion,
.brick[data-form="dark"] .dragon-companion,
.brick[data-form="blade-transform"] .dragon-companion,
.brick[data-form="blade"] .dragon-companion {
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.62)) drop-shadow(0 0 9px var(--dragon-particle-glow));
}
.brick[data-form="blade"] .dragon-companion {
  width: 50%; height: 50%;
}
.brick[data-form="blade"] .dragon-aura {
  scale: .58; transform-origin: 50% 50%;
}
.brick[data-form="blade"] .dragon-magic {
  scale: .6; transform-origin: 50% 50%;
}
.brick[data-form="blade"] .dragon-trail {
  scale: .72; transform-origin: 82% 50%;
}
.brick[data-form="blade"] .dragon-wake {
  left: -30%; width: 116%; opacity: .9; scale: 1.28 .72; transform-origin: 100% 50%;
}
.brick[data-form="blade"] .dragon-wake i {
  height: 2.5px; animation-duration: .68s;
}
.brick[data-form="blade"] .dragon-wake::before {
  border-top-width: 3px; animation-duration: .82s;
}
.brick[data-form="turning"],
.brick[data-form="blade-transform"],
.brick[data-form="dark"],
.brick[data-form="blade"],
.brick[data-form="danger"] {
  --dragon-particle: #bd72ff;
  --dragon-particle-core: #f2d9ff;
  --dragon-particle-glow: rgba(178,73,255,.96);
  --dragon-magic-soft: rgba(151,55,255,.3);
  --dragon-aura-main: rgba(185,84,255,.86);
  --dragon-aura-alt: rgba(117,70,255,.8);
}

@media (max-width: 520px) {
  .brick { left: calc(17% - 116px); width: 280px; height: 120px; }
  .dragon-trail i:nth-child(n+25),
  .dragon-magic i:nth-child(n+31) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dragon-flight-rig { animation: none !important; transform: translate3d(12px,-5px,0); }
  .brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::before,
  .brick:is(.dragon-rush, .sword-rush) .dragon-flight-rig::after { display: none; animation: none !important; }
  .dragon-wake { display: none; }
  .brick.bump, .brick.danger { animation: none !important; }
}

/* ===== Coins & Gems ===== */
.coin, .gem { position: fixed; z-index: 46; pointer-events: none; animation: coinFlyA .68s cubic-bezier(.45,-.15,.55,1) forwards; }
.coin {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c0, #ffd700 45%, #b87700);
  border: 2px solid #8b6b00; box-shadow: 0 0 16px rgba(255,215,0,.9);
}
.gem {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #ff5ee1, #45e6ff 40%, #7dff6a 70%, #ffd700);
  clip-path: polygon(50% 0, 100% 38%, 80% 100%, 20% 100%, 0 38%);
  box-shadow: 0 0 22px rgba(255,255,255,.95);
}
.coin.drop { animation: coinDropA 1.15s ease-in forwards; }

/* ===== Dust & Flame ===== */
.dust {
  position: fixed; z-index: 5; pointer-events: none; border-radius: 50%;
  background: rgba(150,200,255,.5); box-shadow: 0 0 6px rgba(69,230,255,.4);
  animation: dustPuff .55s ease-out forwards;
}
.flame {
  position: fixed; z-index: 5; pointer-events: none; border-radius: 50%;
  animation: flameGo .5s ease-out forwards;
}

/* ===== UFO & Beam & Cow ===== */
.ufo { position: fixed; z-index: 3; pointer-events: none; font-size: 20px; opacity: .5; filter: drop-shadow(0 0 10px rgba(125,249,255,.7)); animation: ufoFly 7s linear forwards; }
.beam { position: fixed; z-index: 3; pointer-events: none; width: 54px; background: linear-gradient(180deg, rgba(160,255,240,.5), rgba(160,255,240,.04)); clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%); animation: beamOn 2.4s ease forwards; }
.cow { position: fixed; z-index: 3; pointer-events: none; font-size: 20px; animation: cowUp 2.1s ease-in forwards; }

/* ===== Critters & Cans ===== */
.critter { position: fixed; z-index: 4; pointer-events: none; font-size: 18px; opacity: .5; will-change: transform; }
.critter.sil { filter: brightness(.15) saturate(.4); }
.can { position: fixed; z-index: 5; pointer-events: none; font-size: 15px; will-change: transform; }
.kbubble {
  position: fixed; z-index: 14; pointer-events: none;
  background: rgba(2,6,20,.88); border: 1.5px solid var(--glow);
  color: #fff; padding: 4px 10px; border-radius: 10px;
  font-size: 12px; font-weight: bold; letter-spacing: 1px;
  white-space: nowrap; animation: bubIn 1.2s ease forwards;
}
.kbubble::after { content: ''; position: absolute; left: 14px; bottom: -7px; border: 4px solid transparent; border-top-color: var(--glow); }
.ghost-float { position: fixed; z-index: 50; pointer-events: none; font-size: 30px; opacity: 0; animation: ghostUp 4s ease-out forwards; }
.dbg-badge {
  position: fixed; right: 8px; bottom: calc(var(--kb) + env(safe-area-inset-bottom) + 70px);
  z-index: 60; background: #ffe97a; color: #141414; font-weight: bold;
  padding: 4px 9px; border-radius: 6px; font-size: 12px; letter-spacing: 1px;
  pointer-events: none; box-shadow: 0 0 12px rgba(255,233,122,.6);
}

/* ===== HUD ===== */
.hud {
  position: fixed; top: 0; left: 0; width: 100%; z-index: 30;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  pointer-events: none;
}
.hud-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.world-tag {
  background: rgba(0,0,0,.72); color: var(--glow);
  padding: 6px 12px; border-radius: 6px; font-size: 11px;
  font-weight: bold; border: 1.5px solid var(--glow);
  letter-spacing: 1px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 52vw;
  transition: color .6s, border-color .6s;
}
.hud-right { display: flex; align-items: center; gap: 8px; }
.score-display {
  position: relative;
  color: #ffd700; font-size: 20px; font-weight: bold;
  text-shadow: 0 0 10px rgba(255,215,0,.4);
  background: rgba(0,0,0,.6); padding: 6px 12px;
  border-radius: 8px; min-height: 36px;
}
.score-display.pop { animation: scorePop .35s ease; }
.score-display.double-armed {
  border: 1.5px solid #ffd700;
  box-shadow: 0 0 16px rgba(255,215,0,.42);
}
.score-display.double-armed::after {
  content: '×2'; position: absolute; right: -7px; top: -9px;
  color: #151005; background: #ffd700; border-radius: 4px;
  padding: 1px 5px; font-size: 10px; line-height: 15px;
}
.mute-btn {
  pointer-events: auto; width: 44px; height: 44px; font-size: 19px;
  background: rgba(0,0,0,.6); color: #ccc;
  border: 1.5px solid rgba(255,255,255,.25); border-radius: 10px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.mute-btn:active { transform: scale(.92); }
.progress-mini {
  position: absolute; top: calc(100% + 2px); left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--glow), #ffd700);
  transition: width .3s; border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--glow);
}

/* ===== Distance counter ===== */
.dist-overlay {
  position: fixed; top: calc(var(--vvh) * .52); right: max(12px, env(safe-area-inset-right));
  transform: translateY(-50%); z-index: 5; pointer-events: none; opacity: .72;
  transition: top .18s ease;
}
.dist-num {
  font-size: clamp(18px, 3.7vw, 28px); font-weight: bold;
  color: rgba(255,255,255,.52); text-align: right; line-height: 1;
  text-shadow: 0 0 14px rgba(255,255,255,.18);
}
.dist-num.mile { color: #ffd700; text-shadow: 0 0 30px rgba(255,215,0,.85); animation: milePop .9s ease; }

/* Skill 3 answer reveal: centered briefly while the game state is locked. */
.skip-answer-reveal {
  position: fixed; left: 50%; top: 50%; z-index: 62;
  width: min(86vw, 500px); padding: 18px 22px 20px;
  transform: translate(-50%, -50%); text-align: center;
  border: 2px solid #ffe496; border-radius: 10px;
  background: rgba(10, 12, 29, .93);
  box-shadow: 0 0 32px rgba(255, 215, 109, .42), 0 14px 32px rgba(0,0,0,.5);
  animation: skipAnswerIn .22s ease-out both;
  pointer-events: none;
}
.skip-answer-label {
  color: #ffe496; font-size: clamp(13px, 3vw, 17px); letter-spacing: 3px;
  margin-bottom: 8px;
}
.skip-answer-value {
  color: #fff; font-size: clamp(24px, 6vw, 40px); font-weight: bold;
  line-height: 1.35; overflow-wrap: anywhere;
  text-shadow: 0 0 16px rgba(255,255,255,.4);
}
@keyframes skipAnswerIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ===== Input bar ===== */
.input-bar {
  position: fixed; bottom: calc(var(--kb) + env(safe-area-inset-bottom));
  left: 0; width: 100%; padding: 10px 12px;
  background: linear-gradient(180deg, rgba(10,10,24,.88), rgba(0,0,0,.9));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; gap: 8px; z-index: 30;
  border-top: 1px solid var(--glow);
  box-shadow: 0 -6px 24px -12px var(--glow);
}
.input-bar input {
  flex: 1; min-width: 0; min-height: 48px; padding: 12px 16px;
  font-size: 18px; border: 3px solid #555; border-radius: 12px;
  background: rgba(255,255,255,.07); color: #fff;
  font-family: 'Courier New', 'SimHei', monospace;
  outline: none; transition: border-color .2s;
}
.input-bar input:focus { border-color: var(--glow); box-shadow: 0 0 18px -4px var(--glow); }
.input-bar input::placeholder { color: rgba(255,255,255,.25); }
.input-bar button {
  min-width: 56px; min-height: 48px; padding: 12px 18px;
  font-size: 20px; font-weight: bold;
  background: linear-gradient(135deg, #e4000f, #ff4444); color: #fff;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 0 #8b0000, 0 0 18px rgba(255,0,0,.25);
  font-family: 'Courier New', 'SimHei', monospace;
  transition: transform .1s;
}
.input-bar button:active { transform: translateY(2px); box-shadow: 0 2px 0 #8b0000; }
.input-bar button:disabled { opacity: .3; box-shadow: none; }
.input-bar .give-up-btn {
  min-width: 68px; padding-inline: 12px; font-size: 14px;
  background: rgba(255,255,255,.08); color: #d7dbe7;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 4px 0 rgba(0,0,0,.5);
}
.input-bar .give-up-btn:active { box-shadow: 0 2px 0 rgba(0,0,0,.5); }
.input-bar .quit-run-btn {
  min-width: 68px; padding-inline: 10px; font-size: 13px;
  background: linear-gradient(135deg, rgba(44,91,132,.9), rgba(30,46,84,.92));
  color: #d8f1ff;
  border: 1px solid rgba(145,220,255,.48);
  box-shadow: 0 4px 0 rgba(4,19,40,.76), 0 0 14px rgba(77,190,255,.14);
}
.input-bar .quit-run-btn:active { box-shadow: 0 2px 0 rgba(4,19,40,.76); }

/* ===== Floating text ===== */
.float-text {
  position: fixed; left: 50%; z-index: 50; pointer-events: none;
  font-size: clamp(17px, 4.4vw, 24px); font-weight: bold; letter-spacing: 1px;
  animation: ftUp .95s ease-out forwards;
  text-shadow: 0 0 14px currentColor, 0 2px 4px rgba(0,0,0,.8);
}
.big-text {
  position: fixed; top: 38%; left: 50%; transform: translateX(-50%);
  z-index: 50; pointer-events: none;
  font-size: clamp(28px, 7.5vw, 44px); font-weight: bold; letter-spacing: 3px;
  text-shadow: 0 0 26px currentColor, 0 3px 0 rgba(0,0,0,.6);
  animation: fbFloatBig 1.25s ease forwards; white-space: nowrap;
}

/* ===== Vignettes ===== */
.vignette {
  position: fixed; inset: 0; z-index: 35; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 26%, rgba(140,0,0,.5) 72%, rgba(50,0,0,.92) 100%);
  opacity: 0; transition: opacity .85s ease;
}
.vignette.on { opacity: 1; }
.vgn-danger {
  position: fixed; inset: 0; z-index: 34; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(220,0,0,.5) 100%);
}
.vgn-danger.on { animation: vgPulse .9s ease-in-out infinite; }
.vgn-danger.max { animation-duration: .4s; }

/* ===== Title card ===== */
.title-card {
  position: fixed; top: calc(var(--vvh)*0.34); left: 0; width: 100%;
  z-index: 25; pointer-events: none; text-align: center;
}
.tc-inner { animation: tcIn 1.5s ease forwards; }
.tc-phase { font-size: clamp(18px, 4vw, 24px); color: #fff; letter-spacing: 10px; opacity: .85; }
.tc-name { font-size: clamp(34px, 9vw, 58px); font-weight: bold; color: var(--glow); text-shadow: 0 0 30px var(--glow), 0 0 80px var(--glow); margin: 6px 0; letter-spacing: 6px; }
.tc-rule { font-size: clamp(13px, 3.2vw, 17px); color: rgba(255,255,255,.75); letter-spacing: 3px; }

/* ===== READY → GO ===== */
#rdy {
  position: fixed; inset: 0; z-index: 90; display: flex;
  align-items: center; justify-content: center; pointer-events: none;
  background: rgba(2,4,14,.35);
}
.rdy-t {
  font-size: clamp(38px, 9.5vw, 66px); font-weight: bold; color: #fff;
  letter-spacing: 5px; text-shadow: 0 0 30px rgba(69,230,255,.8), 4px 4px 0 #123;
  animation: rdyPop .5s ease;
}
.rdy-t.go { color: #ffd700; text-shadow: 4px 4px 0 #8b5e00, 0 0 44px rgba(255,215,0,.65); }

/* ===== Overlays ===== */
.full-overlay {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100; padding: 24px; text-align: center;
}

/* Game Over */
.go-overlay {
  isolation: isolate;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(22px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 40%, rgba(69,20,30,.68), rgba(17,5,13,.88) 56%, rgba(3,2,9,.97) 100%),
    linear-gradient(145deg, rgba(31,7,16,.9), rgba(3,4,12,.95));
  backdrop-filter: blur(3px) saturate(.72);
  -webkit-backdrop-filter: blur(3px) saturate(.72);
  animation: fadeIn .55s;
}
@media (min-width: 481px) {
  .go-overlay { scrollbar-gutter: stable both-edges; }
}
.go-overlay::before {
  content: '';
  position: fixed;
  inset: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
         max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(255,191,151,.22);
  box-shadow: inset 0 0 70px rgba(0,0,0,.34), 0 0 55px rgba(255,67,58,.08);
}
.go-overlay::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 38%, transparent 0 24%, rgba(255,65,70,.08) 52%, transparent 76%),
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(255,196,144,.022) 42px 43px, transparent 43px 84px);
}
.go-overlay > * { position: relative; z-index: 1; }
.go-tag { color: #ffb49b; font-size: 12px; letter-spacing: 5px; margin-bottom: 7px; text-shadow: 0 0 16px rgba(255,111,91,.42); }
.go-overlay h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(34px, 8.5vw, 58px); color: #ff867c; text-shadow: 0 0 34px rgba(255,47,44,.5), 0 3px 16px rgba(0,0,0,.5); margin-bottom: 14px; letter-spacing: 4px; }
.go-ans-label { color: #ff9a9a; font-size: 12px; letter-spacing: 5px; }
.go-answer {
  margin-top: 8px; min-height: 1.5em; max-width: 100%;
  font-size: clamp(22px, 5.8vw, 36px); font-weight: bold;
  color: #ffd700; letter-spacing: 2px; line-height: 1.4;
  word-break: break-word; text-shadow: 0 0 26px rgba(255,215,0,.45);
}
.caret { animation: blink .7s steps(2) infinite; color: #ffb84d; }
.go-info { width: 100%; color: #b8a9aa; font-size: 13px; line-height: 1.9; margin: 16px 0 4px; }
.go-info b { color: #ffd700; }
.go-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; margin-inline: auto; align-items: center; width: min(100%, 360px); }
.btn-again {
  min-width: 220px; min-height: 52px; padding: 15px 40px;
  font-size: clamp(16px, 3.8vw, 20px); font-weight: bold;
  background: linear-gradient(135deg, #e4000f, #ff4444); color: #fff;
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 5px 0 #8b0000, 0 0 24px rgba(255,0,0,.3);
  font-family: inherit;
}
.btn-again:active { transform: translateY(2px); box-shadow: 0 2px 0 #8b0000; }
.btn-ghost {
  min-width: 220px; min-height: 46px; padding: 12px 32px; font-size: 15px;
  background: rgba(255,255,255,.07); color: #bbb;
  border: 1.5px solid rgba(255,255,255,.18); border-radius: 12px;
  cursor: pointer; font-family: inherit;
}
.go-overlay .go-btns button { width: 100%; min-width: 0; }
.go-overlay .btn-again {
  background: linear-gradient(135deg, #bc3040, #ef7258 56%, #f2a16b);
  box-shadow: 0 5px 0 #721c2b, 0 0 26px rgba(255,74,61,.24);
}
.go-overlay .btn-again:active { box-shadow: 0 2px 0 #721c2b; }
.go-overlay .btn-ghost {
  color: #f0d4d4;
  background: rgba(255,241,234,.07);
  border-color: rgba(255,204,190,.25);
}
.go-card {
  position: relative;
  width: min(560px, 100%);
  margin-inline: auto;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: clamp(24px, 5vh, 44px) clamp(18px, 5vw, 44px) clamp(22px, 4vh, 34px);
  border: 1px solid rgba(255,214,182,.34);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(48,19,30,.82), rgba(13,12,27,.92)),
    radial-gradient(circle at 50% 0, rgba(255,220,182,.12), transparent 58%);
  box-shadow: 0 24px 80px rgba(0,0,0,.52), inset 0 0 0 1px rgba(255,255,255,.035), 0 0 42px rgba(255,75,71,.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,194,161,.48) transparent;
}
.go-card::before,
.go-card::after {
  content: '';
  position: absolute;
  left: 22px; right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,208,176,.58), transparent);
  pointer-events: none;
}
.go-card::before { top: 14px; }
.go-card::after { bottom: 14px; }
.go-mark {
  color: #ffd6a6;
  font-size: 22px;
  line-height: 1;
  margin-bottom: 8px;
  text-shadow: 0 0 18px rgba(255,159,104,.72);
}
.go-subtitle {
  max-width: 34em;
  margin: -4px auto 0;
  color: rgba(255,225,220,.62);
  font-size: 12px;
  line-height: 1.65;
}
.go-answer-panel {
  margin: 18px auto 0;
  padding: 13px 16px 15px;
  border: 1px solid rgba(255,214,177,.24);
  border-radius: 6px;
  background: rgba(5,6,17,.34);
}
.go-answer-panel .go-ans-label { color: rgba(255,210,187,.7); letter-spacing: 3px; }
.go-info { color: rgba(255,225,220,.62); }
.go-info b { color: #ffd9a4; }
.go-overlay .go-btns button { min-height: 46px; }

/* Four-second world gate: close, lock, impact, then tear open onto the new scene. */
.route-transition {
  --route-warm: #9bbcff;
  --route-cool: #4778d2;
  --route-hot: #6b8fe0;
  position: fixed;
  inset: 0;
  z-index: 420;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: auto;
  isolation: isolate;
  opacity: 0;
  transition: opacity .3s ease;
  background-color: #030817;
  background-image:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--route-accent) 18%, transparent), transparent 30%),
    linear-gradient(125deg, rgba(3,8,23,.99), rgba(10,24,54,.98) 45%, rgba(7,12,34,.98));
}
.route-transition.is-active { opacity: 1; }
.route-transition.is-out { opacity: 0; transition-duration: 1.45s; pointer-events: auto; }
.route-transition::before {
  content: '';
  position: absolute;
  inset: 12px;
  z-index: 8;
  border: 1px solid rgba(155,190,255,.22);
  box-shadow: inset 0 0 80px rgba(0,0,0,.42);
  pointer-events: none;
}
.route-transition::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: .32;
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.025) 5px 6px);
}
.route-shutters { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.route-shutter {
  position: absolute;
  top: -10%;
  width: 62%;
  height: 120%;
  background:
    linear-gradient(112deg, rgba(255,255,255,.035), transparent 28% 68%, rgba(255,255,255,.025)),
    repeating-linear-gradient(90deg, rgba(5,13,31,.98) 0 46px, rgba(12,29,63,.98) 46px 47px);
  transition: transform .6s cubic-bezier(.18,.76,.18,1), opacity .42s ease;
  will-change: transform;
}
.route-shutter.left {
  left: -8%;
  clip-path: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%);
  transform: translateX(-108%);
  border-right: 2px solid var(--route-warm);
  box-shadow: 24px 0 55px rgba(91,141,235,.2);
}
.route-shutter.right {
  right: -8%;
  clip-path: polygon(12% 0, 100% 0, 100% 100%, 12% 100%, 0 50%);
  transform: translateX(108%);
  border-left: 2px solid var(--route-cool);
  box-shadow: -24px 0 55px rgba(64,115,212,.2);
}
.route-transition.is-active .route-shutter { transform: translateX(0); }
.route-transition.is-out .route-shutter.left { transform: translateX(-112%) skewX(-3deg); transition-duration: 1.2s; }
.route-transition.is-out .route-shutter.right { transform: translateX(112%) skewX(3deg); transition-duration: 1.2s; }
.route-speedlines { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .18s ease; }
.route-transition.is-active .route-speedlines { opacity: 1; }
.route-transition.is-out .route-speedlines { opacity: 0; }
.route-speedlines i {
  position: absolute;
  left: 50%;
  top: 43%;
  width: var(--line-length);
  max-width: 340px;
  height: 1px;
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--route-accent) 78%, white));
  box-shadow: 0 0 7px color-mix(in srgb, var(--route-accent) 50%, transparent);
  animation: routeLineRush 1.35s var(--line-delay) cubic-bezier(.12,.72,.16,1) both;
}
.route-gate {
  position: absolute;
  left: 50%;
  top: 43%;
  z-index: 3;
  width: min(66vw, 410px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(.42);
  opacity: 0;
  transition: transform .78s cubic-bezier(.18,.8,.2,1), opacity .32s ease, filter .45s ease;
  will-change: transform, opacity;
}
.route-transition.is-active .route-gate { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.route-ring { position: absolute; inset: 0; border-radius: 50%; }
.route-ring.outer {
  background: repeating-conic-gradient(from 8deg, var(--route-accent) 0 3deg, transparent 3deg 12deg);
  -webkit-mask: radial-gradient(circle, transparent 0 70%, #000 71% 78%, transparent 79%);
  mask: radial-gradient(circle, transparent 0 70%, #000 71% 78%, transparent 79%);
  animation: routeGateSpin 2s cubic-bezier(.18,.78,.2,1) both;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--route-accent) 55%, transparent));
}
.route-ring.middle {
  inset: 12%;
  border: 1px solid rgba(155,190,255,.72);
  background: repeating-conic-gradient(from 20deg, transparent 0 16deg, rgba(155,190,255,.64) 16deg 19deg, transparent 19deg 34deg);
  -webkit-mask: radial-gradient(circle, transparent 0 78%, #000 79% 81%, transparent 82%);
  mask: radial-gradient(circle, transparent 0 78%, #000 79% 81%, transparent 82%);
  animation: routeGateSpinReverse 1.7s cubic-bezier(.18,.78,.2,1) .06s both;
}
.route-ring.inner {
  inset: 27%;
  border: 2px solid rgba(84,137,226,.66);
  box-shadow: 0 0 26px rgba(68,123,218,.24), inset 0 0 24px rgba(155,190,255,.14);
  animation: routeGateBreath .48s ease-in-out infinite alternate;
}
.route-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104px;
  height: 104px;
  display: grid;
  place-content: center;
  gap: 2px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,244,214,.72);
  border-radius: 50%;
  color: #edf4ff;
  text-align: center;
  background: radial-gradient(circle, color-mix(in srgb, var(--route-accent) 28%, #0b1836), #050b1d 68%);
  box-shadow: 0 0 34px color-mix(in srgb, var(--route-accent) 28%, transparent), inset 0 0 28px rgba(0,0,0,.5);
}
.route-core b { display: block; font-family: Georgia, serif; font-size: 44px; line-height: .95; font-weight: 500; letter-spacing: 0; }
.route-core small { color: rgba(207,224,255,.7); font-family: 'Courier New', monospace; font-size: 9px; font-weight: bold; letter-spacing: 0; }
.route-copy {
  position: absolute;
  left: 50%;
  top: calc(43% + min(34vw, 214px));
  z-index: 4;
  width: min(82vw, 620px);
  transform: translate(-50%, 12px);
  opacity: 0;
  text-align: center;
  transition: transform .55s .35s ease, opacity .42s .35s ease;
}
.route-transition.is-active .route-copy { transform: translate(-50%, 0); opacity: 1; }
.route-transition.is-out .route-copy { transform: translate(-50%, -12px); opacity: 0; transition-delay: 0s; }
.route-kicker { display: block; margin-bottom: 7px; color: rgba(145,187,255,.84); font-family: 'Courier New', monospace; font-size: 10px; font-weight: bold; letter-spacing: 0; }
.route-label { display: block; color: #eaf2ff; font-family: Georgia, 'Songti SC', serif; font-size: 17px; font-weight: 600; line-height: 1.45; letter-spacing: 0; text-shadow: 0 0 20px rgba(0,0,0,.7); }
.route-progress {
  position: absolute;
  left: 50%;
  bottom: 13%;
  z-index: 4;
  width: min(300px, 64vw);
  height: 8px;
  display: grid;
  grid-template-columns: 7px 1fr 7px;
  align-items: center;
  gap: 7px;
  transform: translateX(-50%);
}
.route-progress i { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid rgba(155,190,255,.78); }
.route-progress span { position: relative; display: block; height: 2px; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--route-cool), var(--route-accent), var(--route-warm)); box-shadow: 0 0 10px color-mix(in srgb, var(--route-accent) 52%, transparent); }
.route-progress span::after { content: ''; position: absolute; right: -2px; top: 50%; width: 6px; height: 6px; transform: translateY(-50%) rotate(45deg); background: #edf5ff; box-shadow: 0 0 12px var(--route-accent); }
.route-transition.is-active .route-progress span { animation: routeProgressFill 1.75s cubic-bezier(.18,.78,.2,1) .08s both; }
.route-impact { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0; }
.route-impact::before { content: ''; position: absolute; left: 50%; top: 43%; width: 130vw; height: 3px; transform: translate(-50%, -50%) scaleX(.04); background: #eef6ff; box-shadow: 0 0 16px #d8eaff, 0 0 54px var(--route-accent); }
.route-impact::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 43%, rgba(232,244,255,.78), rgba(87,139,225,.18) 24%, transparent 58%); }
.route-transition.is-impact .route-impact { animation: routeImpactFlash .36s ease-out both; }
.route-transition.is-impact .route-impact::before { animation: routeImpactLine .3s cubic-bezier(.12,.78,.12,1) both; }
.route-transition.is-impact:not(.is-swap) .route-gate { transform: translate(-50%, -50%) scale(.84); transition-duration: .2s; }
.route-transition.is-swap:not(.is-out) .route-gate { transform: translate(-50%, -50%) scale(1.28); filter: brightness(1.55); transition-duration: .24s; }
.route-transition.is-out .route-gate { transform: translate(-50%, -50%) scale(2.9); opacity: 0; filter: brightness(1.7); transition-duration: 1.25s; }
@keyframes routeLineRush {
  0% { opacity: 0; transform: rotate(var(--line-angle)) translateX(48vmax) scaleX(.16); }
  28% { opacity: .95; }
  100% { opacity: 0; transform: rotate(var(--line-angle)) translateX(7vmax) scaleX(1.25); }
}
@keyframes routeGateSpin { from { transform: rotate(-210deg) scale(.62); opacity: .1; } to { transform: rotate(250deg) scale(1); opacity: 1; } }
@keyframes routeGateSpinReverse { from { transform: rotate(190deg) scale(.58); opacity: .1; } to { transform: rotate(-290deg) scale(1); opacity: 1; } }
@keyframes routeGateBreath { from { opacity: .45; transform: scale(.96); } to { opacity: 1; transform: scale(1.04); } }
@keyframes routeProgressFill { to { transform: scaleX(1); } }
@keyframes routeImpactFlash { 0% { opacity: 0; } 28% { opacity: .92; } 100% { opacity: 0; } }
@keyframes routeImpactLine { from { transform: translate(-50%, -50%) scaleX(.04); } to { transform: translate(-50%, -50%) scaleX(1); opacity: 0; } }

/* In-game world fold: a short, pointer-transparent veil for plugin swaps. */
.world-shift {
  --shift-from: #74d9ff;
  --shift-to: #8bb8ff;
  position: fixed;
  inset: 0;
  z-index: 74;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--shift-to) 23%, transparent), transparent 28%),
    radial-gradient(circle at 50% 48%, rgba(5, 12, 35, .96), rgba(2, 6, 22, .99) 68%);
  transition: opacity .32s ease;
}
.world-shift.is-active { opacity: 1; }
.world-shift.is-out { opacity: 0; transition-duration: .68s; }
.world-shift::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .42;
  background:
    linear-gradient(90deg, transparent 0 17%, color-mix(in srgb, var(--shift-from) 22%, transparent) 35%, transparent 50%, color-mix(in srgb, var(--shift-to) 24%, transparent) 71%, transparent 86%),
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(219, 236, 255, .025) 5px 6px);
  transform: scaleX(.35);
  filter: blur(1px);
}
.world-shift.is-active::before { animation: worldShiftSweep 2.16s cubic-bezier(.16, .72, .18, 1) both; }
.world-shift::after {
  content: '';
  position: absolute;
  inset: -18%;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 48%, rgba(239, 249, 255, .75), color-mix(in srgb, var(--shift-to) 30%, transparent) 12%, transparent 47%);
  mix-blend-mode: screen;
}
.world-shift.is-impact::after { animation: worldShiftFlash .76s ease-out both; }
.world-shift-scan {
  position: absolute;
  inset: -20%;
  z-index: 1;
  pointer-events: none;
  opacity: .36;
  background: repeating-conic-gradient(from 0deg at 50% 48%, color-mix(in srgb, var(--shift-to) 26%, transparent) 0 2deg, transparent 2deg 13deg);
  -webkit-mask: radial-gradient(ellipse at 50% 48%, #000 0 16%, transparent 66%);
  mask: radial-gradient(ellipse at 50% 48%, #000 0 16%, transparent 66%);
  transform: rotate(-9deg) scale(.72);
}
.world-shift.is-active .world-shift-scan { animation: worldShiftScan 2.2s cubic-bezier(.2, .75, .2, 1) both; }
.world-shift-stars { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.world-shift-stars i {
  position: absolute;
  left: 50%;
  top: 48%;
  width: var(--shift-length);
  max-width: 420px;
  height: 1px;
  transform-origin: left center;
  opacity: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--shift-to) 78%, white));
  box-shadow: 0 0 9px color-mix(in srgb, var(--shift-to) 64%, transparent);
}
.world-shift.is-active .world-shift-stars i { animation: worldShiftStar 2.04s var(--shift-delay) cubic-bezier(.12, .75, .16, 1) both; }
.world-shift-rift {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 3;
  width: min(42vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.26) rotate(-18deg);
  background: conic-gradient(from 12deg, transparent 0 7%, color-mix(in srgb, var(--shift-from) 82%, white) 11% 14%, transparent 19% 31%, color-mix(in srgb, var(--shift-to) 88%, white) 36% 41%, transparent 46% 61%, color-mix(in srgb, var(--shift-from) 74%, white) 66% 70%, transparent 76% 88%, color-mix(in srgb, var(--shift-to) 92%, white) 93% 96%, transparent);
  -webkit-mask: radial-gradient(circle, transparent 0 42%, #000 45% 51%, transparent 55% 100%);
  mask: radial-gradient(circle, transparent 0 42%, #000 45% 51%, transparent 55% 100%);
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--shift-to) 70%, transparent));
  mix-blend-mode: screen;
}
.world-shift.is-active .world-shift-rift { animation: worldShiftRift 2.42s cubic-bezier(.14, .78, .16, 1) both; }
.world-shift-rift i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48%;
  height: 1px;
  transform-origin: left center;
  transform: rotate(var(--rift-angle)) scaleX(.08);
  opacity: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.96), color-mix(in srgb, var(--shift-to) 70%, transparent), transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--shift-to) 76%, transparent);
}
.world-shift.is-active .world-shift-rift i { animation: worldShiftSpoke 1.55s var(--rift-delay) cubic-bezier(.16, .75, .18, 1) both; }
.world-shift-ripples {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 3;
  width: min(44vw, 340px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.world-shift-ripples i {
  position: absolute;
  inset: 0;
  border: 1px solid color-mix(in srgb, var(--shift-to) 78%, white 8%);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 22px color-mix(in srgb, var(--shift-to) 34%, transparent), inset 0 0 22px color-mix(in srgb, var(--shift-from) 20%, transparent);
}
.world-shift-ripples i:nth-child(2) { inset: 9%; border-color: color-mix(in srgb, var(--shift-from) 72%, white 8%); }
.world-shift-ripples i:nth-child(3) { inset: 20%; border-style: dashed; border-color: color-mix(in srgb, var(--shift-to) 88%, white 10%); }
.world-shift.is-active .world-shift-ripples i:nth-child(1) { animation: worldShiftRipple 2.35s .08s cubic-bezier(.12, .76, .16, 1) both; }
.world-shift.is-active .world-shift-ripples i:nth-child(2) { animation: worldShiftRipple 2.06s .22s cubic-bezier(.12, .76, .16, 1) both; }
.world-shift.is-active .world-shift-ripples i:nth-child(3) { animation: worldShiftRipple 1.72s .38s cubic-bezier(.12, .76, .16, 1) both; }
.world-shift-orbit {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(64vw, 500px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--shift-to) 72%, white 8%);
  box-shadow: 0 0 28px color-mix(in srgb, var(--shift-to) 26%, transparent), inset 0 0 28px color-mix(in srgb, var(--shift-from) 18%, transparent);
  transform: translate(-50%, -50%) scale(.42) rotate(-28deg);
  opacity: 0;
}
.world-shift-orbit::before,
.world-shift-orbit::after {
  content: '';
  position: absolute;
  inset: 7%;
  border-radius: inherit;
  border: 1px solid color-mix(in srgb, var(--shift-from) 58%, transparent);
  -webkit-mask: conic-gradient(from 18deg, #000 0 18%, transparent 18% 31%, #000 31% 52%, transparent 52% 68%, #000 68% 84%, transparent 84%);
  mask: conic-gradient(from 18deg, #000 0 18%, transparent 18% 31%, #000 31% 52%, transparent 52% 68%, #000 68% 84%, transparent 84%);
}
.world-shift-orbit::after { inset: 18%; border-color: color-mix(in srgb, var(--shift-to) 58%, transparent); transform: rotate(42deg); }
.world-shift-orbit.orbit-a { animation: worldShiftOrbit 2.28s cubic-bezier(.16, .78, .18, 1) both; }
.world-shift-orbit.orbit-b { width: min(48vw, 370px); border-style: dashed; animation: worldShiftOrbitReverse 2.04s .08s cubic-bezier(.16, .78, .18, 1) both; }
.world-shift-core {
  position: relative;
  z-index: 5;
  width: min(82vw, 430px);
  padding: 18px 24px 19px;
  border: 1px solid rgba(208, 232, 255, .34);
  border-radius: 999px;
  text-align: center;
  background: linear-gradient(135deg, rgba(14, 31, 67, .74), rgba(4, 12, 34, .84));
  box-shadow: 0 0 0 7px rgba(125, 184, 255, .035), 0 0 48px color-mix(in srgb, var(--shift-to) 26%, transparent), 0 0 120px color-mix(in srgb, var(--shift-from) 13%, transparent), inset 0 0 24px rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
  transform: translateY(16px) scale(.88);
  opacity: 0;
}
.world-shift.is-active .world-shift-core { animation: worldShiftCore 1.36s .32s cubic-bezier(.18, .82, .2, 1) both; }
.world-shift.is-out .world-shift-core { transform: translateY(-8px) scale(1.04); opacity: 0; transition: transform .56s ease, opacity .44s ease; }
.world-shift-sigil {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 7px;
  border: 1px solid color-mix(in srgb, var(--shift-to) 68%, white 12%);
  border-radius: 50%;
  color: #f5fbff;
  font-size: 27px;
  line-height: 1;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.3), color-mix(in srgb, var(--shift-to) 30%, transparent) 38%, rgba(2,11,32,.7) 76%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--shift-to) 60%, transparent), inset 0 0 18px color-mix(in srgb, var(--shift-from) 36%, transparent);
  animation: worldShiftSigil 1.55s .38s ease-out both;
}
.world-shift-name {
  display: block;
  margin-top: 0;
  color: #f1f7ff;
  font-family: Georgia, 'Songti SC', serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .08em;
  text-shadow: 0 0 22px color-mix(in srgb, var(--shift-to) 48%, transparent);
}
.world-shift-core small {
  display: block;
  margin-top: 7px;
  color: rgba(180, 209, 244, .62);
  font-family: 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: .08em;
}
.world-shift-flare {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 4;
  width: min(46vw, 360px);
  height: 2px;
  transform: translate(-50%, -50%) scaleX(.05);
  opacity: 0;
  background: #f5fbff;
  box-shadow: 0 0 12px #e7f5ff, 0 0 60px var(--shift-to), 0 0 110px var(--shift-from);
}
.world-shift.is-impact .world-shift-flare { animation: worldShiftFlare .68s cubic-bezier(.14, .78, .16, 1) both; }
@keyframes worldShiftSweep {
  0% { opacity: 0; transform: translateX(-34vw) scaleX(.2); }
  28% { opacity: .85; }
  100% { opacity: 0; transform: translateX(34vw) scaleX(1.9); }
}
@keyframes worldShiftFlash { 0% { opacity: 0; } 34% { opacity: .92; } 100% { opacity: 0; } }
@keyframes worldShiftScan { from { opacity: 0; transform: rotate(-9deg) scale(.52); } 38% { opacity: .72; } to { opacity: 0; transform: rotate(36deg) scale(1.28); } }
@keyframes worldShiftRift { from { opacity: 0; transform: translate(-50%, -50%) scale(.22) rotate(-120deg); } 24% { opacity: .94; } 58% { opacity: .72; } to { opacity: 0; transform: translate(-50%, -50%) scale(1.62) rotate(250deg); } }
@keyframes worldShiftSpoke { 0% { opacity: 0; transform: rotate(var(--rift-angle)) scaleX(.08); } 22% { opacity: .98; } 100% { opacity: 0; transform: rotate(calc(var(--rift-angle) + 28deg)) scaleX(1.14); } }
@keyframes worldShiftRipple { 0% { opacity: 0; transform: scale(.28) rotate(-18deg); } 22% { opacity: .82; } 100% { opacity: 0; transform: scale(2.2) rotate(42deg); } }
@keyframes worldShiftStar {
  0% { opacity: 0; transform: rotate(var(--shift-angle)) translateX(42vmax) scaleX(.08); }
  22% { opacity: .9; }
  100% { opacity: 0; transform: rotate(var(--shift-angle)) translateX(4vmax) scaleX(1.12); }
}
@keyframes worldShiftOrbit { from { opacity: 0; transform: translate(-50%, -50%) scale(.38) rotate(-120deg); } 28% { opacity: .78; } to { opacity: .18; transform: translate(-50%, -50%) scale(1.12) rotate(245deg); } }
@keyframes worldShiftOrbitReverse { from { opacity: 0; transform: translate(-50%, -50%) scale(.44) rotate(160deg); } 34% { opacity: .64; } to { opacity: .12; transform: translate(-50%, -50%) scale(1.02) rotate(-230deg); } }
@keyframes worldShiftCore { from { opacity: 0; transform: translateY(18px) scale(.82); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes worldShiftSigil { from { opacity: 0; transform: scale(.45) rotate(-90deg); } 45% { opacity: 1; transform: scale(1.1) rotate(12deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes worldShiftFlare { 0% { opacity: 0; transform: translate(-50%, -50%) scaleX(.04); } 30% { opacity: .95; } 100% { opacity: 0; transform: translate(-50%, -50%) scaleX(1.28); } }

@media (max-width: 600px) {
  .route-transition::before { inset: 7px; }
  .route-shutter { width: 68%; }
  .route-gate { top: 42%; width: min(76vw, 330px); }
  .route-core { width: 86px; height: 86px; }
  .route-core b { font-size: 36px; }
  .route-copy { top: calc(42% + min(40vw, 168px)); width: 84vw; }
  .route-label { font-size: 14px; }
  .route-progress { bottom: 10%; width: 62vw; }
  .route-speedlines i:nth-child(n+9) { display: none; }
  .world-shift-core { width: min(88vw, 380px); padding-inline: 16px; }
  .world-shift-rift { width: min(70vw, 320px); }
  .world-shift-ripples { width: min(72vw, 340px); }
  .world-shift-name { font-size: 17px; }
  .world-shift-orbit { width: min(88vw, 420px); }
  .world-shift-orbit.orbit-b { width: min(66vw, 310px); }
}

@media (prefers-reduced-motion: reduce) {
  .world-shift *, .world-shift::before, .world-shift::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (max-height: 620px) {
  .route-gate { top: 39%; width: min(58vh, 300px); }
  .route-copy { top: calc(39% + min(29vh, 152px)); }
  .route-progress { bottom: 7%; }
}

/* Victory */
.vic-overlay {
  isolation: isolate;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: transparent;
  animation: fadeIn .8s;
  font-family: Georgia, 'Songti SC', 'STSong', serif;
}
.vic-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(2,4,8,.18), rgba(2,4,8,.38) 52%, rgba(2,3,6,.68)),
    linear-gradient(90deg, rgba(2,3,6,.42), transparent 35% 65%, rgba(2,3,6,.42));
}
.vic-overlay::after {
  content: '';
  position: fixed;
  inset: 12px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(132,169,232,.3);
  box-shadow: inset 0 0 70px rgba(0,0,0,.18);
}
.vic-fireflies {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.vic-fireflies i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #b9d8ff;
  box-shadow: 0 0 8px #70a9ff, 0 0 18px rgba(91,145,235,.74);
  animation: victoryFirefly 4.8s var(--d) ease-in-out infinite;
}
.vic-card {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100vw - 64px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 34px 42px 30px;
  color: #e7efff;
  background: linear-gradient(145deg, rgba(8,24,54,.88), rgba(3,10,27,.94));
  border: 1px solid rgba(132,169,232,.68);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.48), inset 0 0 0 1px rgba(255,255,255,.05);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}
.vic-card::before,
.vic-card::after {
  content: '';
  position: absolute;
  left: 32px;
  right: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(155,190,255,.78), transparent);
}
.vic-card::before { top: 16px; }
.vic-card::after { bottom: 14px; }
.vic-rank-burst {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2;
  color: #ffe29a;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(255,226,154,.8);
  animation: vicRankBurst 1.75s ease forwards;
  pointer-events: none;
}
@keyframes vicRankBurst {
  0% { opacity: 0; transform: scale(.5); }
  18% { opacity: 1; transform: scale(1.12); }
  34% { transform: scale(1); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.04); }
}
.vic-eyebrow {
  color: #aec8f4;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0;
  text-transform: uppercase;
}
.vic-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 13px 0 18px;
}
.vic-medallion {
  position: relative;
  flex: 0 0 94px;
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(177,207,255,.84);
  border-radius: 50%;
  color: var(--rank-color, #ffe29a);
  background: radial-gradient(circle, rgba(113,159,239,.2), rgba(2,12,34,.78) 66%);
  box-shadow: 0 0 0 7px rgba(119,165,239,.08), 0 0 30px color-mix(in srgb, var(--rank-color, #a9c9ff) 35%, transparent);
}
.vic-medallion::before,
.vic-medallion::after {
  content: '✦';
  position: absolute;
  top: 50%;
  color: rgba(174,205,255,.78);
  font-size: 15px;
  transform: translateY(-50%);
}
.vic-medallion::before { left: -17px; }
.vic-medallion::after { right: -17px; }
.vic-grade {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 54px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 22px currentColor;
}
.vic-heading { text-align: left; }
.vic-overlay h1 {
  margin: 0 0 5px;
  color: #edf4ff;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0;
  text-shadow: 0 3px 24px rgba(0,0,0,.5);
}
.vic-rank {
  color: var(--rank-color, #ffe29a);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}
.vic-chapter {
  margin-top: 7px;
  color: #a9bddd;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 12px;
  letter-spacing: 0;
}
.vic-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 18px;
  color: #fff;
  border-top: 1px solid rgba(144,177,235,.3);
  border-bottom: 1px solid rgba(144,177,235,.3);
}
.vic-stat {
  min-width: 0;
  padding: 15px 12px 14px;
  border-right: 1px solid rgba(144,177,235,.2);
}
.vic-stat:last-child { border-right: 0; }
.vic-stat small {
  display: block;
  margin-bottom: 5px;
  color: #9fb5dc;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  letter-spacing: 0;
}
.vic-stat strong {
  display: block;
  overflow-wrap: anywhere;
  color: #e5efff;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0;
}
.vic-stamp {
  margin: 0 0 20px;
  color: #a9b9d7;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0;
}
.vic-stamp b { color: #b7d1ff; font-weight: normal; }
.vic-actions.go-btns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0;
}
.vic-actions button {
  min-width: 0;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 5px;
  border: 1px solid rgba(147,179,232,.3);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.vic-actions button:hover { transform: translateY(-2px); border-color: rgba(177,207,255,.72); }
.vic-actions button:active { transform: translateY(1px); }
.vic-actions .btn-again {
  color: #07142d;
  background: linear-gradient(135deg, #d8e9ff, #739ee9);
  border-color: #d8e9ff;
  box-shadow: 0 8px 28px rgba(83,132,220,.28);
}
.vic-actions .btn-ghost {
  color: #d9e7ff;
  background: rgba(255,255,255,.055);
  box-shadow: none;
}

/* ===== Start screen ===== */
.start-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  isolation: isolate;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
           max(34px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  text-align: center;
  background-image: url('../assets/ui/start-sakura.png');
  background-size: cover;
  background-position: center 46%;
  font-family: Georgia, 'Songti SC', 'STSong', serif;
}
.start-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(24,12,34,.22), rgba(31,15,38,.54) 54%, rgba(10,8,21,.94) 100%),
    linear-gradient(90deg, rgba(16,9,28,.5), transparent 30% 70%, rgba(16,9,28,.5));
}
.start-overlay::after {
  content: '';
  position: fixed;
  inset: 12px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(255,232,218,.22);
  box-shadow: inset 0 0 80px rgba(13,7,23,.2);
}
.start-petals {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.start-petals i {
  position: absolute;
  left: var(--x);
  top: -24px;
  width: 10px;
  height: 7px;
  border-radius: 70% 0 70% 20%;
  background: rgba(255,211,219,.74);
  box-shadow: 0 0 7px rgba(255,198,213,.34);
  transform: scale(var(--s));
  animation: elegantPetal 12s var(--d) linear infinite;
}
.blue-snow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  display: none;
}
.blue-snow i {
  position: absolute;
  left: var(--x);
  top: -18px;
  width: var(--size, 4px);
  height: var(--size, 4px);
  border-radius: 50%;
  background: rgba(235,249,255,.86);
  box-shadow: 0 0 8px rgba(176,225,255,.72), 0 0 16px rgba(118,192,243,.24);
  opacity: 0;
  animation: blueSnow var(--dur, 9s) var(--d, 0s) linear infinite;
}
.start-shell {
  position: relative;
  z-index: 1;
  width: min(1020px, 100%);
  min-height: calc(100dvh - max(44px, env(safe-area-inset-top)) - max(68px, env(safe-area-inset-bottom)));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.start-header { width: 100%; }
.start-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255,239,225,.76);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0;
}
.start-eyebrow::before,
.start-eyebrow::after {
  content: '';
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,224,206,.72));
}
.start-eyebrow::after { transform: rotate(180deg); }
.start-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 10px 0 5px;
}
.start-seal {
  position: relative;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  display: grid;
  place-items: center;
  color: #5b3148;
  background: rgba(255,231,213,.92);
  border: 1px solid #fff2e4;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255,219,206,.1), 0 0 28px rgba(255,196,202,.34);
}
.start-seal::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(103,51,79,.42);
  border-radius: 50%;
}
.start-seal span { position: relative; font-size: 28px; font-weight: 700; }
.start-title-copy { text-align: left; }
.start-overlay h1 {
  margin: 0;
  color: #fff3e8;
  font-size: 48px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 4px 30px rgba(30,8,24,.66);
}
.start-overlay h1 small {
  margin-left: 8px;
  color: #f1c4c9;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: normal;
  vertical-align: top;
}
.start-overlay .sub {
  margin-top: 7px;
  color: rgba(255,238,226,.76);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 12px;
  letter-spacing: 0;
}
.start-route {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 17px auto 13px;
  padding: 10px 0;
  border-top: 1px solid rgba(255,225,215,.22);
  border-bottom: 1px solid rgba(255,225,215,.22);
}
.start-route span {
  position: relative;
  min-width: 0;
  color: rgba(255,241,233,.78);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  letter-spacing: 0;
}
.start-route span + span::before {
  content: '›';
  position: absolute;
  left: -3px;
  color: rgba(255,210,202,.4);
}
.start-rules {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 13px;
  color: rgba(255,238,227,.72);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0;
}
.start-rules span { white-space: nowrap; }
.start-rules b { color: #ffe4b1; font-weight: bold; }

/* Section picker is central before selection and returns to the requested side rail afterwards. */
.section-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: center;
  gap: 8px;
  margin: 10px 0 7px;
  width: min(430px, 100%);
}
.start-skin-toggle {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: 126px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 0 auto 1px;
  padding: 9px 18px;
  color: rgba(255,239,228,.78);
  background: rgba(23,13,31,.55);
  border: 1px solid rgba(255,225,213,.32);
  border-radius: 5px;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 0;
  font-weight: bold;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.start-skin-toggle:hover { transform: translateY(-2px); background: rgba(255,236,225,.13); border-color: rgba(255,236,225,.68); color: #fff8ef; }
.start-skin-toggle:active { transform: translateY(1px); }
.skin-toggle-icon { color: #ffd497; font-size: 21px; line-height: 1; }
.skin-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.section-btn {
  min-width: 126px;
  min-height: 44px;
  padding: 9px 18px;
  color: #f8eae2;
  background: rgba(23,13,31,.55);
  border: 1px solid rgba(255,225,213,.32);
  border-radius: 5px;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.section-btn:hover { transform: translateY(-2px); background: rgba(255,236,225,.13); border-color: rgba(255,236,225,.68); }
.section-btn:active { transform: translateY(1px); }
.section-btn.active {
  color: #3b2031;
  background: linear-gradient(135deg, #ffe4d6, #e8b8c6);
  border-color: #fff1e7;
  box-shadow: 0 8px 26px rgba(107,42,75,.24);
}
.section-help {
  min-height: 18px;
  color: rgba(255,238,228,.6);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  letter-spacing: 0;
}
body.section-selected .start-shell { width: min(1020px, calc(100% - 72px)); }
body.section-selected .section-picker {
  display: flex;
  width: auto;
  align-items: center;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  top: 50%;
  z-index: 3;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 7px;
  transform: translateY(-50%);
  background: rgba(17,10,27,.6);
  border: 1px solid rgba(255,229,220,.24);
  border-radius: 999px;
  box-shadow: 0 12px 38px rgba(13,5,19,.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body.section-selected .start-skin-toggle {
  width: 44px;
  min-width: 0;
  height: 44px;
  min-height: 0;
  margin: 0 0 1px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}
body.section-selected .start-skin-toggle .skin-toggle-icon { font-size: 21px; }
body.section-selected .section-btn {
  width: 44px;
  height: 44px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
}
body.section-selected .section-btn::after {
  content: attr(data-letter);
  font-size: 15px;
  letter-spacing: 0;
}
body.section-selected .section-help { display: none; }

.start-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
#lvBtns {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px auto 10px;
}
.start-btns button {
  font-family: 'Courier New', 'SimHei', monospace;
  letter-spacing: 0;
  cursor: pointer;
}
.level-btn {
  position: relative;
  min-width: 0;
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 3px 9px;
  align-items: center;
  padding: 12px 12px 11px;
  overflow: hidden;
  text-align: left;
  color: #fff7ec;
  background: linear-gradient(145deg, rgba(41,22,48,.75), rgba(18,12,31,.82));
  border: 1px solid rgba(255,225,211,.3);
  border-radius: 6px;
  box-shadow: 0 9px 28px rgba(17,7,24,.25);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.level-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: rgba(255,237,222,.74);
  background: linear-gradient(145deg, rgba(79,42,72,.78), rgba(27,17,42,.88));
}
.level-btn:active:not(:disabled) { transform: translateY(1px); }
.level-btn:disabled { opacity: .46; cursor: not-allowed; filter: saturate(.4); }
.level-number {
  grid-column: 1;
  grid-row: 1 / 3;
  color: #efbec7;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 27px;
  line-height: 1;
  text-align: center;
}
.level-title {
  grid-column: 2;
  align-self: end;
  min-width: 0;
  color: #fff6e9;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-meta {
  grid-column: 2;
  align-self: start;
  min-width: 0;
  color: rgba(255,233,220,.62);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.level-state {
  position: absolute;
  top: 6px;
  right: 7px;
  color: rgba(255,236,214,.54);
  font-size: 10px;
}
.start-secondary-actions { margin-top: 1px; }
.btn-browse {
  min-width: 190px;
  min-height: 42px;
  padding: 10px 20px;
  color: #f5e9df;
  background: rgba(24,14,34,.48);
  border: 1px solid rgba(255,231,218,.3);
  border-radius: 5px;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 7px 22px rgba(16,7,24,.18);
  transition: transform .18s ease, background .18s ease;
}
.btn-browse:hover { transform: translateY(-2px); background: rgba(255,240,229,.12); }
.btn-browse:active { transform: translateY(1px); }

/* The menu keeps playback control separate from the in-game mute control. */
.start-audio-control {
  display: flex;
  justify-content: center;
  margin-top: 7px;
}
.start-audio-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  color: rgba(255,239,226,.76);
  background: rgba(24,14,34,.34);
  border: 1px solid rgba(255,231,218,.22);
  border-radius: 6px;
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.start-audio-btn:hover { transform: translateY(-1px); background: rgba(255,240,229,.1); border-color: rgba(255,231,218,.48); color: #fff5e9; }
.start-audio-btn:active { transform: translateY(1px); }
.start-audio-btn[data-state="stopped"] { color: #ffe0a4; border-color: rgba(255,214,139,.44); }
.start-audio-icon { min-width: 1em; color: #ffd497; font-size: 12px; line-height: 1; }

/* Hardcore mode toggle */
.hardcore-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 10px 0 2px;
  color: rgba(255,236,224,.7);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 11px;
  letter-spacing: 0;
  cursor: pointer;
}
.hardcore-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.hardcore-switch {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 38px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,235,222,.28);
  border-radius: 999px;
  transition: background .18s ease, border-color .18s ease;
}
.hardcore-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #eadfd8;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0,0,0,.32);
  transition: transform .18s ease, background .18s ease;
}
.hardcore-toggle input:checked + .hardcore-switch { background: rgba(158,45,66,.64); border-color: rgba(255,189,194,.7); }
.hardcore-toggle input:checked + .hardcore-switch::after { transform: translateX(18px); background: #ffe9de; }
.hardcore-toggle input:focus-visible + .hardcore-switch { outline: 2px solid #fff0df; outline-offset: 3px; }
.hardcore-copy strong { color: #f4dfd5; font-weight: bold; }
.hardcore-copy small { margin-left: 5px; color: rgba(255,231,220,.48); font-size: 10px; }

.start-credit {
  margin-top: 13px;
  color: rgba(255,238,227,.36);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 9px;
  letter-spacing: 0;
}

/* ===== Start blue skin ===== */
body.start-skin-blue .start-overlay {
  background-image: url('../assets/ui/start-blue-lake.jpg');
  background-position: center 43%;
}
body.start-skin-blue .start-overlay::before {
  background:
    linear-gradient(180deg, rgba(4,20,44,.12), rgba(5,25,54,.48) 52%, rgba(2,9,24,.94) 100%),
    linear-gradient(90deg, rgba(2,13,34,.62), transparent 28% 72%, rgba(2,13,34,.56));
}
body.start-skin-blue .start-overlay::after {
  border-color: rgba(202,235,255,.3);
  box-shadow: inset 0 0 100px rgba(2,12,32,.32), 0 0 34px rgba(92,174,231,.08);
}
body.start-skin-blue .start-petals i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(207,239,255,.78);
  box-shadow: 0 0 9px rgba(151,218,255,.68);
  animation-name: blueMote;
}
body.start-skin-blue .blue-snow { display: block; }
body.start-skin-blue .blue-snow i:nth-child(3n) { opacity: .92; }
body.start-skin-blue .blue-snow i:nth-child(4n) { filter: blur(.35px); }
body.start-skin-blue .start-eyebrow { color: rgba(226,245,255,.82); }
body.start-skin-blue .start-eyebrow::before,
body.start-skin-blue .start-eyebrow::after { background: linear-gradient(90deg, transparent, rgba(188,231,255,.78)); }
body.start-skin-blue .start-seal {
  color: #12355c;
  background: rgba(219,243,255,.92);
  border-color: rgba(245,252,255,.98);
  box-shadow: 0 0 0 6px rgba(178,226,255,.16), 0 0 30px rgba(118,202,255,.42);
}
body.start-skin-blue .start-seal::before { border-color: rgba(30,82,126,.48); }
body.start-skin-blue .start-overlay h1 { color: #f1f9ff; text-shadow: 0 4px 30px rgba(1,12,34,.8); }
body.start-skin-blue .start-overlay h1 small { color: #b9dcfa; }
body.start-skin-blue .start-overlay .sub { color: rgba(225,244,255,.8); }
body.start-skin-blue .start-route {
  border-top-color: rgba(201,233,255,.28);
  border-bottom-color: rgba(201,233,255,.28);
}
body.start-skin-blue .start-route span { color: rgba(231,247,255,.84); }
body.start-skin-blue .start-route span + span::before { color: rgba(170,220,255,.62); }
body.start-skin-blue .start-rules { color: rgba(222,243,255,.76); }
body.start-skin-blue .start-rules b { color: #d4f0ff; }
body.start-skin-blue .start-skin-toggle {
  color: #e7f7ff;
  background: rgba(5,24,51,.62);
  border-color: rgba(190,230,255,.38);
  box-shadow: none;
}
body.start-skin-blue .start-skin-toggle:hover { background: rgba(93,169,222,.25); border-color: rgba(220,245,255,.86); }
body.start-skin-blue .skin-toggle-icon { color: #bdeaff; }
body.start-skin-blue .section-btn {
  color: #e4f5ff;
  background: rgba(5,24,51,.62);
  border-color: rgba(190,230,255,.38);
}
body.start-skin-blue .section-btn:hover { background: rgba(151,213,246,.18); border-color: rgba(220,246,255,.82); }
body.start-skin-blue .section-btn.active {
  color: #0a2a4e;
  background: linear-gradient(135deg, #e3f7ff, #9ed0ef);
  border-color: #f5fcff;
  box-shadow: 0 8px 26px rgba(12,86,135,.3);
}
body.start-skin-blue .section-help { color: rgba(221,242,255,.72); }
body.start-skin-blue.section-selected .section-picker {
  background: rgba(3,18,43,.7);
  border-color: rgba(190,231,255,.3);
  box-shadow: 0 12px 38px rgba(1,9,27,.5);
}
body.start-skin-blue .level-btn {
  color: #eef9ff;
  background: linear-gradient(145deg, rgba(11,48,78,.78), rgba(3,20,43,.86));
  border-color: rgba(190,231,255,.34);
  box-shadow: 0 9px 28px rgba(1,12,31,.34);
}
body.start-skin-blue .level-btn:hover:not(:disabled) {
  border-color: rgba(225,247,255,.84);
  background: linear-gradient(145deg, rgba(27,91,128,.82), rgba(5,28,58,.92));
}
body.start-skin-blue .level-number { color: #a9dfff; }
body.start-skin-blue .level-title { color: #eef9ff; }
body.start-skin-blue .level-meta { color: rgba(216,241,255,.7); }
body.start-skin-blue .level-state { color: rgba(221,243,255,.64); }
body.start-skin-blue .btn-browse {
  color: #e4f6ff;
  background: rgba(4,24,51,.62);
  border-color: rgba(190,231,255,.36);
  box-shadow: 0 7px 22px rgba(1,12,31,.28);
}
body.start-skin-blue .btn-browse:hover { background: rgba(151,213,246,.18); }
body.start-skin-blue .start-audio-btn {
  color: rgba(225,246,255,.82);
  background: rgba(4,23,49,.52);
  border-color: rgba(190,231,255,.3);
}
body.start-skin-blue .start-audio-btn:hover { background: rgba(151,213,246,.18); border-color: rgba(220,246,255,.72); color: #f4fcff; }
body.start-skin-blue .start-audio-btn[data-state="stopped"] { color: #d6efff; border-color: rgba(170,220,255,.56); }
body.start-skin-blue .start-audio-icon { color: #b9e8ff; }
body.start-skin-blue .hardcore-toggle { color: rgba(220,243,255,.76); }
body.start-skin-blue .hardcore-switch { background: rgba(220,243,255,.13); border-color: rgba(190,231,255,.38); }
body.start-skin-blue .hardcore-switch::after { background: #d9efff; }
body.start-skin-blue .hardcore-toggle input:checked + .hardcore-switch { background: rgba(40,126,181,.7); border-color: rgba(194,237,255,.8); }
body.start-skin-blue .hardcore-toggle input:checked + .hardcore-switch::after { background: #f0fbff; }
body.start-skin-blue .hardcore-toggle input:focus-visible + .hardcore-switch { outline-color: #e2f7ff; }
body.start-skin-blue .hardcore-copy strong { color: #e2f5ff; }
body.start-skin-blue .hardcore-copy small { color: rgba(211,239,255,.56); }
body.start-skin-blue .start-credit { color: rgba(218,241,255,.52); }

@media (max-width: 760px) {
  .start-overlay { padding-inline: max(18px, env(safe-area-inset-left)); }
  .start-overlay h1 { font-size: 38px; }
  .start-seal { width: 56px; height: 56px; flex-basis: 56px; }
  .start-seal span { font-size: 24px; }
  .start-route { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 0; }
  .start-route span:nth-child(3)::before { display: none; }
  #lvBtns { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
  .start-skin-toggle { min-width: 126px; }
  body.section-selected .start-shell { width: calc(100% - 72px); margin-left: 0; }
  body.section-selected .section-picker { right: max(6px, env(safe-area-inset-right)); gap: 6px; padding: 5px; }
  body.section-selected .start-skin-toggle { width: 36px; min-width: 36px; height: 36px; min-height: 36px; padding: 0; }
  body.section-selected .start-skin-toggle .skin-toggle-icon { font-size: 18px; }
  body.section-selected .section-btn { width: 36px; height: 36px; }
  body.section-selected .section-btn::after { font-size: 13px; }
  .vic-card { width: min(650px, calc(100vw - 40px)); padding: 30px 24px 26px; }
  .vic-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vic-stat:nth-child(2) { border-right: 0; }
  .vic-stat:nth-child(-n+2) { border-bottom: 1px solid rgba(144,177,235,.2); }
  .vic-actions.go-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .start-overlay { padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .start-overlay::after, .vic-overlay::after { inset: 7px; }
  .start-shell { min-height: calc(100dvh - 48px); }
  .start-eyebrow { font-size: 9px; }
  .start-eyebrow::before, .start-eyebrow::after { width: 28px; }
  .start-title-row { gap: 12px; margin-top: 7px; }
  .start-seal { width: 48px; height: 48px; flex-basis: 48px; }
  .start-seal span { font-size: 21px; }
  .start-overlay h1 { font-size: 32px; }
  .start-overlay h1 small { margin-left: 4px; font-size: 10px; }
  .start-overlay .sub { font-size: 10px; }
  .start-route { margin: 12px auto 9px; padding: 8px 0; }
  .start-route span { font-size: 9px; }
  .start-rules { gap: 5px 12px; margin-bottom: 8px; font-size: 9px; }
  .section-picker { gap: 5px; margin: 7px 0 5px; }
  .start-skin-toggle { min-width: 84px; min-height: 38px; padding: 7px 10px; }
  .section-btn { min-width: 84px; min-height: 38px; padding: 7px 10px; font-size: 11px; }
  .section-help { min-height: 15px; font-size: 9px; }
  #lvBtns { gap: 7px; margin: 8px auto 7px; }
  .level-btn { min-height: 66px; grid-template-columns: 27px minmax(0, 1fr); gap: 2px 6px; padding: 9px 8px; }
  .level-number { font-size: 22px; }
  .level-title { font-size: 11px; }
  .level-meta { font-size: 8px; }
  .btn-browse { min-width: 164px; min-height: 38px; padding: 8px 14px; font-size: 10px; }
  .hardcore-toggle { margin-top: 8px; font-size: 10px; }
  .hardcore-copy small { display: none; }
  .start-credit { margin-top: 9px; font-size: 8px; }
  .vic-overlay { padding: max(14px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .vic-card { width: calc(100vw - 24px); max-height: calc(100dvh - 28px); padding: 25px 16px 22px; }
  .vic-card::before, .vic-card::after { left: 18px; right: 18px; }
  .vic-hero { gap: 15px; margin: 9px 0 14px; }
  .vic-medallion { flex-basis: 74px; width: 74px; height: 74px; }
  .vic-grade { font-size: 42px; }
  .vic-overlay h1 { font-size: 28px; }
  .vic-rank { font-size: 15px; }
  .vic-chapter { font-size: 10px; }
  .vic-stat { padding: 11px 7px; }
  .vic-stat small { font-size: 9px; }
  .vic-stat strong { font-size: 17px; }
  .vic-stamp { margin-bottom: 14px; font-size: 9px; }
  .vic-actions.go-btns { gap: 7px; }
  .vic-actions button { min-height: 42px; padding: 9px 7px; font-size: 11px; }
  .input-bar { gap: 5px; padding-inline: 8px; }
  .input-bar input { padding-inline: 10px; font-size: 16px; }
  .input-bar button { min-width: 52px; padding-inline: 9px; }
  .input-bar .give-up-btn { min-width: 58px; padding-inline: 8px; font-size: 13px; }
  .input-bar .quit-run-btn { min-width: 60px; padding-inline: 7px; font-size: 12px; }
  .go-overlay {
    padding-inline-start: max(12px, env(safe-area-inset-left));
    padding-inline-end: max(12px, env(safe-area-inset-right));
  }
  .go-overlay .go-btns { margin-top: 20px; }
  .go-card { width: 100%; padding: 24px 15px 28px; }
  .go-subtitle { font-size: 11px; }
}

@media (max-width: 360px) {
  body.section-selected #lvBtns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-height: 620px) {
  .go-overlay { justify-content: flex-start; padding-top: max(14px, env(safe-area-inset-top)); }
  .go-overlay h1 { margin-bottom: 8px; }
  .go-info { margin-top: 9px; line-height: 1.6; }
  .go-overlay .go-btns { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .section-btn, .start-skin-toggle, .level-btn, .btn-browse, .start-audio-btn, .vic-actions button,
  .review-toggle button, .review-card, .review-nav button, .btn-back,
  .go-overlay .go-btns button { transition: none; }
  .start-petals i, .blue-snow i, .vic-fireflies i { animation: none; opacity: .42; }
  .go-overlay { animation: none; }
  .review-card.flip { animation: none; }
  .route-transition, .route-transition.is-out { transition-duration: .12s; }
  .route-shutter,
  .route-transition.is-out .route-shutter,
  .route-transition.is-out .route-gate { transition-duration: .12s; }
  .route-speedlines, .route-impact { display: none; }
  .route-ring, .route-progress span { animation: none !important; }
  .route-progress span { transform: scaleX(1); }
}

@keyframes elegantPetal {
  0% { opacity: 0; transform: translate3d(0,-3vh,0) rotate(0deg) scale(var(--s)); }
  10% { opacity: .8; }
  50% { transform: translate3d(38px,52vh,0) rotate(190deg) scale(var(--s)); }
  90% { opacity: .68; }
  100% { opacity: 0; transform: translate3d(-22px,106vh,0) rotate(410deg) scale(var(--s)); }
}

@keyframes blueMote {
  0% { opacity: 0; transform: translate3d(0,-3vh,0) scale(.55); }
  12% { opacity: .82; }
  48% { transform: translate3d(34px,50vh,0) scale(1); }
  82% { opacity: .58; }
  100% { opacity: 0; transform: translate3d(-18px,106vh,0) scale(.7); }
}

@keyframes blueSnow {
  0% { opacity: 0; transform: translate3d(0,-4vh,0) scale(.72) rotate(0deg); }
  10% { opacity: .82; }
  48% { transform: translate3d(var(--drift, 22px),52vh,0) scale(1.06) rotate(170deg); }
  84% { opacity: .62; }
  100% { opacity: 0; transform: translate3d(calc(var(--drift, 22px) * -.55),108vh,0) scale(.86) rotate(360deg); }
}

@keyframes victoryFirefly {
  0%,100% { opacity: .18; transform: translate3d(0,0,0) scale(.72); }
  35% { opacity: .95; transform: translate3d(13px,-10px,0) scale(1.15); }
  68% { opacity: .42; transform: translate3d(-8px,9px,0) scale(.9); }
}

/* ===== Review panel ===== */
.review-panel {
  position: fixed; inset: 0;
  isolation: isolate;
  background: #100b1a;
  z-index: 150; display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}
.review-panel::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(24,11,34,.24), rgba(22,10,31,.65) 56%, rgba(7,7,18,.95)),
    url('../assets/ui/start-sakura.png') center 42% / cover no-repeat;
  filter: saturate(.78) brightness(.72);
}
.review-panel::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255,205,219,.13), transparent 48%),
    linear-gradient(90deg, rgba(14,7,27,.58), transparent 30% 70%, rgba(14,7,27,.58));
}
.review-shell {
  width: min(620px, 100%);
  min-height: calc(100dvh - max(32px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  margin: 0 auto;
  padding: clamp(12px, 4vh, 34px) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.review-kicker {
  color: rgba(255,226,235,.64);
  font-family: 'Courier New', 'SimHei', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  margin-bottom: 7px;
}
.review-panel h2 { color: #ffe4ea; font-family: Georgia, 'Songti SC', 'STSong', serif; font-size: clamp(21px, 5vw, 28px); font-weight: 600; margin-bottom: 4px; letter-spacing: 2px; text-shadow: 0 0 22px rgba(255,170,197,.34); }
.review-toggle { width: min(100%, 500px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 15px 0 9px; }
.review-toggle button {
  min-width: 0; min-height: 44px; padding: 10px 8px; font-size: 14px;
  background: rgba(35,20,48,.62); color: rgba(255,235,239,.66);
  border: 1px solid rgba(255,221,232,.22); border-radius: 8px;
  cursor: pointer; font-family: inherit; transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.review-toggle button:hover { transform: translateY(-1px); border-color: rgba(255,218,230,.48); }
.review-toggle button.active, .review-toggle button[aria-pressed="true"] { background: rgba(151,68,105,.48); color: #ffe4b8; border-color: rgba(255,211,171,.64); box-shadow: 0 0 18px rgba(241,124,164,.12); }
.review-counter { color: rgba(255,220,228,.6); font-size: 12px; letter-spacing: 2px; }
.review-card {
  appearance: none; -webkit-appearance: none;
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,227,205,.13), transparent 56%),
    linear-gradient(145deg, rgba(58,31,57,.82), rgba(18,19,36,.86));
  color: #fff; border: 1px solid rgba(255,221,184,.56);
  border-radius: 8px; padding: clamp(28px, 5vh, 46px) 22px;
  margin: 14px 0 12px; text-align: center; cursor: pointer;
  width: min(440px, 100%); min-height: clamp(142px, 22vh, 184px);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; font-family: inherit; transition: transform .18s, background .2s, border-color .2s, box-shadow .2s;
  box-shadow: 0 16px 38px rgba(0,0,0,.28), inset 0 0 0 1px rgba(255,255,255,.04), 0 0 26px rgba(232,126,166,.1);
}
.review-card::before {
  content: '';
  position: absolute; inset: 8px;
  border: 1px solid rgba(255,231,203,.14);
  border-radius: 5px;
  pointer-events: none;
}
.review-card::after {
  content: '';
  position: absolute; left: 18%; right: 18%; top: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,220,177,.5), transparent);
  pointer-events: none;
}
.review-card:hover { transform: translateY(-2px); border-color: rgba(255,228,190,.8); box-shadow: 0 20px 44px rgba(0,0,0,.32), 0 0 30px rgba(238,137,177,.16); }
.review-card:active { transform: translateY(1px); background: rgba(93,48,79,.82); }
.review-card:focus-visible { outline: 2px solid #ffe9b4; outline-offset: 4px; }
.review-card.flip { animation: cardFlip .18s ease; }
.review-card .ren { font-size: clamp(22px, 5.4vw, 32px); font-weight: bold; color: #fff; word-break: break-word; }
.review-card .rcn { display: block; font-size: clamp(15px, 3.8vw, 21px); color: #ffd8a5; margin-top: 12px; line-height: 1.7; }
.review-card .rhint { display: block; color: rgba(255,222,230,.42); font-size: 12px; margin-top: 12px; }
.review-nav { display: flex; gap: 14px; margin: 6px 0; }
.review-nav button {
  min-width: 64px; min-height: 46px; padding: 10px 24px; font-size: 17px;
  background: rgba(34,25,53,.68); color: #f0dbe6;
  border: 1px solid rgba(255,222,234,.24); border-radius: 8px;
  cursor: pointer; font-family: inherit; transition: transform .18s, background .18s, border-color .18s;
}
.review-nav button:hover { transform: translateY(-1px); background: rgba(90,55,92,.72); border-color: rgba(255,222,234,.52); }
.review-nav button:disabled { opacity: .25; }
.btn-back { 
  min-height: 44px; font-size: 14px; padding: 10px 24px;
  background: rgba(34,25,53,.58); color: rgba(255,230,238,.7);
  border: 1px solid rgba(255,222,234,.2); border-radius: 8px;
  cursor: pointer; margin-top: 10px; font-family: inherit; transition: transform .18s, background .18s, border-color .18s;
}
.btn-back:hover { transform: translateY(-1px); background: rgba(90,55,92,.68); border-color: rgba(255,222,234,.46); }

/* The review route belongs to the selected menu skin as well. */
body.start-skin-blue .review-panel {
  background: #071a2e;
  color: #e8f7ff;
}
body.start-skin-blue .review-panel::before {
  background:
    linear-gradient(180deg, rgba(4,22,45,.1), rgba(3,22,47,.54) 56%, rgba(2,9,25,.96)),
    url('../assets/ui/start-blue-lake.jpg') center 43% / cover no-repeat;
  filter: saturate(.92) brightness(.82);
}
body.start-skin-blue .review-panel::after {
  background:
    radial-gradient(ellipse at 50% 22%, rgba(183,229,255,.16), transparent 48%),
    linear-gradient(90deg, rgba(1,12,30,.6), transparent 28% 72%, rgba(1,12,30,.58));
}
body.start-skin-blue .review-kicker { color: rgba(211,240,255,.72); }
body.start-skin-blue .review-panel h2 {
  color: #effaff;
  text-shadow: 0 0 22px rgba(112,202,255,.38);
}
body.start-skin-blue .review-toggle button {
  background: rgba(7,31,57,.72);
  color: rgba(220,244,255,.72);
  border-color: rgba(172,224,255,.28);
}
body.start-skin-blue .review-toggle button:hover {
  border-color: rgba(202,239,255,.7);
  background: rgba(34,91,132,.58);
}
body.start-skin-blue .review-toggle button.active,
body.start-skin-blue .review-toggle button[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(49,126,174,.78), rgba(27,70,119,.86));
  color: #f1fbff;
  border-color: rgba(198,238,255,.84);
  box-shadow: 0 0 20px rgba(85,190,244,.2);
}
body.start-skin-blue .review-counter { color: rgba(200,234,255,.72); }
body.start-skin-blue .review-card {
  background:
    radial-gradient(circle at 50% 0%, rgba(205,242,255,.16), transparent 56%),
    linear-gradient(145deg, rgba(16,61,91,.88), rgba(7,20,42,.92));
  border-color: rgba(184,230,255,.68);
  box-shadow: 0 16px 38px rgba(0,4,18,.42), inset 0 0 0 1px rgba(225,249,255,.08), 0 0 30px rgba(75,181,236,.16);
}
body.start-skin-blue .review-card::before { border-color: rgba(202,239,255,.22); }
body.start-skin-blue .review-card::after { background: linear-gradient(90deg, transparent, rgba(184,231,255,.65), transparent); }
body.start-skin-blue .review-card:hover {
  border-color: rgba(220,248,255,.95);
  box-shadow: 0 20px 44px rgba(0,4,18,.5), 0 0 34px rgba(89,202,255,.24);
}
body.start-skin-blue .review-card:active { background: rgba(25,85,119,.9); }
body.start-skin-blue .review-card:focus-visible { outline-color: #d7f5ff; }
body.start-skin-blue .review-card .rcn { color: #bde7ff; }
body.start-skin-blue .review-card .rhint { color: rgba(205,235,249,.52); }
body.start-skin-blue .review-nav button {
  background: rgba(7,30,54,.78);
  color: #e2f6ff;
  border-color: rgba(177,225,255,.32);
}
body.start-skin-blue .review-nav button:hover {
  background: rgba(34,91,132,.72);
  border-color: rgba(205,241,255,.76);
}
body.start-skin-blue .btn-back {
  background: rgba(7,30,54,.72);
  color: rgba(221,244,255,.82);
  border-color: rgba(177,225,255,.3);
}
body.start-skin-blue .btn-back:hover {
  background: rgba(34,91,132,.68);
  border-color: rgba(205,241,255,.72);
}
body.start-skin-blue .review-panel button:focus-visible { outline-color: #d7f5ff; }

/* Keyboard focus remains visible against the dark game canvas. */
.go-overlay button:focus-visible,
.review-panel button:focus-visible,
.quit-run-btn:focus-visible { outline: 2px solid #ffe9b4; outline-offset: 3px; }

@media (max-width: 480px) {
  .review-shell { padding-top: 10px; padding-bottom: 16px; }
  .review-toggle { gap: 5px; margin-top: 12px; }
  .review-toggle button { min-height: 42px; padding-inline: 5px; font-size: 11px; }
  .review-card { min-height: clamp(132px, 26vh, 174px); padding-inline: 15px; }
  .review-card .ren { font-size: clamp(21px, 6.4vw, 28px); }
  .review-card .rcn { font-size: clamp(14px, 4.4vw, 19px); }
  .review-nav { gap: 10px; }
  .review-nav button { min-width: 58px; padding-inline: 18px; }
}

@media (max-height: 620px) {
  .review-shell { justify-content: flex-start; padding-top: 8px; }
  .review-card { margin-top: 10px; margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .review-toggle button, .review-card, .review-nav button, .btn-back { transition: none; }
  .review-card.flip { animation: none; }
}

/* ===== Skill bar ===== */
.skill-bar {
  position: fixed; bottom: calc(var(--kb) + env(safe-area-inset-bottom) + 82px);
  left: 50%; transform: translateX(-50%); z-index: 28;
  display: flex; gap: 8px; padding: 6px 8px;
  background: rgba(0,0,0,.76); border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
}
.skill-icon {
  width: 72px; height: 48px; border-radius: 7px; padding: 3px 4px 2px;
  display: grid; grid-template-columns: 25px 1fr; grid-template-rows: 25px 14px; align-items: center;
  font-family: inherit; color: #fff; cursor: pointer; transition: all .2s;
  background: rgba(255,255,255,.05); border: 2px solid rgba(255,255,255,.15);
  position: relative;
}
.skill-symbol { grid-row: 1; grid-column: 1; font-size: 18px; font-weight: bold; }
.skill-name { grid-row: 1; grid-column: 2; font-size: 12px; font-weight: bold; white-space: nowrap; }
.skill-icon small { grid-row: 2; grid-column: 1 / 3; font-size: 9px; color: rgba(255,255,255,.55); }
.skill-icon:disabled { color: #fff; }
.skill-icon.locked { opacity: .3; cursor: not-allowed; filter: grayscale(1); }
.skill-icon.ready { border-color: rgba(255,215,0,.6); box-shadow: 0 0 12px rgba(255,215,0,.25); animation: skillReady 1.5s ease-in-out infinite; }
.skill-icon.ready:hover { background: rgba(255,215,0,.15); transform: scale(1.1); }
.skill-icon.active { border-color: #9eeaff; background: rgba(105,210,255,.18); box-shadow: 0 0 20px rgba(105,210,255,.45); }
.skill-icon.armed { border-color: #ffd700; background: rgba(255,215,0,.2); box-shadow: 0 0 20px rgba(255,215,0,.5); }
.skill-icon.used { opacity: .4; filter: grayscale(.5); cursor: not-allowed; }

.skill-slash {
  position: fixed; z-index: 47; pointer-events: none; overflow: visible;
  display: flex; align-items: center; justify-content: center;
}
.skill-slash span {
  position: absolute; left: 0; top: 50%; width: 100%; height: 5px;
  background: linear-gradient(90deg, transparent, #fff 14%, #62eaff 50%, #fff 86%, transparent);
  box-shadow: 0 0 12px #62eaff, 0 0 34px rgba(98,234,255,.8);
  transform: rotate(-8deg) scaleX(0); transform-origin: left center;
  animation: wordSlash .6s ease-out forwards;
}
.skill-slash b {
  position: relative; padding: 4px 9px; color: #071016; background: #baf6ff;
  border: 2px solid #fff; border-radius: 4px; font-size: 13px;
  box-shadow: 0 0 18px #62eaff; animation: slashLabel .6s ease forwards;
}

/* ===== Pet ===== */
.pet {
  position: fixed; z-index: 7; pointer-events: none;
  width: 54px; height: 54px; object-fit: contain;
  transform-origin: 50% 100%;
  transition: opacity .2s ease, filter .3s ease;
  filter: drop-shadow(0 0 7px rgba(69,230,255,.55));
  will-change: left, top, transform;
}
.pet.happy { filter: drop-shadow(0 0 10px rgba(255,215,0,.8)); }
.pet.scared { filter: drop-shadow(0 0 8px rgba(255,50,50,.7)) grayscale(.35); }

/* ===== Qt-Gaming impact animations ===== */
.qt-impact {
  position: fixed; z-index: 44; pointer-events: none;
  object-fit: contain; transform: translate(-50%, -50%);
  animation: qtImpactFade .68s ease-out forwards;
  filter: drop-shadow(0 0 18px rgba(255,120,20,.75));
}
.qt-impact.fire-hit { width: 252px; height: 252px; }
.qt-impact.bomb {
  width: 352px; height: 352px; z-index: 47;
  animation: qtBombFade 1.02s ease-out forwards;
  clip-path: circle(50% at 50% 50%);
  filter: drop-shadow(0 0 28px rgba(255,80,20,.9));
}
.qt-impact.evolution-bomb {
  width: 188px; height: 188px; z-index: 48;
  animation: qtEvolutionBombFade 1.26s cubic-bezier(.18,.7,.2,1) forwards;
  filter: drop-shadow(0 0 22px rgba(255,188,56,.95)) drop-shadow(0 0 42px rgba(255,77,120,.52));
}
.qt-fire-projectile {
  position: fixed; z-index: 47; pointer-events: none;
  width: 58px; height: 58px;
  transform: translate(-50%, -50%);
  animation: qtFireFly .88s cubic-bezier(.18,.62,.34,1) forwards;
  will-change: transform, opacity;
}
.qt-fire-projectile img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  transform: var(--orientation); transform-origin: 50% 50%;
  filter: drop-shadow(0 0 9px rgba(255,84,24,.95)) drop-shadow(0 0 3px rgba(255,220,96,.9));
}

@media (max-width: 520px) {
  .qt-player { width: 108px; height: 108px; }
  .char.qt-ready.dark .qt-player { width: 117px; height: 117px; }
  .pet { width: 46px; height: 46px; }
  .qt-impact.fire-hit { width: 216px; height: 216px; }
  .qt-impact.bomb { width: 296px; height: 296px; }
  .qt-impact.evolution-bomb { width: 158px; height: 158px; }
  .qt-fire-projectile { width: 48px; height: 48px; }
}

/* ===== Utility ===== */
.hidden { display: none !important; }

/* ===== Blog word-window selector ===== */
.blog-picker { width: auto; display: flex; margin: 8px 0 5px; }
.blog-picker .start-skin-toggle { grid-column: auto; min-width: 52px; width: 52px; min-height: 42px; padding: 0; border-radius: 999px; }
.selection-summary { min-height: 20px; margin: 2px 0 3px; color: rgba(232,246,255,.76); font-size: 11px; letter-spacing: .3px; text-align: center; }
#lvBtns { display: block; width: min(1040px, 100%); max-height: min(42vh, 420px); overflow: auto; padding: 4px 6px 8px; scrollbar-width: thin; scrollbar-color: rgba(160,213,255,.45) transparent; }
.window-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.window-level { min-height: 67px; padding: 9px 8px; grid-template-columns: 35px minmax(0, 1fr); border-radius: 8px; }
.window-level.selected { border-color: rgba(180,231,255,.9); box-shadow: 0 0 0 1px rgba(120,205,255,.3), 0 10px 26px rgba(33,111,169,.28); }
.window-level .level-number { font-size: 20px; color: #bfe6ff; }
.window-level .level-title { font-size: 11px; }
.window-level .level-meta { font-size: 9px; }
.custom-level-panel { margin: 9px auto 2px; padding: 10px 12px; width: min(780px, 100%); border: 1px solid rgba(180,222,255,.24); border-radius: 9px; background: rgba(8,25,48,.46); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.custom-level-heading { display: flex; justify-content: space-between; align-items: baseline; color: #dff4ff; font-size: 12px; font-weight: bold; }
.custom-level-heading small, .custom-level-note { color: rgba(214,239,255,.56); font-size: 10px; font-weight: normal; }
.custom-level-fields { display: flex; align-items: end; justify-content: center; gap: 8px; margin-top: 8px; }
.custom-level-fields label { display: grid; gap: 4px; color: rgba(220,243,255,.7); font-size: 10px; text-align: left; }
.custom-level-fields input { width: 86px; height: 32px; padding: 4px 8px; color: #effaff; background: rgba(2,13,30,.7); border: 1px solid rgba(169,220,255,.35); border-radius: 5px; font: inherit; font-size: 12px; }
.custom-level-fields > span { color: rgba(214,241,255,.6); padding-bottom: 8px; }
.custom-start { min-height: 32px; padding: 6px 12px; font-size: 11px; }
.custom-level-note { margin-top: 7px; text-align: center; }
.challenge-panel { width: min(780px, 100%); margin: 6px auto 7px; }
.challenge-heading { display: flex; justify-content: space-between; align-items: baseline; color: #e9f8ff; font-size: 12px; font-weight: bold; }
.challenge-heading small { color: rgba(214,239,255,.54); font-size: 9px; font-weight: normal; }
.challenge-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 6px; }
.challenge-btn { min-height: 52px; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 7px 8px; color: #f1fbff; text-align: left; border: 1px solid rgba(180,222,255,.3); border-radius: 7px; background: linear-gradient(145deg, rgba(22,53,78,.72), rgba(9,24,48,.82)); transition: transform .16s, border-color .16s, background .16s; }
.challenge-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(218,246,255,.86); background: linear-gradient(145deg, rgba(42,93,125,.8), rgba(12,34,62,.9)); }
.challenge-btn:disabled { opacity: .46; cursor: not-allowed; }
.challenge-icon { font-size: 18px; text-align: center; }
.challenge-btn strong { display: block; font-size: 10px; white-space: nowrap; }
.challenge-btn small { display: block; margin-top: 2px; color: rgba(217,240,255,.6); font-size: 8px; line-height: 1.2; }
.challenge-btn em { color: #bdeaff; font-size: 9px; font-style: normal; white-space: nowrap; }
.review-selection-info { margin-top: 5px; color: rgba(202,234,255,.62); font-size: 10px; }
body.start-skin-pink .selection-summary, body.start-skin-pink .challenge-heading, body.start-skin-pink .custom-level-heading { color: #fff0f5; }
body.start-skin-pink .custom-level-panel { border-color: rgba(255,216,229,.24); background: rgba(57,25,57,.42); }
body.start-skin-pink .challenge-btn { border-color: rgba(255,213,229,.3); background: linear-gradient(145deg, rgba(75,39,73,.72), rgba(33,17,45,.84)); }
@media (max-width: 760px) { .window-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); } .challenge-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); } #lvBtns { max-height: 38vh; } }
@media (max-width: 470px) { .window-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } .challenge-buttons { grid-template-columns: 1fr; } .custom-level-fields { gap: 5px; } .custom-level-fields input { width: 72px; } }
