@font-face {
  font-family: "Quest Chancery";
  src: url("fonts/QuestChancery.otf") format("opentype");
  font-display: swap;
}

:root {
  --navy: #25365d;
  --navy-dark: #182540;
  --cream: #fff9e9;
  --gold: #f3c75f;
  --coral: #ec795b;
  --mint: #8fd6bf;
  --green: #3c9b6b;
  --red: #c94f58;
  --ink: #263650;
  --muted: #66728a;
  --panel: rgba(255, 253, 245, 0.94);
  --shadow: 0 18px 50px rgba(37, 54, 93, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 240, 173, 0.9) 0 6%, transparent 19%),
    radial-gradient(circle at 86% 84%, rgba(143, 214, 191, 0.75) 0 8%, transparent 23%),
    linear-gradient(145deg, #f6dfcf, #dceeee 52%, #dcdcf1);
  overflow-x: hidden;
  transition: color 300ms ease, background 450ms ease;
}

body[data-theme="dark"] {
  --navy: #d9e4ff;
  --navy-dark: #7389bd;
  --cream: #121728;
  --gold: #bb8e25;
  --coral: #b34940;
  --mint: #296d60;
  --green: #70d6a0;
  --red: #ff8b91;
  --ink: #edf2ff;
  --muted: #b7c1d9;
  --panel: rgba(18, 23, 40, 0.96);
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.52);
  background-color: #06091a;
  background-image:
    radial-gradient(circle at 14% 10%, rgba(94, 228, 255, .2), transparent 25%),
    radial-gradient(circle at 86% 82%, rgba(173, 89, 255, .22), transparent 27%),
    conic-gradient(from 28deg at 18% 38%, transparent 0 12%, rgba(67, 190, 255, .11) 12% 20%, transparent 20% 62%, rgba(150, 77, 240, .13) 62% 73%, transparent 73%),
    linear-gradient(145deg, #050817, #0c1230 48%, #1a1034);
}

body[data-world-color="yellow"] { --world-rgb: 255, 207, 42; --world-accent: #ffe052; --world-deep: #5b3c00; }
body[data-world-color="red"] { --world-rgb: 255, 70, 70; --world-accent: #ff6d65; --world-deep: #520b1a; }
body[data-world-color="blue"] { --world-rgb: 46, 168, 255; --world-accent: #59c8ff; --world-deep: #062f63; }
body[data-world-color="green"] { --world-rgb: 68, 211, 116; --world-accent: #70ed91; --world-deep: #073d2c; }
body[data-world-color="purple"] { --world-rgb: 166, 102, 255; --world-accent: #c59aff; --world-deep: #32105f; }
body[data-world-color="pink"] { --world-rgb: 235, 83, 211; --world-accent: #ff88e9; --world-deep: #52104e; }
body[data-world-color="brown"] { --world-rgb: 178, 110, 54; --world-accent: #dfa266; --world-deep: #402313; }
body[data-world-color="gray"] { --world-rgb: 174, 188, 212; --world-accent: #d6e0f1; --world-deep: #303745; }
body[data-world-color="orange"] { --world-rgb: 255, 145, 50; --world-accent: #ffb35b; --world-deep: #5b2700; }
body[data-world-color="teal"] { --world-rgb: 42, 219, 203; --world-accent: #75f1df; --world-deep: #053f4a; }
body[data-world-color="meteor"] { --world-rgb: 255, 93, 54; --world-accent: #ffbd63; --world-deep: #4a0914; }

body[data-theme="dark"][data-world-color] {
  background-color: var(--world-deep);
  background-image:
    radial-gradient(circle at 13% 12%, rgba(var(--world-rgb),.42), transparent 27%),
    radial-gradient(circle at 86% 83%, rgba(var(--world-rgb),.29), transparent 31%),
    conic-gradient(from 32deg at 20% 42%, transparent 0 12%, rgba(var(--world-rgb),.16) 12% 21%, transparent 21% 64%, rgba(var(--world-rgb),.12) 64% 74%, transparent 74%),
    linear-gradient(145deg, #050817, var(--world-deep) 52%, #090b20);
}

body[data-world-color] .app-shell::before {
  border-color: rgba(var(--world-rgb),.6);
  box-shadow: 0 0 42px rgba(var(--world-rgb),.32), inset 0 0 32px rgba(var(--world-rgb),.22);
}

body[data-world-color] .screen-overlay {
  background: linear-gradient(145deg, rgba(4,8,25,.82), rgba(var(--world-rgb),.22));
}

body[data-world-color] .modal-card,
body[data-world-color] .results-dialog {
  border-color: rgba(var(--world-rgb),.78);
  box-shadow: 0 24px 70px rgba(0,0,0,.5), 0 0 36px rgba(var(--world-rgb),.25);
}

body[data-theme="dark"]::before,
body[data-theme="dark"]::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  pointer-events: none;
}

body[data-theme="dark"]::before {
  opacity: .68;
  background:
    linear-gradient(128deg, transparent 0 43%, rgba(127,225,255,.16) 43.5% 44.2%, transparent 44.8% 100%) 0 0 / 230px 190px,
    linear-gradient(48deg, transparent 0 56%, rgba(189,126,255,.14) 56.5% 57.3%, transparent 58% 100%) 30px 15px / 260px 220px,
    conic-gradient(from 210deg at 50% 50%, rgba(70,155,255,.08), transparent 18% 46%, rgba(176,80,255,.09) 54% 69%, transparent 75%) 0 0 / 280px 240px;
}

body[data-theme="dark"]::after {
  z-index: -1;
  opacity: .72;
  background:
    linear-gradient(150deg, rgba(87,225,255,.23), transparent 25%) left top / 23vw 100% no-repeat,
    linear-gradient(30deg, rgba(153,82,255,.2), transparent 28%) right bottom / 24vw 100% no-repeat;
  mask-image: linear-gradient(90deg, #000, transparent 25%, transparent 75%, #000);
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  width: min(92vw, 1320px);
  min-width: 0;
  margin: clamp(18px, 3vh, 38px) auto;
}

.app-shell::before {
  position: absolute;
  z-index: -1;
  inset: -18px;
  content: "";
  background:
    conic-gradient(from 45deg at 12% 18%, rgba(81,226,255,.48), rgba(87,82,214,.14), rgba(173,93,255,.4), rgba(81,226,255,.48)),
    linear-gradient(135deg, rgba(24,68,115,.76), rgba(50,20,91,.76));
  border: 1px solid rgba(151,236,255,.3);
  border-radius: 42px;
  box-shadow: 0 0 34px rgba(77,207,255,.2), inset 0 0 28px rgba(166,91,255,.2);
  clip-path: polygon(2% 4%, 8% 0, 18% 3%, 28% 0, 39% 3%, 50% 0, 62% 3%, 74% 0, 86% 3%, 96% 1%, 100% 8%, 97% 20%, 100% 31%, 97% 43%, 100% 55%, 97% 67%, 100% 80%, 97% 94%, 91% 100%, 79% 97%, 67% 100%, 54% 97%, 42% 100%, 29% 97%, 16% 100%, 4% 97%, 0 90%, 3% 77%, 0 64%, 3% 51%, 0 38%, 3% 25%, 0 12%);
}

.game-header {
  display: grid;
  justify-items: center;
  margin-bottom: 14px;
}

.brand-lockup { width: min(100%, 610px); margin: 0 auto; }

.eyebrow {
  margin: 0 0 3px;
  color: #bd5d4c;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  letter-spacing: -0.055em;
}

.game-title {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: min(100%, 600px);
  margin: 0 auto;
  line-height: 0;
}
.game-title::before,
.game-title::after {
  position: absolute;
  content: "";
  pointer-events: none;
  border-radius: 50%;
}
.game-title::before {
  z-index: 0;
  inset: 14% 3% 12%;
  opacity: .82;
  background:
    conic-gradient(from 0deg, transparent 0 8%, rgba(84,239,255,.92) 13%, transparent 23% 39%, rgba(180,76,255,.88) 47%, transparent 59% 73%, rgba(255,102,211,.72) 82%, transparent 94%),
    radial-gradient(ellipse, rgba(69,209,255,.48), rgba(112,51,255,.2) 46%, transparent 72%);
  filter: blur(16px) saturate(1.45);
  transform: scale(.94);
  animation: title-plasma-orbit 7s linear infinite;
}
.game-title::after {
  z-index: 1;
  inset: 22% 8% 17%;
  opacity: .76;
  background:
    radial-gradient(ellipse at 30% 46%, rgba(205,249,255,.95), transparent 9%),
    radial-gradient(ellipse at 72% 58%, rgba(237,166,255,.8), transparent 12%),
    repeating-radial-gradient(ellipse, transparent 0 15px, rgba(119,222,255,.24) 17px 19px, transparent 22px 31px);
  filter: blur(7px);
  box-shadow: 0 0 28px rgba(83,224,255,.64), 0 0 58px rgba(155,74,255,.5), inset 0 0 32px rgba(232,251,255,.25);
  animation: title-energy-field 2.4s ease-in-out infinite alternate;
}
.game-title-image {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 3px rgba(25,30,40,.38));
  animation: title-energy-float 3.2s ease-in-out infinite;
}
.game-header .game-title-image { width: min(100%, 520px); margin: 2px auto 0; }
.start-card .game-title-image { width: min(100%, 540px); margin: 0 auto; }
body[data-theme="dark"] .game-title-image { filter: drop-shadow(0 5px 3px rgba(0,0,0,.7)) drop-shadow(0 0 14px rgba(90,211,255,.42)); }

.class-signature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7em;
  width: fit-content;
  max-width: 96%;
  padding: 7px 13px;
  color: #dffaff;
  font-family: "Arial Black", "Trebuchet MS", Verdana, sans-serif;
  font-size: clamp(.67rem, 1.2vw, .9rem);
  font-weight: 900;
  letter-spacing: .09em;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(105deg, rgba(15,47,91,.92), rgba(51,31,101,.94));
  border: 1px solid rgba(149,235,255,.62);
  border-radius: 999px;
  box-shadow: inset 0 0 12px rgba(117,225,255,.14), 0 0 16px rgba(91,204,255,.22);
  text-shadow: 0 0 8px rgba(109,222,255,.58);
}
.class-signature::before,
.class-signature::after { width: 10px; height: 14px; content: ""; background: linear-gradient(145deg, #9af4ff, #8867ff 62%, #e0b0ff); clip-path: polygon(50% 0, 100% 34%, 72% 100%, 25% 86%, 0 34%); filter: drop-shadow(0 0 5px rgba(116,228,255,.85)); }
.signature-copy { display: grid; gap: 1px; line-height: 1.16; }
.signature-copy span { display: block; }
.signature-copy span:last-child { color: #cfc3ff; font-size: .86em; letter-spacing: .14em; }
.class-signature strong { padding: 3px 7px; color: #f2d8ff; font-size: .8em; letter-spacing: .12em; background: rgba(164,86,255,.18); border: 1px solid rgba(206,167,255,.42); border-radius: 999px; white-space: nowrap; }
.game-header .class-signature { margin: 5px auto 0; }
.start-card .class-signature { margin: 4px auto 15px; }
body[data-theme="dark"] .class-signature { color: #dffaff; text-shadow: 0 0 8px rgba(109,222,255,.58); }

.header-actions {
  display: flex;
  gap: 8px;
}

.question-utilities {
  justify-content: center;
  flex-wrap: wrap;
  width: min(100%, 520px);
  margin: 11px auto 0;
}

.icon-button {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 900;
  background: rgba(255,255,255,0.72);
  border: 2px solid rgba(37,54,93,0.12);
  border-radius: 12px;
}

.icon-button:hover { background: white; }

.intro-music-button {
  display: block;
  min-width: 190px;
  margin: 5px auto 13px;
  color: #273e79;
  background: linear-gradient(135deg, rgba(224,249,255,.96), rgba(225,211,255,.95));
  border-color: rgba(78,100,190,.35);
  box-shadow: 0 5px 14px rgba(57,78,151,.18), 0 0 12px rgba(101,214,255,.2);
}
.intro-music-button.playing {
  color: #17365d;
  background: linear-gradient(135deg, #8defff, #d8b6ff);
  box-shadow: 0 0 0 3px rgba(99,217,255,.2), 0 0 18px rgba(89,202,255,.5);
}
body[data-theme="dark"] .intro-music-button {
  color: #e8f7ff;
  background: linear-gradient(135deg, rgba(28,56,100,.96), rgba(64,38,104,.96));
  border-color: rgba(124,220,255,.4);
}

.journey {
  position: relative;
  height: clamp(270px, 27vw, 370px);
  overflow: hidden;
  border: 6px solid rgba(255,255,255,0.7);
  border-radius: 30px;
  box-shadow: var(--shadow);
  isolation: isolate;
  transition: height 500ms ease, background 500ms ease, box-shadow 500ms ease;
}

body[data-theme="dark"] .journey {
  border-color: rgba(137,226,255,.64);
  box-shadow: 0 0 0 3px rgba(115,82,216,.2), 0 18px 48px rgba(0,0,0,.55), 0 0 24px rgba(76,209,255,.2);
}

.journey::before,
.journey::after {
  position: absolute;
  z-index: -1;
  content: "";
}

.journey::before,
.journey::after { display: none; }

.zone-0,
.zone-1,
.zone-2,
.zone-3,
.zone-4 {
  background-color: #6ea6ce;
  background-image: linear-gradient(rgba(63,76,143,.03), rgba(255,187,213,.08)), url("images/journey-crystal-v38.webp");
  background-position: center 60%;
  background-size: cover;
}
.zone-1 { background-image: linear-gradient(rgba(45,130,107,.06), rgba(28,76,69,.12)), url("images/journey-crystal-v38.webp"); }
.zone-2 { background-image: linear-gradient(rgba(250,190,81,.04), rgba(38,151,182,.1)), url("images/journey-crystal-v38.webp"); }
.zone-3 { background-image: linear-gradient(rgba(70,92,131,.1), rgba(34,43,74,.15)), url("images/journey-crystal-v38.webp"); }
.zone-4 { background-image: linear-gradient(rgba(180,77,139,.06), rgba(86,45,123,.14)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .zone-0,
body[data-theme="dark"] .zone-1,
body[data-theme="dark"] .zone-2,
body[data-theme="dark"] .zone-3,
body[data-theme="dark"] .zone-4 {
  background-color: #10152d;
  background-image: linear-gradient(rgba(5,8,28,.12), rgba(13,9,35,.24)), url("images/journey-crystal-v38.webp");
  background-position: center 60%;
  background-size: cover;
}
body[data-theme="dark"] .journey[data-scene="training"]:not(.battle-active) { background-image: radial-gradient(circle at 16% 72%, rgba(255,202,95,.34), transparent 22%), linear-gradient(rgba(13,45,48,.16), rgba(7,17,38,.32)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="village"]:not(.battle-active) { background-image: radial-gradient(circle at 30% 62%, rgba(255,153,83,.28), transparent 28%), linear-gradient(rgba(57,30,32,.18), rgba(14,10,37,.34)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="garden"]:not(.battle-active) { background-image: radial-gradient(circle at 67% 35%, rgba(237,105,255,.26), transparent 30%), linear-gradient(rgba(39,27,94,.18), rgba(8,29,48,.3)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="ember"]:not(.battle-active) { background-image: radial-gradient(circle at 72% 68%, rgba(255,92,38,.42), transparent 25%), linear-gradient(rgba(74,20,23,.24), rgba(17,7,34,.4)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="ruins"]:not(.battle-active) { background-image: radial-gradient(circle at 48% 28%, rgba(175,157,255,.28), transparent 27%), linear-gradient(rgba(48,48,80,.18), rgba(14,14,31,.42)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="valley"]:not(.battle-active) { background-image: linear-gradient(rgba(8,75,91,.12), rgba(6,15,39,.35)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="crossroads"]:not(.battle-active) { background-image: radial-gradient(circle at 25% 30%, rgba(77,239,255,.24), transparent 22%), radial-gradient(circle at 78% 70%, rgba(255,94,211,.24), transparent 22%), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="cliffs"]:not(.battle-active) { background-image: linear-gradient(135deg, rgba(33,45,86,.12), rgba(5,8,28,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="stars"]:not(.battle-active) { background-image: radial-gradient(circle at 72% 20%, rgba(119,215,255,.42), transparent 18%), linear-gradient(rgba(38,20,84,.18), rgba(4,7,28,.45)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="storm"]:not(.battle-active) { background-image: linear-gradient(115deg, rgba(49,70,118,.32), rgba(18,8,45,.42)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="frost"]:not(.battle-active) { background-image: linear-gradient(rgba(116,215,255,.18), rgba(31,35,82,.42)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="forest"]:not(.battle-active) { background-image: linear-gradient(rgba(9,79,59,.2), rgba(5,20,31,.45)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="crystal"]:not(.battle-active) { background-image: radial-gradient(circle at 64% 42%, rgba(92,245,255,.34), transparent 24%), linear-gradient(rgba(82,30,122,.22), rgba(10,10,37,.43)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"] .journey[data-scene="citadel"]:not(.battle-active) { background-image: radial-gradient(circle at 75% 28%, rgba(255,214,108,.28), transparent 20%), linear-gradient(rgba(75,35,130,.24), rgba(7,7,28,.46)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="yellow"] .journey:not(.battle-active) { background-color: #6b5200; background-image: linear-gradient(rgba(255,211,43,.48), rgba(80,49,0,.42)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="red"] .journey:not(.battle-active) { background-color: #5b1017; background-image: linear-gradient(rgba(255,65,55,.48), rgba(63,4,20,.48)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="blue"] .journey:not(.battle-active) { background-color: #073f72; background-image: linear-gradient(rgba(25,155,255,.5), rgba(4,25,76,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="green"] .journey:not(.battle-active) { background-color: #0b4e35; background-image: linear-gradient(rgba(45,210,101,.47), rgba(3,49,37,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="purple"] .journey:not(.battle-active) { background-color: #34145f; background-image: linear-gradient(rgba(151,79,255,.49), rgba(22,7,58,.56)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="pink"] .journey:not(.battle-active) { background-color: #57144f; background-image: linear-gradient(rgba(244,72,211,.46), rgba(67,8,64,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="brown"] .journey:not(.battle-active) { background-color: #51301b; background-image: linear-gradient(rgba(190,113,50,.53), rgba(54,27,12,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="gray"] .journey:not(.battle-active) { background-color: #414b5e; background-image: linear-gradient(rgba(175,190,214,.44), rgba(32,37,51,.56)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="orange"] .journey:not(.battle-active) { background-color: #613000; background-image: linear-gradient(rgba(255,145,50,.48), rgba(67,23,0,.48)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="teal"] .journey:not(.battle-active) { background-color: #064d54; background-image: linear-gradient(rgba(42,219,203,.42), rgba(3,35,53,.5)), url("images/journey-crystal-v38.webp"); }
body[data-theme="dark"][data-world-color="meteor"] .journey:not(.battle-active) { background-color: #4a0914; background-image: radial-gradient(circle at 72% 18%, rgba(255,188,80,.38), transparent 17%), radial-gradient(circle at 18% 68%, rgba(255,49,42,.34), transparent 27%), linear-gradient(rgba(126,14,25,.25), rgba(21,3,21,.58)), url("images/journey-crystal-v38.webp"); }

body[data-theme="dark"][data-world-color] .journey.battle-active {
  background-image: linear-gradient(rgba(var(--world-rgb),.19), rgba(7,7,28,.34)), url("images/cosmic-battlefield-v38.webp");
  border-color: rgba(var(--world-rgb),.9);
  box-shadow: 0 0 0 3px rgba(var(--world-rgb),.2), 0 22px 60px rgba(0,0,0,.56), 0 0 28px rgba(var(--world-rgb),.28);
}
.journey.training-active .health-display, .journey.training-active .enemy, .journey.training-active .guardian-countdown { display: none !important; }
.journey.training-active .treasure-landmark { opacity: .3; filter: saturate(.5); }
.journey[data-scene="meteor"] .health-display,
.journey[data-scene="meteor"] .enemy,
.journey[data-scene="meteor"] .guardian-countdown,
.journey[data-scene="meteor"] .guardian-attack,
.journey[data-scene="meteor"] .player-attack,
.journey[data-scene="meteor"] .treasure-landmark { display: none !important; }
body[data-theme="dark"] .sky-orb { background: #cbd3e6; border-color: rgba(255,255,255,.28); box-shadow: 0 0 0 10px rgba(191,203,229,.12); }

.journey:not(.battle-active) .sky-orb,
.journey:not(.battle-active) .pixel-cloud { display: none; }

.journey.battle-active,
body[data-theme="dark"] .journey.battle-active {
  height: clamp(430px, 39vw, 560px);
  background-color: #111632;
  background-image: linear-gradient(rgba(16,12,45,.04), rgba(9,8,30,.16)), url("images/cosmic-battlefield-v38.webp");
  background-position: center 57%;
  background-size: cover;
  border-color: rgba(204,218,255,.8);
  box-shadow: 0 0 0 3px rgba(118,94,217,.24), 0 22px 60px rgba(22,15,65,.46);
}

.journey.battle-active::before,
.journey.battle-active::after { display: none; }
.journey.battle-active .sky-orb,
.journey.battle-active .pixel-cloud,
.journey.battle-active .dark-weather,
.journey.battle-active .treasure-landmark,
.journey.battle-active .path { opacity: 0; pointer-events: none; }
.journey.battle-active .stage-name,
.journey.battle-active .step-label { opacity: 0; }

.sky-orb {
  position: absolute;
  top: 17px;
  right: 8%;
  width: 43px;
  height: 43px;
  background: #ffdc6b;
  border: 5px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(255,220,107,0.2);
}

.pixel-cloud {
  position: absolute;
  color: rgba(255,255,255,0.83);
  font-family: Arial, sans-serif;
  font-size: 2.8rem;
  filter: drop-shadow(5px 5px 0 rgba(47,81,99,0.08));
}

.cloud-one { top: 16px; left: 5%; animation: cloud-drift 6s ease-in-out infinite alternate; }
.cloud-two { top: 44px; left: 27%; font-size: 1.8rem; animation: cloud-drift 8s ease-in-out infinite alternate-reverse; }
.cloud-three { top: 8px; left: 48%; font-size: 2.2rem; animation: cloud-drift 7s ease-in-out infinite alternate; }
.cloud-four { top: 54px; left: 64%; font-size: 1.6rem; animation: cloud-drift 9s ease-in-out infinite alternate-reverse; }
.cloud-five { top: 25px; left: 78%; font-size: 2.4rem; animation: cloud-drift 6.5s ease-in-out infinite alternate; }

.dark-weather { position: absolute; z-index: 4; inset: 0; display: none; overflow: hidden; pointer-events: none; }
body[data-theme="dark"] .dark-weather { display: block; }
.rain { position: absolute; inset: -40px; opacity: .48; background: repeating-linear-gradient(108deg, transparent 0 15px, rgba(202,220,255,.68) 16px 17px, transparent 18px 29px); background-size: 34px 34px; animation: rain-fall 450ms linear infinite; }
.meteor-field { position: absolute; inset: 0; display: none; overflow: hidden; }
.journey[data-scene="meteor"] .meteor-field { display: block; }
.journey[data-scene="meteor"] .rain,
.journey[data-scene="meteor"] .bat { display: none; }
.journey[data-scene="meteor"] .lightning { background: rgba(255,103,53,.52); animation: meteor-flash 4.6s linear infinite; }
.meteor { position: absolute; color: #ffdc8a; font-size: clamp(1.2rem, 2.6vw, 2.25rem); line-height: 1; text-shadow: 0 0 7px #fff2b2, 0 0 18px #ff5b35, 0 0 34px rgba(255,63,45,.92); transform: rotate(-28deg); animation: meteor-fall 2.7s linear infinite; }
.meteor::after { position: absolute; top: 50%; right: 70%; width: 90px; height: 10px; content: ""; background: linear-gradient(90deg, transparent, rgba(255,116,55,.08), rgba(255,185,86,.72)); border-radius: 999px; filter: blur(4px); transform: translateY(-50%); }
.meteor-one { top: -6%; left: 22%; animation-delay: -.3s; animation-duration: 2.7s; }
.meteor-two { top: -12%; left: 58%; color: #fff0bd; font-size: 1.4rem; animation-delay: -1.2s; animation-duration: 2.1s; }
.meteor-three { top: 8%; left: 79%; animation-delay: -1.9s; animation-duration: 3.2s; }
.meteor-four { top: -8%; left: 42%; color: #ff9f69; font-size: 1.1rem; animation-delay: -.8s; animation-duration: 2.4s; }
.meteor-five { top: 19%; left: 92%; font-size: 1.5rem; animation-delay: -2.2s; animation-duration: 2.8s; }
.meteor-six { top: -15%; left: 7%; color: #ffe8ae; font-size: 1.25rem; animation-delay: -1.6s; animation-duration: 3.4s; }
.lightning { position: absolute; inset: 0; background: rgba(216,225,255,.9); opacity: 0; animation: lightning-flash 7.5s linear infinite; }
.bat { position: absolute; left: -15%; font-size: 1.25rem; filter: drop-shadow(3px 3px 0 rgba(0,0,0,.5)); animation: bat-flight 8s linear infinite; }
.bat-one { top: 22%; }
.bat-two { top: 40%; font-size: .95rem; animation-delay: 2.7s; animation-duration: 9.5s; }
.bat-three { top: 10%; font-size: 1.55rem; animation-delay: 5.1s; animation-duration: 7s; }

.stage-name,
.step-label {
  position: absolute;
  z-index: 7;
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  background: rgba(24,37,64,0.82);
  border: 2px solid rgba(255,255,255,0.22);
  border-radius: 999px;
}

.stage-name { top: 10px; left: 12px; padding: 6px 11px; text-transform: uppercase; }
.step-label { right: 10px; bottom: 8px; padding: 5px 9px; }

.treasure-landmark {
  position: absolute;
  z-index: 2;
  bottom: 43px;
  font-size: 3.2rem;
  filter: drop-shadow(0 5px 2px rgba(24,37,64,0.2));
}

.treasure-landmark { right: 1.5%; bottom: 38px; width: 138px; font-size: 0; filter: drop-shadow(0 0 13px rgba(92,211,255,.72)) drop-shadow(0 9px 5px rgba(12,15,42,.7)); }
.treasure-landmark img { display: block; width: 100%; height: auto; }

.path {
  position: absolute;
  z-index: 3;
  right: 7%;
  bottom: 59px;
  left: 8%;
  height: 15px;
  overflow: visible;
  background: transparent;
}

.path-dots { position: absolute; inset: 0; }

.path-dot {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  background: #ffdc54;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(31,20,67,.32), 0 0 9px rgba(255,220,84,.85);
  transform: translate(-50%, -50%);
  transition: transform 260ms ease, filter 260ms ease, opacity 260ms ease;
}

.path-dot:nth-child(even) { background: #f35b58; box-shadow: 0 0 0 2px rgba(31,20,67,.32), 0 0 9px rgba(243,91,88,.9); }
.path-dot.reached { opacity: .4; filter: saturate(.65); }
.path-dot.current { opacity: 1; transform: translate(-50%, -50%) scale(1.45); animation: current-step-pulse 900ms ease-in-out infinite alternate; }

.traveler {
  position: absolute;
  z-index: 8;
  bottom: 66px;
  left: 7%;
  width: 72px;
  height: 82px;
  text-align: center;
  transform: translateX(-50%);
  transition: left 700ms cubic-bezier(.22,.8,.25,1);
}

.journey.battle-active .traveler {
  left: 19% !important;
  bottom: 190px;
  transform: translateX(-50%) scale(2.35);
  filter: drop-shadow(0 0 18px rgba(91,232,255,.82));
}

.player-sprite {
  position: relative;
  z-index: 2;
  display: block;
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 4px 1px rgba(24,37,64,0.23));
  animation: robot-idle 1.2s steps(2, end) infinite;
}

.player-sprite img {
  display: block;
  width: 51px;
  height: 51px;
  object-fit: contain;
}

.player-sprite.image-sprite {
  top: -12px;
  left: -11px;
  transform-origin: 50% 72%;
  animation: wizard-hover 2.2s ease-in-out infinite;
}

.player-sprite.image-sprite img {
  width: 94px;
  height: 94px;
}

.equipped-item {
  position: absolute;
  z-index: 4;
  top: 19px;
  right: -15px;
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  filter: drop-shadow(0 3px 1px rgba(24,37,64,0.25));
  transform: rotate(-28deg);
  transform-origin: 20% 80%;
}

.equipped-item[hidden] { display: none; }

.robot-shadow {
  position: absolute;
  right: 7px;
  bottom: 0;
  left: 7px;
  height: 7px;
  background: rgba(24,37,64,0.25);
  border-radius: 50%;
  animation: shadow-pulse 1.2s steps(2, end) infinite;
}

.traveler.walking .player-sprite { animation: robot-walk 180ms steps(2,end) infinite; }
.traveler.moving-back .player-sprite { animation: robot-back 620ms ease; }
.traveler.attacking .player-sprite { animation: robot-attack 480ms ease; }
.traveler.walking .player-sprite.image-sprite { animation: wizard-glide 720ms cubic-bezier(.18,.82,.24,1); }
.traveler.moving-back .player-sprite.image-sprite { animation: wizard-retreat 620ms ease; }
.traveler.walking .equipped-item { animation: weapon-walk 180ms steps(2,end) infinite; }
.traveler.attacking .equipped-item { animation: weapon-strike 480ms ease; }
.traveler.taking-hit { animation: player-impact 720ms cubic-bezier(.18,.9,.28,1); }

.enemy {
  position: absolute;
  z-index: 9;
  top: 18px;
  left: 50%;
  display: grid;
  justify-items: center;
  color: white;
  opacity: 0;
  pointer-events: none;
  width: 430px;
  transform: translate(-50%, -150%) scale(0.5);
  transition: opacity 300ms ease, transform 500ms cubic-bezier(.17,.89,.32,1.3);
}

.enemy.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.enemy.defeated { animation: enemy-defeat 650ms ease forwards; }
.enemy.taking-hit:not(.defeated) { animation: enemy-impact 720ms cubic-bezier(.18,.9,.28,1); }
.guardian-sprite { position: relative; isolation: isolate; display: grid; width: 410px; height: 310px; place-items: end center; line-height: 1; filter: drop-shadow(0 9px 5px rgba(10,6,35,.72)) drop-shadow(0 0 19px rgba(89,209,255,.56)); }
.guardian-sprite img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; }
.guardian-sprite.guardian-fallback { font-size: 5.4rem; place-items: center; }

.journey.battle-active .enemy {
  top: auto;
  bottom: 118px;
  left: 81%;
}
.journey.battle-active .enemy.visible { transform: translate(-50%, 0) scale(1); }

.enemy-label {
  margin-top: -3px;
  padding: 3px 7px;
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  background: #8e3f59;
  border-radius: 4px;
}

.enemy.casting .guardian-sprite { animation: guardian-cast 760ms cubic-bezier(.18,.9,.3,1); }
.enemy.charging .guardian-sprite { animation: guardian-charge-body 1.1s ease-in-out infinite alternate; }
.enemy.charging .guardian-sprite::before,
.enemy.charging .guardian-sprite::after { position: absolute; z-index: -1; inset: 11% 17%; content: ""; border-radius: 50%; pointer-events: none; }
.enemy.charging .guardian-sprite::before { border: 3px solid rgba(160,232,255,.64); box-shadow: 0 0 22px rgba(103,218,255,.64), inset 0 0 28px rgba(172,92,255,.34); animation: guardian-charge-ring 1.2s linear infinite; }
.enemy.charging .guardian-sprite::after { inset: 22% 27%; background: radial-gradient(circle, rgba(255,255,255,.34), rgba(118,99,255,.2) 42%, transparent 72%); filter: blur(6px); animation: guardian-charge-breath 650ms ease-in-out infinite alternate; }

.guardian-countdown {
  position: absolute;
  z-index: 16;
  top: 18px;
  left: 50%;
  width: min(30%, 320px);
  padding: 10px 13px 11px;
  color: #eafaff;
  background: rgba(8,14,38,.88);
  border: 2px solid rgba(127,224,255,.68);
  border-radius: 11px;
  box-shadow: 0 0 16px rgba(88,207,255,.28), inset 0 0 11px rgba(154,88,255,.18);
  transform: translateX(-50%);
}
.guardian-countdown[hidden] { display: none; }
.guardian-countdown > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 6px; font-size: .7rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.guardian-countdown strong { color: #9af4ff; font-size: .95rem; font-variant-numeric: tabular-nums; }
.guardian-countdown-track { height: 10px; overflow: hidden; background: rgba(255,255,255,.13); border-radius: 999px; }
.guardian-countdown-track span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #70ebff, #986fff); border-radius: inherit; box-shadow: 0 0 8px rgba(109,229,255,.65); }
.guardian-countdown.urgent { border-color: #ff7997; animation: guardian-timer-pulse 450ms ease-in-out infinite alternate; }
.guardian-countdown.urgent strong { color: #ff9db1; }
.guardian-countdown.urgent .guardian-countdown-track span { background: linear-gradient(90deg, #ffcc69, #ff507c); }

.guardian-attack {
  position: absolute;
  z-index: 15;
  left: 72%;
  bottom: 172px;
  width: 82px;
  height: 82px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0) scale(.45);
}
.guardian-attack.launch { animation: guardian-projectile 680ms cubic-bezier(.3,.05,.75,.85) forwards; }
.guardian-attack.charging {
  opacity: var(--charge-opacity, .56);
  transform: translate(-50%, 0) scale(var(--charge-scale, .45));
  filter: brightness(var(--charge-brightness, 1)) saturate(var(--charge-saturation, 1));
  transition: transform 90ms linear, opacity 90ms linear, filter 90ms linear;
}
.guardian-attack.charging::before,
.guardian-attack.charging::after { position: absolute; content: ""; pointer-events: none; border-radius: 50%; }
.guardian-attack.charging::before { inset: -20px; border: 3px solid rgba(153,230,255,.72); border-inline-color: rgba(194,115,255,.78); box-shadow: 0 0 18px rgba(98,219,255,.65); animation: charge-orbit 820ms linear infinite; }
.guardian-attack.charging::after { inset: -34px; opacity: var(--charge-rays-opacity, .28); background: conic-gradient(from 0deg, transparent 0 10%, rgba(255,255,255,.9) 11% 12%, transparent 13% 34%, rgba(126,222,255,.75) 35% 37%, transparent 38% 65%, rgba(207,126,255,.8) 66% 68%, transparent 69%); filter: drop-shadow(0 0 8px rgba(151,112,255,.8)); animation: charge-rays 1.3s linear infinite reverse; }
.journey.guardian-charging::after { z-index: 3; display: block; inset: 0; opacity: var(--charge-overlay, .1); background: radial-gradient(circle at 72% 56%, rgba(157,103,255,.46), transparent 26%), linear-gradient(90deg, transparent 38%, rgba(80,188,255,.12), transparent 82%); pointer-events: none; animation: arena-charge-pulse 900ms ease-in-out infinite alternate; }
.journey[data-guardian-attack="fire"].guardian-charging::after { background: radial-gradient(circle at 72% 56%, rgba(255,102,45,.58), transparent 27%), linear-gradient(90deg, transparent 38%, rgba(255,170,55,.12), transparent 82%); }
.journey[data-guardian-attack="wind"].guardian-charging::after { background: radial-gradient(circle at 72% 56%, rgba(104,224,255,.48), transparent 28%), linear-gradient(90deg, transparent 38%, rgba(170,242,255,.12), transparent 82%); }
.journey[data-guardian-attack="spectral"].guardian-charging::after { background: radial-gradient(circle at 72% 56%, rgba(91,255,210,.46), transparent 28%), linear-gradient(90deg, transparent 38%, rgba(171,103,255,.13), transparent 82%); }
.guardian-attack-core,
.guardian-attack-core::before,
.guardian-attack-core::after { position: absolute; inset: 0; display: block; content: ""; }
.guardian-attack-core { border-radius: 50%; }
.attack-fire .guardian-attack-core { background: radial-gradient(circle at 35% 32%, #fffbd0 0 9%, #ffcb46 18%, #ff5b32 48%, rgba(165,21,51,.12) 71%); box-shadow: 0 0 12px #ffbc3d, 0 0 28px rgba(255,65,40,.9); }
.attack-fire .guardian-attack-core::after { left: 72%; width: 90px; background: linear-gradient(90deg, rgba(255,176,42,.9), rgba(255,63,44,.35), transparent); filter: blur(5px); transform: translateX(0) scaleY(.45); }
.attack-wind .guardian-attack-core { inset: 7px; border: 7px double #c4fbff; box-shadow: 0 0 13px #75deff, inset 0 0 12px #957cff; }
.attack-wind .guardian-attack-core::before { inset: -15px; border: 4px solid rgba(168,243,255,.68); border-right-color: transparent; border-radius: 50%; animation: wind-spin 260ms linear infinite; }
.attack-wind .guardian-attack-core::after { inset: -7px 20px; border-block: 4px solid rgba(202,250,255,.72); border-radius: 50%; transform: rotate(20deg); }
.attack-spectral .guardian-attack-core { inset: 8px -3px; background: radial-gradient(ellipse, rgba(209,255,238,.8), rgba(79,255,205,.34) 35%, rgba(126,62,255,.28) 57%, transparent 70%); border: 4px solid rgba(171,255,230,.62); box-shadow: 0 0 22px rgba(91,255,212,.72); }
.attack-spectral .guardian-attack-core::before { inset: -11px; border: 3px solid rgba(180,114,255,.55); border-radius: 50%; animation: spectral-wave 380ms ease-out infinite; }
.attack-arcane .guardian-attack-core { inset: 7px; background: linear-gradient(135deg, #a9f7ff 0 16%, #5279ff 36%, #c35aff 68%, #f4c5ff); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); box-shadow: 0 0 20px rgba(120,119,255,.9); filter: drop-shadow(0 0 12px #9f5cff); }
.attack-arcane .guardian-attack-core::before { inset: -11px; border: 3px solid rgba(143,236,255,.75); transform: rotate(45deg); animation: arcane-spin 360ms linear infinite; }
.journey.final-guardian .enemy-label { color: var(--world-accent); border-color: rgba(var(--world-rgb),.72); text-shadow: 0 0 10px rgba(var(--world-rgb),.9); }
.journey.final-guardian .guardian-countdown { border-color: rgba(var(--world-rgb),.72); box-shadow: 0 0 18px rgba(var(--world-rgb),.28); }
.journey.final-guardian .guardian-countdown strong { color: var(--world-accent); }
.journey.final-guardian .guardian-countdown-track span { background: linear-gradient(90deg, var(--world-accent), white); box-shadow: 0 0 10px rgba(var(--world-rgb),.85); }
.journey.final-guardian .attack-arcane .guardian-attack-core { background: radial-gradient(circle at 34% 28%, #fff 0 10%, var(--world-accent) 24%, var(--world-deep) 72%); box-shadow: 0 0 16px var(--world-accent), 0 0 34px rgba(var(--world-rgb),.9); filter: drop-shadow(0 0 13px var(--world-accent)); }
.journey.final-guardian .attack-arcane .guardian-attack-core::before { border-color: var(--world-accent); }
body[data-world-color="yellow"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(8) brightness(1.18) drop-shadow(0 0 18px #ffe052); }
body[data-world-color="red"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(9) hue-rotate(315deg) brightness(1.08) drop-shadow(0 0 18px #ff514d); }
body[data-world-color="blue"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(8) hue-rotate(165deg) brightness(1.08) drop-shadow(0 0 18px #46bdff); }
body[data-world-color="green"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(8) hue-rotate(72deg) brightness(1.08) drop-shadow(0 0 18px #62e987); }
body[data-world-color="purple"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(9) hue-rotate(225deg) brightness(1.12) drop-shadow(0 0 18px #c59aff); }
body[data-world-color="pink"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(8) hue-rotate(274deg) brightness(1.12) drop-shadow(0 0 18px #ff78e6); }
body[data-world-color="brown"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(3) brightness(.88) drop-shadow(0 0 18px #d89455); }
body[data-world-color="gray"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) contrast(1.32) brightness(1.12) drop-shadow(0 0 18px #d6e0f1); }
body[data-world-color="orange"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(7) hue-rotate(342deg) brightness(1.08) drop-shadow(0 0 18px #ffb35b); }
body[data-world-color="teal"] .journey.final-guardian .guardian-sprite img { filter: grayscale(1) sepia(1) saturate(7) hue-rotate(135deg) brightness(1.08) drop-shadow(0 0 18px #75f1df); }

.player-attack {
  position: absolute;
  z-index: 17;
  left: 19%;
  bottom: 172px;
  width: 72px;
  height: 72px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%,0) scale(.25);
}
.player-attack.launch { animation: player-projectile 720ms cubic-bezier(.22,.2,.72,.9) forwards; }
.player-attack-core,
.player-attack-core::before,
.player-attack-core::after { position: absolute; display: block; content: ""; }
.player-attack-core { inset: 5px; background: radial-gradient(circle at 34% 28%, white 0 10%, var(--world-accent) 24%, var(--world-deep) 70%); border: 2px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 13px var(--world-accent), 0 0 30px rgba(var(--world-rgb),.9); }
.player-attack-core::before { inset: -9px; border: 3px solid var(--world-accent); clip-path: polygon(50% 0, 63% 36%, 100% 50%, 63% 64%, 50% 100%, 37% 64%, 0 50%, 37% 36%); filter: drop-shadow(0 0 7px var(--world-accent)); animation: player-crystal-spin 360ms linear infinite; }
.player-attack-core::after { top: 15px; right: 72%; width: 108px; height: 13px; background: linear-gradient(90deg, transparent, rgba(var(--world-rgb),.18) 20%, rgba(var(--world-rgb),.72) 72%, var(--world-accent)); border-radius: 999px; filter: blur(3px); transform-origin: right center; }
.player-attack.impact .player-attack-core { animation: player-impact-burst 230ms ease-out forwards; }

.traveler.casting-attack::before,
.traveler.casting-attack::after { position: absolute; z-index: 1; content: ""; pointer-events: none; }
.traveler.casting-attack::before { inset: -23px; border: 4px solid var(--world-accent); border-block-style: dashed; border-radius: 50%; box-shadow: 0 0 14px var(--world-accent), inset 0 0 17px rgba(var(--world-rgb),.42); animation: wizard-charge-ring 430ms ease-out infinite; }
.traveler.casting-attack::after { inset: -35px; background: conic-gradient(from 0deg, transparent 0 8%, rgba(var(--world-rgb),.85) 9% 11%, transparent 12% 23%, rgba(255,255,255,.9) 24% 25%, transparent 26% 48%, rgba(var(--world-rgb),.8) 49% 51%, transparent 52% 74%, rgba(255,255,255,.85) 75% 76%, transparent 77%); border-radius: 50%; filter: drop-shadow(0 0 7px var(--world-accent)); animation: wizard-charge-rays 620ms linear infinite; }
.journey.battle-active .traveler.casting-attack { filter: drop-shadow(0 0 20px var(--world-accent)) brightness(1.22); }

.health-display {
  position: absolute;
  z-index: 10;
  top: 43px;
  width: min(29%, 220px);
  padding: 9px 11px;
  color: white;
  background: rgba(24,37,64,0.79);
  border: 3px solid rgba(255,255,255,0.72);
  border-radius: 12px;
  box-shadow: 0 7px 18px rgba(24,37,64,0.32);
  transform-origin: center;
}

.player-health-display { top: 10px; left: 50%; width: min(42%, 280px); transform: translateX(-50%); }
.enemy-health-display { right: 12px; }
.journey.battle-active .player-health-display { top: 18px; left: 18px; width: min(28%, 270px); transform: none; }
.journey.battle-active .enemy-health-display { top: 18px; right: 18px; width: min(28%, 270px); }
.health-heading { display: flex; justify-content: space-between; gap: 5px; margin-bottom: 6px; font-size: 0.76rem; font-weight: 900; text-transform: uppercase; }
.health-heading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-track { height: 14px; overflow: hidden; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,.22); border-radius: 999px; }
.health-fill { width: 100%; height: 100%; border-radius: inherit; transition: width 450ms ease, background 300ms ease; }
.player-fill { background: #69d288; }
.player-fill.warning { background: #f1c454; }
.player-fill.danger { background: #ee6a5d; }
.enemy-fill { background: #ed6a68; }
.health-display.damaged { animation: health-alert 720ms ease; }

.damage-popup {
  position: absolute;
  z-index: 20;
  top: 13px;
  display: none;
  padding: 4px 9px;
  color: white;
  font-size: 1.15rem;
  font-weight: 1000;
  background: #c63c4d;
  border: 3px solid white;
  border-radius: 9px;
  text-shadow: 2px 2px 0 rgba(0,0,0,.25);
  box-shadow: 0 6px 0 rgba(82,21,34,.35);
}
.player-damage-popup { left: 19%; }
.enemy-damage-popup { right: 20%; }
.journey.battle-active .player-damage-popup { top: 92px; left: 20%; }
.journey.battle-active .enemy-damage-popup { top: 92px; right: 19%; }
.damage-popup.show { display: block; animation: damage-float 760ms ease forwards; }

.score-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(3, minmax(90px, 1fr));
  gap: 8px;
  max-width: 1040px;
  margin: 14px auto;
}
.score-strip.untimed { grid-template-columns: minmax(180px, 1.6fr) repeat(2, minmax(90px, 1fr)); }

.player-card,
.score-item {
  min-height: 60px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.82);
  border: 2px solid rgba(255,255,255,0.78);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(37,54,93,0.1);
}
body[data-theme="dark"] .player-card,
body[data-theme="dark"] .score-item { background: linear-gradient(145deg, rgba(18,31,61,.96), rgba(35,21,63,.96)); border-color: rgba(124,217,255,.38); box-shadow: inset 0 0 15px rgba(112,201,255,.06), 0 8px 22px rgba(0,0,0,.32); }

.player-card { display: grid; align-content: center; }
.player-card > span { color: var(--muted); font-size: 0.68rem; font-weight: 900; text-transform: uppercase; }
.player-name-button { overflow: hidden; padding: 0; color: var(--navy); font: inherit; font-size: 1.03rem; font-weight: 900; text-align: left; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 0; cursor: pointer; }
.player-name-button:hover { color: #7654ca; text-decoration: underline; }
.player-name-button:disabled { color: inherit; text-decoration: none; cursor: default; opacity: 1; }
body[data-theme="dark"] .player-name-button { color: #effaff; }

.score-item { display: grid; place-content: center; text-align: center; }
.score-item[hidden] { display: none; }
.score-item > span { color: var(--navy); font-size: 1.25rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.score-item small { color: var(--muted); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; }
.timer > span { color: #ad5548; }
body[data-theme="dark"] .timer > span { color: #ffad9a; }
.timer.minute-drop { z-index: 12; animation: timer-zoom 850ms cubic-bezier(.18,.89,.32,1.28); }
.timer.urgent { border-color: #d94c58; box-shadow: 0 0 0 4px rgba(217,76,88,.18), 0 8px 22px rgba(37,54,93,.1); }
.timer.urgent > span { color: #d22e42; animation: urgent-tick 1s steps(2,end) infinite; }
body[data-theme="dark"] .timer.urgent > span { color: #ff7582; }

.question-panel {
  position: relative;
  max-width: 1040px;
  margin-inline: auto;
  padding: 18px 22px 16px;
  background: var(--panel);
  border: 4px solid rgba(255,255,255,0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

body[data-theme="dark"] .question-panel {
  border-color: rgba(145,225,255,.54);
  background: linear-gradient(145deg, rgba(13,21,45,.97), rgba(28,18,52,.97));
  box-shadow: 0 0 0 3px rgba(130,81,225,.16), 0 20px 55px rgba(0,0,0,.5), inset 0 0 25px rgba(84,194,255,.05);
}

.question-copy { display: flex; align-items: center; justify-content: center; gap: 9px; margin-bottom: 10px; }
.question-copy p { margin: 0; color: var(--muted); font-size: 0.97rem; font-weight: 800; }

.question-badge {
  padding: 4px 7px;
  color: white;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--navy);
  border-radius: 5px;
}

.question-badge.boss { background: #9b4058; }
.question-badge.quiz { background: #a76713; }
.question-badge.training { background: #26735f; }
.question-badge.meteor-question { color: #32101a; background: linear-gradient(135deg, #ffdd84, #ef5639); }
body[data-theme="dark"] .question-badge { color: #ffffff; background: #354b79; }
body[data-theme="dark"] .question-badge.boss { background: #8d3653; }
body[data-theme="dark"] .question-badge.training { background: #24745f; }
body[data-theme="dark"] .question-badge.meteor-question { color: #2f0a14; background: linear-gradient(135deg, #ffe29a, #ff724e); }

.prompt-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 600px);
  height: 230px;
  margin: auto;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.7),rgba(255,255,255,.7)),
    repeating-linear-gradient(45deg,#f7da84 0 18px,#aee0cf 18px 36px);
  border: 3px solid #d8d8c0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 7px rgba(255,255,255,0.52);
}

.prompt-card.boss-mode { background: radial-gradient(circle at 50% 35%, #fff2a8, #eca06d 57%, #8e4661); border-color: #8e4661; }
body[data-theme="dark"] .prompt-card { background: linear-gradient(rgba(17,23,41,.8),rgba(17,23,41,.8)), repeating-linear-gradient(45deg,#5c4420 0 18px,#225247 18px 36px); border-color: #53617f; }
body[data-theme="dark"] .prompt-card.boss-mode { background: radial-gradient(circle at 50% 35%, #674f32, #492f39 57%, #20182c); border-color: #8d5468; }
body[data-theme="dark"][data-world-color] .player-card,
body[data-theme="dark"][data-world-color] .score-item {
  background: linear-gradient(145deg, rgba(var(--world-rgb),.22), rgba(8,13,31,.96));
  border-color: rgba(var(--world-rgb),.58);
  box-shadow: inset 0 0 18px rgba(var(--world-rgb),.1), 0 8px 22px rgba(0,0,0,.36);
}
body[data-theme="dark"][data-world-color] .question-panel {
  border-color: rgba(var(--world-rgb),.66);
  background: linear-gradient(145deg, rgba(var(--world-rgb),.16), rgba(8,12,30,.97) 58%);
  box-shadow: 0 0 0 3px rgba(var(--world-rgb),.12), 0 20px 55px rgba(0,0,0,.52), inset 0 0 28px rgba(var(--world-rgb),.08);
}
body[data-theme="dark"][data-world-color] .prompt-card,
body[data-theme="dark"][data-world-color] .prompt-card.boss-mode {
  background: radial-gradient(circle at 50% 35%, rgba(var(--world-rgb),.32), rgba(9,13,31,.94) 70%);
  border-color: rgba(var(--world-rgb),.68);
  box-shadow: inset 0 0 0 7px rgba(var(--world-rgb),.08), 0 0 20px rgba(var(--world-rgb),.12);
}
body[data-theme="dark"][data-world-color] .question-badge,
body[data-theme="dark"][data-world-color] .question-badge.training,
body[data-theme="dark"][data-world-color] .question-badge.quiz,
body[data-theme="dark"][data-world-color] .question-badge.boss { color: #07101d; background: var(--world-accent); text-shadow: none; }

.pixel-corners::before,
.pixel-corners::after {
  position: absolute;
  width: 22px;
  height: 22px;
  content: "";
  border: solid rgba(37,54,93,0.24);
}

.pixel-corners::before { top: 12px; left: 12px; border-width: 4px 0 0 4px; }
.pixel-corners::after { right: 12px; bottom: 12px; border-width: 0 4px 4px 0; }

.number-prompt {
  color: var(--navy);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(5.4rem, 10vw, 8rem);
  line-height: 1;
  letter-spacing: -0.08em;
  text-shadow: 5px 5px 0 #f3c75f, 9px 9px 0 rgba(37,54,93,0.13);
  animation: card-pop 350ms cubic-bezier(.18,.89,.34,1.35);
}
body[data-theme="dark"] .number-prompt { color: #f2f5ff; text-shadow: 5px 5px 0 #735c27, 9px 9px 0 rgba(0,0,0,.45); }
.prompt-card.number-size-large .number-prompt { max-width: 96%; font-size: clamp(2.8rem, 7vw, 4.5rem); letter-spacing: -.045em; white-space: nowrap; }
.prompt-card.number-size-huge .number-prompt { max-width: 96%; font-size: clamp(2.35rem, 6vw, 3.75rem); letter-spacing: -.035em; white-space: nowrap; }
.prompt-card.number-word-mode .number-prompt { max-width: 94%; margin: auto; font-size: clamp(1.55rem, 5vw, 3.45rem); line-height: 1.1; letter-spacing: -.035em; text-align: center; text-shadow: 3px 3px 0 #f3c75f, 6px 6px 0 rgba(37,54,93,.13); }
body[data-theme="dark"] .prompt-card.number-word-mode .number-prompt { text-shadow: 3px 3px 0 #735c27, 6px 6px 0 rgba(0,0,0,.45); }
.prompt-card.spelling-mode { background: radial-gradient(circle at 50% 42%, rgba(var(--world-rgb),.38), rgba(8,12,30,.98) 72%); }
.prompt-card.letter-dash-mode { background: radial-gradient(circle at 50% 42%, rgba(255,103,53,.46), rgba(32,6,20,.98) 72%); border-color: #ffbd63; box-shadow: inset 0 0 0 7px rgba(255,181,91,.1), 0 0 24px rgba(255,76,46,.28); }
.prompt-card.letter-dash-mode .word-prompt { gap: 12px; }
.word-picture.letter-dash-speaker { color: #fff1bd; background: radial-gradient(circle, #ffcf72, #7b1b1c 70%, #300614); border-color: #ffe1a3; box-shadow: 0 0 34px rgba(255,80,40,.78), inset 0 0 18px rgba(255,255,255,.3); animation: meteor-signal 760ms ease-in-out infinite alternate; }
.prompt-card.spelling-mode .word-prompt { gap: 12px; }
.word-picture.spelling-speaker { display: grid; place-items: center; width: 98px; height: 98px; padding: 0; color: #fff; font-size: 3.8rem; background: radial-gradient(circle, var(--world-accent), var(--world-deep) 72%); border: 4px solid rgba(255,255,255,.68); border-radius: 50%; box-shadow: 0 0 30px rgba(var(--world-rgb),.62), inset 0 0 18px rgba(255,255,255,.24); filter: none; animation: spelling-speaker-pulse 1.15s ease-in-out infinite alternate; }

.prompt-card [hidden] { display: none !important; }
.word-prompt { display: grid; justify-items: center; width: 100%; gap: 4px; animation: card-pop 350ms cubic-bezier(.18,.89,.34,1.35); }
.word-picture { font-size: 5.2rem; line-height: 1; filter: drop-shadow(6px 6px 0 rgba(57,37,59,0.16)); }
.word-picture img { display: block; width: 155px; height: 108px; object-fit: contain; border-radius: 10px; }
.translation-prompt { max-width: 96%; padding: 16px 22px; color: #13203a; font-family: Arial, Tahoma, sans-serif; font-size: clamp(1.85rem, 4vw, 3.6rem); font-weight: 900; line-height: 1.16; text-align: center; overflow-wrap: anywhere; background: rgba(255,255,255,.9); border: 4px solid rgba(37,54,93,.2); border-radius: 16px; filter: drop-shadow(7px 7px 0 rgba(37,54,93,.14)); }
.conjugation-prompt { display: grid; min-width: min(94%, 520px); place-items: center; gap: .12em; white-space: normal; letter-spacing: .02em; background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,226,218,.94)); border-color: rgba(var(--world-rgb),.7); box-shadow: inset 0 0 22px rgba(var(--world-rgb),.1); }
.conjugation-verb { display: block; max-width: 100%; font-size: 1em; line-height: 1.02; overflow-wrap: anywhere; }
.conjugation-pronoun { display: block; max-width: 100%; font-size: .5em; line-height: 1.12; }
.translation-prompt.long { padding-inline: 18px; font-size: clamp(1.55rem, 3.3vw, 2.7rem); }
.translation-prompt.very-long { padding-inline: 14px; font-size: clamp(1.2rem, 2.65vw, 2.15rem); }
body[data-theme="dark"] .translation-prompt { color: #090f1f; background: #f1f4fb; border-color: #8796b8; filter: drop-shadow(7px 7px 0 rgba(0,0,0,.42)); }
body[data-theme="dark"] .conjugation-prompt { background: linear-gradient(145deg, #fff8f4, #ffdcd4); border-color: var(--world-accent); box-shadow: inset 0 0 24px rgba(var(--world-rgb),.12); }
.picture-hint { padding: 4px 9px; color: white; font-size: 0.73rem; font-weight: 900; background: rgba(55,39,70,0.72); border-radius: 999px; }

.answer-form { display: flex; width: min(100%, 640px); margin: 13px auto 0; gap: 8px; }
.answer-form input { flex: 1; min-width: 0; min-height: 60px; padding: 13px 16px; color: var(--ink); caret-color: var(--navy); font-size: clamp(1.45rem, 2.5vw, 2rem); font-weight: 900; line-height: 1.2; letter-spacing: 0.01em; background: white; border: 3px solid #cbded8; border-radius: 12px; outline: none; }
.answer-form input:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(37,54,93,0.1); }
.answer-form button, .primary-button { padding: 11px 19px; color: white; font-weight: 900; letter-spacing: 0.04em; background: var(--navy); border: 0; border-radius: 11px; box-shadow: 0 5px 0 var(--navy-dark); }
.answer-form button:active, .primary-button:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy-dark); }
.answer-form button:disabled { cursor: wait; opacity: 0.55; }
.spelling-replay-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 9px auto 0; padding: 8px 14px; color: #eef8ff; font-size: .72rem; font-weight: 900; letter-spacing: .04em; background: rgba(42,31,87,.86); border: 2px solid rgba(var(--world-rgb),.68); border-radius: 999px; box-shadow: 0 0 14px rgba(var(--world-rgb),.22); }
.spelling-replay-button[hidden] { display: none; }
.spelling-replay-button kbd { min-width: 31px; padding: 3px 6px; color: #10182b; background: #f4f6ff; border-radius: 6px; }
body[data-theme="dark"] .answer-form input { color: #0c1427; background: #f7f9ff; border-color: #8190af; }
body[data-theme="dark"] .answer-form input::placeholder { color: #526078; opacity: 1; }
body[data-theme="dark"] .answer-form button,
body[data-theme="dark"] .primary-button { color: #ffffff; background: #425b94; box-shadow: 0 5px 0 #1b294c; }

.secondary-button {
  padding: 10px 14px;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  background: white;
  border: 2px solid #d3dce0;
  border-radius: 10px;
}

.feedback { min-height: 22px; margin: 9px 0 0; text-align: center; font-size: 1rem; font-weight: 900; }
.feedback.correct { color: var(--green); }
.feedback.wrong { color: var(--red); }
.training-hint { margin: 8px auto 0; padding: 9px 13px; max-width: 520px; color: #182240; font-size: clamp(.94rem, 2.2vw, 1.1rem); font-weight: 900; background: linear-gradient(135deg, #fff0a4, #ffc779); border: 2px solid #fff6c9; border-radius: 11px; box-shadow: 0 0 16px rgba(255,205,100,.3); }
.training-hint[hidden] { display: none; }

@keyframes spelling-speaker-pulse {
  from { transform: scale(.96); box-shadow: 0 0 18px rgba(var(--world-rgb),.42), inset 0 0 14px rgba(255,255,255,.18); }
  to { transform: scale(1.04); box-shadow: 0 0 36px rgba(var(--world-rgb),.78), inset 0 0 22px rgba(255,255,255,.3); }
}

@keyframes title-plasma-orbit {
  0% { transform: scale(.94) rotate(0deg); filter: blur(16px) saturate(1.35) hue-rotate(0deg); }
  50% { transform: scale(1.03) rotate(180deg); filter: blur(20px) saturate(1.7) hue-rotate(24deg); }
  100% { transform: scale(.94) rotate(360deg); filter: blur(16px) saturate(1.35) hue-rotate(0deg); }
}

@keyframes title-energy-field {
  from { opacity: .54; transform: scale(.94); }
  to { opacity: .9; transform: scale(1.05); }
}

@keyframes title-energy-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.012); }
}

.game-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px 18px; margin-top: 10px; color: rgba(37,54,93,0.68); font-size: 0.74rem; font-weight: 800; }
body[data-theme="dark"] .game-footer { color: #d5def2; }

.screen-overlay {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(24,37,64,0.66);
  backdrop-filter: blur(8px);
}

.screen-overlay.visible { display: grid; }
.modal-card, .results-dialog { width: min(500px, 94vw); padding: 25px; text-align: center; color: var(--ink); background: #fff9e9; border: 5px solid white; border-radius: 24px; box-shadow: 0 24px 70px rgba(17,28,52,0.35); }
.start-card { position: relative; width: min(760px, 94vw); max-height: 94vh; overflow-y: auto; }
.setup-stage[hidden] { display: none !important; }
.setup-stage.active { animation: setup-stage-arrive 320ms ease both; }
@keyframes setup-stage-arrive { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.setup-info-button { position: sticky; z-index: 5; top: 0; float: right; display: grid; place-items: center; width: 34px; height: 34px; margin: -10px -9px 0 0; color: #06152c; font: 900 1rem/1 Georgia, serif; background: linear-gradient(145deg, #98edff, #c39dff); border: 2px solid rgba(255,255,255,.65); border-radius: 50%; box-shadow: 0 0 14px rgba(100,222,255,.38); cursor: pointer; }
.setup-info-button:hover, .setup-info-button:focus-visible { outline: 3px solid rgba(255,232,130,.72); outline-offset: 2px; }
.setup-info-panel { clear: both; margin: 0 42px 16px; padding: 11px 14px; color: #dcecff; font-size: .78rem; font-weight: 800; line-height: 1.45; text-align: left; background: rgba(7,17,44,.72); border: 1px solid rgba(124,222,255,.4); border-radius: 12px; }
.setup-info-panel[hidden] { display: none; }
.welcome-stage { padding: 5px 0 2px; }
.welcome-stage .start-character { display: flex; margin: -14px auto -3px; }
.setup-stage kbd { display: inline-grid; place-items: center; min-width: 28px; min-height: 27px; padding: 2px 7px; color: #10182c; font: 900 .82rem/1 "Trebuchet MS", sans-serif; background: #f7f8fc; border: 2px solid #8b99b5; border-bottom-width: 4px; border-radius: 7px; box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.setup-continue { width: min(360px, 100%); margin-top: 13px; }
.stage-name-input { margin: 25px auto 0; max-width: 460px; min-height: 58px; font-size: clamp(1.2rem, 4vw, 1.7rem); text-align: center; }
.setup-stage[data-setup-stage="name"] .start-label { max-width: 460px; margin-inline: auto; }
.setup-stage[data-setup-stage="name"] .practice-name-note { max-width: 460px; margin: 8px auto 0; text-align: center; }
.setup-back { display: block; margin: 15px auto 0; color: #a9dff2; }
.group-key-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 560px; margin: 22px auto 8px; }
.group-key-choices button { display: grid; grid-template-columns: 58px 1fr; align-items: center; min-height: 108px; padding: 14px; color: #eaf8ff; text-align: left; background: linear-gradient(145deg, rgba(27,49,87,.98), rgba(61,31,94,.98)); border: 3px solid rgba(118,220,255,.45); border-radius: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.28); cursor: pointer; }
.group-key-choices button:hover, .group-key-choices button:focus-visible { border-color: #fff0a3; outline: none; transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(117,225,255,.17), 0 13px 30px rgba(0,0,0,.34); }
.group-key-choices kbd { width: 45px; height: 48px; font-size: 1.4rem; }
.group-key-choices strong { font-size: 1.25rem; }
.world-yellow { --card-light: #ffe968; --card-main: #d79800; --card-dark: #493000; }
.world-red { --card-light: #ff8c7f; --card-main: #d42d3b; --card-dark: #480817; }
.world-blue { --card-light: #83dcff; --card-main: #167bd6; --card-dark: #062b60; }
.world-green { --card-light: #8af2a7; --card-main: #25a85f; --card-dark: #073f2a; }
.world-purple { --card-light: #d2b3ff; --card-main: #8f4de0; --card-dark: #32105f; }
.world-pink { --card-light: #ff9ceb; --card-main: #c638b1; --card-dark: #4e1048; }
.world-brown { --card-light: #e9b37d; --card-main: #9a572c; --card-dark: #3b2011; }
.world-gray { --card-light: #e0e8f4; --card-main: #7d899d; --card-dark: #303644; }
.world-orange { --card-light: #ffd39a; --card-main: #d96b00; --card-dark: #4a2000; }
.world-teal { --card-light: #9cfff2; --card-main: #119b9c; --card-dark: #063f4d; }
.world-meteor { --card-light: #ffe0a0; --card-main: #e14a2d; --card-dark: #4a0914; }

.world-grid,
.range-grid,
.assessment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
  max-width: 650px;
  margin: 22px auto 8px;
}

.range-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.assessment-grid { margin-top: 24px; }
.world-card,
.range-card,
.assessment-card {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  min-height: 126px;
  padding: 16px 12px;
  overflow: hidden;
  color: white;
  text-align: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.38), transparent 32%),
    linear-gradient(145deg, var(--card-main), var(--card-dark));
  border: 3px solid var(--card-light);
  border-radius: 20px;
  box-shadow: inset 0 0 26px rgba(255,255,255,.1), 0 10px 25px rgba(0,0,0,.34), 0 0 16px var(--card-main);
  text-shadow: 0 2px 5px rgba(0,0,0,.72);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.world-card::after,
.range-card::after,
.assessment-card::after { position: absolute; inset: 0; content: ""; pointer-events: none; background: linear-gradient(115deg, transparent 12%, rgba(255,255,255,.18) 13%, transparent 26%, transparent 67%, rgba(255,255,255,.1) 68%, transparent 79%); }
.world-card:hover,
.world-card:focus-visible,
.world-card.selected,
.range-card:hover,
.range-card:focus-visible,
.range-card.selected,
.assessment-card:hover,
.assessment-card:focus-visible { z-index: 1; outline: none; border-color: #fff4b0; transform: translateY(-4px) scale(1.02); box-shadow: 0 0 0 4px rgba(255,244,176,.18), 0 15px 34px rgba(0,0,0,.42), 0 0 26px var(--card-main); }
.world-card > span,
.range-card > span,
.assessment-card > span { font-size: 2.3rem; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.48)); }
.world-card strong,
.range-card strong,
.assessment-card strong { font-family: "Arial Black", "Trebuchet MS", sans-serif; font-size: 1.15rem; letter-spacing: .02em; }
.world-card small,
.range-card small,
.assessment-card small { margin: 1px 0 0; color: rgba(255,255,255,.92); font-size: .65rem; font-weight: 900; }
.spelling-world-card { grid-column: 1 / -1; min-height: 108px; }
.range-card { min-height: 116px; }
.assessment-card { min-height: 140px; }
.keyboard-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 22px; margin: 15px auto 2px; color: #d9edff; font-size: .76rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.keyboard-legend span { display: inline-flex; align-items: center; gap: 7px; }
.keyboard-legend kbd { min-width: 31px; min-height: 29px; color: #0b1730; background: linear-gradient(145deg, #fff5a9, #a9eaff); border-color: rgba(255,255,255,.88); }
.setup-choice-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; max-width: 650px; margin: 28px auto 12px; }
.difficulty-choice-grid.spelling-difficulties { grid-template-columns: repeat(4,1fr); max-width: 780px; }
.setup-choice-grid button[hidden] { display: none; }
.setup-choice-grid button { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 130px; padding: 16px; color: #eaf8ff; background: linear-gradient(145deg, rgba(27,49,87,.98), rgba(61,31,94,.98)); border: 3px solid rgba(118,220,255,.38); border-radius: 18px; box-shadow: 0 10px 24px rgba(0,0,0,.28); cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.setup-choice-grid button:hover, .setup-choice-grid button:focus-visible, .setup-choice-grid button.selected { border-color: #fff0a3; outline: none; transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(117,225,255,.17), 0 13px 30px rgba(0,0,0,.34); }
.setup-choice-grid button.selected { color: #071226; background: linear-gradient(135deg, #91efff, #d1abff); }
.setup-choice-grid b { display: grid; place-items: center; width: 46px; height: 46px; color: #0d1830; font-family: "Arial Black", sans-serif; font-size: 1rem; background: #f5f7fc; border-radius: 50%; }
.setup-choice-grid strong { font-size: 1.05rem; }
.activity-stage > h2 { margin-bottom: 3px; }
.compact-options { margin: 12px 0 2px; }
.compact-options .start-input { padding-block: 8px; }
.activity-path:focus-visible { outline: 4px solid rgba(255,232,130,.72); outline-offset: 3px; }
.start-card h2, .results-dialog h2, .utility-dialog h2 { margin: 3px 0 9px; color: var(--navy); font-size: 2rem; letter-spacing: -0.04em; }
.start-card .start-intro { margin: 0 auto 16px; max-width: 370px; color: var(--muted); line-height: 1.45; }
.start-card small { display: block; margin-top: 13px; color: var(--muted); }
.start-character { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 110px; min-height: 86px; font-size: 4.8rem; }
#startCharacterSprite { display: inline-grid; place-items: center; animation: robot-idle 1.2s steps(2,end) infinite; }
#startCharacterSprite img { width: 86px; height: 86px; object-fit: contain; }
#startWeaponSprite { position: absolute; right: -2px; bottom: 4px; font-size: 2.6rem; transform: rotate(-28deg); filter: drop-shadow(0 3px 1px rgba(24,37,64,.24)); }
.class-signature { max-width: 100%; line-height: 1.35; }

.start-label { display: block; margin: 0 0 6px; text-align: left; color: var(--navy); font-size: 0.78rem; font-weight: 900; text-transform: uppercase; }
.start-label.spaced { margin-top: 14px; }
.identity-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr); gap: 10px; margin-top: 4px; }
.practice-name-note { margin: 6px 0 0; color: #65598a; font-size: .72rem; font-weight: 800; text-align: left; }
.practice-name-note strong { color: #382a75; font-family: "Arial Black", "Trebuchet MS", sans-serif; letter-spacing: .04em; }
.pathway-picker { margin: 16px 0 8px; padding: 13px; text-align: left; background: linear-gradient(180deg, rgba(19,30,64,.98), rgba(31,18,59,.98)); border: 2px solid rgba(130,226,255,.48); border-radius: 18px; box-shadow: inset 0 0 25px rgba(87,205,255,.07), 0 8px 22px rgba(24,21,58,.2); }
.pathway-heading { display: flex; align-items: center; justify-content: center; margin-bottom: 9px; color: #e8f8ff; }
.pathway-heading h3 { margin: 0; color: #e8f8ff; font-size: .85rem; letter-spacing: .07em; text-transform: uppercase; }
.pathway-heading p { max-width: 270px; margin: 0; color: #b9cbea; font-size: .68rem; font-weight: 800; line-height: 1.35; text-align: right; }
.compass-mark, .pathway-south span { display: grid; place-items: center; width: 26px; height: 26px; color: #071226; font-family: "Arial Black", sans-serif; font-size: .72rem; background: linear-gradient(145deg, #91f1ff, #c19cff); border-radius: 50%; box-shadow: 0 0 12px rgba(105,222,255,.48); }
.activity-path { position: relative; display: flex; gap: 13px; min-height: 140px; padding: 14px 18px 17px; overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth; scroll-snap-type: x mandatory; background: radial-gradient(circle at 50% 50%, rgba(82,112,192,.12), transparent 55%); border: 1px solid rgba(151,209,255,.2); border-radius: 14px; }
.activity-path::before { position: absolute; z-index: 0; top: 50%; right: 0; left: 0; height: 5px; content: ""; background: linear-gradient(90deg, #ffbd67, #64e6ff 50%, #b486ff); border-radius: 999px; box-shadow: 0 0 12px rgba(105,222,255,.55); transform: translateY(-50%); }
.pathway-node { position: relative; z-index: 1; display: grid; grid-template-columns: 52px 1fr; align-items: center; flex: 0 0 218px; width: 218px; min-height: 106px; padding: 10px; color: #eaf8ff; text-align: left; scroll-snap-align: center; background: linear-gradient(145deg, rgba(27,49,87,.98), rgba(57,31,89,.98)); border: 2px solid rgba(116,214,255,.36); border-radius: 14px; box-shadow: 0 6px 15px rgba(0,0,0,.28); cursor: pointer; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.pathway-node:hover { border-color: #9defff; transform: translateY(-2px); }
.pathway-node.selected { color: #071226; background: linear-gradient(135deg, #91efff, #d1abff); border-color: #fff3b3; box-shadow: 0 0 0 3px rgba(255,225,121,.22), 0 0 18px rgba(92,224,255,.52); }
.pathway-node.training-node { border-style: dashed; }
.pathway-node.quiz-node { border-color: rgba(255,198,103,.65); }
.pathway-icon { display: grid; place-items: center; width: 40px; height: 40px; font-size: 1.65rem; background: rgba(5,12,34,.42); border-radius: 11px; }
.pathway-copy { display: grid; min-width: 0; gap: 1px; }
.pathway-copy small { margin: 0; color: #8feaff; font-size: .57rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.pathway-copy strong { font-size: .76rem; line-height: 1.2; }
.pathway-copy em { overflow: hidden; color: #b8c8e5; font-size: .58rem; font-style: normal; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.pathway-node.selected .pathway-copy small, .pathway-node.selected .pathway-copy em { color: #354575; }
.pathway-node:not(.selected).world-yellow { background: linear-gradient(145deg, #9b6a00, #3e2900); border-color: #ffe064; }
.pathway-node:not(.selected).world-red { background: linear-gradient(145deg, #a82835, #3e0714); border-color: #ff7b73; }
.pathway-node:not(.selected).world-blue { background: linear-gradient(145deg, #176fb3, #062754); border-color: #70d5ff; }
.pathway-node:not(.selected).world-green { background: linear-gradient(145deg, #23894e, #063621); border-color: #7aea9a; }
.pathway-node:not(.selected).world-purple { background: linear-gradient(145deg, #7636bc, #280c50); border-color: #cfadff; }
.pathway-node:not(.selected).world-pink { background: linear-gradient(145deg, #a92f99, #410d3c); border-color: #ff8ce7; }
.pathway-node:not(.selected).world-brown { background: linear-gradient(145deg, #86502d, #321b10); border-color: #e2a26a; }
.pathway-node:not(.selected).world-gray { background: linear-gradient(145deg, #657084, #292f3c); border-color: #cbd5e4; }
.pathway-node:not(.selected).world-orange { background: linear-gradient(145deg, #a95a00, #421d00); border-color: #ffc27b; }
.pathway-node:not(.selected).world-teal { background: linear-gradient(145deg, #138d8d, #063a4b); border-color: #8dfff0; }
.pathway-node:not(.selected).world-meteor { background: linear-gradient(145deg, #b83224, #460913); border-color: #ffd391; }
.pathway-node.complete-node .pathway-icon { color: #082b20; background: #91efac; box-shadow: 0 0 16px rgba(99,237,142,.55); }
.pathway-node.locked-node,
.pathway-node.locked-node:disabled { color: #a8afbf; background: linear-gradient(145deg, #454b58, #252832); border-color: #6f7685; border-style: solid; box-shadow: inset 0 0 22px rgba(0,0,0,.35); cursor: not-allowed; filter: grayscale(.78); opacity: .78; }
.pathway-node.locked-node:hover { transform: none; border-color: #6f7685; }
.pathway-direction { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; color: #ffcc83; font-size: .62rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; }
.start-input { width: 100%; padding: 11px 12px; color: var(--ink); font-weight: 900; background: white; border: 3px solid #d3dfdc; border-radius: 10px; outline: none; }
.start-input:focus { border-color: var(--navy); }
select.start-input { cursor: pointer; }
select.start-input:disabled { cursor: not-allowed; opacity: .58; }
.start-options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.option-description { margin: 6px 0 0; color: var(--muted); font-size: .76rem; font-weight: 800; text-align: left; }
.workbook-status { margin: 5px 0 0; text-align: left; color: var(--muted); font-size: .7rem; font-weight: 800; }
.workbook-status.loaded { color: var(--green); }
.workbook-status.fallback { color: #a35b3e; }
.music-status { margin: 7px 0 0; color: var(--muted); font-size: .7rem; font-weight: 800; }
.music-status.loaded { color: var(--green); }
.music-status.fallback { color: #9a593f; }

.choice-picker { display: grid; gap: 8px; margin: 15px 0 0; padding: 0; border: 0; }
.character-picker { grid-template-columns: repeat(4, 1fr); }
.weapon-picker { grid-template-columns: repeat(3, 1fr); }
.choice-picker legend { margin-bottom: 7px; color: var(--navy); font-size: .78rem; font-weight: 900; text-align: left; text-transform: uppercase; }
.choice-picker label { position: relative; min-width: 0; }
.choice-picker input { position: absolute; opacity: 0; pointer-events: none; }
.choice-picker label > span { display: grid; place-items: center; align-content: center; min-height: 76px; padding: 7px 5px; color: var(--muted); font-size: .76rem; font-weight: 900; background: white; border: 3px solid #d3dfdc; border-radius: 12px; cursor: pointer; }
.choice-picker b { display: block; margin-bottom: 4px; font-size: 2rem; line-height: 1; }
.choice-picker .choice-gif { height: 47px; margin-bottom: 2px; }
.choice-picker .choice-gif img { display: block; width: 47px; height: 47px; object-fit: contain; }
.choice-picker.disabled { opacity: .48; }
.choice-picker.disabled label > span { cursor: not-allowed; transform: none; }
.built-in-weapon-note { margin: 7px 0 0; color: #7b3f72; font-size: .76rem; font-weight: 900; text-align: left; }
.built-in-weapon-note[hidden] { display: none; }
.choice-picker input:checked + span { color: white; background: #314875; border-color: #f0c85f; box-shadow: inset 0 0 0 2px #314875; transform: translateY(-2px); }
.choice-picker input:focus-visible + span { outline: 3px solid rgba(37,54,93,.3); outline-offset: 2px; }
.choice-picker label > span:hover { border-color: #91aaa2; }

.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 15px 0 0; padding: 0; border: 0; }
.theme-picker legend { margin-bottom: 7px; color: var(--navy); font-size: .78rem; font-weight: 900; text-align: left; text-transform: uppercase; }
.theme-picker label { position: relative; }
.theme-picker input { position: absolute; opacity: 0; }
.theme-picker span { display: block; padding: 10px; color: var(--muted); font-weight: 900; background: white; border: 3px solid #d3dfdc; border-radius: 11px; cursor: pointer; }
.theme-picker input:checked + span { color: white; background: #314875; border-color: #f0c85f; box-shadow: inset 0 0 0 2px #314875; }
.theme-picker input:focus-visible + span { outline: 3px solid rgba(37,54,93,.25); }
body[data-theme="dark"] .modal-card,
body[data-theme="dark"] .results-dialog,
body[data-theme="dark"] .utility-dialog { color: var(--ink); background: linear-gradient(145deg, #111a34, #251641); border-color: rgba(126,220,255,.52); box-shadow: 0 0 0 3px rgba(151,88,235,.18), 0 24px 70px rgba(0,0,0,.62), inset 0 0 28px rgba(87,199,255,.05); }
body[data-theme="dark"] .start-input,
body[data-theme="dark"] .theme-picker span,
body[data-theme="dark"] .choice-picker label > span { color: #11182c; background: #f3f5fb; border-color: #7786a5; }
body[data-theme="dark"] .start-input { color: #10182b; background: #f5f7fc; border-color: #7b89a8; }
body[data-theme="dark"] .history-table { color: #eef3ff; background: #20283d; border-color: #4d5a79; }
body[data-theme="dark"] .theme-picker input:checked + span { background: #4b214e; border-color: #e1a758; box-shadow: inset 0 0 0 2px #4b214e; }
body[data-theme="dark"] .theme-picker input:checked + span { color: #ffffff; }
body[data-theme="dark"] .choice-picker input:checked + span { color: #ffffff; background: #4b214e; border-color: #e1a758; box-shadow: inset 0 0 0 2px #4b214e; }
body[data-theme="dark"] .eyebrow { color: #ffad9a; }
body[data-theme="dark"] .workbook-status.fallback,
body[data-theme="dark"] .music-status.fallback { color: #ffc28a; }
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .secondary-button { color: #111a30; background: #f1f4fb; border-color: #8795b2; }
body[data-theme="dark"] .icon-button:hover { background: #ffffff; }
body[data-theme="dark"] .setup-back { color: #a9e8ff; }

.vocabulary-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 15px 0 8px; color: var(--navy); font-size: 0.78rem; font-weight: 900; text-transform: uppercase; }
.text-button { padding: 0; color: #a95049; font-size: 0.72rem; font-weight: 900; background: none; border: 0; text-decoration: underline; }
.vocabulary-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.vocabulary-choice { position: relative; }
.vocabulary-choice input { position: absolute; opacity: 0; pointer-events: none; }
.vocabulary-choice span { display: block; padding: 7px 9px; color: var(--muted); font-size: 0.78rem; font-weight: 900; background: white; border: 2px solid #d9e2df; border-radius: 999px; cursor: pointer; }
.vocabulary-choice input:checked + span { color: white; background: var(--navy); border-color: var(--navy); }
.vocabulary-choice input:focus-visible + span { outline: 3px solid rgba(37,54,93,0.25); }
.start-error { min-height: 18px; margin: 7px 0; color: var(--red); font-size: 0.78rem; font-weight: 900; }

.start-scores { margin-top: 17px; padding-top: 12px; border-top: 2px solid #eadfc9; }
.start-scores h3 { margin: 0 0 7px; color: var(--navy); font-size: 0.77rem; letter-spacing: 0.07em; text-transform: uppercase; }
.scores-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.scores-heading-row h3 { margin: 0; }
.secondary-button.compact { min-height: 31px; padding: 5px 9px; font-size: .64rem; }
.score-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 0 9px; }
.score-tab { min-height: 34px; padding: 6px 8px; color: #cddcff; font-size: .7rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; background: rgba(33,46,79,.82); border: 1px solid rgba(130,196,255,.3); border-radius: 9px; }
.score-tab.active { color: #071226; background: linear-gradient(135deg, #87edff, #c09aff); border-color: #d9faff; box-shadow: 0 0 12px rgba(101,218,255,.35); }
.history-score-tabs { width: min(100%, 440px); margin-inline: auto; }
.mini-score-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; }
.mini-score-table th, .mini-score-table td { padding: 4px 5px; border-bottom: 1px solid #eadfc9; text-align: left; }
.mini-score-table td:first-child { width: 28px; color: #a95049; font-weight: 900; }
.student-name-link { padding: 0; color: inherit; font: inherit; font-weight: 900; text-align: left; background: transparent; border: 0; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(84,178,211,.45); text-underline-offset: 2px; }
.student-name-link:hover { color: #6a56cf; text-decoration-color: currentColor; }
.mini-score-table td small { display: block; margin: 1px 0 0; font-size: .58rem; opacity: .78; }
.empty-history { margin: 4px 0 !important; color: var(--muted); font-size: 0.78rem; }

.results-dialog { border: 0; }
.results-dialog::backdrop { background: rgba(24,37,64,0.7); backdrop-filter: blur(8px); }
.results-crown { font-size: 4.3rem; }
.result-team { margin: 0 0 15px; color: var(--muted); font-weight: 800; }

.final-score { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; }
.final-score.untimed { grid-template-columns: repeat(3,1fr); }
.final-score.training { grid-template-columns: repeat(2,1fr); }
.final-score div { padding: 11px 5px; background: #edf4e7; border-radius: 11px; }
.final-score div[hidden] { display: none; }
.final-score strong, .final-score span { display: block; }
.final-score strong { color: var(--navy); font-size: 1.22rem; }
.final-score span { margin-top: 2px; color: var(--muted); font-size: 0.67rem; font-weight: 900; text-transform: uppercase; }
body[data-theme="dark"] .final-score div { background: #dce9e2; }
body[data-theme="dark"] .final-score strong { color: #152341; }
body[data-theme="dark"] .final-score span { color: #45516a; }
.final-progress { margin: 11px 0 0; color: var(--muted); font-size: .85rem; font-weight: 900; }
.results-dialog.completed { border: 5px solid #53ad79; }
.results-dialog.timeout { border: 5px solid #d85460; }
.results-dialog.timeout h2, .results-dialog.timeout .final-progress { color: #b62d3f; }
body[data-theme="dark"] .results-dialog.timeout h2,
body[data-theme="dark"] .results-dialog.timeout .final-progress { color: #ff9ba4; }

.practice-section { margin: 17px 0; padding: 13px; text-align: left; background: #f4ead2; border-radius: 13px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 10px; }
.result-actions > button { width: 100%; }
.practice-section h3 { margin: 0 0 9px; color: var(--navy); font-size: 0.88rem; text-transform: uppercase; }
.practice-words { display: flex; flex-wrap: wrap; gap: 6px; }
.practice-chip { padding: 5px 8px; color: #80404a; font-size: 0.78rem; font-weight: 900; background: white; border: 2px solid #e3c8ba; border-radius: 999px; }
.practice-perfect { margin: 0; color: var(--green); font-weight: 900; }
body[data-theme="dark"] .practice-section { color: #142039; background: #eadfc8; }
body[data-theme="dark"] .practice-section h3 { color: #172847; }
body[data-theme="dark"] .practice-chip { color: #642b3d; background: #ffffff; }
body[data-theme="dark"] .practice-perfect { color: #246747; }

.results-dialog > .secondary-button { display: block; width: 100%; margin-top: 11px; }

.utility-dialog { width: min(720px, 95vw); padding: 24px; color: var(--ink); background: #fff9e9; border: 5px solid white; border-radius: 22px; box-shadow: 0 24px 70px rgba(17,28,52,0.35); }
.utility-dialog::backdrop { background: rgba(24,37,64,0.72); backdrop-filter: blur(8px); }
.utility-dialog form { margin: 0; }
.dialog-help { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.utility-dialog textarea { width: 100%; min-height: 235px; padding: 12px; color: var(--ink); font-family: Consolas, monospace; font-size: 0.85rem; line-height: 1.5; background: white; border: 3px solid #d3dfdc; border-radius: 11px; resize: vertical; }
.dialog-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dialog-actions.end { justify-content: flex-end; }
.history-dialog { width: min(850px, 96vw); }
.student-dialog { width: min(780px, 96vw); }
.student-roster { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.student-roster-button { display: grid; min-width: 125px; padding: 8px 11px; color: #eaf8ff; text-align: left; background: linear-gradient(145deg, #263d70, #56316f); border: 1px solid rgba(141,225,255,.4); border-radius: 11px; }
.student-roster-button strong { font-size: .78rem; }
.student-roster-button span { color: #b9d2ec; font-size: .61rem; font-weight: 800; text-transform: uppercase; }
.student-profile { padding-top: 12px; border-top: 1px solid rgba(137,201,239,.25); }
.student-profile[hidden] { display: none; }
.student-overview { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-bottom: 12px; }
.student-overview > div { padding: 10px 6px; text-align: center; background: rgba(238,245,255,.95); border-radius: 10px; }
.student-overview strong, .student-overview span { display: block; }
.student-overview strong { color: #17284d; font-size: 1.15rem; }
.student-overview span { color: #58647c; font-size: .59rem; font-weight: 900; text-transform: uppercase; }
.student-game-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; max-height: 48vh; overflow-y: auto; }
.student-game-card { padding: 11px; color: #172340; text-align: left; background: #eef5ff; border: 2px solid #cbd9ed; border-radius: 12px; }
.student-game-card > div:first-child { display: flex; align-items: center; gap: 7px; }
.student-game-card h3 { margin: 0; color: #1c2c53; font-size: .78rem; }
.student-game-card p { margin: 7px 0; color: #4c5b75; font-size: .7rem; font-weight: 800; line-height: 1.35; }
.student-game-card small { display: block; margin-top: 6px; color: #667187; font-size: .61rem; }
.profile-meter { height: 8px; overflow: hidden; background: #cbd5e5; border-radius: 999px; }
.profile-meter span { display: block; height: 100%; background: linear-gradient(90deg, #47cfa5, #6fa9ff, #b97cff); border-radius: inherit; }
.history-scroll { max-height: 55vh; overflow: auto; border: 2px solid #e0e3d7; border-radius: 11px; }
.history-table { width: 100%; border-collapse: collapse; background: white; font-size: 0.8rem; }
.history-table th, .history-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #e4e7df; white-space: nowrap; }
.history-table th { position: sticky; top: 0; color: white; background: var(--navy); }
.history-table td:first-child { color: #a95049; font-weight: 900; }
body[data-theme="dark"] .history-table th { color: #ffffff; background: #31466f; }
body[data-theme="dark"] .history-table td { border-bottom-color: #3d4863; }
body[data-theme="dark"] .history-table td:first-child { color: #ffb29f; }
.history-table tr.completed td { color: #216b45; background: #ebf8ef; }
.history-table tr.timeout td { color: #a92739; background: #fff0f1; }
.history-table tr.completed td:first-child { color: #216b45; }
.history-table tr.timeout td:first-child { color: #a92739; }
.mini-score-table tr.completed td { color: #216b45; }
.mini-score-table tr.timeout td { color: #ad2f40; }
body[data-theme="dark"] .history-table tr.completed td { color: #b9f2cd; background: #18362d; }
body[data-theme="dark"] .history-table tr.timeout td { color: #ffc1c7; background: #43232b; }
body[data-theme="dark"] .mini-score-table tr.completed td { color: #9ee7b8; }
body[data-theme="dark"] .mini-score-table tr.timeout td { color: #ffadb6; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes cloud-drift { to { transform: translateX(92px) translateY(-5px); } }
@keyframes rain-fall { to { background-position: -18px 38px; } }
@keyframes meteor-fall {
  0% { opacity: 0; transform: translate(10px,-90px) rotate(-28deg) scale(.45); }
  9% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-360px,520px) rotate(-28deg) scale(1.22); }
}
@keyframes meteor-signal { from { transform: scale(.94) rotate(-2deg); filter: brightness(1); } to { transform: scale(1.08) rotate(2deg); filter: brightness(1.32); } }
@keyframes meteor-flash { 0%, 68%, 71%, 100% { opacity: 0; } 69%, 70% { opacity: .54; } }
@keyframes lightning-flash { 0%, 73%, 76%, 79%, 100% { opacity: 0; } 74%, 78% { opacity: .85; } 75% { opacity: .12; } }
@keyframes bat-flight { 0% { transform: translate(-20px,18px) scale(.7); opacity: 0; } 10% { opacity: 1; } 45% { transform: translate(430px,-12px) scale(1) rotate(-8deg); } 100% { transform: translate(1050px,22px) scale(.72) rotate(7deg); opacity: 0; } }
@keyframes robot-idle { 50% { transform: translateY(-4px) rotate(2deg); } }
@keyframes wizard-hover { 0%,100% { transform: translateY(1px) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1.5deg); } }
@keyframes wizard-glide { 0% { transform: translate(-8px,2px) rotate(-4deg) scale(.96); } 45% { transform: translate(7px,-11px) rotate(2deg) scale(1.05); } 100% { transform: translate(0,0) rotate(-1deg) scale(1); } }
@keyframes wizard-retreat { 0% { transform: translate(6px,0) rotate(2deg); } 45% { transform: translate(-9px,-8px) rotate(-4deg) scale(1.03); } 100% { transform: translate(0,0) rotate(-1deg); } }
@keyframes shadow-pulse { 50% { transform: scaleX(.78); opacity: .68; } }
@keyframes robot-walk { 0% { transform: translateY(0) rotate(-8deg); } 100% { transform: translateY(-7px) rotate(8deg); } }
@keyframes robot-back { 20% { transform: translateX(7px) rotate(8deg); } 50% { transform: translateX(-5px) rotate(-7deg); } 80% { transform: translateX(4px) rotate(4deg); } }
@keyframes robot-attack { 35% { transform: translate(25px,-7px) rotate(11deg) scale(1.12); } 70% { transform: translate(-3px,0) rotate(-3deg); } }
@keyframes weapon-walk { 0% { transform: translateY(0) rotate(-34deg); } 100% { transform: translateY(-5px) rotate(-18deg); } }
@keyframes weapon-strike { 0% { transform: rotate(-28deg); } 40% { transform: translate(20px,-15px) rotate(54deg) scale(1.2); } 75% { transform: translate(7px,-4px) rotate(8deg); } 100% { transform: rotate(-28deg); } }
@keyframes current-step-pulse { to { transform: translate(-50%, -50%) scale(1.72); filter: brightness(1.35); } }
@keyframes player-impact { 0% { transform: translateX(-50%) scale(1); } 18% { transform: translateX(-50%) scale(1.85) rotate(-12deg); filter: brightness(2); } 36% { transform: translateX(calc(-50% - 12px)) scale(1.65) rotate(11deg); } 55% { transform: translateX(calc(-50% + 10px)) scale(1.45) rotate(-8deg); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes enemy-impact { 0% { transform: translate(-50%,0) scale(1); } 18% { transform: translate(-50%,0) scale(1.18) rotate(8deg); filter: brightness(2.2); } 38% { transform: translate(calc(-50% + 14px),0) scale(1.08) rotate(-7deg); } 58% { transform: translate(calc(-50% - 11px),0) scale(1.03) rotate(5deg); } 100% { transform: translate(-50%,0) scale(1); } }
@keyframes battle-player-impact { 0% { transform: translateX(-50%) scale(2.35); } 25% { transform: translateX(calc(-50% - 16px)) scale(2.62) rotate(-9deg); filter: brightness(2); } 55% { transform: translateX(calc(-50% + 9px)) scale(2.2) rotate(6deg); } 100% { transform: translateX(-50%) scale(2.35); } }
@keyframes battle-enemy-impact { 0% { transform: translate(-50%,0) scale(1); } 25% { transform: translate(calc(-50% + 16px),0) scale(1.13) rotate(7deg); filter: brightness(2.1); } 55% { transform: translate(calc(-50% - 9px),0) scale(.96) rotate(-5deg); } 100% { transform: translate(-50%,0) scale(1); } }
.journey.battle-active .traveler.taking-hit { animation: battle-player-impact 720ms cubic-bezier(.18,.9,.28,1); }
.journey.battle-active .enemy.taking-hit:not(.defeated) { animation: battle-enemy-impact 720ms cubic-bezier(.18,.9,.28,1); }
@keyframes health-alert { 25% { transform: scale(1.16); background: #a32f41; box-shadow: 0 0 0 7px rgba(255,90,103,.35); } 100% { transform: scale(1); } }
@keyframes damage-float { 0% { opacity: 0; transform: translateY(14px) scale(.7); } 25% { opacity: 1; transform: translateY(0) scale(1.18); } 100% { opacity: 0; transform: translateY(-30px) scale(1); } }
@keyframes enemy-defeat { 30% { transform: translate(-50%,0) scale(1.25) rotate(-10deg); } 100% { transform: translate(-50%,-90px) scale(.2) rotate(35deg); opacity: 0; } }
@keyframes card-pop { from { opacity: 0; transform: scale(.7) rotate(-3deg); } }
@keyframes timer-zoom { 0%,100% { transform: scale(1); } 35% { transform: scale(1.48) rotate(-2deg); box-shadow: 0 14px 35px rgba(180,55,69,.35); } }
@keyframes urgent-tick { 50% { opacity: .58; } }
@keyframes guardian-timer-pulse { to { box-shadow: 0 0 0 3px rgba(255,91,128,.2), 0 0 22px rgba(255,73,113,.48); } }
@keyframes guardian-cast { 0%,100% { transform: scale(1); filter: drop-shadow(0 7px 4px rgba(10,6,35,.68)) drop-shadow(0 0 14px rgba(89,209,255,.48)); } 38% { transform: translateX(-9px) scale(1.13); filter: brightness(1.4) drop-shadow(0 0 26px rgba(178,104,255,.94)); } 62% { transform: translateX(7px) scale(1.06); } }
@keyframes guardian-charge-body { from { transform: translateY(2px) scale(1); filter: brightness(1) drop-shadow(0 9px 5px rgba(10,6,35,.72)) drop-shadow(0 0 18px rgba(89,209,255,.56)); } to { transform: translateY(-8px) scale(1.045); filter: brightness(1.22) drop-shadow(0 10px 5px rgba(10,6,35,.72)) drop-shadow(0 0 34px rgba(164,99,255,.92)); } }
@keyframes guardian-charge-ring { to { transform: rotate(360deg) scale(1.08); } }
@keyframes guardian-charge-breath { to { opacity: .92; transform: scale(1.24); } }
@keyframes charge-orbit { to { transform: rotate(360deg) scale(1.08); } }
@keyframes charge-rays { to { transform: rotate(360deg); } }
@keyframes arena-charge-pulse { to { filter: brightness(1.24) saturate(1.18); } }
@keyframes guardian-projectile {
  0% { left: var(--guardian-origin-x, 74%); opacity: 0; transform: translate(-50%,0) scale(.55); }
  12% { opacity: 1; transform: translate(-50%,-6px) scale(1); }
  74% { opacity: 1; }
  100% { left: var(--guardian-target-x, 22%); opacity: 0; transform: translate(-50%,3px) scale(1.85); }
}
@keyframes player-projectile {
  0% { left: var(--player-origin-x, 22%); opacity: 0; transform: translate(-50%,5px) scale(.3); }
  13% { opacity: 1; transform: translate(-50%,-4px) scale(.85); }
  78% { left: 72%; opacity: 1; transform: translate(-50%,-10px) scale(1.12); }
  100% { left: var(--player-target-x, 80%); opacity: 1; transform: translate(-50%,0) scale(2); }
}
@keyframes player-crystal-spin { to { transform: rotate(360deg); } }
@keyframes player-impact-burst { from { opacity: 1; transform: scale(1); filter: brightness(1); } to { opacity: 0; transform: scale(2.8); filter: brightness(2.1); } }
@keyframes wizard-charge-ring { 0% { opacity: .25; transform: scale(.55) rotate(0); } 55% { opacity: 1; } 100% { opacity: 0; transform: scale(1.22) rotate(90deg); } }
@keyframes wizard-charge-rays { to { transform: rotate(360deg); } }
@keyframes wind-spin { to { transform: rotate(360deg); } }
@keyframes spectral-wave { from { opacity: .9; transform: scale(.55); } to { opacity: 0; transform: scale(1.5); } }
@keyframes arcane-spin { to { transform: rotate(405deg); } }

@media (max-width: 780px) {
  .app-shell { width: 94vw; min-width: 0; margin: 18px auto 30px; }
  .journey { height: 240px; }
  .journey.battle-active { height: 400px; }
  .treasure-landmark { width: 105px; bottom: 33px; }
  .path { bottom: 46px; }
  .traveler { bottom: 53px; }
  .journey.battle-active .traveler { left: 20% !important; bottom: 130px; transform: translateX(-50%) scale(1.9); }
  .journey.battle-active .enemy { left: 80%; bottom: 105px; width: 330px; }
  .journey.battle-active .guardian-sprite { width: 320px; height: 242px; }
  .guardian-attack, .player-attack { bottom: 138px; width: 66px; height: 66px; }
  .score-strip { grid-template-columns: repeat(3,1fr); }
  .score-strip.untimed { grid-template-columns: repeat(2,1fr); }
  .player-card { grid-column: 1 / -1; }
  .prompt-card { height: 175px; }
  .health-display { width: 34%; }
  .guardian-countdown { width: 30%; }
  .pathway-node { flex-basis: 210px; width: 210px; }
}

@media (max-width: 480px) {
  .game-header { display: block; }
  .header-actions { flex-direction: row; margin-top: 10px; }
  .header-actions { flex-wrap: wrap; }
  .question-utilities .icon-button { flex: 1 1 115px; }
  .treasure-landmark { right: 1%; bottom: 27px; width: 82px; }
  .health-display { top: 52px; width: 43%; padding: 7px 8px; }
  .player-health-display { top: 8px; left: 58%; width: 50%; }
  .journey { height: 210px; }
  .journey.battle-active { height: 330px; }
  .journey.battle-active .traveler { left: 22% !important; bottom: 105px; transform: translateX(-50%) scale(1.6); }
  .journey.battle-active .enemy { bottom: 85px; left: 78%; width: 235px; }
  .journey.battle-active .enemy.visible { transform: translate(-50%,0) scale(1); }
  .journey.battle-active .guardian-sprite { width: 230px; height: 176px; }
  .journey.battle-active .player-health-display { top: 12px; left: 8px; width: 42%; transform: none; }
  .journey.battle-active .enemy-health-display { top: 12px; right: 8px; width: 42%; }
  .guardian-countdown { top: 76px; width: 58%; }
  .guardian-attack { bottom: 111px; width: 54px; height: 54px; }
  .player-attack { bottom: 111px; width: 52px; height: 52px; }
  .health-heading { font-size: 0.62rem; }
  .health-track { height: 12px; }
  .question-panel { padding: 15px 12px; }
  .question-copy { align-items: flex-start; }
  .answer-form { flex-direction: column; }
  .answer-form button { min-height: 48px; }
  .word-picture { font-size: 4.3rem; }
  .guardian-sprite.guardian-fallback { font-size: 4.5rem; }
  .translation-prompt { padding: 14px 16px; font-size: clamp(1.7rem, 9vw, 3rem); }
  .translation-prompt.long { font-size: clamp(1.42rem, 7.5vw, 2.35rem); }
  .translation-prompt.very-long { font-size: clamp(1.15rem, 6vw, 1.85rem); }
  .final-score { grid-template-columns: repeat(2,1fr); }
  .start-options-grid { grid-template-columns: 1fr; gap: 0; }
  .group-key-choices { grid-template-columns: 1fr; gap: 10px; }
  .group-key-choices button { min-height: 92px; }
  .world-grid { gap: 9px; }
  .world-card { min-height: 108px; padding: 12px 8px; }
  .range-grid, .assessment-grid { grid-template-columns: 1fr; gap: 9px; }
  .range-card, .assessment-card { min-height: 88px; grid-template-columns: 46px 1fr; text-align: left; }
  .range-card > span, .assessment-card > span { grid-row: 1 / span 2; font-size: 1.8rem; }
  .identity-grid { grid-template-columns: 1fr; gap: 10px; }
  .activity-path { padding-inline: 8px; }
  .pathway-node { flex-basis: min(260px,78vw); width: min(260px,78vw); }
  .setup-choice-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
  .difficulty-choice-grid.spelling-difficulties { grid-template-columns: 1fr; }
  .setup-choice-grid button { min-height: 86px; grid-template-columns: 54px 1fr; align-content: center; text-align: left; }
  .setup-choice-grid b { grid-row: 1; }
  .result-actions { grid-template-columns: 1fr; }
  .student-overview { grid-template-columns: repeat(2,1fr); }
  .student-game-list { grid-template-columns: 1fr; }
  .character-picker { grid-template-columns: repeat(2, 1fr); }
  .weapon-picker { grid-template-columns: 1fr; }
  .weapon-picker label > span { min-height: 58px; grid-template-columns: auto 1fr; gap: 8px; text-align: left; }
  .weapon-picker b { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Version 39: the learning console now lives inside the adventure view. */
body.game-running .app-shell {
  margin: 8px auto 12px;
}

body.game-running .app-shell::before {
  inset: -9px;
  border-radius: 34px;
}

body.game-running .game-header {
  margin-bottom: 6px;
}

body.game-running .brand-lockup {
  width: min(100%, 330px);
}

body.game-running .game-header .game-title-image {
  width: min(100%, 280px);
  margin-top: 0;
}

body.game-running .game-header .game-title::before {
  filter: blur(11px) saturate(1.4);
}

body.game-running .game-header .game-title::after {
  filter: blur(5px);
}

body.game-running .game-header .class-signature {
  gap: .45em;
  margin-top: -2px;
  padding: 3px 8px;
  font-size: .54rem;
}

body.game-running .journey,
body.game-running .journey.battle-active {
  height: clamp(520px, calc(100vh - 175px), 680px);
}

body.game-running .path {
  z-index: 6;
  right: 6%;
  bottom: 43%;
  left: 6%;
  height: 24px;
}

body.game-running .traveler {
  bottom: calc(43% + 10px);
}

body.game-running .treasure-landmark {
  bottom: calc(43% - 4px);
}

body.game-running .journey:not(.battle-active) .path::before,
body.game-running .journey:not(.battle-active) .path::after {
  position: absolute;
  top: 50%;
  content: "";
  pointer-events: none;
  transform: translateY(-50%);
}

body.game-running .journey:not(.battle-active) .path::before {
  right: 0;
  left: 0;
  height: 7px;
  opacity: .82;
  background: linear-gradient(90deg, rgba(88,236,255,.22), rgba(255,220,84,.9) 12%, rgba(243,91,88,.88) 48%, rgba(255,220,84,.92) 82%, rgba(137,102,255,.28));
  border: 1px solid rgba(225,249,255,.78);
  border-radius: 999px;
  box-shadow: 0 0 7px rgba(105,226,255,.9), 0 0 18px rgba(255,194,70,.62), 0 0 30px rgba(163,89,255,.38);
}

body.game-running .journey:not(.battle-active) .path::after {
  left: 0;
  width: 24%;
  height: 13px;
  opacity: .88;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), rgba(115,235,255,.8), transparent);
  border-radius: 999px;
  filter: blur(2px);
  animation: route-energy-flow 3.2s linear infinite;
}

body.game-running .journey:not(.battle-active) .path-dot {
  width: 18px;
  height: 18px;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(31,20,67,.45), 0 0 13px rgba(255,220,84,1), 0 0 24px rgba(255,220,84,.62);
}

body.game-running .journey:not(.battle-active) .path-dot:nth-child(even) {
  box-shadow: 0 0 0 3px rgba(31,20,67,.45), 0 0 13px rgba(243,91,88,1), 0 0 24px rgba(243,91,88,.66);
}

body.game-running .journey:not(.battle-active) .traveler {
  width: 90px;
  height: 100px;
  filter: drop-shadow(0 0 9px rgba(92,231,255,.9)) drop-shadow(0 10px 7px rgba(5,8,28,.72));
}

body.game-running .journey:not(.battle-active) .traveler::before {
  position: absolute;
  z-index: 0;
  inset: -27px -31px -18px;
  content: "";
  pointer-events: none;
  opacity: .78;
  background: radial-gradient(ellipse, rgba(255,246,166,.42) 0 15%, rgba(78,224,255,.28) 32%, rgba(139,81,255,.13) 52%, transparent 72%);
  filter: blur(4px);
  animation: traveler-aura-pulse 1.5s ease-in-out infinite alternate;
}

body.game-running .journey:not(.battle-active) .player-sprite.image-sprite {
  top: -28px;
  left: -19px;
}

body.game-running .journey:not(.battle-active) .player-sprite.image-sprite img {
  width: 128px;
  height: 128px;
}

body.game-running .journey:not(.battle-active) .robot-shadow {
  right: 12px;
  left: 12px;
  height: 9px;
  background: rgba(20,13,55,.48);
  box-shadow: 0 0 12px rgba(84,224,255,.45);
}

body.game-running .step-label {
  top: 10px;
  right: 12px;
  bottom: auto;
}

body.game-running .journey.battle-active .enemy {
  bottom: 35%;
}

body.game-running .journey.battle-active .traveler {
  bottom: calc(35% + 55px);
}

body.game-running .guardian-attack,
body.game-running .player-attack {
  bottom: calc(35% - 4px);
}

.gameplay-hud {
  position: absolute;
  z-index: 30;
  right: 12px;
  bottom: 10px;
  left: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 178px;
  grid-template-rows: auto auto;
  gap: 6px 10px;
  pointer-events: none;
}

.gameplay-hud > * {
  pointer-events: auto;
}

.gameplay-hud .question-panel {
  grid-row: 1;
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(205px, 28%) minmax(0, 1fr);
  grid-template-areas: "prompt response";
  gap: 12px;
  min-height: 190px;
  max-width: none;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(6,15,39,.76), rgba(31,14,60,.68));
  border: 2px solid rgba(154,232,255,.72);
  border-radius: 20px;
  box-shadow: 0 12px 34px rgba(0,0,0,.46), inset 0 0 26px rgba(107,211,255,.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.25);
  backdrop-filter: blur(12px) saturate(1.25);
}

.gameplay-hud .prompt-card {
  grid-area: prompt;
  width: 100%;
  height: 170px;
  min-width: 0;
  margin: 0;
  background: radial-gradient(circle at 50% 38%, rgba(61,104,156,.62), rgba(7,13,33,.76) 72%);
  border: 2px solid rgba(173,226,255,.48);
  border-radius: 15px;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.05), 0 0 18px rgba(76,199,255,.1);
}

body[data-theme="dark"][data-world-color] .gameplay-hud .question-panel {
  background: linear-gradient(135deg, rgba(var(--world-rgb),.18), rgba(5,11,29,.78) 54%, rgba(23,10,47,.72));
  border-color: rgba(var(--world-rgb),.78);
  box-shadow: 0 12px 36px rgba(0,0,0,.48), 0 0 24px rgba(var(--world-rgb),.18), inset 0 0 28px rgba(var(--world-rgb),.08);
}

body[data-theme="dark"][data-world-color] .gameplay-hud .prompt-card,
body[data-theme="dark"][data-world-color] .gameplay-hud .prompt-card.boss-mode {
  background: radial-gradient(circle at 50% 38%, rgba(var(--world-rgb),.4), rgba(7,12,30,.78) 72%);
  border-color: rgba(var(--world-rgb),.64);
  box-shadow: inset 0 0 0 4px rgba(var(--world-rgb),.08), 0 0 18px rgba(var(--world-rgb),.16);
}

.response-console {
  grid-area: response;
  display: grid;
  align-content: center;
  min-width: 0;
}

.gameplay-hud .question-copy {
  justify-content: flex-start;
  min-width: 0;
  margin-bottom: 5px;
}

.gameplay-hud .question-copy p {
  overflow: hidden;
  color: #eef5ff;
  font-size: clamp(.8rem, 1.25vw, .96rem);
  line-height: 1.25;
  text-overflow: ellipsis;
}

.gameplay-hud .answer-form {
  width: 100%;
  margin: 0;
}

.gameplay-hud .answer-form input {
  min-height: 54px;
  padding: 9px 14px;
  font-size: clamp(1.35rem, 2.25vw, 1.85rem);
  background: rgba(247,249,255,.94);
  box-shadow: inset 0 0 12px rgba(40,54,94,.08);
}

.gameplay-hud .answer-form button {
  min-width: 94px;
  padding-inline: 14px;
}

.response-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 6px;
}

.gameplay-hud .question-utilities {
  justify-content: flex-end;
  width: auto;
  margin: 0 0 0 auto;
}

.gameplay-hud .question-utilities .icon-button,
.gameplay-hud .spelling-replay-button {
  min-height: 32px;
  margin: 0;
  padding: 5px 9px;
  font-size: .66rem;
  background: rgba(23,35,72,.76);
  border-color: rgba(145,222,255,.42);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.gameplay-hud .feedback {
  min-height: 20px;
  margin: 5px 0 0;
  font-size: clamp(.8rem, 1.3vw, .96rem);
  line-height: 1.2;
}

.gameplay-hud .training-hint {
  max-width: none;
  margin: 5px 0 0;
  padding: 5px 9px;
  font-size: .82rem;
}

.gameplay-hud .number-prompt {
  font-size: clamp(3.8rem, 7vw, 6.1rem);
}

.gameplay-hud .prompt-card.number-size-large .number-prompt {
  font-size: clamp(2.35rem, 5vw, 3.75rem);
}

.gameplay-hud .prompt-card.number-size-huge .number-prompt {
  font-size: clamp(1.95rem, 4.3vw, 3.15rem);
}

.gameplay-hud .prompt-card.number-word-mode .number-prompt {
  font-size: clamp(1.3rem, 3.2vw, 2.45rem);
}

.gameplay-hud .word-picture {
  font-size: 4.25rem;
}

.gameplay-hud .word-picture img {
  width: 138px;
  height: 92px;
}

.gameplay-hud .word-picture.spelling-speaker {
  width: 82px;
  height: 82px;
  font-size: 3rem;
}

.gameplay-hud .translation-prompt {
  max-width: 94%;
  padding: 10px 13px;
  font-size: clamp(1.35rem, 2.55vw, 2.4rem);
  border-width: 3px;
}

.gameplay-hud .translation-prompt.long {
  font-size: clamp(1.2rem, 2.2vw, 2rem);
}

.gameplay-hud .translation-prompt.very-long {
  font-size: clamp(1.02rem, 1.9vw, 1.65rem);
}

.gameplay-hud .conjugation-prompt {
  min-width: 0;
  width: 94%;
  padding: 9px 10px;
  font-size: clamp(1.15rem, 2.4vw, 2.3rem);
}

.gameplay-hud .conjugation-verb {
  white-space: nowrap;
}

.gameplay-hud .score-strip,
.gameplay-hud .score-strip.untimed {
  grid-row: 1;
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  max-width: none;
  margin: 0;
}

.gameplay-hud .player-card {
  grid-column: 1 / -1;
  min-height: 50px;
}

.gameplay-hud .score-item {
  min-height: 48px;
  padding: 5px 7px;
}

.gameplay-hud .score-item.timer {
  grid-column: 1 / -1;
}

.gameplay-hud .player-card,
.gameplay-hud .score-item,
body[data-theme="dark"] .gameplay-hud .player-card,
body[data-theme="dark"] .gameplay-hud .score-item {
  background: linear-gradient(145deg, rgba(13,27,57,.76), rgba(41,20,72,.68));
  border: 1px solid rgba(145,222,255,.52);
  border-radius: 12px;
  box-shadow: 0 7px 19px rgba(0,0,0,.3), inset 0 0 14px rgba(120,213,255,.06);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
}

body[data-theme="dark"][data-world-color] .gameplay-hud .player-card,
body[data-theme="dark"][data-world-color] .gameplay-hud .score-item {
  background: linear-gradient(145deg, rgba(var(--world-rgb),.2), rgba(6,12,30,.76));
  border-color: rgba(var(--world-rgb),.62);
}

.gameplay-hud .player-card > span,
.gameplay-hud .score-item small {
  font-size: .58rem;
}

.gameplay-hud .player-name-button {
  font-size: .88rem;
}

.gameplay-hud .score-item > span {
  font-size: 1.03rem;
}

.gameplay-hud .game-footer {
  grid-row: 2;
  grid-column: 1 / -1;
  gap: 5px 14px;
  margin: 0;
  padding: 3px 10px;
  color: rgba(235,245,255,.88);
  font-size: .61rem;
  background: rgba(5,12,31,.54);
  border: 1px solid rgba(145,222,255,.28);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

@keyframes route-energy-flow {
  from { left: -24%; opacity: .25; }
  18%, 82% { opacity: .92; }
  to { left: 100%; opacity: .25; }
}

@keyframes traveler-aura-pulse {
  from { opacity: .55; transform: scale(.9); }
  to { opacity: .9; transform: scale(1.08); }
}

@media (max-width: 900px) {
  body.game-running .journey,
  body.game-running .journey.battle-active {
    height: clamp(640px, calc(100vh - 160px), 760px);
  }

  body.game-running .path { bottom: 51%; }
  body.game-running .traveler { bottom: calc(51% + 10px); }
  body.game-running .treasure-landmark { bottom: calc(51% - 4px); }
  body.game-running .journey.battle-active .enemy { bottom: 44%; }
  body.game-running .journey.battle-active .traveler { bottom: calc(44% + 44px); }
  body.game-running .guardian-attack,
  body.game-running .player-attack { bottom: calc(44% - 8px); }

  .gameplay-hud {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: 1fr;
  }

  .gameplay-hud .question-panel {
    grid-row: 1;
    grid-column: 1;
    grid-template-columns: minmax(185px, 31%) minmax(0, 1fr);
    min-height: 180px;
  }

  .gameplay-hud .prompt-card {
    height: 160px;
  }

  .gameplay-hud .score-strip,
  .gameplay-hud .score-strip.untimed {
    grid-row: 2;
    grid-column: 1;
    grid-template-columns: minmax(145px, 1.5fr) repeat(3, minmax(78px, 1fr));
  }

  .gameplay-hud .player-card,
  .gameplay-hud .score-item.timer {
    grid-column: auto;
  }

  .gameplay-hud .player-card,
  .gameplay-hud .score-item {
    min-height: 48px;
  }

  .gameplay-hud .game-footer {
    grid-row: 3;
  }
}

@media (max-width: 600px) {
  body.game-running .brand-lockup { width: min(100%, 270px); }
  body.game-running .game-header .game-title-image { width: min(100%, 225px); }
  body.game-running .game-header .class-signature { font-size: .47rem; }

  body.game-running .journey,
  body.game-running .journey.battle-active {
    height: 830px;
  }

  body.game-running .path { bottom: 66%; }
  body.game-running .traveler { bottom: calc(66% + 9px); }
  body.game-running .treasure-landmark { bottom: calc(66% - 3px); }
  body.game-running .journey.battle-active .enemy { bottom: 61%; }
  body.game-running .journey.battle-active .traveler { bottom: calc(61% + 30px); }
  body.game-running .guardian-attack,
  body.game-running .player-attack { bottom: calc(61% - 5px); }

  .gameplay-hud .question-panel {
    grid-template-columns: 1fr;
    grid-template-areas: "prompt" "response";
    gap: 8px;
  }

  .gameplay-hud .prompt-card {
    height: 135px;
  }

  .gameplay-hud .answer-form {
    flex-direction: row;
  }

  .gameplay-hud .answer-form button {
    min-width: 78px;
    min-height: 54px;
    padding-inline: 9px;
  }

  .response-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .gameplay-hud .question-utilities {
    justify-content: stretch;
    width: 100%;
    margin: 0;
  }

  .gameplay-hud .question-utilities .icon-button {
    flex: 1 1 0;
  }

  .gameplay-hud .score-strip,
  .gameplay-hud .score-strip.untimed {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gameplay-hud .player-card,
  .gameplay-hud .score-item.timer {
    grid-column: 1 / -1;
  }

  .gameplay-hud .game-footer {
    border-radius: 14px;
  }
}

@media (min-width: 901px) and (max-height: 680px) {
  body.game-running .app-shell { margin-top: 5px; }
  body.game-running .game-header .game-title-image { width: 230px; }
  body.game-running .game-header .class-signature { display: none; }
  body.game-running .journey,
  body.game-running .journey.battle-active { height: max(480px, calc(100vh - 115px)); }
}

/* Version 41: foreground platforms and character-anchored battle magic. */
body.game-running .journey.battle-active {
  background-position: center center, center bottom;
  background-size: 100% 100%, auto 126%;
  background-repeat: no-repeat, no-repeat;
}

body.game-running .journey.battle-active .enemy {
  bottom: 40%;
}

body.game-running .journey.battle-active .traveler {
  bottom: calc(47% + 55px);
}

body.game-running .journey.battle-active .guardian-attack {
  --guardian-origin-x: 74%;
  --guardian-target-x: 22%;
  left: var(--guardian-origin-x);
  bottom: 70%;
}

body.game-running .journey.battle-active .guardian-attack.attack-fire {
  --guardian-origin-x: 73%;
  bottom: 70%;
}

body.game-running .journey.battle-active .guardian-attack.attack-wind {
  --guardian-origin-x: 80%;
  bottom: 61%;
}

body.game-running .journey.battle-active .guardian-attack.attack-spectral {
  --guardian-origin-x: 75%;
  bottom: 61%;
}

body.game-running .journey.battle-active .guardian-attack.attack-arcane {
  --guardian-origin-x: 74%;
  bottom: 71%;
}

body.game-running .journey.battle-active .player-attack {
  --player-origin-x: 22%;
  --player-target-x: 80%;
  left: var(--player-origin-x);
  bottom: 70%;
}

@media (max-width: 900px) {
  body.game-running .journey.battle-active .enemy { bottom: 41%; }
  body.game-running .journey.battle-active .traveler { bottom: calc(47% + 37px); }
  body.game-running .journey.battle-active .player-attack { bottom: 60%; }
  body.game-running .journey.battle-active .guardian-attack.attack-fire { bottom: 61%; }
  body.game-running .journey.battle-active .guardian-attack.attack-wind,
  body.game-running .journey.battle-active .guardian-attack.attack-spectral { bottom: 57.5%; }
  body.game-running .journey.battle-active .guardian-attack.attack-arcane { bottom: 65%; }
}

@media (max-width: 600px) {
  body.game-running .journey.battle-active .enemy { bottom: 43%; }
  body.game-running .journey.battle-active .traveler { bottom: calc(47% + 25px); }
  body.game-running .journey.battle-active .player-attack { bottom: 56%; }
  body.game-running .journey.battle-active .guardian-attack.attack-fire { bottom: 54%; }
  body.game-running .journey.battle-active .guardian-attack.attack-wind,
  body.game-running .journey.battle-active .guardian-attack.attack-spectral { bottom: 52%; }
  body.game-running .journey.battle-active .guardian-attack.attack-arcane { bottom: 57%; }
}

@media (min-width: 901px) and (max-height: 680px) {
  body.game-running .journey.battle-active {
    background-size: 100% 100%, cover;
  }
  body.game-running .journey.battle-active .enemy { bottom: 44%; }
  body.game-running .journey.battle-active .traveler { bottom: calc(52% + 55px); }
  body.game-running .journey.battle-active .player-attack { bottom: 72%; }
  body.game-running .journey.battle-active .guardian-attack.attack-fire { bottom: 72%; }
  body.game-running .journey.battle-active .guardian-attack.attack-wind,
  body.game-running .journey.battle-active .guardian-attack.attack-spectral { bottom: 63%; }
  body.game-running .journey.battle-active .guardian-attack.attack-arcane { bottom: 75%; }
}

/* Readable utility controls on every world and battle background. */
body[data-theme="dark"] .gameplay-hud .question-utilities .icon-button {
  background: #203354; color: #fff; border: 2px solid #9cdafa;
  font-size: 14px; font-weight: 700; opacity: 1;
}
body[data-theme="dark"] .gameplay-hud .question-utilities .icon-button:hover,
body[data-theme="dark"] .gameplay-hud .question-utilities .icon-button:focus-visible {
  background: #34537c; color: #fff; outline: 2px solid #fff; outline-offset: 2px;
}
.about-button { margin-top: 12px; }
.about-button kbd { margin-left: 10px; }
.about-dialog { width: min(560px, 90vw); padding: 30px; color: #f7faff; background: #111c3b; border: 2px solid #93e7ff; border-radius: 20px; box-shadow: 0 0 45px #8653dd80; }
.about-dialog::backdrop { background: #05091ccc; }
.about-dialog p { font: 18px/1.6 Arial, sans-serif; }
.about-dialog h2 { font-size: 26px; color: #a9edff; }
.about-dialog form { margin-top: 20px; }
.about-dialog button:disabled { opacity: .75; }
.welcome-footer { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 16px; color: #c9daf5; font: 14px/1.4 system-ui, sans-serif; }
.welcome-footer .text-button { margin: 0; padding: 8px; color: #c9daf5; font-size: 14px; }
.privacy-dialog { width: min(660px, 94vw); max-height: 86dvh; overflow-y: auto; padding: 22px; }
.privacy-dialog p, .privacy-dialog li { font: 16px/1.5 system-ui, sans-serif; }
.privacy-dialog ul { padding-left: 22px; }
.privacy-dialog li + li { margin-top: 10px; }
.privacy-dialog .privacy-small { font-size: 14px; color: #cfddf0; }
.privacy-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.privacy-actions button { min-height: 44px; }
.privacy-actions .text-button { color: #c9daf5; }
.privacy-details summary { padding: 12px 0; color: #bcefff; font: 600 16px/1.4 system-ui, sans-serif; cursor: pointer; }
.points-card { grid-column: 1 / -1; padding: 5px 10px; border: 1px solid #98defb; border-radius: 10px; background: #101c37e8; color: #fff0a0; text-align: center; font: 700 14px/1.3 system-ui, sans-serif; }
.result-points { color: #fff0a0; font-size: 20px; font-weight: 700; }
.points-milestone { color: #dceaff; font-size: 14px; }
.result-actions { flex-wrap: wrap; gap: 8px; }

.touch-keyboard[hidden] { display: none; }
.touch-keyboard {
  grid-column: 1 / -1; grid-row: 4; display: grid; gap: 5px;
  padding: 6px 3px; border-radius: 12px; background: rgba(7, 15, 35, .94);
  border: 1px solid #79b7dc; pointer-events: auto; touch-action: manipulation;
}
.touch-key-row { display: flex; justify-content: center; gap: 4px; }
.touch-keyboard button {
  flex: 1 1 0; min-width: 0; max-width: 80px; height: 44px; min-height: 44px;
  padding: 0; border: 1px solid #7291ba; border-radius: 6px;
  background: #263959; color: #fff; font: 600 18px/1 system-ui, sans-serif;
  box-shadow: 0 2px 0 #080f21; user-select: none; -webkit-user-select: none;
}
.touch-keyboard button:active { background: #536cad; transform: translateY(1px); }
.touch-keyboard button:focus-visible { outline: 2px solid #a1f0ff; outline-offset: 1px; }
.touch-keyboard button:disabled { opacity: .45; }
.touch-key-actions button { max-width: none; font-size: 14px; }
.touch-keyboard [data-key=" "] { flex-grow: 3; }
.touch-keyboard [data-key="enter"] { flex-grow: 2; background: #254d64; }
body.touch-answer-active .gameplay-hud .answer-form button { display: none; }
body.touch-answer-active .gameplay-hud .score-strip { grid-row: 2; }
@media (max-width: 950px) and (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  body.touch-answer-active .gameplay-hud { grid-template-columns: 1fr 1fr; align-items: end; }
  body.touch-answer-active .gameplay-hud .question-panel { grid-column: 1; grid-row: 1; }
  body.touch-answer-active .touch-keyboard { grid-column: 2; grid-row: 1 / 3; }
  body.touch-answer-active .gameplay-hud .score-strip { grid-column: 1; }
}

/* Mobile play: one visible stage, a compact console, and room for the keyboard. */
@media (max-width: 600px), (max-width: 950px) and (pointer: coarse) {
  body.game-running { overflow: hidden; }
  body.game-running .app-shell {
    position: fixed; top: var(--play-top, 0px); left: 0; right: 0;
    width: 100%; max-width: none; height: var(--play-height, 100dvh);
    margin: 0; padding: 4px; box-sizing: border-box;
  }
  body.game-running .game-header { display: none; }
  body.game-running .journey,
  body.game-running .journey.battle-active {
    height: 100%; min-height: 0; margin: 0; border-radius: 16px;
    --stage-floor: calc(var(--mobile-hud-height, 220px) + 20px);
  }
  body.game-running .stage-name { display: none; }
  body.game-running .step-label { top: 5px; right: 6px; padding: 4px 8px; font-size: 12px; }
  body.game-running .path { bottom: var(--stage-floor); left: 10%; right: 10%; }
  body.game-running .journey:not(.battle-active) .path-dot { width: 9px; height: 9px; border-width: 1px; }
  body.game-running .journey:not(.battle-active) .traveler {
    bottom: calc(var(--stage-floor) + 9px); width: 60px; height: 65px;
  }
  body.game-running .journey:not(.battle-active) .player-sprite.image-sprite { top: -12px; left: -9px; }
  body.game-running .journey:not(.battle-active) .player-sprite.image-sprite img { width: 80px; height: 80px; }
  body.game-running .treasure-landmark { bottom: var(--stage-floor); width: 70px; height: 90px; }
  .gameplay-hud { left: 5px; right: 5px; bottom: max(5px, env(safe-area-inset-bottom)); gap: 4px; }
  .gameplay-hud .question-panel { min-height: 0; padding: 7px; gap: 5px; border-radius: 14px; }
  .gameplay-hud .prompt-card { height: 62px; min-height: 0; border-radius: 9px; }
  .gameplay-hud .prompt-card.letter-dash-mode,
  .gameplay-hud .prompt-card.spelling-mode { display: none; }
  .gameplay-hud .word-picture { font-size: 24px; }
  .gameplay-hud .word-picture img { width: 45px; height: 45px; }
  .gameplay-hud .word-prompt { flex-direction: row; gap: 6px; padding: 3px; }
  .gameplay-hud .picture-hint { font-size: 16px; padding: 2px; }
  .gameplay-hud .number-prompt { font-size: 30px; }
  .gameplay-hud .prompt-card.number-size-large .number-prompt,
  .gameplay-hud .prompt-card.number-size-huge .number-prompt { font-size: 24px; }
  .gameplay-hud .prompt-card.number-word-mode .number-prompt { font-size: 16px; }
  .gameplay-hud .question-badge { display: none; }
  .gameplay-hud .question-copy { margin-bottom: 4px; }
  .gameplay-hud .question-copy p { margin: 0; font-size: 14px; line-height: 1.15; }
  .gameplay-hud .question-panel:has(.letter-dash-mode) .question-copy { display: none; }
  .gameplay-hud .answer-form { gap: 5px; }
  .gameplay-hud .answer-form input { min-width: 0; min-height: 44px; height: 44px; padding: 6px 9px; font-size: 20px; }
  .gameplay-hud .answer-form button { min-width: 65px; min-height: 44px; padding: 6px; font-size: 14px; }
  .gameplay-hud .response-tools { flex-direction: row; gap: 5px; margin-top: 4px; }
  .gameplay-hud .question-utilities { flex: 1; width: auto; gap: 5px; }
  .gameplay-hud .question-utilities .icon-button,
  .gameplay-hud .spelling-replay-button { min-height: 44px; padding: 5px 7px; font-size: 14px; letter-spacing: 0; }
  .gameplay-hud .spelling-replay-button kbd { display: none; }
  .gameplay-hud .feedback { min-height: 0; margin: 3px 0 0; font-size: 14px; }
  .gameplay-hud .feedback:empty { display: none; }
  .gameplay-hud .training-hint { font-size: 14px; margin: 3px 0 0; padding: 3px; }
  .gameplay-hud .score-strip,
  .gameplay-hud .score-strip.untimed { display: flex; justify-content: flex-end; gap: 5px; }
  .gameplay-hud .player-card, .gameplay-hud .score-item:not(.timer),
  .gameplay-hud .game-footer { display: none; }
  .gameplay-hud .score-item.timer { min-height: 24px; padding: 2px 9px; display: flex; align-items: center; gap: 8px; }
  .gameplay-hud .score-item.timer small { font-size: 12px; }
  body.game-running .journey.battle-active .traveler { bottom: calc(var(--stage-floor) + 10px); transform: translateX(-50%) scale(.85); }
  body.game-running .journey.battle-active .enemy { bottom: var(--stage-floor); width: 120px; }
  body.game-running .journey.battle-active .guardian-sprite { width: 120px; height: 105px; }
  body.game-running .enemy-label { display: none; }
  body.game-running .journey.battle-active .guardian-attack,
  body.game-running .journey.battle-active .player-attack { bottom: calc(var(--stage-floor) + 48px); }
  body.game-running .health-display,
  body.game-running .journey.battle-active .health-display { top: 5px; padding: 4px; font-size: 12px; }
  body.game-running .guardian-countdown { top: 5px; padding: 4px; }
  body.game-running .guardian-countdown > div:first-child { font-size: 10px; gap: 2px; margin-bottom: 2px; }
}

/* 5.7: reserve a real scene above the entire touch console and safe area. */
@media (max-width: 600px), (max-width: 950px) and (pointer: coarse) {
  body.game-running .app-shell { overflow-y: auto; overscroll-behavior: contain; }
  body.game-running .journey,
  body.game-running .journey.battle-active {
    --hud-bottom: max(6px, env(safe-area-inset-bottom));
    --stage-floor: calc(var(--mobile-hud-height, 220px) + var(--hud-bottom) + 28px);
    height: max(100%, calc(var(--mobile-hud-height, 220px) + var(--hud-bottom) + 215px));
    min-height: calc(var(--mobile-hud-height, 220px) + var(--hud-bottom) + 215px);
  }
  body.game-running .gameplay-hud { bottom: var(--hud-bottom); }
  body.game-running .journey:not(.battle-active) .path {
    display: block; opacity: 1; z-index: 12; left: 7%; right: 7%; height: 24px;
    bottom: var(--stage-floor);
  }
  body.game-running .journey:not(.battle-active) .path::before {
    height: 8px; opacity: 1; background: #9bedff; border: 2px solid #ecfbff;
    box-shadow: 0 0 0 3px #102345, 0 0 14px #7be6ff;
  }
  body.game-running .journey:not(.battle-active) .path-dot { width: 11px; height: 11px; border-width: 2px; }
  body.game-running .journey:not(.battle-active) .traveler { z-index: 13; bottom: calc(var(--stage-floor) + 10px); }
  body[data-theme="dark"][data-world-color] .journey.battle-active {
    /* Show both platforms contained in the artwork instead of cropping the sides. */
    background-size: 100% calc(100% - var(--stage-floor) + 20px);
    background-position: center top; background-repeat: no-repeat;
    background-color: #10162f;
  }
  .gameplay-hud .points-card { margin-right: auto; padding: 3px 7px; align-self: center; font-size: 13px; }
  .gameplay-hud .score-strip { align-items: center; }
}
