﻿/* â”€â”€â”€â”€â”€â”€â”€â”€â”€ sign-flip doors (dungeon quest) â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .door-game { max-width: 1000px; margin: 0 auto; }
    .dungeon-toolbar { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
    .dungeon-scene {
      position: relative; border-radius: 16px; overflow: hidden;
      border: 1px solid #3d3428;
      background: linear-gradient(180deg, #1a1510 0%, #0d0b09 40%, #12100e 100%);
      min-height: 520px;
      box-shadow: inset 0 0 80px rgba(0,0,0,.65), 0 16px 40px rgba(0,0,0,.45);
    }
    .dungeon-scene::before {
      content: ""; position: absolute; inset: 0;
      background:
        repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 48px, transparent 48px 50px),
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(120,180,255,.12), transparent 60%);
      pointer-events: none;
    }
    .dungeon-map {
      position: absolute; left: 14px; top: 10px; width: 96px; height: 118px;
      background: linear-gradient(145deg, #e8d5a8, #c9b07a);
      border: 2px solid #6b5438; border-radius: 6px; padding: 6px;
      box-shadow: 2px 4px 12px rgba(0,0,0,.5); z-index: 2;
      transform: rotate(-2deg);
    }
    .dungeon-map-label { font-size: 9px; font-weight: 800; color: #5c3d1e; text-transform: uppercase; letter-spacing: .06em; }
    .dungeon-map-svg { width: 100%; height: 76px; display: block; margin-top: 2px; }
    .dungeon-problem {
      position: relative; z-index: 3; text-align: center; padding: 22px 16px 8px;
    }
    .dungeon-prompt {
      font-size: clamp(18px, 3vw, 26px); font-weight: 700; color: #7ee8ff;
      text-shadow: 0 0 18px rgba(80,200,255,.55), 0 0 4px rgba(80,200,255,.8);
      min-height: 36px;
    }
    .dungeon-prompt .katex { color: #7ee8ff; font-size: 1.05em; }
    .dungeon-sub { margin-top: 6px; font-size: 13px; color: #8ec8e8; font-style: italic; opacity: .9; }
    .dungeon-hall {
      position: relative; z-index: 2; padding: 8px 12px 100px;
      display: flex; flex-direction: column; align-items: center;
    }
    .dungeon-hero {
      position: relative; z-index: 4; margin: 0 auto -18px; width: 56px; height: 88px;
    }
    .hero-sprite {
      position: relative; width: 100%; height: 100%;
      transition: transform .5s cubic-bezier(.4,0,.2,1), opacity .5s ease;
    }
    .dungeon-hero.hurt .hero-sprite { animation: hero-hit .55s ease; }
    .dungeon-hero.hurt .hero-glow {
      background: radial-gradient(circle, rgba(239,83,80,.55), transparent 70%);
      animation: hero-flash .55s ease;
    }
    .dungeon-hero.hurt .hero-body {
      border-color: #ef5350;
      box-shadow: 0 0 18px rgba(239,83,80,.7), inset 0 0 10px rgba(239,83,80,.25);
    }
    .dungeon-hero.critical .hero-glow {
      background: radial-gradient(circle, rgba(239,83,80,.4), transparent 70%);
      animation: hero-critical-pulse 1s ease-in-out infinite;
    }
    .dungeon-hero.critical .hero-body {
      border-color: #ff7043;
      box-shadow: 0 0 14px rgba(255,112,67,.55);
    }
    .dungeon-hero.defeated .hero-sprite {
      animation: hero-fall .9s ease forwards;
      opacity: 0;
    }
    .dungeon-hero.dragged-down {
      z-index: 6;
      animation: hero-dragged-down 2.6s cubic-bezier(.55,.05,.75,.9) forwards;
      pointer-events: none;
    }
    .dungeon-hero.dragged-partial {
      z-index: 6;
      animation: hero-dragged-partial 1.3s cubic-bezier(.55,.05,.75,.9) forwards;
      pointer-events: none;
    }
    .dungeon-hero.dragged-down .hero-sprite,
    .dungeon-hero.dragged-partial .hero-sprite {
      animation: hero-struggle .22s ease-in-out infinite;
    }
    .dungeon-hero.dragged-down .hero-glow,
    .dungeon-hero.dragged-partial .hero-glow {
      background: radial-gradient(circle, rgba(239,83,80,.6), transparent 70%);
    }
    .dungeon-hero.dragged-down .hero-body,
    .dungeon-hero.dragged-partial .hero-body {
      border-color: #ef5350;
      box-shadow: 0 0 16px rgba(239,83,80,.8);
    }
    .dungeon-door.dragging-hero .door-chains,
    .dungeon-door.dragging-partial .door-chains { opacity: 1; z-index: 4; }
    .dungeon-door.dragging-hero .door-danger {
      opacity: 1;
      animation: door-suck 2.6s ease forwards;
    }
    .dungeon-door.dragging-partial .door-danger {
      opacity: 1;
      animation: door-suck 1.3s ease forwards;
    }
    .dungeon-door.dragging-hero .door-monster {
      opacity: .85; filter: none; font-size: 36px;
      animation: monster-grab-fatal 2.6s ease forwards;
    }
    .dungeon-door.dragging-partial .door-monster {
      opacity: .75; filter: none; font-size: 32px;
      animation: monster-grab-partial 1.3s ease forwards;
    }
    .dungeon-door.dragging-hero .door-frame,
    .dungeon-door.dragging-partial .door-frame {
      border-color: #ef5350;
      box-shadow: 0 0 28px rgba(239,83,80,.65);
    }
    .dungeon-door.dragging-hero .door-frame::after {
      content: ""; position: absolute; top: -72px; left: 50%; width: 4px; height: 72px;
      transform: translateX(-50%); z-index: 5; pointer-events: none;
      background: repeating-linear-gradient(
        180deg, #888 0 6px, #555 6px 8px, #aaa 8px 14px, #666 14px 16px
      );
      border-radius: 2px; opacity: .85;
      animation: chain-yank-fatal 2.6s ease forwards;
    }
    .dungeon-door.dragging-partial .door-frame::after {
      content: ""; position: absolute; top: -72px; left: 50%; width: 4px; height: 72px;
      transform: translateX(-50%); z-index: 5; pointer-events: none;
      background: repeating-linear-gradient(
        180deg, #888 0 6px, #555 6px 8px, #aaa 8px 14px, #666 14px 16px
      );
      border-radius: 2px; opacity: .85;
      animation: chain-yank-partial 1.3s ease forwards;
    }
    .dungeon-hero.defeated .hero-glow { opacity: 0; }
    .dungeon-hero.defeated .hero-body {
      border-color: #b71c1c;
      background: linear-gradient(180deg, #2a1515, #1a0a0a);
    }
    .dungeon-hero.defeated .hero-head {
      background: #c9a088;
      opacity: .7;
    }
    .dungeon-scene.gameover-mode .dungeon-hero { z-index: 3; }
    @keyframes hero-hit {
      0%, 100% { transform: translateX(0) rotate(0); }
      15% { transform: translateX(-10px) rotate(-8deg); }
      30% { transform: translateX(10px) rotate(8deg); }
      45% { transform: translateX(-8px) rotate(-6deg); }
      60% { transform: translateX(8px) rotate(6deg); }
      75% { transform: translateX(-4px); }
    }
    @keyframes hero-flash {
      0%, 100% { opacity: 1; }
      30% { opacity: .4; }
      60% { opacity: 1; }
    }
    @keyframes hero-critical-pulse {
      0%, 100% { opacity: .6; transform: scale(1); }
      50% { opacity: 1; transform: scale(1.12); }
    }
    @keyframes hero-fall {
      0% { transform: translateY(0) rotate(0); opacity: 1; }
      40% { transform: translateY(6px) rotate(-25deg); opacity: 1; }
      100% { transform: translateY(48px) rotate(-75deg); opacity: 0; }
    }
    @keyframes hero-dragged-down {
      0% {
        transform: translateX(var(--hero-x, 0px)) translateY(0) scale(1);
        opacity: 1;
      }
      8% {
        transform: translateX(var(--hero-x, 0px)) translateY(-14px) scale(1.06);
        opacity: 1;
      }
      20% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .15))
                   translateY(calc(var(--drag-y, 80px) * .12)) scale(.98);
        opacity: 1;
      }
      35% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .35))
                   translateY(calc(var(--drag-y, 80px) * .3)) scale(.88) rotate(6deg);
        opacity: .95;
      }
      50% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .55))
                   translateY(calc(var(--drag-y, 80px) * .5)) scale(.72) rotate(12deg);
        opacity: .85;
      }
      65% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .72))
                   translateY(calc(var(--drag-y, 80px) * .68)) scale(.55) rotate(16deg);
        opacity: .65;
      }
      80% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .9))
                   translateY(calc(var(--drag-y, 80px) * .88)) scale(.35) rotate(22deg);
        opacity: .35;
      }
      92% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .98))
                   translateY(calc(var(--drag-y, 80px) * .96)) scale(.15) rotate(28deg);
        opacity: .1;
      }
      100% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px)))
                   translateY(var(--drag-y, 120px)) scale(.05) rotate(35deg);
        opacity: 0;
      }
    }
    @keyframes hero-dragged-partial {
      0% {
        transform: translateX(var(--hero-x, 0px)) translateY(0) scale(1);
        opacity: 1;
      }
      12% {
        transform: translateX(var(--hero-x, 0px)) translateY(-10px) scale(1.04);
        opacity: 1;
      }
      40% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .55))
                   translateY(calc(var(--drag-y, 80px) * .5)) scale(.7) rotate(14deg);
        opacity: .8;
      }
      58% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .78))
                   translateY(calc(var(--drag-y, 80px) * .72)) scale(.5) rotate(20deg);
        opacity: .55;
      }
      72% {
        transform: translateX(calc(var(--hero-x, 0px) + var(--drag-x, 0px) * .5))
                   translateY(calc(var(--drag-y, 80px) * .4)) scale(.65) rotate(10deg);
        opacity: .75;
      }
      88% {
        transform: translateX(var(--hero-x, 0px)) translateY(-8px) scale(1.04) rotate(-4deg);
        opacity: 1;
      }
      100% {
        transform: translateX(var(--hero-x, 0px)) translateY(0) scale(1) rotate(0);
        opacity: 1;
      }
    }
    @keyframes hero-struggle {
      0%, 100% { transform: rotate(-14deg) scaleX(.95); }
      50% { transform: rotate(14deg) scaleX(1.05); }
    }
    @keyframes chain-yank-fatal {
      0% { height: 0; opacity: 0; }
      12% { height: 72px; opacity: .9; }
      88% { height: 72px; opacity: .7; }
      100% { height: 72px; opacity: 0; }
    }
    @keyframes chain-yank-partial {
      0% { height: 0; opacity: 0; }
      15% { height: 72px; opacity: .85; }
      55% { height: 72px; opacity: .7; }
      100% { height: 0; opacity: 0; }
    }
    @keyframes door-suck {
      0%, 100% { opacity: .85; }
      50% { opacity: 1; filter: brightness(1.5); }
    }
    @keyframes monster-grab-fatal {
      0% { transform: scale(1); bottom: 12px; }
      30% { transform: scale(1.3); bottom: 24px; }
      60% { transform: scale(1.7); bottom: 40px; }
      100% { transform: scale(2.2); bottom: 56px; opacity: 1; }
    }
    @keyframes monster-grab-partial {
      0% { transform: scale(1); bottom: 12px; }
      45% { transform: scale(1.5); bottom: 32px; }
      100% { transform: scale(1); bottom: 12px; opacity: .5; }
    }
    .hero-body {
      position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
      width: 34px; height: 52px; border-radius: 8px 8px 4px 4px;
      background: linear-gradient(180deg, #1a1a22, #0a0a10);
      border: 2px solid #ff8c00;
      box-shadow: 0 0 12px rgba(255,140,0,.45), inset 0 0 8px rgba(255,140,0,.15);
    }
    .hero-head {
      position: absolute; bottom: 48px; left: 50%; transform: translateX(-50%);
      width: 22px; height: 22px; border-radius: 50%;
      background: #f0c9a0; border: 2px solid #333;
    }
    .hero-glow {
      position: absolute; inset: -8px; border-radius: 50%;
      background: radial-gradient(circle, rgba(255,140,0,.25), transparent 70%);
      pointer-events: none;
    }
    .dungeon-doors {
      display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
      width: 100%; max-width: 920px; margin: 0 auto;
    }
    @media (max-width: 700px) {
      .dungeon-doors { grid-template-columns: repeat(2, 1fr); gap: 10px; }
      .dungeon-map { display: none; }
    }
    .dungeon-door {
      position: relative; background: transparent; border: none; padding: 0;
      cursor: pointer; font: inherit; color: inherit; text-align: center;
    }
    .dungeon-door:disabled { cursor: default; opacity: .85; }
    .door-ineq {
      min-height: 32px; margin-bottom: 8px; font-size: clamp(14px, 2.2vw, 20px);
      color: #b8e4ff; text-shadow: 0 0 10px rgba(100,200,255,.4);
    }
    .door-ineq .katex { color: #b8e4ff; font-size: 1em; }
    .door-frame {
      position: relative; height: 140px; border-radius: 42px 42px 4px 4px;
      background: linear-gradient(180deg, #4a4035 0%, #2a241c 55%, #1a1612 100%);
      border: 3px solid #5c5040;
      box-shadow: inset 0 -20px 30px rgba(0,0,0,.5), 0 6px 16px rgba(0,0,0,.4);
      overflow: hidden;
    }
    .door-frame::before {
      content: ""; position: absolute; inset: 10px 12px 8px;
      border-radius: 34px 34px 2px 2px;
      background: linear-gradient(180deg, #1a1208 0%, #0a0806 100%);
      box-shadow: inset 0 0 30px rgba(0,0,0,.8);
    }
    .door-inner {
      position: absolute; inset: 14px 16px 10px; border-radius: 30px 30px 2px 2px;
      overflow: hidden; display: flex; align-items: flex-end; justify-content: center;
    }
    .door-danger {
      position: absolute; inset: 0;
      background: radial-gradient(ellipse at 50% 80%, rgba(180,20,20,.55), transparent 65%);
      opacity: .85;
    }
    .door-chains {
      position: absolute; inset: 0; pointer-events: none;
      background:
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(120,120,130,.35) 8px, rgba(120,120,130,.35) 10px),
        repeating-linear-gradient(-45deg, transparent, transparent 12px, rgba(90,90,100,.3) 12px, rgba(90,90,100,.3) 13px);
      opacity: .7;
    }
    .door-monster {
      position: absolute; bottom: 12px; font-size: 28px; opacity: .5;
      filter: blur(1px); text-shadow: 0 0 8px #f00;
    }
    .door-home-view {
      position: absolute; inset: 0; opacity: 0; transition: opacity .35s;
      background: linear-gradient(180deg, #87ceeb 0%, #98d8a0 45%, #4a7c3f 100%);
    }
    .door-home-view::after {
      content: "correct"; position: absolute; top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      font-size: 15px; font-weight: 800; letter-spacing: .1em;
      color: #1a5c2e; text-shadow: 0 1px 0 rgba(255,255,255,.5);
    }
    .dungeon-door:hover:not(:disabled) .door-frame { border-color: #7ee8ff; }
    .dungeon-door.correct .door-frame {
      border-color: #ffd54f;
      box-shadow: 0 0 24px rgba(255,200,80,.5), inset 0 -10px 20px rgba(255,200,80,.15);
    }
    .dungeon-door.correct .door-chains { opacity: 0; }
    .dungeon-door.correct .door-danger { opacity: 0; }
    .dungeon-door.correct .door-monster { opacity: 0; }
    .dungeon-door.correct .door-home-view { opacity: 1; }
    .dungeon-door.wrong .door-frame {
      border-color: #ef5350;
      box-shadow: 0 0 20px rgba(239,83,80,.6);
      animation: door-danger-flash .4s ease;
    }
    @keyframes door-danger-flash {
      0%, 100% { filter: brightness(1); }
      50% { filter: brightness(1.4); }
    }
    .dungeon-hud {
      position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
      display: flex; flex-direction: column; gap: 8px; z-index: 5; width: min(320px, 92%);
    }
    .dungeon-pill {
      background: rgba(10,30,40,.75); border: 2px solid #4fc3f7;
      border-radius: 999px; padding: 8px 20px; text-align: center;
      font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #7ee8ff;
      text-transform: uppercase; backdrop-filter: blur(4px);
      box-shadow: 0 0 16px rgba(79,195,247,.2);
    }
    .dungeon-pill b { font-size: 15px; color: #fff; }
    .dungeon-lives-pill { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
    .lives-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: #7ee8ff; text-transform: uppercase; }
    .dungeon-hearts { display: inline-flex; gap: 6px; align-items: center; }
    .dungeon-hearts .heart {
      font-size: 22px; line-height: 1; transition: transform .25s, opacity .25s, filter .25s;
      color: #ef5350; text-shadow: 0 0 10px rgba(239,83,80,.55);
    }
    .dungeon-hearts .heart.empty {
      color: #3a3a3a; opacity: .45; text-shadow: none; filter: grayscale(1);
    }
    .dungeon-hearts .heart.heart-lost {
      animation: heart-break .5s ease forwards;
    }
    @keyframes heart-break {
      0% { transform: scale(1); opacity: 1; }
      40% { transform: scale(1.35); color: #ef5350; }
      100% { transform: scale(.6); opacity: .2; color: #555; filter: grayscale(1); }
    }
    .dungeon-lives-pill.critical {
      border-color: #ef5350 !important;
      box-shadow: 0 0 18px rgba(239,83,80,.45);
      animation: life-pulse 1.1s ease-in-out infinite;
    }
    @keyframes life-pulse {
      0%, 100% { box-shadow: 0 0 12px rgba(239,83,80,.3); }
      50% { box-shadow: 0 0 22px rgba(239,83,80,.65); }
    }
    .dungeon-lives-pill.dead {
      border-color: #b71c1c !important;
      background: rgba(40,10,10,.85) !important;
      box-shadow: 0 0 20px rgba(183,28,28,.5);
    }
    .dungeon-lives-pill.dead .lives-label { color: #ef9a9a; }
    .visually-hidden {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
    }
    .door-char.danger { animation: door-shake .45s ease; }
    @keyframes door-shake {
      0%, 100% { transform: translateX(-50%); }
      20% { transform: translateX(calc(-50% - 8px)) rotate(-4deg); }
      40% { transform: translateX(calc(-50% + 8px)) rotate(4deg); }
      60% { transform: translateX(calc(-50% - 6px)); }
      80% { transform: translateX(calc(-50% + 6px)); }
    }
    .door-msg { margin-top: 10px; text-align: center; font-size: 14px; color: var(--dim); min-height: 22px; }
    .door-msg.ok { color: var(--gt); font-weight: 700; }
    .door-msg.bad { color: var(--red); font-weight: 700; }
    .door-hint { margin-top: 6px; color: var(--dim); font-size: 13px; text-align: center; line-height: 1.55; }
    .door-hint b { color: var(--ink); }
    .dungeon-scene.stage-forest {
      background: linear-gradient(180deg, #141a12 0%, #0a0d09 40%, #0e120e 100%);
    }
    .dungeon-scene.stage-forest::before {
      background:
        repeating-linear-gradient(90deg, rgba(80,160,80,.03) 0 48px, transparent 48px 50px),
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(80,180,100,.1), transparent 60%);
    }
    .dungeon-scene.stage-caves {
      background: linear-gradient(180deg, #12101a 0%, #08070d 40%, #0e0c14 100%);
    }
    .dungeon-scene.stage-caves::before {
      background:
        repeating-linear-gradient(90deg, rgba(120,80,200,.03) 0 48px, transparent 48px 50px),
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(140,100,220,.12), transparent 60%);
    }
    .dungeon-scene.stage-castle {
      background: linear-gradient(180deg, #1a1210 0%, #0d0908 40%, #14100e 100%);
    }
    .dungeon-scene.stage-castle::before {
      background:
        repeating-linear-gradient(90deg, rgba(200,80,60,.03) 0 48px, transparent 48px 50px),
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(220,120,80,.12), transparent 60%);
    }
    .dungeon-stage-pill {
      position: absolute; top: 10px; right: 14px; z-index: 3;
      background: rgba(10,30,40,.8); border: 2px solid #4fc3f7;
      border-radius: 999px; padding: 6px 14px;
      font-size: 10px; font-weight: 800; letter-spacing: .06em; color: #7ee8ff;
      text-transform: uppercase; backdrop-filter: blur(4px);
    }
    .dungeon-stage-pill b { color: #fff; font-size: 11px; }
    .dungeon-powers {
      position: absolute; top: 44px; right: 14px; z-index: 3;
      display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
    }
    .power-tag {
      font-size: 9px; font-weight: 800; letter-spacing: .05em;
      padding: 3px 10px; border-radius: 999px; text-transform: uppercase;
      background: rgba(20,40,20,.85); border: 1px solid #66bb6a; color: #a5d6a7;
    }
    .power-tag.hidden { display: none; }
    .dungeon-door.eliminated { pointer-events: none; opacity: .35; }
    .dungeon-door.eliminated .door-ineq::after {
      content: "âœ•"; display: block; color: #ef5350; font-size: 18px; margin-top: 4px;
    }
    .dungeon-door.eliminated .door-frame { filter: grayscale(.8) brightness(.5); }
    .dungeon-checkpoint {
      position: absolute; inset: 0; z-index: 20;
      display: flex; align-items: center; justify-content: center;
      background: rgba(0,0,0,.72); backdrop-filter: blur(3px);
    }
    .dungeon-checkpoint.hidden { display: none; }
    .checkpoint-card {
      background: linear-gradient(160deg, #1e2a1a, #121a10);
      border: 2px solid #6a9c4a; border-radius: 16px;
      padding: 22px 24px; max-width: 420px; width: 92%;
      box-shadow: 0 0 40px rgba(106,156,74,.25);
      text-align: center;
    }
    .checkpoint-card h3 {
      margin: 0 0 6px; font-size: 20px; color: #c5e89a;
      text-shadow: 0 0 12px rgba(150,220,100,.4);
    }
    .checkpoint-card p { margin: 0 0 16px; color: #9cb88a; font-size: 14px; line-height: 1.5; }
    .checkpoint-powers { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
    .power-btn {
      flex: 1 1 140px; background: rgba(10,30,40,.6);
      border: 2px solid #4fc3f7; border-radius: 12px;
      padding: 14px 12px; cursor: pointer; color: inherit; font: inherit;
      transition: border-color .15s, box-shadow .15s;
    }
    .power-btn:hover { border-color: #ffd54f; box-shadow: 0 0 16px rgba(255,213,79,.3); }
    .power-btn strong { display: block; font-size: 14px; color: #7ee8ff; margin-bottom: 4px; }
    .power-btn span { font-size: 11px; color: #8ec8e8; line-height: 1.4; }

    /* â”€â”€â”€â”€â”€â”€â”€â”€â”€ victory (in-scene, same dungeon UI) â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .victory-confetti {
      position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden;
    }
    .victory-confetti.hidden { display: none; }
    .victory-confetti i {
      position: absolute; top: -12px; width: 8px; height: 12px;
      border-radius: 2px; opacity: .75;
      animation: confetti-fall 3.2s linear infinite;
    }
    .victory-confetti i:nth-child(1)  { left: 8%;  background: #ffd54f; animation-delay: 0s;    animation-duration: 2.8s; }
    .victory-confetti i:nth-child(2)  { left: 18%; background: #81c784; animation-delay: .4s;   animation-duration: 3.4s; }
    .victory-confetti i:nth-child(3)  { left: 28%; background: #64b5f6; animation-delay: .8s;   animation-duration: 2.6s; }
    .victory-confetti i:nth-child(4)  { left: 38%; background: #f48fb1; animation-delay: .2s;   animation-duration: 3.1s; }
    .victory-confetti i:nth-child(5)  { left: 48%; background: #ffb74d; animation-delay: 1.1s; animation-duration: 2.9s; }
    .victory-confetti i:nth-child(6)  { left: 58%; background: #ce93d8; animation-delay: .6s;   animation-duration: 3.3s; }
    .victory-confetti i:nth-child(7)  { left: 68%; background: #4dd0e1; animation-delay: 1.4s; animation-duration: 2.7s; }
    .victory-confetti i:nth-child(8)  { left: 78%; background: #fff176; animation-delay: .3s;   animation-duration: 3.5s; }
    .victory-confetti i:nth-child(9)  { left: 88%; background: #a5d6a7; animation-delay: .9s;   animation-duration: 2.5s; }
    .victory-confetti i:nth-child(10) { left: 14%; background: #90caf9; animation-delay: 1.6s; animation-duration: 3s; }
    .victory-confetti i:nth-child(11) { left: 44%; background: #ffab91; animation-delay: .7s;  animation-duration: 2.8s; }
    .victory-confetti i:nth-child(12) { left: 74%; background: #b39ddb; animation-delay: 1.2s; animation-duration: 3.2s; }
    @keyframes confetti-fall {
      0% { transform: translateY(0) rotate(0deg); opacity: 1; }
      100% { transform: translateY(560px) rotate(720deg); opacity: .15; }
    }
    .dungeon-victory-banner {
      position: absolute; z-index: 15;
      left: 50%; top: 50%;
      transform: translate(-50%, -50%);
      width: min(420px, 90%);
      background: rgba(12,22,18,.92); border: 2px solid #c5a028; border-radius: 14px;
      padding: 14px 18px 16px; text-align: center;
      box-shadow: 0 0 28px rgba(255,200,80,.18), inset 0 0 20px rgba(255,200,80,.06);
    }
    .dungeon-victory-banner.hidden { display: none; }
    .victory-banner-lead {
      margin: 0 0 10px; font-size: 13px; color: #c5e89a; line-height: 1.45;
    }
    .dungeon-victory-banner .victory-skills {
      list-style: none; margin: 0 0 10px; padding: 8px 10px; text-align: left;
      background: rgba(0,0,0,.25); border-radius: 10px; border: 1px solid rgba(197,160,40,.35);
    }
    .dungeon-victory-banner .victory-skills li {
      font-size: 12px; color: #b8d4a8; line-height: 1.45; padding: 3px 0 3px 20px; position: relative;
    }
    .dungeon-victory-banner .victory-skills li::before {
      content: "\2713"; position: absolute; left: 0; color: #ffd54f; font-weight: 900;
    }
    .victory-encourage {
      margin: 0; font-size: 13px; font-weight: 700; color: #7ee8ff;
    }
    #df-victory-again {
      font-size: 14px; padding: 10px 24px; border-radius: 999px;
      box-shadow: 0 4px 16px rgba(21,101,192,.3);
    }
    .dungeon-scene.victory-mode { min-height: 580px; }
    .dungeon-scene.victory-mode .dungeon-hud { z-index: 9; }
    .dungeon-hud-play {
      display: block; width: 100%; margin-top: 2px;
      font-size: 13px; padding: 10px 20px; border-radius: 999px;
      box-shadow: 0 4px 16px rgba(21,101,192,.35);
    }
    .dungeon-hud-play.hidden { display: none; }
    .dungeon-scene.victory-mode {
      box-shadow: inset 0 0 100px rgba(255,200,80,.2), 0 16px 40px rgba(0,0,0,.45);
    }
    .dungeon-scene.victory-mode.stage-victory {
      background: linear-gradient(180deg, #1a1810 0%, #12100a 35%, #1a2018 100%);
    }
    .dungeon-scene.victory-mode.stage-victory::before {
      background:
        repeating-linear-gradient(90deg, rgba(255,200,80,.04) 0 48px, transparent 48px 50px),
        radial-gradient(ellipse 90% 55% at 50% 15%, rgba(255,213,79,.22), transparent 65%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(120,200,120,.12), transparent 60%);
    }
    .dungeon-scene.victory-mode .dungeon-prompt {
      color: #ffd54f;
      text-shadow: 0 0 20px rgba(255,213,79,.55), 0 0 6px rgba(255,200,80,.8);
      font-size: clamp(20px, 3.5vw, 30px);
    }
    .dungeon-scene.victory-mode .dungeon-sub {
      color: #c5e89a; font-style: normal; font-size: 14px;
    }
    .dungeon-scene.victory-mode .dungeon-door .door-chains,
    .dungeon-scene.victory-mode .dungeon-door .door-danger,
    .dungeon-scene.victory-mode .dungeon-door .door-monster { opacity: 0; }
    .dungeon-scene.victory-mode .dungeon-door .door-home-view { opacity: 1; }
    .dungeon-scene.victory-mode .dungeon-door .door-frame {
      border-color: #ffd54f;
      box-shadow: 0 0 16px rgba(255,213,79,.35);
    }
    .dungeon-scene.victory-mode .door-ineq { opacity: .55; font-size: .9em; }
    .dungeon-scene.victory-mode .dungeon-map {
      box-shadow: 2px 4px 12px rgba(0,0,0,.5), 0 0 16px rgba(255,213,79,.25);
    }
    .dungeon-scene.victory-mode #df-map-you { fill: #ffd54f; }
    .dungeon-scene.victory-mode .dungeon-hall { padding-bottom: 8px; }
    .dungeon-scene.victory-mode .hero-sprite {
      animation: hero-celebrate 1.1s ease-in-out infinite;
    }
    .dungeon-scene.victory-mode .hero-glow {
      background: radial-gradient(circle, rgba(255,213,79,.45), transparent 70%);
    }
    @keyframes hero-celebrate {
      0%, 100% { transform: translateY(0); }
      50% { transform: translateY(-10px); }
    }

    /* â”€â”€â”€â”€â”€â”€â”€â”€â”€ game over â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
    .dungeon-gameover {
      position: absolute; inset: 0; z-index: 22;
      display: flex; align-items: center; justify-content: center;
      background: rgba(20,0,0,.78); backdrop-filter: blur(4px);
      animation: gameover-fade .4s ease;
    }
    .dungeon-gameover.hidden { display: none; }
    @keyframes gameover-fade {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    .gameover-card {
      background: linear-gradient(160deg, #2a1212, #1a0a0a);
      border: 2px solid #ef5350; border-radius: 16px;
      padding: 22px 24px 20px; max-width: 400px; width: 92%;
      text-align: center;
      box-shadow: 0 0 40px rgba(239,83,80,.35);
      animation: gameover-shake .5s ease;
    }
    @keyframes gameover-shake {
      0%, 100% { transform: translateX(0); }
      20% { transform: translateX(-6px); }
      40% { transform: translateX(6px); }
      60% { transform: translateX(-4px); }
      80% { transform: translateX(4px); }
    }
    .gameover-icon { font-size: 44px; line-height: 1; margin-bottom: 6px; }
    .gameover-card h3 {
      margin: 0 0 8px; font-size: 22px; color: #ff8a80;
      text-shadow: 0 0 14px rgba(255,100,100,.4);
    }
    .gameover-lead { margin: 0 0 12px; color: #ef9a9a; font-size: 14px; line-height: 1.5; }
    .gameover-stat {
      margin: 0 0 16px; font-size: 13px; color: #ffccbc;
      background: rgba(0,0,0,.3); border-radius: 10px; padding: 8px 12px;
    }
    .gameover-stat b { font-size: 18px; color: #fff; }
    #df-gameover-retry { padding: 10px 24px; border-radius: 999px; }
    .dungeon-scene.gameover-mode {
      box-shadow: inset 0 0 120px rgba(180,0,0,.35), 0 16px 40px rgba(0,0,0,.45);
      filter: saturate(.65) brightness(.75);
    }
    .dungeon-scene.gameover-mode .dungeon-prompt {
      color: #ef5350;
      text-shadow: 0 0 16px rgba(239,83,80,.6);
    }
    .dungeon-scene.gameover-mode .dungeon-sub { color: #ef9a9a; font-style: normal; }
    .dungeon-scene.gameover-mode .dungeon-door .door-frame {
      border-color: #b71c1c;
      box-shadow: 0 0 16px rgba(183,28,28,.5);
    }

    
