@font-face {
  font-family: Cinzel;
  src: url('assets/fonts/cinzel-latin.woff2') format('woff2');
  font-weight: 500 700;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('assets/fonts/dm-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Dungeon Emoji';
  src: url('assets/fonts/dungeon-emoji.woff2') format('woff2');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #101315;
  --surface: #181c1e;
  --surface-high: #202528;
  --line: #303637;
  --ink: #f5f0e6;
  --muted: #b4b6b3;
  --gold: #edc47e;
  --display: 'Cinzel', Georgia, serif;
  --body: 'DM Sans', 'Dungeon Emoji', system-ui, sans-serif;
  --width: 1120px;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(ellipse at 42% 0%, #1b2120 0, transparent 62%), var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid #f9d494; outline-offset: 4px; }
:focus:not(:focus-visible) { outline: none; }
h1, h2, p { margin: 0; }
.icon { inline-size: 1.18em; block-size: 1.18em; display: inline-block; flex: 0 0 auto; }
.shell { width: min(var(--width), calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid #2b3030; background: #121617; }
.header-inner { width: min(var(--width), calc(100% - 64px)); min-height: 70px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 12px; padding: 0; text-align: left; font: 700 1.16rem var(--display); letter-spacing: .015em; min-height: 44px; }
.brand strong { color: var(--gold); font-weight: inherit; }
.brand-mark, .bank-icon { display: grid; place-items: center; border: 1px solid #554528; background: #2c251b; color: var(--gold); border-radius: 10px; inline-size: 39px; block-size: 39px; flex: 0 0 auto; }
.brand-mark svg { width: 25px; height: 25px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
#audio-button { width: 44px; padding: 0; flex: 0 0 auto; }
.header-actions .wallet { border-left: 1px solid var(--line); margin-left: 2px; padding-left: 8px; }
.wallet { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); white-space: nowrap; font-weight: 700; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-high); padding: 9px 15px; font-weight: 700; line-height: 1.2; text-align: center; }
.button:hover:not(:disabled) { border-color: #777367; background: #292e2e; }
.button:disabled { color: var(--muted); background: #191b1c; }
.button-quiet { background: transparent; }
.button-quiet .icon { color: var(--gold); }
.button-primary { background: var(--gold); color: #24190c; border-color: #f1d09b; padding-inline: 19px; box-shadow: 0 3px 14px #070a0960; }
.button-primary:hover:not(:disabled) { background: #f8d7a0; border-color: #ffe5b7; }
.button-small { font-size: .875rem; }
.text-button { background: transparent; border: none; padding: 6px 0; color: var(--gold); display: inline-flex; gap: 7px; align-items: center; min-height: 44px; font-weight: 700; }
.text-button:hover { color: #ffe0a9; }
#app { padding-block: 33px 26px; }
.page-heading, .battle-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 23px; }
h1 { font: 700 clamp(1.65rem, 4vw, 2.35rem)/1.18 var(--display); letter-spacing: -.015em; }
.page-heading p { color: var(--muted); margin-top: 8px; line-height: 1.4; }
.bank-button { text-align: left; justify-content: flex-start; min-width: 225px; padding: 7px 11px; gap: 11px; }
.bank-button span:nth-child(2) { flex: 1; }
.bank-button small, .bank-button strong { display: block; }
.bank-button small { font-size: .76rem; line-height: 1.2; margin-bottom: 4px; color: var(--muted); font-weight: 500; }
.bank-button strong { font-size: .9rem; }
.bank-button > .icon { color: var(--muted); }
.bank-icon { inline-size: 34px; block-size: 34px; border: 0; border-radius: 7px; }
.theme-mosswood { --theme: #95dbaf; --shade: #203a2d; --art: url('assets/mosswood.webp'); }
.theme-ember { --theme: #ffad83; --shade: #43291e; --art: url('assets/ember.webp'); }
.theme-frost { --theme: #a2d5ff; --shade: #25384c; --art: url('assets/frost.webp'); }
.theme-stormspire { --theme: #d7c5ff; --shade: #33284c; --art: url('assets/stormspire.webp'); }
.theme-astral { --theme: #ffe19d; --shade: #272944; --art: url('assets/astral.webp'); }
.dungeon-hero { min-height: 338px; border: 1px solid #43574c; border-radius: 17px; overflow: hidden; position: relative; display: flex; align-items: center; background-color: var(--shade); background-image: linear-gradient(90deg, #121817f6 0%, #121817ec 23%, #12181787 47%, #12181700 77%), linear-gradient(0deg,#10151488,transparent 50%), var(--art); background-size: cover; background-position: center; }
.hero-content { flex: 1; min-width: 0; padding: 31px 39px; }
.map-rescue {
  flex: 0 0 clamp(94px, 16vw, 174px); display: grid; justify-items: center; align-content: center; gap: 5px;
  margin: 12px clamp(10px, 3.5vw, 38px) 12px 0; padding: 9px 7px 11px; text-align: center;
  border: 1px solid color-mix(in srgb, var(--theme) 63%, #1d2621); border-radius: 16px;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--shade) 90%, var(--theme)), #151918 86%);
  box-shadow: 0 4px 22px #0c121080; color: var(--theme); font-size: .88rem; line-height: 1.2;
}
.map-rescue img { width: 100%; height: clamp(70px, 13vw, 132px); object-fit: contain; }
.map-rescue[data-rescued="false"] img {
  filter: brightness(0) saturate(100%) drop-shadow(1px 0 0 #b6c7c3) drop-shadow(-1px 0 0 #b6c7c3) drop-shadow(0 0 9px #d5f6e285);
}
.difficulty { color: var(--theme, var(--gold)); background: #151b19cf; border: 1px solid color-mix(in srgb, var(--theme, var(--gold)) 45%, transparent); border-radius: 20px; min-height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: .81rem; font-weight: 700; }
.hero-content h2 { margin-top: 14px; font: 700 clamp(1.9rem, 5.5vw, 3.2rem)/1.07 var(--display); letter-spacing: -.025em; text-wrap: balance; text-shadow: 0 2px 12px #0008; }
.hero-content p { color: #e1e3da; margin-top: 10px; max-width: 340px; line-height: 1.5; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 15px; margin: 16px 0 23px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; color: #e9e6da; font-size: .9rem; }
.hero-meta .icon { color: var(--gold); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 11px; }
.section-heading h2 { font: 700 1.13rem/1.3 var(--display); }
.dungeon-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.dungeon-card { min-width: 0; text-align: left; position: relative; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color 150ms, background-color 150ms; }
.dungeon-card { display: grid; align-content: start; }
.dungeon-card:hover { border-color: var(--theme); background: var(--surface-high); }
.dungeon-card.is-selected { border-color: var(--gold); box-shadow: 0 0 0 1px #edc47e30; }
.card-art { display: block; height: 87px; background: linear-gradient(0deg,#13181980,transparent), var(--art) var(--shade) 68% center / cover; }
.card-body { display: grid; gap: 6px; padding: 12px 14px 13px; }
.card-title { font-weight: 700; line-height: 1.25; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--theme); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; }
.map-state { position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid #d9c58c68; border-radius: 5px; background: #161818e8; color: #f3ddad; font-size: .73rem; font-weight: 700; }
.dot { inline-size: 4px; block-size: 4px; border-radius: 50%; background: #747975; }
.selected-mark { position: absolute; right: 9px; top: 9px; display: grid; place-items: center; height: 26px; width: 26px; background: var(--gold); color: #21190d; border-radius: 50%; }
.resume-bar { display: flex; align-items: center; gap: 10px; background: #222822; border: 1px solid #454734; border-radius: 10px; margin-bottom: 12px; padding: 6px 9px 6px 14px; }
.resume-bar > .icon { color: var(--gold); }
.resume-bar > span { flex: 1; color: var(--muted); font-size: .9rem; }
.resume-bar > span strong { color: var(--ink); }
.site-footer { display: flex; justify-content: flex-end; border-top: 1px solid #292e2d; color: var(--muted); font-size: .83rem; padding-block: 13px max(16px, env(safe-area-inset-bottom)); }
.battle-heading { margin-top: -12px; margin-bottom: 16px; }
.run-coins { padding: 8px 11px; border: 1px solid #514632; border-radius: 8px; background: #262218; font-size: .88rem; }
.route { padding: 11px 15px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; margin-bottom: 16px; }
.route-title, .route-title > span { display: flex; align-items: center; gap: 7px; }
.route-title { justify-content: space-between; font-size: .9rem; }
.route-title > span { color: var(--gold); }
.route ol { counter-reset: room; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; padding: 0; margin: 9px 0 0; list-style: none; }
.route li { display: grid; place-items: center; min-height: 28px; background: #242a2b; border: 1px solid #323839; border-radius: 6px; color: var(--muted); font-size: .79rem; }
.route li.boss { color: var(--gold); }
.route li.done { background: #254438; border-color: #487b63; color: #d1f5da; }
.route li.current { background: var(--gold); border-color: #f8d9a0; color: #21190d; font-weight: 700; }
.battle-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 13px; align-items: start; }
.encounter, .challenge { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.encounter { overflow: hidden; }
.encounter-art { padding: 13px 13px 11px; overflow: hidden; background: linear-gradient(0deg,#101614,#10141430 68%), var(--art) var(--shade) 71% center / cover; }
.encounter-art > .difficulty { position: absolute; top: 9px; left: 10px; }
.encounter-art[data-room="vault"] .difficulty { --theme: #ffda88; }
.encounter-art[data-room="shrine"] .difficulty { --theme: #a8efd1; }
.encounter-art[data-room="rune"] .difficulty { --theme: #b4dbff; }
.encounter-art[data-room="boss"] { background-image: linear-gradient(0deg,#201412,#5e24145c 80%), var(--art); }
.encounter-art[data-room="boss"] .difficulty { --theme: #ffd4aa; }
.boss-cue {
  position: absolute; z-index: 2; inset: 7px auto auto 9px; max-width: calc(100% - 18px);
  display: grid; gap: 2px; padding: 4px 9px; border-radius: 8px;
  color: #fff0d7; background: #241b14f5; border: 1px solid var(--theme); text-align: left;
  font-size: .83rem; line-height: 1.25;
}
.boss-cue strong { display: flex; align-items: center; gap: 5px; color: var(--theme); }
.encounter-art[data-room="boss"] .combatants { padding-top: 40px; }
.combatants { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; align-items: end; min-width: 0; padding-top: 22px; }
.combatant { display: grid; justify-items: center; min-width: 0; }
.combatants { --portrait-size: clamp(158px, 36vh, 310px); }
.foe img { width: 100%; height: var(--portrait-size); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 7px 5px #080d0ba0); user-select: none; }
.adventurer-portrait { position: relative; width: min(100%, var(--portrait-size)); aspect-ratio: 1; filter: drop-shadow(0 7px 5px #080d0ba0); user-select: none; }
.adventurer-portrait img { position: absolute; object-fit: contain; pointer-events: none; }
.adventurer-body, .adventurer-grip { inset: 0; width: 100%; height: 100%; }
.adventurer-weapon { width: 36%; height: 41%; left: -1%; top: 53%; }
.adventurer-shield { width: 30%; height: 42%; left: 67%; top: 34%; }
.adventurer-grip { clip-path: polygon(30% 55.5%, 32.5% 56.7%, 33.6% 59.1%, 33.2% 62.4%, 31.5% 64.1%, 29.1% 64.6%, 26.2% 63.5%, 25.1% 61.8%, 25.7% 59.1%, 28.2% 56.3%); }
.adventurer-pet { width: 42%; height: 37%; left: 3%; top: 1%; filter: drop-shadow(0 0 5px #ffdf8c6b); }
/* Masks follow the fabric and leather on the 320 × 320 adventurer sprite. */
.adventurer-cape,
.adventurer-boots {
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask: var(--costume-mask) center / 100% 100% no-repeat;
  mask: var(--costume-mask) center / 100% 100% no-repeat;
}
.adventurer-cape {
  --costume-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Cpath d='M0 79H108L124 99 131 108 135 107 133 101 141 97 159 94 171 94 180 98 188 103 193 108 200 113 205 122 204 128 201 133 198 137 188 137 176 134 162 131 150 130 139 132 130 137 119 141 114 145 111 151 111 157 106 164 103 170 99 175 95 181 91 184 86 189 82 195 84 201 90 205 97 206 103 202 106 194 109 188 113 182 118 177 125 171 132 171 134 175 131 182 129 190 126 198 127 205 121 209 115 216 115 222 117 228 115 234 110 239 102 243H0ZM225 115L231 109 234 114 234 128 233 135 235 144 238 156 235 158 231 154 228 146 224 143 224 138 222 134 221 130 223 123ZM161 235L167 233 172 230 179 226 187 223 195 228 196 235 190 243 178 249 164 250 157 243Z'/%3E%3C/svg%3E");
}
.adventurer-boots {
  --costume-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 320'%3E%3Cpath d='M57 318V296L72 277 83 267 93 254 98 248 99 241 108 236 116 234 124 236 135 235 144 235 148 239 149 247 145 254 140 259 134 266 125 271 118 275 110 277 115 283 119 294 119 318ZM207 300L209 273 213 267 212 259 211 252 215 245 216 238 225 240 236 238 246 234 252 231 258 233 260 246 259 258 253 265 247 268 255 275 280 277 281 302Z'/%3E%3C/svg%3E");
}
.adventurer-cape[data-item="mossweave-cape"] { filter: hue-rotate(53deg) saturate(1.32); }
.adventurer-cape[data-item="ember-satin-cape"] { filter: hue-rotate(-42deg) saturate(1.52) brightness(1.03); }
.adventurer-cape[data-item="starlight-cape"] { filter: hue-rotate(195deg) saturate(1.5) brightness(1.3); }
.adventurer-boots[data-item="trail-boots"] { filter: hue-rotate(92deg) saturate(.92) brightness(1.04); }
.adventurer-boots[data-item="emberstep-boots"] { filter: hue-rotate(-33deg) saturate(1.5) brightness(1.03); }
.adventurer-boots[data-item="stormstep-boots"] { filter: hue-rotate(225deg) saturate(.96) brightness(1.12); }
.adventurer-armor {
  left: 40%;
  top: 39%;
  width: 33%;
  height: 29%;
  transform: rotate(7deg);
  filter: drop-shadow(0 1px 1px #241711a6);
}
.adventurer-armor[data-item="frostplate-armor"] { left: 39%; width: 35%; }
.adventurer-armor[data-item="sunforged-armor"] { left: 38%; width: 36%; }
.adventurer-decoration {
  left: 60%;
  top: 38%;
  width: 13%;
  height: 13%;
  filter: drop-shadow(0 1px 1px #1d1426ac);
}
.adventurer-decoration[data-item="frost-crystal"] { top: 40%; }
.adventurer-decoration[data-item="ember-lantern"] { left: 51%; top: 57%; height: 15%; }
.adventurer-decoration[data-item="storm-medal"] { left: 58%; top: 43%; height: 15%; }
.adventurer-decoration[data-item="astral-crown"] {
  left: 54%;
  top: 1%;
  width: 32%;
  height: 22%;
  transform: rotate(9deg);
  filter: drop-shadow(0 0 2px #eab4ffc8);
}
.combatant span, .combatant h2 { text-align: center; font: 700 clamp(.8rem, 1.45vw, 1.15rem)/1.18 var(--display); text-shadow: 0 2px 7px #000; }
.combatant span { color: #b3ebc9; }
.combatant h2 { color: #ffe0bd; }
.combatant.defeated img { opacity: .55; }
.rune-seal { display: grid; place-items: center; width: min(100%, var(--portrait-size)); aspect-ratio: 1; color: #d9efff; }
.rune-seal i { display: grid; place-items: center; width: 56%; aspect-ratio: 1; position: relative; border-radius: 50%; border: 2px solid #d6edff;
  background: radial-gradient(circle, #b3deff42, #325077aa 58%, #21435a7d); box-shadow: 0 0 14px #8cd3fff0, inset 0 0 13px #9dd5ffd9; }
.rune-seal i::after { content: ""; position: absolute; inset: -10%; border: 1px dashed #cdeeff9e; border-radius: 50%; }
.rune-seal .icon { width: 53%; height: 53%; filter: drop-shadow(0 0 4px #daefff); }
.rune-seal[data-lit="2"] { color: #ffebad; }
.rune-seal[data-lit="2"] i { border-color: #ffe4a0; box-shadow: 0 0 19px #ffd786dd, inset 0 0 16px #ffcf809c; }
.encounter-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 11px 13px; }
.health-label { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; }
.health-label span { color: var(--muted); }
.health-track { position: relative; margin-top: 5px; }
progress { appearance: none; width: 100%; height: 9px; border: 0; border-radius: 10px; background: #303737; display: block; overflow: hidden; }
progress::-webkit-progress-bar { background: #303737; }
progress::-webkit-progress-value { background: var(--meter); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--meter); border-radius: 10px; }
.enemy-meter { --meter: #e7867c; }
.player-meter { --meter: #86c79e; }
.rune-meter { --meter: #9ecaff; }
.stat-row { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .84rem; }
.stat-row span { display: flex; align-items: center; gap: 5px; }
.stat-row .icon { color: var(--gold); }
.spellbook { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 7px 10px 9px; background: #1d2124; }
.spellbook-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; font-size: .84rem; }
.spellbook-heading strong { color: #ebdaf6; }
.spellbook-heading span { color: var(--muted); }
.spell-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.spell { min-width: 0; min-height: 44px; display: grid; justify-items: center; align-content: center; padding: 3px; border: 1px solid #645879; border-radius: 7px; background: #302b41; color: #f6ebff; line-height: 1.1; }
.spell:hover:enabled { border-color: #decaff; background: #473953; }
.spell-name { display: flex; align-items: center; gap: 3px; font-size: .86rem; }
.spell-name img { width: 24px; height: 23px; object-fit: contain; }
.spell small { display: block; color: #d3c5e1; font-size: .75rem; line-height: 1.1; padding-bottom: 2px; }
.spell:disabled { border-color: #42454c; background: #242629; color: #d1cad8; }
.spell[data-spell-state="spent"] .spell-name img { opacity: .42; }
.spell[data-spell-state="active"] { border-color: #99c4ee; background: #23364a; color: #e5f3ff; }
.spell[data-spell-state="active"] small { color: #b7ddff; }
.challenge { padding: 9px 13px 13px; }
.question-meta, .question-meta > span, .question-tools { display: flex; align-items: center; gap: 8px; }
.question-meta { justify-content: space-between; min-height: 44px; color: var(--gold); font-size: .88rem; }
.question-level { display: inline-flex; align-items: center; border: 1px solid currentColor; border-radius: 6px; padding: 3px 7px; font-weight: 700; line-height: 1.15; }
.question-level[data-level="Easy"] { color: #ade5bc; }
.question-level[data-level="Medium"] { color: #f4cf8e; }
.question-level[data-level="Hard"] { color: #ffc0b3; }
.question-tools { flex: 0 0 auto; gap: 5px; }
.question-tools button { min-width: 44px; justify-content: center; padding-inline: 6px; }
.challenge h2 { font-size: clamp(1.15rem, 2.15vw, 1.42rem); line-height: 1.22; margin: 1px 0 10px; }
.picture-prompt { background: #222d2c; border: 1px solid #4d625a; border-radius: 7px; margin-bottom: 8px; padding: 5px 10px; display: inline-block; letter-spacing: .12em; white-space: pre-line; font: 1.26rem/1.2 'Dungeon Emoji', system-ui; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.answer { min-height: 48px; display: flex; align-items: center; gap: 7px; border: 1px solid #3b4344; background: #22282a; border-radius: 8px; text-align: left; padding: 6px 8px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.answer:hover:enabled { background: #303638; border-color: var(--gold); }
.answer-eliminated { color: #b0aeb8; background: #252631; border-color: #434252; border-style: dashed; font-weight: 500; }
.option-key { flex: 0 0 auto; display: grid; place-items: center; inline-size: 24px; block-size: 24px; border-radius: 5px; border: 1px solid #535a59; color: #d4cbbb; font-size: .77rem; }
.answer:disabled { color: #d8d8d2; }
.answer.answer-correct { border-color: #75c698; background: #224635; color: #ebfff1; }
.answer.answer-wrong { border-color: #df8f81; background: #482d2a; color: #ffeae6; }
.answers.answers-reviewed { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.answers.answers-reviewed .answer { min-height: 34px; padding-block: 4px; }
.answers-reviewed .answer > span:nth-child(2) { flex: 1; min-width: 0; }
.answer-mark { display: flex; margin-left: auto; color: inherit; }
.hint, .answer-feedback { background: #272b25; border: 1px solid #4a4b39; border-radius: 8px; padding: 8px 10px; line-height: 1.32; }
.hint { margin-bottom: 10px; display: flex; gap: 8px; }
.hint .icon { color: var(--gold); margin-top: 2px; }
.answer-feedback { margin-top: 10px; font-size: .94rem; }
.answer-feedback.good { background: #22352a; border-color: #3a5a4b; }
.answer-feedback.good strong { color: #bcebcf; }
.answer-feedback.retry strong { color: var(--gold); }
.answer-feedback p { margin-top: 3px; }
.challenge-actions, .result-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.retry-note { flex: 1; color: var(--muted); font-size: .85rem; }
.result { text-align: center; padding: 24px 18px; background: linear-gradient(0deg,#171d1e 26%,#171d1ecf), var(--art) var(--shade) center / cover; border: 1px solid var(--line); border-radius: 15px; }
.result p { margin-top: 10px; color: var(--muted); }
.result .map-unlock { display: inline-flex; align-items: center; gap: 6px; color: var(--gold); border: 1px solid #8e774d; background: #30291c; border-radius: 7px; padding: 6px 9px; }
.result-mark { display: grid; place-items: center; width: 63px; height: 63px; margin: 0 auto 13px; border-radius: 50%; background: #3d301d; border: 1px solid #836a3f; color: var(--gold); font-size: 1.85rem; }
.result-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 560px; gap: 8px; margin: 19px auto; }
.result-stats > div { display: grid; justify-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 5px; }
.result-stats .icon { color: var(--gold); }
.result-stats strong { font-size: 1.2rem; }
.result-stats span { color: var(--muted); font-size: .81rem; }
.result-actions { justify-content: center; }
.result-unlocks { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.result-unlocks .map-unlock { margin-top: 0; }
.escape-rewards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 277px), 1fr)); gap: 8px;
  max-width: 675px; margin: 7px auto 0;
}
.escape-reward {
  display: grid; grid-template-columns: 65px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 5px 8px; text-align: left;
  background: radial-gradient(ellipse at 14% 50%, var(--shade), #192322 76%);
  border: 1px solid color-mix(in srgb, var(--theme) 65%, #263736); border-radius: 12px;
}
.escape-reward:only-child { max-width: 480px; width: 100%; justify-self: center; }
.escape-reward img { width: 65px; height: 62px; object-fit: contain; filter: drop-shadow(0 0 8px #f7e4b138); }
.escape-reward h2 { color: var(--theme); font-size: 1rem; line-height: 1.2; }
.escape-reward p { margin-top: 3px; font-size: .83rem; }
.escape-reward button { padding-inline: 9px; }
.feedback-boss { display: flex; align-items: center; gap: 5px; color: var(--gold); }
.review { max-width: 700px; margin-inline: auto; }
.review > p { margin-bottom: 13px; }
dialog { width: min(570px, calc(100% - 24px)); max-height: calc(100dvh - 32px); color: var(--ink); background: #191d1e; border: 1px solid #54574f; border-radius: 15px; padding: 16px; }
dialog::backdrop { background: #080a0be0; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dialog-heading h2 { font: 700 clamp(1.08rem, 4vw, 1.4rem)/1.25 var(--display); }
.close-button { padding: 0; width: 44px; flex: 0 0 auto; }
dialog > p { color: var(--muted); margin-bottom: 11px; line-height: 1.4; }
.bank-list { display: grid; gap: 7px; }
.subject-filters, .store-filters { display: grid; gap: 6px; margin-bottom: 12px; }
.subject-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.store-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); }
dialog[data-kind="loadout"] .store-filters { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.subject-filters .button, .store-filters .button { padding-inline: 4px; }
.store-filters .button { font-size: .86rem; gap: 5px; }
:is(.subject-filters, .store-filters) .button[aria-pressed="true"] { background: #3f3323; border-color: #a88f5b; color: var(--gold); }
.list-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-high); text-align: left; }
.list-item > span:nth-child(2) { flex: 1; min-width: 0; }
.list-item small { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; line-height: 1.3; }
.list-item.is-selected, .bank-option:hover { border-color: #a88f5b; }
.list-item > .icon { color: var(--gold); }
.list-icon { color: var(--theme, var(--gold)); display: grid; place-items: center; width: 33px; height: 33px; border-radius: 6px; background: #2d2d25; flex: none; }
dialog[data-kind="audio"] { width: min(420px, calc(100% - 24px)); }
.audio-options { display: grid; gap: 8px; }
.audio-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-high);
}
.audio-option small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.audio-toggle { min-width: 62px; background: #171b1d; }
.audio-toggle[aria-pressed="true"], .audio-toggle[aria-pressed="true"]:hover {
  background: #3b3020; border-color: #a78c5d; color: var(--gold);
}
.shop-intro { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
.journal-stats { margin-block: 8px 13px; }
dialog:is([data-kind="store"], [data-kind="loadout"]) { width: min(680px, calc(100% - 24px)); }
.store-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.store-item { display: grid; grid-template-rows: auto 1fr auto; gap: 7px; padding: 10px; min-width: 0; border: 1px solid #40443c; border-radius: 10px; background: #202623; }
.store-item-heading { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; line-height: 1.22; }
.store-item p, .slot-label, .owned-empty, .shop-notice { color: var(--muted); font-size: .87rem; line-height: 1.35; }
.store-item p { padding-bottom: 4px; }
.store-item .button { width: 100%; }
.store-item .button:enabled { background: #352c1c; color: var(--gold); border-color: #635234; }
.store-item[data-unlocked="false"] button { color: #e4cea4; font-size: .81rem; padding-inline: 6px; }
.store-item .button:enabled:hover { background: #443624; border-color: var(--gold); }
.gear-emblem { display: inline-grid; place-items: center; color: var(--gold); background: #352b1c; border: 1px solid #635234; border-radius: 8px; width: 37px; height: 37px; flex-shrink: 0; }
.gear-emblem img { width: 85%; height: 85%; object-fit: contain; }
.slot-label { display: block; }
.store-item .gear-emblem { width: 49px; height: 43px; background: radial-gradient(ellipse, #574731, #2a261d); }
.item-perk { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: var(--gold); }
.feedback-perks { display: inline-flex; align-items: center; gap: 4px; margin-left: 7px; color: var(--gold); font-size: .86em; font-weight: 700; }
.shop-footer { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; justify-content: space-between; margin-top: 13px; }
.owned-list { max-height: min(44dvh, 285px); overflow-y: auto; overscroll-behavior: contain; }
.shop-footer .button { margin-left: auto; }
.loadout-layout { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.8fr); align-items: stretch; gap: 10px; }
.loadout-hero { --portrait-size: 192px; display: grid; gap: 6px; justify-items: center; align-content: center; overflow: hidden; border: 1px solid #48584b; border-radius: 10px; background: radial-gradient(ellipse,#34453b, #17201c 79%); padding: 7px; }
.loadout-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; font-size: .83rem; font-weight: 700; }
.loadout-stats span { display: inline-flex; align-items: center; gap: 4px; }
.loadout-stats .icon { color: var(--gold); }
.loadout-equipped { margin-bottom: 7px; background: #292921; border-color: #55513f; }
.loadout-equipped small { margin: 0 0 2px; }
.loadout-inventory .owned-empty { margin: 7px 4px 0; }
.collection-progress { margin: 7px 0; color: var(--gold); font-size: .85rem; font-weight: 700; }
.collection-lock { display: grid; place-items: center; min-width: 36px; color: var(--gold); }
.owned-list .list-item { min-height: 52px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

@media (max-height: 750px) and (min-width: 701px) {
  .header-inner { min-height: 61px; }
  #app { padding-block: 23px 17px; }
  .page-heading { margin-bottom: 15px; }
  .dungeon-hero { min-height: 300px; }
  .hero-content { padding-block: 23px; }
  .section-heading { margin-top: 16px; }
  .card-art { height: 73px; }
  .battle-heading { margin-top: -9px; margin-bottom: 9px; }
  .route { margin-bottom: 12px; }
}
@media (max-height: 690px) and (min-width: 701px) {
  .dungeon-hero { min-height: 249px; }
  .hero-content { padding-block: 12px; }
  .hero-content h2 { margin-top: 9px; }
  .hero-meta { margin-block: 10px 12px; }
  .card-art { height: 57px; }
}
@media (max-width: 850px) {
  .shell, .header-inner { width: calc(100% - 38px); }
  .header-actions { gap: 7px; }
  .header-actions .button { padding-inline: 10px; }
  .hero-content { padding-inline: 24px; }
  .card-title .icon { display: none; }
  .card-title { overflow-wrap: anywhere; }
  .card-meta { gap: 5px; font-size: .78rem; }
}
@media (max-width: 700px) {
  .header-inner { min-height: 60px; }
  #app { padding-block: 19px 16px; }
  .page-heading { margin-bottom: 14px; align-items: flex-start; }
  .page-heading p { font-size: .9rem; }
  .bank-button { min-width: 0; max-width: 47%; }
  .bank-icon { display: none; }
  .dungeon-hero { min-height: 285px; background-position: 58% center; }
  .hero-content { padding-block: 16px; }
  .dungeon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .card-title { font-size: .9rem; }
  .card-art { height: 66px; }
  .card-body { gap: 4px; padding: 8px; }
  .card-meta { gap: 4px; font-size: .77rem; }
  .selected-mark { right: 6px; top: 6px; }
  .section-heading { margin-top: 16px; }
  .battle-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .encounter { display: grid; grid-template-columns: minmax(145px, 3fr) minmax(0, 2fr); }
  .encounter-art { padding: 6px 7px 8px; text-align: center; }
  .encounter-art .difficulty { position: relative; inset: auto; min-height: 22px; padding: 2px 5px; font-size: .69rem; }
  .boss-cue { position: relative; inset: auto; max-width: 100%; font-size: .77rem; padding-inline: 5px; }
  .encounter-art[data-room="boss"] .combatants { padding-top: 3px; }
  .combatants { --portrait-size: clamp(54px, 15vw, 84px); padding-top: 0; }
  .combatant span, .combatant h2 { font-size: .69rem; }
  .encounter-stats { grid-template-columns: minmax(0, 1fr); gap: 5px; align-content: center; padding: 7px 9px; }
  .health-label, .stat-row { font-size: .76rem; }
  .route { margin-bottom: 8px; padding: 7px 8px; }
  .route ol { gap: 3px; margin-top: 5px; }
  .route li { min-height: 24px; font-size: .68rem; }
  .challenge { padding: 8px 11px 11px; }
  .challenge h2 { margin-bottom: 9px; }
  .battle-heading { margin-top: 0; margin-bottom: 8px; }
  .battle-heading h1 { font-size: 1.3rem; }
  .run-coins { font-size: .8rem; padding: 6px 8px; }
  .battle-heading .text-button { font-size: .84rem; min-height: 44px; }
  .header-actions { gap: 5px; }
  .header-actions .button { padding-inline: 8px; }
}
@media (max-width: 660px) {
  .brand { font-size: .95rem; gap: 8px; }
  .brand-mark { inline-size: 34px; block-size: 34px; }
  .header-actions .button { min-width: 44px; }
  #store-button > .icon { display: none; }
  .header-actions .wallet { border: 0; margin: 0; padding: 0; }
  #loadout-button > span, #journal-button > span {
    position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden;
  }
  .store-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  dialog[data-kind="loadout"] .store-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .loadout-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .loadout-hero { --portrait-size: 130px; grid-template-columns: var(--portrait-size) max-content; align-items: center; justify-content: center; }
  .loadout-stats { display: grid; justify-items: start; min-width: 57px; }
}
@media (max-width: 460px) {
  .header-inner, .shell { width: calc(100% - 24px); }
  .brand { font-size: .88rem; gap: 6px; }
  .brand-mark { inline-size: 31px; block-size: 31px; border-radius: 7px; }
  .brand-mark svg { width: 21px; }
  .header-actions { gap: 4px; }
  .button-quiet { font-size: .82rem; padding-inline: 7px; }
  .header-actions .wallet .icon { display: none; }
  .page-heading { display: grid; gap: 9px; }
  .page-heading .bank-button { max-width: none; justify-self: start; }
  .hero-content { padding-inline: 13px; }
  .hero-content h2 { font-size: 1.75rem; }
  .hero-content p { font-size: .9rem; max-width: 245px; }
  .map-rescue { font-size: .78rem; }
  .dungeon-hero { min-height: 255px; background-position: 61% center; background-image: linear-gradient(90deg,#121817f6 0%,#121817d6 38%,#12181735 100%),var(--art); }
  .card-art { height: 51px; }
  .card-title { overflow-wrap: anywhere; font-size: .82rem; }
  .answers { gap: 6px; }
  .answer { min-height: 47px; padding-inline: 6px; gap: 6px; font-size: .91rem; }
  .option-key { inline-size: 20px; block-size: 20px; }
  .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .store-item .gear-emblem { width: 36px; height: 36px; }
  .escape-reward { grid-template-columns: 49px minmax(0, 1fr) auto; }
  .escape-reward img { width: 49px; height: 53px; }
}
@media (max-width: 400px) {
  .header-actions .button { padding-inline: 5px; }
  dialog[data-kind="loadout"] .store-filters .icon { display: none; }
}
@media (max-width: 385px) {
  #store-button > .icon { display: block; }
  #store-button > span:not(.wallet) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
}
@media (max-width: 370px) {
  .brand > span:last-child { width: 85px; }
}
@media (max-width: 345px) {
  .brand > span:last-child { display: none; }
}
@media (orientation: landscape) and (min-width: 750px) and (max-height: 850px) {
  .shell, .header-inner { width: min(var(--width), calc(100% - 36px)); }
  .header-inner { min-height: 54px; }
  body[data-view="battle"] #app { padding-block: 10px 8px; }
  body:is([data-view="battle"], [data-view="lobby"]) .site-footer { display: none; }
  .battle-heading { margin: 0 0 8px; }
  .battle-heading > div { display: flex; align-items: center; gap: 12px; }
  .battle-heading h1 { font-size: clamp(1.2rem, 2.8vw, 1.8rem); }
  .battle-heading .text-button { font-size: .86rem; }
  .route { padding: 6px 9px 8px; margin-bottom: 9px; }
  .route ol { margin-top: 5px; }
  .route li { min-height: 23px; }
  .battle-grid { gap: 10px; grid-template-columns: minmax(0, 1.34fr) minmax(0, 1fr); }
  .encounter-art { padding: 8px 10px 10px; }
  .combatants { --portrait-size: clamp(132px, 34vh, 270px); }
  .encounter-stats { padding: 8px 10px; gap: 7px 12px; }
  .challenge { padding: 6px 12px 11px; }
  .challenge h2 { margin-bottom: 8px; }
  .answer { min-height: 47px; }
  .answer-feedback { margin-top: 7px; }
}
@media (orientation: landscape) and (min-width: 750px) and (max-width: 850px) {
  .battle-grid { grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr); }
  .combatants { --portrait-size: clamp(126px, 32vh, 195px); }
}
@media (orientation: landscape) and (min-width: 750px) and (max-height: 700px) {
  dialog[data-kind="store"] :is(.shop-intro, .store-filters) { margin-bottom: 8px; }
  .store-grid { gap: 7px; }
  .store-item { gap: 5px; padding: 8px; }
  .store-item p { padding-bottom: 0; }
  .store-item .gear-emblem { width: 45px; height: 40px; }
  .shop-footer { margin-top: 9px; }
}
@media (orientation: landscape) and (min-width: 750px) and (max-height: 620px) {
  body[data-view="lobby"] #app { padding-block: 12px 8px; }
  body[data-view="result"] #app { padding-block: 10px 6px; }
  .result { padding-block: 14px; }
  .result-mark { width: 50px; height: 50px; margin-bottom: 8px; }
  .result-stats { margin-block: 12px; }
  .escape-reward img { height: 57px; }
  .dungeon-hero { min-height: 222px; }
  .hero-content h2 { font-size: clamp(1.8rem, 5vw, 2.3rem); }
  .hero-content p { max-width: 400px; font-size: .94rem; }
  .hero-meta { margin-block: 8px 9px; }
  .card-body { padding: 7px 9px; }
  .card-meta { gap: 3px; font-size: .74rem; }
  dialog[data-kind="store"] { padding-bottom: 8px; }
  body[data-view="battle"] #app { padding-block: 5px 0; }
  .battle-heading { margin-bottom: 5px; }
  .route { padding-block: 4px 6px; margin-bottom: 6px; }
  .route ol { margin-top: 4px; }
  .route li { min-height: 20px; }
  .challenge h2 { font-size: 1.2rem; margin-bottom: 6px; }
  .answers { gap: 5px; }
  .answer { min-height: 44px; padding: 4px 7px; font-size: .9rem; }
  .answer-feedback { padding-block: 5px; margin-top: 5px; font-size: .88rem; }
  .challenge-actions { margin-top: 5px; }
  .store-grid { gap: 6px; }
  .store-item { gap: 4px; padding: 7px; }
  .store-item .gear-emblem { width: 28px; height: 28px; }
  .shop-footer { margin-top: 7px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

