:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #080b12;
  --panel: #111722;
  --panel-2: #171f2c;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f6fb;
  --muted: #8d99aa;
  --cyan: #45c8ff;
  --blue: #3188ff;
  --green: #45d882;
  --gold: #f5bd3f;
  --red: #f05757;
  --stone-dark: #0b1018;
  --stone-mid: #171f2b;
  --stone-line: rgba(177, 188, 196, 0.18);
  --dungeon-gold-line: rgba(245, 189, 63, 0.34);
  --dungeon-cyan-line: rgba(69, 200, 255, 0.26);
  --ds-bg: #071018;
  --ds-panel: #111c24;
  --ds-stone: #2a2d2f;
  --ds-stone-light: #4a4540;
  --ds-gold: #f2c766;
  --ds-torch: #ff9f3f;
  --ds-cyan: #48d6ff;
  --ds-green: #34c779;
  --ds-parchment: #ead7a1;
  --ds-leather: #6b3f22;
  --ds-danger: #d94a38;
  --tile-gap: 0px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 15%, rgba(38, 85, 135, 0.22), transparent 34rem),
    linear-gradient(145deg, #0c111b, var(--bg) 55%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button {
  font: inherit;
}

.hidden-screen,
.hidden {
  display: none !important;
}

.menu-screen {
  min-height: 100dvh;
  padding:
    max(24px, env(safe-area-inset-top))
    clamp(18px, 5vw, 34px)
    max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 159, 63, 0.12), transparent 18rem),
    radial-gradient(circle at 50% 75%, rgba(72, 214, 255, 0.08), transparent 18rem);
}

.menu-card {
  position: relative;
  width: min(100%, 430px);
  overflow: hidden;
  border: 3px solid rgba(52, 49, 45, 0.92);
  border-radius: 31px;
  background:
    radial-gradient(circle at 50% 9%, rgba(255, 159, 63, 0.18), transparent 10rem),
    linear-gradient(rgba(7, 12, 18, 0.58), rgba(7, 12, 18, 0.96)),
    url("./assets/dungeon-brick-floor.png") center / 245px auto repeat;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.58),
    0 0 70px rgba(255, 159, 63, 0.08),
    inset 0 0 0 2px rgba(242, 199, 102, 0.09),
    inset 0 0 50px rgba(0, 0, 0, 0.74);
}

.home-card {
  min-height: min(760px, calc(100dvh - 48px));
  padding: clamp(38px, 8vw, 56px) clamp(24px, 7vw, 42px) 34px;
  text-align: center;
}

.menu-torch-glow {
  position: absolute;
  top: -66px;
  left: 50%;
  z-index: 0;
  width: 290px;
  height: 240px;
  border-radius: 50%;
  translate: -50% 0;
  background: rgba(255, 159, 63, 0.24);
  filter: blur(48px);
  pointer-events: none;
  animation: torch-breathe 3.8s ease-in-out infinite alternate;
}

.game-title {
  position: relative;
  z-index: 2;
  color: #fff1bf;
  font-family: Georgia, "Times New Roman", "Cinzel Decorative", serif;
  font-size: clamp(2.62rem, 10.4vw, 4.18rem);
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  text-shadow:
    0 2px 0 #76511f,
    0 5px 0 #25170c,
    0 12px 24px rgba(0, 0, 0, 0.78),
    0 0 34px rgba(255, 159, 63, 0.24);
  filter: drop-shadow(0 0 18px rgba(242, 199, 102, 0.08));
  animation: title-glow-breathe 4.6s ease-in-out infinite alternate;
}

.game-title::before,
.game-title::after {
  position: absolute;
  pointer-events: none;
  content: "";
}

.game-title::before {
  inset: -12px 5% auto;
  height: 48%;
  opacity: 0.18;
  border-top: 2px solid rgba(255, 249, 221, 0.52);
  border-radius: 50%;
  transform: rotate(-3deg);
}

.game-title::after {
  left: 23%;
  top: 44%;
  width: 52%;
  height: 7px;
  opacity: 0.42;
  background:
    linear-gradient(100deg, transparent, rgba(87, 58, 31, 0.85) 18% 21%, transparent 24% 45%, rgba(87, 58, 31, 0.9) 49% 53%, transparent 58%);
  transform: rotate(-7deg);
}

.menu-intro {
  position: relative;
  z-index: 2;
  max-width: 310px;
  margin: 18px auto 24px;
  padding: 10px 14px;
  border: 1px solid rgba(242, 199, 102, 0.22);
  border-radius: 999px;
  color: #f0dec0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.96rem;
  line-height: 1.35;
  background:
    linear-gradient(90deg, transparent, rgba(107, 63, 34, 0.42), transparent),
    rgba(7, 12, 18, 0.42);
  box-shadow:
    0 0 24px rgba(255, 159, 63, 0.08),
    inset 0 0 16px rgba(0, 0, 0, 0.22);
}

.menu-actions {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 12px;
}

.menu-button {
  width: 100%;
}

.home-dungeon-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.home-dungeon-scene::before {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    radial-gradient(circle, rgba(234, 215, 161, 0.3) 0 1px, transparent 1.7px);
  background-size: 46px 52px;
  animation: dust-drift 9s linear infinite;
  content: "";
}

.home-arch {
  position: absolute;
  left: 50%;
  top: 62px;
  width: min(72%, 290px);
  height: 285px;
  border: 20px solid rgba(64, 60, 55, 0.9);
  border-bottom: 0;
  border-radius: 155px 155px 22px 22px;
  translate: -50% 0;
  background:
    linear-gradient(rgba(12, 17, 24, 0.2), rgba(12, 17, 24, 0.7)),
    url("./assets/dungeon-brick-floor.png") center / 170px auto repeat;
  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.42),
    inset 0 0 0 4px rgba(242, 199, 102, 0.08),
    inset 0 0 38px rgba(0, 0, 0, 0.74);
}

.home-doorway {
  position: absolute;
  left: 50%;
  top: 104px;
  width: min(46%, 180px);
  height: 230px;
  border-radius: 100px 100px 14px 14px;
  translate: -50% 0;
  background:
    radial-gradient(circle at 50% 28%, rgba(72, 214, 255, 0.12), transparent 42%),
    linear-gradient(#05080d, #020407);
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.94),
    0 0 40px rgba(255, 159, 63, 0.12);
}

.home-torch {
  position: absolute;
  top: 155px;
  width: 38px;
  height: 86px;
  background: url("./assets/dungeon-wall-torch.png") center / contain no-repeat;
  filter:
    drop-shadow(0 0 13px rgba(255, 159, 63, 0.86))
    drop-shadow(0 0 28px rgba(255, 111, 46, 0.45));
  animation: torch-flicker 420ms ease-in-out infinite alternate;
}

.home-torch-left { left: 34px; }
.home-torch-right { right: 34px; transform: scaleX(-1); }

.home-fog {
  position: absolute;
  bottom: 105px;
  width: 185px;
  height: 56px;
  border-radius: 50%;
  opacity: 0.16;
  background: rgba(199, 229, 234, 0.36);
  filter: blur(16px);
  animation: fog-slide 8s ease-in-out infinite alternate;
}

.fog-one { left: -30px; }
.fog-two { right: -40px; animation-delay: -3s; }

.home-treasure-pile {
  position: absolute;
  right: 28px;
  bottom: 24px;
  width: 100px;
  height: 72px;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  filter:
    drop-shadow(0 8px 8px rgba(0, 0, 0, 0.56))
    drop-shadow(0 0 18px rgba(242, 199, 102, 0.3));
}

.home-treasure-pile::before,
.home-treasure-pile::after {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: url("./assets/golden-coin.png") center / contain no-repeat;
  content: "";
}

.home-treasure-pile::before {
  left: -18px;
  bottom: 3px;
}

.home-treasure-pile::after {
  right: -14px;
  bottom: -1px;
  transform: rotate(18deg);
}

.home-adventurer-duo {
  position: absolute;
  left: 24px;
  bottom: 17px;
  width: 126px;
  height: 104px;
  filter:
    drop-shadow(0 10px 8px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 14px rgba(255, 159, 63, 0.14));
}

.home-adventurer {
  position: absolute;
  bottom: 0;
  width: 62px;
  height: 82px;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
}

.adventurer-one {
  left: 4px;
  background-image: url("./assets/player-female.png");
  transform: rotate(-4deg);
}

.adventurer-two {
  right: 2px;
  background-image: url("./assets/player-male.png");
  transform: scaleX(-1) rotate(-5deg);
}

.high-five-spark {
  position: absolute;
  top: 13px;
  left: 58px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff8b9 0 13%, #f2c766 22% 45%, transparent 48%);
  box-shadow:
    0 0 14px rgba(242, 199, 102, 0.7),
    0 0 28px rgba(255, 159, 63, 0.28);
  animation: high-five-pop 1.65s ease-in-out infinite alternate;
}

.high-five-spark::before,
.high-five-spark::after {
  position: absolute;
  inset: 9px -7px auto;
  height: 3px;
  border-radius: 999px;
  background: rgba(242, 199, 102, 0.8);
  content: "";
}

.high-five-spark::after {
  transform: rotate(90deg);
}

.dialog-card {
  max-height: min(760px, calc(100dvh - 34px));
  padding: 34px 28px 28px;
  overflow-y: auto;
}

.close-button {
  position: absolute;
  z-index: 2;
  top: 13px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  background: rgba(15, 19, 26, 0.82);
  cursor: pointer;
}

.menu-panel h2 {
  margin-bottom: 24px;
  font-size: clamp(1.7rem, 7vw, 2.25rem);
}

.menu-copy {
  margin: -10px 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.difficulty-options {
  margin: 8px 0 18px;
  display: grid;
  gap: 12px;
}

.difficulty-card {
  width: 100%;
  padding: 15px 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  align-items: center;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(135deg, rgba(69, 200, 255, 0.08), transparent 44%),
    rgba(20, 27, 37, 0.84);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.difficulty-card:hover {
  transform: translateY(-2px);
  border-color: rgba(69, 200, 255, 0.42);
  box-shadow: 0 0 20px rgba(69, 200, 255, 0.13);
}

.difficulty-card.selected {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 15% 20%, rgba(245, 189, 63, 0.16), transparent 42%),
    rgba(93, 69, 28, 0.42);
  box-shadow: 0 0 22px rgba(245, 189, 63, 0.16);
}

.difficulty-icon {
  grid-row: span 2;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(245, 189, 63, 0.34);
  border-radius: 14px;
  display: block;
  background-color: rgba(7, 12, 20, 0.52);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 86%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.difficulty-icon.normal-icon {
  background-image: url("./assets/difficulty-campfire.png");
}

.difficulty-icon.timed-icon {
  background-image: url("./assets/difficulty-clock.png");
}

.difficulty-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.timed-options {
  margin: 0 0 18px;
  padding: 13px;
  border: 1px solid rgba(69, 200, 255, 0.18);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  background: rgba(7, 12, 20, 0.5);
}

.timed-options > strong {
  color: #d9f5ff;
  font-size: 0.88rem;
}

.timed-level-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.timed-level-button {
  min-height: 44px;
  border: 1px solid rgba(245, 189, 63, 0.28);
  border-radius: 13px;
  color: #fff1c8;
  font-weight: 850;
  background: rgba(93, 69, 28, 0.42);
  cursor: pointer;
}

.timed-level-button:hover,
.timed-level-button.selected {
  border-color: var(--gold);
  background: rgba(180, 129, 32, 0.56);
}

.character-options {
  margin: 8px 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.character-card {
  min-width: 0;
  padding: 12px 8px 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  display: grid;
  gap: 8px;
  place-items: center;
  color: var(--text);
  background: rgba(20, 27, 37, 0.84);
  cursor: pointer;
}

.character-card.selected {
  border-color: var(--gold);
  background: rgba(93, 69, 28, 0.52);
  box-shadow: 0 0 22px rgba(245, 189, 63, 0.18);
}

.character-portrait {
  width: 100%;
  max-width: 125px;
  aspect-ratio: 1;
  display: block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.6));
}

.character-portrait.female { background-image: url("./assets/player-female.png"); }
.character-portrait.male { background-image: url("./assets/player-male.png"); }

.setting-row {
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(17, 23, 34, 0.78);
}

.setting-row div {
  display: grid;
  gap: 4px;
}

.setting-row span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.toggle-button {
  min-width: 64px;
  padding: 9px 13px;
  border: 1px solid rgba(69, 216, 130, 0.42);
  border-radius: 999px;
  color: #d9ffe7;
  font-weight: 800;
  background: rgba(37, 151, 85, 0.62);
  cursor: pointer;
}

.toggle-button[aria-pressed="false"] {
  border-color: var(--line);
  color: var(--muted);
  background: #222b38;
}

.volume-control {
  margin-bottom: 26px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 15px;
  background: rgba(17, 23, 34, 0.78);
}

.volume-control > span {
  display: flex;
  justify-content: space-between;
}

.volume-control output {
  color: var(--gold);
  font-weight: 800;
}

.volume-control input {
  width: 100%;
  accent-color: var(--gold);
}

.leaderboard-list {
  margin-bottom: 20px;
  display: grid;
  gap: 13px;
}

.leaderboard-board {
  padding: 14px;
  border: 1px solid rgba(245, 189, 63, 0.18);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(245, 189, 63, 0.08), rgba(17, 23, 34, 0.86) 44%),
    rgba(17, 23, 34, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.leaderboard-heading {
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.leaderboard-heading strong {
  color: #fff2cc;
  font-size: 1rem;
}

.leaderboard-heading small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-entries {
  display: grid;
  gap: 7px;
}

.leaderboard-entry,
.leaderboard-empty {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: #dce5ef;
  background: rgba(7, 12, 20, 0.46);
}

.leaderboard-entry .rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #2a1d06;
  font-size: 0.72rem;
  font-weight: 950;
  background: var(--gold);
}

.leaderboard-entry .time {
  color: #fff3cf;
  font-size: 1.08rem;
  font-weight: 950;
}

.leaderboard-entry .meta,
.leaderboard-empty {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}

.leaderboard-empty {
  grid-template-columns: 1fr;
  text-align: center;
}

.leaderboard-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rules-list {
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: dungeon-rules;
  list-style: none;
}

.rules-list li {
  position: relative;
  min-height: 48px;
  padding: 12px 12px 12px 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #bec7d3;
  font-size: 0.86rem;
  line-height: 1.42;
  background: rgba(17, 23, 34, 0.74);
  counter-increment: dungeon-rules;
}

.rules-list li::before {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  content: counter(dungeon-rules);
  color: #2a1d06;
  font-size: 0.75rem;
  font-weight: 900;
  background: var(--gold);
}

.rules-list strong {
  color: #fff1c8;
}

.game-shell {
  width: min(100%, 680px);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    clamp(18px, 5vw, 34px)
    max(20px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: clamp(14px, 2.5vh, 24px);
}

.topbar {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar > div:first-child {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  padding: 7px 0 0 12px;
}

.topbar > div:first-child::before {
  position: absolute;
  top: 5px;
  bottom: 2px;
  left: 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(to bottom, var(--cyan), var(--gold));
  box-shadow:
    0 0 18px rgba(69, 200, 255, 0.42),
    0 0 18px rgba(245, 189, 63, 0.22);
  content: "";
}

.top-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.sound-button {
  width: 42px;
  border: 1px solid var(--stone-line);
  border-bottom-color: rgba(0, 0, 0, 0.46);
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 1rem;
  background:
    linear-gradient(160deg, rgba(69, 200, 255, 0.08), transparent 45%),
    linear-gradient(180deg, #202936, #0c111a);
  cursor: pointer;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -7px 14px rgba(0, 0, 0, 0.22);
  text-shadow: 0 0 10px rgba(69, 200, 255, 0.32);
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.sound-button:hover {
  border-color: var(--dungeon-cyan-line);
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.sound-button[aria-pressed="false"] {
  color: var(--muted);
  opacity: 0.72;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(1.8rem, 7vw, 2.7rem);
}

#level-title {
  position: relative;
  display: inline-block;
  max-width: 12ch;
  color: #fff6db;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
  text-shadow:
    0 3px 0 #392612,
    0 8px 0 rgba(0, 0, 0, 0.18),
    0 10px 26px rgba(0, 0, 0, 0.45);
}

#level-title::after {
  position: absolute;
  right: 5%;
  bottom: -8px;
  left: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), rgba(69, 200, 255, 0.6), transparent);
  box-shadow: 0 0 14px rgba(245, 189, 63, 0.24);
  content: "";
}

.score-card {
  position: relative;
  flex: 0 0 auto;
  min-width: 184px;
  overflow: hidden;
  padding: 17px 18px 16px;
  border: 1px solid var(--dungeon-gold-line);
  border-bottom-color: rgba(83, 62, 26, 0.66);
  border-radius: 20px;
  display: grid;
  gap: 6px;
  text-align: left;
  background:
    radial-gradient(circle at 88% 16%, rgba(245, 189, 63, 0.2), transparent 3rem),
    linear-gradient(135deg, rgba(245, 189, 63, 0.12), rgba(7, 12, 20, 0.9) 48%),
    url("./assets/dungeon-brick-floor.png") center / 190px auto repeat;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.035),
    inset 0 -18px 30px rgba(0, 0, 0, 0.22);
}

.score-card::after {
  position: absolute;
  right: 11px;
  bottom: 9px;
  width: 38px;
  height: 38px;
  opacity: 0.13;
  background: url("./assets/golden-coin.png") center / contain no-repeat;
  filter: saturate(1.2);
  content: "";
}

.score-card span,
.score-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}

.score-card > strong {
  color: #fff3cf;
  font-size: 1.34rem;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.36);
}

.score-card .floor-number {
  color: var(--cyan);
  font-size: 1rem;
  font-weight: 950;
  text-shadow: 0 0 12px rgba(69, 200, 255, 0.34);
}

.mission-strip {
  position: relative;
  min-height: 70px;
  overflow: hidden;
  padding: 14px 16px 14px 17px;
  border: 1px solid var(--stone-line);
  border-left-color: rgba(69, 200, 255, 0.46);
  border-radius: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  background:
    linear-gradient(90deg, rgba(69, 200, 255, 0.13), transparent 26%),
    linear-gradient(135deg, rgba(7, 12, 20, 0.68), rgba(17, 23, 34, 0.9) 48%),
    url("./assets/dungeon-brick-floor.png") center / 220px auto repeat;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.24),
    inset 0 0 0 2px rgba(255, 255, 255, 0.025);
}

.mission-strip::after {
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 72px;
  height: 72px;
  opacity: 0.1;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  content: "";
}

.mission-strip p {
  margin: 0;
  color: #d9e0e9;
  font-size: clamp(0.84rem, 2.25vw, 0.95rem);
  line-height: 1.42;
  white-space: normal;
}

.status-dot {
  margin-top: 0.46em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow:
    0 0 0 4px rgba(69, 200, 255, 0.08),
    0 0 16px var(--cyan);
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, max-content));
  justify-items: start;
  gap: 8px;
}

.stat {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--stone-line);
  border-bottom-color: rgba(0, 0, 0, 0.46);
  border-radius: 14px;
  display: grid;
  gap: 1px;
  background:
    linear-gradient(180deg, rgba(33, 43, 58, 0.84), rgba(10, 15, 22, 0.82));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -7px 12px rgba(0, 0, 0, 0.14);
}

.heart-stat {
  width: auto;
  min-width: 112px;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
}

.heart-stat {
  display: none;
}

.stat span {
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(0.55rem, 2vw, 0.68rem);
  font-weight: 750;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.stat strong {
  font-size: clamp(0.86rem, 3.2vw, 1.05rem);
  letter-spacing: 0.05em;
}

.hearts {
  color: #ff6d78;
  text-shadow: 0 0 12px rgba(255, 109, 120, 0.38);
}

.timer-stat {
  min-width: 148px;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 10px;
  border-color: rgba(69, 200, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(69, 200, 255, 0.12), rgba(14, 19, 28, 0.82)),
    url("./assets/dungeon-brick-floor.png") center / 190px auto repeat;
}

.timer-stat strong {
  color: #c9f4ff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(69, 200, 255, 0.28);
}

.timer-stat small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checklist-panel {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid var(--dungeon-cyan-line);
  border-bottom-color: rgba(8, 51, 72, 0.58);
  border-radius: 20px;
  display: grid;
  gap: 11px;
  background:
    radial-gradient(circle at 9% 2%, rgba(69, 200, 255, 0.22), transparent 4.2rem),
    linear-gradient(145deg, rgba(7, 12, 20, 0.72), rgba(11, 16, 24, 0.94) 54%),
    url("./assets/dungeon-brick-floor.png") center / 210px auto repeat;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.28),
    inset 0 0 0 2px rgba(255, 255, 255, 0.035),
    inset 0 -18px 28px rgba(0, 0, 0, 0.18);
}

.checklist-panel::before {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  opacity: 0.18;
  background: url("./assets/dungeon-key.png") center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(245, 189, 63, 0.5));
  content: "";
}

.checklist-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.checklist-heading .eyebrow {
  margin: 0;
}

.checklist-heading strong {
  color: #ffe7a6;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-shadow: 0 0 10px rgba(245, 189, 63, 0.12);
}

.checklist {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.checklist-item {
  position: relative;
  padding: 10px 11px;
  border: 1px solid rgba(177, 188, 196, 0.12);
  border-left-color: rgba(69, 200, 255, 0.3);
  border-radius: 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: center;
  background:
    linear-gradient(90deg, rgba(69, 200, 255, 0.06), transparent 38%),
    rgba(7, 12, 20, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    inset 0 -8px 14px rgba(0, 0, 0, 0.12);
}

.check-icon {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(69, 200, 255, 0.42);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-size: 0.78rem;
  line-height: 1;
  background:
    radial-gradient(circle, rgba(69, 200, 255, 0.18), rgba(7, 12, 20, 0.72));
  box-shadow:
    0 0 12px rgba(69, 200, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.checklist-item strong {
  display: block;
  color: #f7fbff;
  font-size: 0.84rem;
  letter-spacing: -0.01em;
}

.checklist-item small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.checklist-item.complete {
  border-color: rgba(118, 239, 166, 0.42);
  border-left-color: rgba(245, 189, 63, 0.56);
  background:
    linear-gradient(90deg, rgba(245, 189, 63, 0.13), transparent 44%),
    rgba(37, 151, 85, 0.18);
  box-shadow:
    0 0 18px rgba(118, 239, 166, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.checklist-item.complete .check-icon {
  border-color: rgba(245, 189, 63, 0.68);
  color: #fff3bd;
  background:
    radial-gradient(circle, rgba(245, 189, 63, 0.34), rgba(37, 151, 85, 0.28));
  box-shadow:
    0 0 14px rgba(245, 189, 63, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.treasure-stars {
  color: var(--gold);
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: 560px;
  align-self: start;
  margin: clamp(34px, 5vh, 56px) auto 0;
  padding: clamp(18px, 5vw, 30px);
  border: 3px solid #11151b;
  border-radius: clamp(16px, 4vw, 24px);
  background:
    linear-gradient(rgba(10, 14, 19, 0.42), rgba(4, 7, 11, 0.68)),
    url("./assets/dungeon-brick-floor.png") center / 230px auto repeat;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.42),
    inset 0 0 0 4px rgba(126, 139, 151, 0.2),
    inset 0 0 22px 9px rgba(0, 0, 0, 0.72),
    0 0 0 2px rgba(93, 105, 118, 0.22);
}

.board-glow {
  position: absolute;
  inset: 12%;
  pointer-events: none;
  border-radius: 50%;
  background: rgba(42, 145, 220, 0.12);
  filter: blur(44px);
}

.wall-torch {
  position: absolute;
  top: 17%;
  z-index: 4;
  width: clamp(42px, 11vw, 66px);
  height: auto;
  pointer-events: none;
  transform-origin: 50% 68%;
  filter:
    drop-shadow(0 0 5px rgba(255, 201, 70, 0.95))
    drop-shadow(0 0 15px rgba(255, 116, 22, 0.82))
    drop-shadow(0 0 30px rgba(255, 101, 16, 0.44));
  animation: torch-flicker 1.35s ease-in-out infinite alternate;
}

.wall-torch-left {
  left: clamp(-15px, -2.4vw, -8px);
}

.wall-torch-right {
  right: clamp(-15px, -2.4vw, -8px);
  animation-delay: -0.67s;
}

@keyframes torch-flicker {
  0% {
    transform: scale(0.98) rotate(-0.5deg);
    filter:
      drop-shadow(0 0 4px rgba(255, 210, 78, 0.9))
      drop-shadow(0 0 12px rgba(255, 116, 22, 0.7))
      drop-shadow(0 0 24px rgba(255, 101, 16, 0.36));
  }
  100% {
    transform: scale(1.025) rotate(0.5deg);
    filter:
      drop-shadow(0 0 7px rgba(255, 218, 104, 1))
      drop-shadow(0 0 19px rgba(255, 116, 22, 0.9))
      drop-shadow(0 0 36px rgba(255, 101, 16, 0.52));
  }
}

.board {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(2px, 0.55vw, 3px);
  overflow: hidden;
  border: clamp(5px, 1.4vw, 9px) solid rgba(19, 23, 28, 0.92);
  border-radius: clamp(7px, 1.8vw, 12px);
  background-color: #8d887d;
  background-image:
    radial-gradient(circle at 22% 30%, rgba(224, 218, 201, 0.42) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 68%, rgba(42, 39, 35, 0.32) 0 1px, transparent 1.4px),
    linear-gradient(135deg, rgba(207, 199, 180, 0.22), rgba(70, 66, 60, 0.26));
  background-position: center;
  background-size: 8px 8px, 11px 11px, cover;
  box-shadow:
    0 0 0 2px rgba(124, 137, 148, 0.25),
    inset 0 0 18px rgba(0, 0, 0, 0.9),
    0 8px 18px rgba(0, 0, 0, 0.55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .wall-torch,
  .symbol.treasure,
  .symbol.exit,
  .patrol-marker {
    animation: none;
  }
}

.tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(145, 158, 171, 0.42);
  border-radius: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
  background-color: #343c46;
  background-image:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.075)),
    url("./assets/dungeon-brick-floor.png");
  background-position: center, var(--grid-x, 50%) var(--grid-y, 50%);
  background-size: cover, 500% 500%;
  box-shadow:
    inset 1px 1px rgba(255, 255, 255, 0.06),
    inset -1px -1px rgba(0, 0, 0, 0.38);
  cursor: pointer;
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tile:not(.wall):active {
  transform: scale(0.94);
}

.tile.wall {
  border-color: rgba(13, 17, 22, 0.92);
  background-color: #151a22;
  background-image:
    linear-gradient(135deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.72)),
    url("./assets/dungeon-brick-floor.png");
  background-position: center, var(--grid-x, 50%) var(--grid-y, 50%);
  background-size: cover, 220% 220%;
  box-shadow:
    inset 0 0 14px rgba(0, 0, 0, 0.72),
    inset 0 2px rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
}

.tile.selected {
  z-index: 1;
  border-color: rgba(69, 200, 255, 0.92);
  background-image:
    linear-gradient(145deg, rgba(93, 211, 255, 0.24), rgba(38, 103, 160, 0.22)),
    url("./assets/dungeon-brick-floor.png");
  box-shadow:
    inset 0 0 0 2px rgba(69, 200, 255, 0.22),
    0 0 18px rgba(69, 200, 255, 0.3);
}

.route-index {
  position: absolute;
  z-index: 3;
  top: 5px;
  left: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(0.48rem, 1.8vw, 0.68rem);
  font-weight: 900;
}

.symbol,
.hero {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: block;
  translate: -50% -50%;
  pointer-events: none;
}

.patrol-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 80%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  translate: -50% -50%;
  filter:
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 8px rgba(236, 142, 64, 0.38));
  animation: patrol-pulse 720ms ease-in-out infinite alternate;
}

.patrol-axis {
  width: 100%;
  height: 100%;
  background: url("./assets/moving-boulder.png") center / contain no-repeat;
  transform: rotate(var(--boulder-rotation, 0deg));
  transform-origin: center;
  transition: transform 180ms ease;
}

.tile.patrol-tile {
  border-color: rgba(240, 87, 87, 0.62);
  background-image:
    linear-gradient(145deg, rgba(240, 87, 87, 0.16), rgba(0, 0, 0, 0.08) 58%),
    url("./assets/dungeon-brick-floor.png");
}

.tile.patrol-next-tile {
  border-color: rgba(245, 189, 63, 0.48);
  box-shadow:
    inset 0 0 0 2px rgba(245, 189, 63, 0.18),
    inset 0 0 22px rgba(245, 189, 63, 0.08);
}

.patrol-next-indicator {
  position: absolute;
  inset: 17%;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255, 207, 91, 0.54);
  border-radius: 16px;
  background:
    radial-gradient(circle, rgba(255, 207, 91, 0.18), rgba(255, 207, 91, 0.04) 56%, transparent 70%);
  opacity: 0.76;
  pointer-events: none;
  animation: patrol-preview-pulse 980ms ease-in-out infinite alternate;
}

.patrol-next-indicator::after {
  content: "";
  width: 22%;
  height: 22%;
  border-top: 3px solid rgba(255, 234, 165, 0.86);
  border-right: 3px solid rgba(255, 234, 165, 0.86);
  filter: drop-shadow(0 0 5px rgba(245, 189, 63, 0.5));
  transform: rotate(calc(var(--boulder-preview-rotation, 0deg) + 45deg));
  transform-origin: center;
}

@keyframes patrol-pulse {
  from { transform: scale(0.94); }
  to { transform: scale(1.04); }
}

@keyframes patrol-preview-pulse {
  from {
    opacity: 0.48;
    transform: scale(0.94);
  }

  to {
    opacity: 0.82;
    transform: scale(1);
  }
}

.hero {
  z-index: 3;
  top: 51%;
  width: 76%;
  height: 91%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter:
    drop-shadow(0 3px 2px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 4px rgba(255, 193, 96, 0.25));
  transition: transform 180ms ease;
}

.hero.moving {
  transform: scale(1.12);
}

.hero-pose-celebrate {
  width: 96%;
  height: 112%;
  top: 46%;
  filter:
    drop-shadow(0 4px 3px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 10px rgba(245, 189, 63, 0.38));
}

.hero-pose-ouch {
  width: 98%;
  height: 112%;
  top: 47%;
  filter:
    drop-shadow(0 4px 3px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 9px rgba(240, 87, 87, 0.38));
}

.hero-pose-oops {
  width: 88%;
  height: 108%;
  top: 48%;
  filter:
    drop-shadow(0 4px 3px rgba(0, 0, 0, 0.72))
    grayscale(0.06)
    drop-shadow(0 0 7px rgba(255, 193, 96, 0.2));
}

.hero-blinking-out {
  animation: hero-blink-out 2s steps(2, end) both;
}

.tile.has-hero {
  overflow: visible;
  z-index: 6;
}

.hero-hearts {
  position: absolute;
  left: 50%;
  bottom: 7%;
  z-index: 5;
  translate: -50% 0;
  padding: 2px 6px 3px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #ff6675;
  font-size: clamp(0.58rem, 1.6vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
  background: rgba(8, 12, 18, 0.74);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.48),
    0 0 12px rgba(255, 109, 120, 0.28);
  text-shadow: 0 0 8px rgba(255, 109, 120, 0.42);
}

@keyframes hero-blink-out {
  0%, 18%, 36%, 54%, 72% { opacity: 1; }
  9%, 27%, 45%, 63%, 88% { opacity: 0.18; }
  100% {
    opacity: 0;
    transform: scale(0.82) translateY(5px);
  }
}

.symbol.key {
  width: 67%;
  height: 67%;
  background: url("./assets/dungeon-key.png") center / contain no-repeat;
  filter:
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.66))
    drop-shadow(0 0 7px rgba(245, 189, 63, 0.48));
}

.symbol.treasure {
  width: 58%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: url("./assets/golden-coin.png") center / contain no-repeat;
  filter:
    drop-shadow(0 0 4px rgba(255, 226, 119, 0.85))
    drop-shadow(0 0 10px rgba(245, 189, 63, 0.48));
  animation: coin-gleam 1.8s ease-in-out infinite alternate;
}

@keyframes coin-gleam {
  from { transform: scale(0.97); }
  to { transform: scale(1.04); }
}

.symbol.door {
  width: 72%;
  height: 82%;
  background: url("./assets/wooden-arch-door.png") center / contain no-repeat;
  filter:
    drop-shadow(0 3px 3px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 7px rgba(230, 181, 86, 0.22));
}

.symbol.exit {
  width: 88%;
  height: 84%;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  filter:
    drop-shadow(0 3px 4px rgba(0, 0, 0, 0.72))
    drop-shadow(0 0 10px rgba(255, 185, 38, 0.62));
  animation: goal-chest-glow 1.65s ease-in-out infinite alternate;
}

@keyframes goal-chest-glow {
  from { transform: scale(0.96); }
  to { transform: scale(1.025); }
}

.symbol.spike-trap {
  z-index: 1;
  width: 82%;
  height: 76%;
  background: url("./assets/spike-trap.png") center / contain no-repeat;
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease;
}

.symbol.spike-trap.active {
  opacity: 1;
  filter:
    brightness(1.08)
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 9px rgba(240, 62, 62, 0.64));
}

.symbol.spike-trap.inactive {
  opacity: 0.28;
  filter: grayscale(0.5) brightness(0.58) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55));
  transform: scale(0.91);
}

.tile.cracked-floor {
  isolation: isolate;
}

.tile.cracked-floor::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.22)),
    url("./assets/dungeon-cracked-floor.png") var(--grid-x, 50%) var(--grid-y, 50%) / 500% 500%;
  opacity: 0.94;
}

.tile.blinking-trap {
  border-color: rgba(240, 87, 87, 0.65);
  background-image:
    linear-gradient(145deg, rgba(240, 87, 87, 0.2), rgba(29, 6, 10, 0.12)),
    url("./assets/dungeon-brick-floor.png");
  animation: triangle-warning 650ms ease-in-out infinite alternate;
}

@keyframes triangle-warning {
  from { box-shadow: inset 0 0 8px rgba(240, 87, 87, 0.2); }
  to { box-shadow: inset 0 0 18px rgba(240, 87, 87, 0.46); }
}

.tile.collected {
  background-image:
    radial-gradient(circle, rgba(245, 189, 63, 0.14), transparent 58%),
    url("./assets/dungeon-brick-floor.png");
}

.item-key-panel {
  position: relative;
  overflow: hidden;
  padding: 13px;
  border: 1px solid var(--dungeon-gold-line);
  border-bottom-color: rgba(83, 62, 26, 0.68);
  border-radius: 19px;
  display: grid;
  gap: 12px;
  background:
    radial-gradient(circle at 95% 0%, rgba(245, 189, 63, 0.18), transparent 4rem),
    linear-gradient(135deg, rgba(245, 189, 63, 0.09), rgba(7, 12, 20, 0.92) 48%),
    url("./assets/dungeon-brick-floor.png") center / 210px auto repeat;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.24),
    inset 0 0 0 2px rgba(255, 255, 255, 0.032);
}

.item-key-panel::before {
  position: absolute;
  left: -19px;
  bottom: -21px;
  width: 78px;
  height: 78px;
  opacity: 0.08;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  content: "";
}

.item-key-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.item-key-heading::after {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(245, 189, 63, 0.48);
  border-radius: 10px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--gold);
  font-size: 0.82rem;
  content: "▴";
  background:
    linear-gradient(180deg, rgba(104, 76, 28, 0.68), rgba(42, 31, 16, 0.78));
  box-shadow:
    0 0 12px rgba(245, 189, 63, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.item-key-panel.collapsed .item-key-heading::after {
  content: "▾";
}

.item-key-panel.collapsed .item-key-grid,
.item-key-panel.collapsed .item-key-description {
  display: none;
}

.item-key-panel.collapsed {
  gap: 0;
}

.item-key-heading:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 12px;
}

.item-key-heading .eyebrow {
  margin: 0;
}

.item-key-heading strong {
  color: #ffe7a6;
  font-size: 0.78rem;
  text-align: right;
  margin-left: auto;
  text-shadow: 0 0 10px rgba(245, 189, 63, 0.1);
}

.item-key-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.item-key-button {
  min-height: 42px;
  padding: 7px 6px;
  border: 1px solid rgba(177, 188, 196, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.46);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #c4cfdd;
  font-size: 0.7rem;
  font-weight: 850;
  background:
    linear-gradient(180deg, rgba(31, 41, 55, 0.88), rgba(12, 17, 25, 0.9));
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 -7px 12px rgba(0, 0, 0, 0.16);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, filter 120ms ease;
}

.item-key-button.selected {
  border-color: rgba(245, 189, 63, 0.68);
  color: #fff4cf;
  background:
    linear-gradient(180deg, rgba(109, 80, 29, 0.68), rgba(41, 30, 14, 0.88));
  box-shadow:
    0 0 16px rgba(245, 189, 63, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.item-key-button:hover {
  border-color: rgba(69, 200, 255, 0.34);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.item-key-description {
  min-height: 3.2em;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(69, 200, 255, 0.2);
  border-radius: 14px;
  color: #d7e0ec;
  font-size: 0.8rem;
  line-height: 1.36;
  background:
    linear-gradient(90deg, rgba(69, 200, 255, 0.05), transparent 50%),
    rgba(7, 12, 20, 0.62);
}

.mini {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-block;
  border-radius: 2px;
}

.mini.key {
  width: 20px;
  height: 20px;
  background: url("./assets/dungeon-key.png") center / contain no-repeat;
  filter: drop-shadow(0 0 3px rgba(245, 189, 63, 0.58));
}
.mini.door {
  width: 18px;
  height: 20px;
  background: url("./assets/wooden-arch-door.png") center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.mini.treasure {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: url("./assets/golden-coin.png") center / contain no-repeat;
  filter: drop-shadow(0 0 3px rgba(245, 189, 63, 0.58));
}
.mini.patrol {
  width: 16px;
  height: 16px;
  background: url("./assets/moving-boulder.png") center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.mini.spike {
  width: 16px;
  height: 14px;
  background: url("./assets/spike-trap.png") center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.mini.exit {
  width: 18px;
  height: 15px;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  filter: drop-shadow(0 0 3px rgba(245, 189, 63, 0.5));
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.button {
  min-height: 56px;
  padding: 0 15px;
  border: 1px solid var(--stone-line);
  border-bottom-color: rgba(0, 0, 0, 0.54);
  border-radius: 18px;
  color: var(--text);
  font-weight: 850;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-grid;
  grid-auto-flow: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  text-align: center;
  text-decoration: none;
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -10px 16px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease, opacity 120ms ease, filter 120ms ease, border-color 120ms ease;
}

.button:hover:not(:disabled) {
  border-color: rgba(69, 200, 255, 0.36);
  filter: brightness(1.09);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(2px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.button.secondary {
  background:
    linear-gradient(135deg, rgba(69, 200, 255, 0.08), transparent 46%),
    linear-gradient(180deg, #25303f, #111821);
}

.button.primary {
  border-color: rgba(103, 230, 157, 0.4);
  background: linear-gradient(180deg, #35bf70, #21894e);
  box-shadow: 0 10px 24px rgba(33, 137, 78, 0.28);
}

.button-icon {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(245, 189, 63, 0.2);
}

/* Dungeon Step thematic UI layer */
.ds-panel,
.score-card,
.mission-strip,
.checklist-panel,
.item-key-panel {
  isolation: isolate;
}

.ds-title {
  letter-spacing: -0.025em;
}

.ds-camp-glow::after {
  position: absolute;
  inset: auto 12% 0;
  height: 142px;
  z-index: 1;
  opacity: 0.28;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(255, 159, 63, 0.42), transparent 68%);
  filter: blur(12px);
  pointer-events: none;
  content: "";
}

.ds-stone-button,
.button.primary.play-slab {
  border-color: rgba(242, 199, 102, 0.54);
  color: #ffe7a6;
  background:
    linear-gradient(90deg, rgba(242, 199, 102, 0.16), transparent 22% 78%, rgba(242, 199, 102, 0.13)),
    repeating-linear-gradient(0deg, rgba(255, 220, 155, 0.04) 0 3px, transparent 3px 10px),
    linear-gradient(180deg, #7a4724, #4a2819);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(242, 199, 102, 0.14),
    inset 0 2px 0 rgba(255, 255, 255, 0.13),
    inset 0 -12px 18px rgba(0, 0, 0, 0.34);
}

.ds-wood-button,
.button.secondary.board-button {
  border-color: rgba(242, 199, 102, 0.44);
  color: #ffe5a8;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 28% 72%, rgba(0, 0, 0, 0.13)),
    repeating-linear-gradient(0deg, rgba(255, 220, 155, 0.06) 0 3px, transparent 3px 9px),
    linear-gradient(180deg, #7a4724, #4a2819);
}

.ds-leather-button,
.button.secondary.tag-button {
  border-color: rgba(183, 116, 64, 0.55);
  color: #f4d4a7;
  background:
    radial-gradient(circle at 12% 22%, rgba(242, 199, 102, 0.14), transparent 34%),
    linear-gradient(180deg, #6b3f22, #392113);
}

.ds-parchment-button,
.button.secondary.scroll-button {
  border-color: rgba(242, 199, 102, 0.58);
  color: #2e2214;
  text-shadow: 0 1px 0 rgba(255, 247, 210, 0.36);
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.28), transparent 32%),
    linear-gradient(180deg, #ead7a1, #b98d4a);
}

.home-card .button:hover:not(:disabled) {
  border-color: rgba(72, 214, 255, 0.64);
  filter: brightness(1.12) saturate(1.07);
  transform: translateY(-2px);
}

.home-card .button:active:not(:disabled) {
  transform: translateY(2px) scale(0.99);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.34),
    inset 0 4px 12px rgba(0, 0, 0, 0.3);
}

.topbar {
  border-radius: 24px;
}

.topbar > div:first-child {
  padding: 10px 0 4px 16px;
}

.topbar > div:first-child::before {
  width: 5px;
  background:
    linear-gradient(to bottom, rgba(72, 214, 255, 0.95), rgba(255, 159, 63, 0.95));
}

.topbar .eyebrow,
.checklist-heading .eyebrow,
.item-key-heading .eyebrow {
  text-shadow: none;
}

.topbar .eyebrow {
  color: #f2c766;
}

.jellykid-home-link {
  display: inline-block;
  width: fit-content;
  text-decoration: none;
  transition: color 120ms ease, filter 120ms ease, transform 120ms ease;
}

.jellykid-home-link:hover,
.jellykid-home-link:focus-visible {
  color: #fff1bf;
  filter: drop-shadow(0 0 10px rgba(242, 199, 102, 0.3));
  transform: translateY(-1px);
}

.checklist-heading .eyebrow {
  color: #5a3218;
}

.item-key-heading .eyebrow {
  color: #f2c766;
  text-shadow: 0 0 10px rgba(242, 199, 102, 0.18);
}

#level-title {
  color: #fff2c5;
  font-family: Georgia, "Times New Roman", "Cormorant SC", serif;
  text-shadow:
    0 2px 0 #6b3f22,
    0 6px 0 rgba(0, 0, 0, 0.28),
    0 0 24px rgba(255, 159, 63, 0.24);
}

.sound-button {
  border-color: rgba(152, 125, 78, 0.38);
  color: #f4e4bf;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 159, 63, 0.15), transparent 42%),
    linear-gradient(180deg, #2f3538, #151b20);
}

.score-card {
  border: 2px solid rgba(93, 57, 26, 0.72);
  border-radius: 18px 18px 22px 22px;
  color: #352413;
  background:
    radial-gradient(circle at 88% 18%, rgba(242, 199, 102, 0.28), transparent 3rem),
    linear-gradient(180deg, rgba(234, 215, 161, 0.97), rgba(180, 126, 61, 0.94));
  box-shadow:
    0 15px 28px rgba(0, 0, 0, 0.32),
    inset 0 0 0 2px rgba(255, 246, 212, 0.3),
    inset 0 -14px 24px rgba(89, 48, 18, 0.18);
}

.score-card::before {
  position: absolute;
  inset: 7px;
  z-index: -1;
  border: 1px dashed rgba(107, 63, 34, 0.35);
  border-radius: 13px 13px 17px 17px;
  content: "";
}

.score-card span,
.score-card small {
  color: #6b3f22;
}

.score-card > strong {
  color: #28190d;
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 0 rgba(255, 249, 219, 0.48);
}

.score-card .floor-number {
  color: #315a3f;
  text-shadow: 0 1px 0 rgba(255, 249, 219, 0.42);
}

.mission-strip {
  border: 2px solid rgba(91, 58, 31, 0.72);
  border-left-color: rgba(255, 159, 63, 0.68);
  border-radius: 18px 22px 18px 22px;
  background:
    radial-gradient(circle at 8% 45%, rgba(255, 159, 63, 0.18), transparent 4rem),
    linear-gradient(180deg, rgba(89, 53, 30, 0.84), rgba(30, 20, 16, 0.94));
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(242, 199, 102, 0.11);
}

.mission-strip::before {
  width: 26px;
  height: 26px;
  margin-top: 0.1em;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff6bf 0 10%, #ff9f3f 24% 45%, rgba(255, 159, 63, 0.05) 66%);
  box-shadow:
    0 0 20px rgba(255, 159, 63, 0.45),
    0 0 34px rgba(255, 159, 63, 0.2);
  content: "";
}

.mission-strip p {
  color: #f0ddbf;
}

.mission-strip .status-dot {
  display: none;
}

.checklist-panel {
  border: 2px solid rgba(107, 63, 34, 0.72);
  border-radius: 24px 18px 24px 18px;
  background:
    radial-gradient(circle at 88% 0%, rgba(72, 214, 255, 0.12), transparent 4.2rem),
    linear-gradient(180deg, rgba(234, 215, 161, 0.97), rgba(189, 139, 75, 0.95));
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.32),
    inset 0 0 0 2px rgba(255, 246, 212, 0.24),
    inset 0 -18px 28px rgba(107, 63, 34, 0.13);
}

.checklist-panel::before {
  opacity: 0.22;
}

.checklist-panel::after {
  position: absolute;
  top: 13px;
  left: 16px;
  right: 16px;
  z-index: -1;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent, rgba(107, 63, 34, 0.18), transparent);
  content: "";
}

.checklist-heading strong {
  color: #422711;
}

.checklist-item {
  border: 1px solid rgba(107, 63, 34, 0.26);
  border-left-color: rgba(72, 214, 255, 0.54);
  color: #2c1d0f;
  background:
    radial-gradient(circle at 0% 40%, rgba(72, 214, 255, 0.08), transparent 42%),
    rgba(255, 244, 206, 0.38);
}

.check-icon {
  border-color: rgba(49, 90, 63, 0.42);
  color: #315a3f;
  background:
    radial-gradient(circle, rgba(52, 199, 121, 0.18), rgba(255, 244, 206, 0.72));
}

.checklist-item strong {
  color: #28190d;
  font-family: Georgia, "Times New Roman", serif;
}

.checklist-item small {
  color: #604528;
}

.checklist-item.complete {
  border-color: rgba(52, 199, 121, 0.48);
  border-left-color: rgba(242, 199, 102, 0.86);
  background:
    radial-gradient(circle at 7% 50%, rgba(52, 199, 121, 0.24), transparent 38%),
    rgba(255, 244, 206, 0.52);
}

.checklist-item.complete .check-icon {
  color: #fff4c5;
  animation: quest-complete-pulse 1.8s ease-in-out infinite;
}

.item-key-panel {
  border: 2px solid rgba(94, 56, 32, 0.78);
  border-radius: 18px 22px 18px 22px;
  background:
    radial-gradient(circle at 96% 0%, rgba(242, 199, 102, 0.2), transparent 4rem),
    linear-gradient(180deg, rgba(84, 51, 31, 0.96), rgba(32, 22, 18, 0.96));
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(242, 199, 102, 0.13);
}

.item-key-panel::after {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    linear-gradient(115deg, transparent 0 45%, rgba(242, 199, 102, 0.2) 50%, transparent 56% 100%);
  animation: key-guide-glint 7s ease-in-out infinite;
  pointer-events: none;
  content: "";
}

.item-key-heading strong {
  color: #f6dcaa;
}

.item-key-heading::after {
  border-color: rgba(242, 199, 102, 0.64);
  color: #ffe39a;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.18), transparent 30%),
    linear-gradient(180deg, #8a6128, #3b2714);
}

.item-key-button {
  border-color: rgba(242, 199, 102, 0.15);
  background:
    linear-gradient(180deg, rgba(79, 48, 29, 0.9), rgba(19, 14, 12, 0.9));
}

.item-key-description {
  border-color: rgba(72, 214, 255, 0.22);
  color: #f2dfc4;
  background:
    linear-gradient(90deg, rgba(72, 214, 255, 0.06), transparent 50%),
    rgba(13, 12, 13, 0.56);
}

.controls .button.secondary {
  border-color: rgba(124, 94, 61, 0.5);
  color: #f8e5c2;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 159, 63, 0.12), transparent 34%),
    linear-gradient(180deg, #424240, #1b2024);
}

.controls .homepage-button {
  border-color: rgba(242, 199, 102, 0.42);
  background:
    repeating-linear-gradient(0deg, rgba(255, 220, 155, 0.05) 0 3px, transparent 3px 10px),
    linear-gradient(180deg, #6f4326, #302016);
}

.controls .button:hover:not(:disabled) {
  border-color: rgba(242, 199, 102, 0.66);
  filter: brightness(1.12);
}

@keyframes torch-flicker {
  from {
    opacity: 0.88;
    transform: translateY(0) scale(0.98);
    filter:
      drop-shadow(0 0 10px rgba(255, 159, 63, 0.7))
      drop-shadow(0 0 22px rgba(255, 111, 46, 0.38));
  }
  to {
    opacity: 1;
    transform: translateY(-1px) scale(1.02);
    filter:
      drop-shadow(0 0 18px rgba(255, 188, 82, 0.9))
      drop-shadow(0 0 36px rgba(255, 111, 46, 0.52));
  }
}

@keyframes torch-breathe {
  from { opacity: 0.72; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.06); }
}

@keyframes title-glow-breathe {
  from { filter: drop-shadow(0 0 12px rgba(242, 199, 102, 0.06)); }
  to { filter: drop-shadow(0 0 24px rgba(242, 199, 102, 0.2)); }
}

@keyframes dust-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-26px, 32px, 0); }
}

@keyframes fog-slide {
  from { transform: translateX(-10px) scaleX(0.9); }
  to { transform: translateX(18px) scaleX(1.08); }
}

@keyframes high-five-pop {
  from {
    opacity: 0.7;
    transform: scale(0.88) rotate(-8deg);
  }
  to {
    opacity: 1;
    transform: scale(1.08) rotate(8deg);
  }
}

@keyframes quest-complete-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(52, 199, 121, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
  50% { box-shadow: 0 0 20px rgba(52, 199, 121, 0.28), 0 0 12px rgba(242, 199, 102, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
}

@keyframes key-guide-glint {
  0%, 62%, 100% { opacity: 0; transform: translateX(-70%); }
  68% { opacity: 0.72; }
  76% { opacity: 0; transform: translateX(70%); }
}

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 12, 0.82);
  backdrop-filter: blur(13px);
  transition: opacity 180ms ease;
}

.overlay.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.result-card {
  position: relative;
  width: min(100%, 470px);
  padding: 26px 24px 24px;
  overflow: hidden;
  border: 3px solid rgba(48, 54, 62, 0.95);
  border-radius: 30px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 172, 61, 0.18), transparent 35%),
    linear-gradient(rgba(6, 9, 14, 0.38), rgba(6, 9, 14, 0.88)),
    url("./assets/dungeon-brick-floor.png") center / 260px auto repeat;
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.68),
    inset 0 0 0 2px rgba(255, 255, 255, 0.05),
    inset 0 -26px 42px rgba(0, 0, 0, 0.34);
}

.result-card::before {
  position: absolute;
  inset: 12px;
  z-index: 0;
  border: 1px solid rgba(245, 189, 63, 0.2);
  border-radius: 23px;
  content: "";
  pointer-events: none;
}

.result-card::after {
  position: absolute;
  top: -90px;
  left: 50%;
  z-index: 0;
  width: 270px;
  height: 190px;
  border-radius: 50%;
  content: "";
  translate: -50% 0;
  background: rgba(255, 170, 64, 0.2);
  filter: blur(42px);
  pointer-events: none;
}

.result-card > * {
  position: relative;
  z-index: 1;
}

.result-emblem {
  width: 62px;
  height: 62px;
  margin: 4px auto 16px;
  border: 2px solid rgba(245, 189, 63, 0.72);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff2c2;
  font-size: 1.7rem;
  background:
    radial-gradient(circle, rgba(245, 189, 63, 0.24), rgba(66, 42, 12, 0.72));
  box-shadow:
    0 0 22px rgba(245, 189, 63, 0.28),
    inset 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.run-complete-art {
  width: min(190px, 52vw);
  height: auto;
  margin: -8px auto 12px;
  display: block;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 22px rgba(69, 200, 255, 0.2));
}

.result-reward-scene {
  position: relative;
  min-height: 128px;
  margin: 2px auto 14px;
  border: 1px solid rgba(245, 189, 63, 0.2);
  border-radius: 22px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(5, 8, 13, 0.22), rgba(5, 8, 13, 0.64)),
    url("./assets/dungeon-brick-floor.png") center / 180px auto repeat;
  box-shadow:
    inset 0 12px 24px rgba(255, 182, 77, 0.08),
    inset 0 -22px 28px rgba(0, 0, 0, 0.42);
}

.result-loot-chest {
  width: min(148px, 42vw);
  aspect-ratio: 1.25;
  display: block;
  background: url("./assets/loot-chest.png") center / contain no-repeat;
  filter:
    drop-shadow(0 16px 12px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 24px rgba(245, 189, 63, 0.32));
  animation: result-chest-pop 520ms cubic-bezier(.2, 1.45, .35, 1) both;
}

.result-scene-torch {
  position: absolute;
  top: 17px;
  width: 42px;
  height: auto;
  filter:
    drop-shadow(0 0 14px rgba(255, 152, 38, 0.86))
    drop-shadow(0 0 28px rgba(255, 107, 36, 0.44));
}

.result-scene-torch-left {
  left: 18px;
}

.result-scene-torch-right {
  right: 18px;
  transform: scaleX(-1);
}

.result-scene-coin {
  position: absolute;
  width: 34px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: url("./assets/golden-coin.png") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(245, 189, 63, 0.5));
  animation: result-coin-bob 1.2s ease-in-out infinite alternate;
}

.result-scene-coin.coin-one {
  left: 30%;
  bottom: 16px;
}

.result-scene-coin.coin-two {
  right: 28%;
  top: 24px;
  width: 26px;
  animation-delay: 180ms;
}

.result-card-run-complete .result-reward-scene {
  display: none;
}

.result-card-failed .result-reward-scene {
  min-height: 96px;
  border-color: rgba(240, 87, 87, 0.34);
  background:
    linear-gradient(180deg, rgba(89, 18, 24, 0.22), rgba(5, 8, 13, 0.72)),
    url("./assets/dungeon-cracked-floor.png") center / 180px auto repeat;
}

.result-card-failed .result-loot-chest {
  width: 96px;
  aspect-ratio: 1;
  background-image: url("./assets/spike-trap.png");
  filter:
    drop-shadow(0 14px 10px rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 22px rgba(240, 87, 87, 0.34));
}

.result-card-failed .result-scene-coin {
  display: none;
}

.result-card h2 {
  margin: 0;
  color: #fff4d4;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 8vw, 2.75rem);
  line-height: 0.95;
  text-shadow: 0 3px 0 #392612, 0 10px 24px rgba(0, 0, 0, 0.58);
}

.result-stars {
  width: fit-content;
  margin: 18px auto 12px;
  padding: 8px 15px 7px;
  border: 1px solid rgba(245, 189, 63, 0.25);
  border-radius: 999px;
  color: var(--gold);
  font-size: 1.75rem;
  letter-spacing: 0.08em;
  background: rgba(5, 8, 13, 0.52);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 20px rgba(245, 189, 63, 0.12);
}

.result-card > p:not(.eyebrow) {
  min-height: 2.5em;
  margin: 0 auto 24px;
  max-width: 340px;
  color: #d7d0c2;
  line-height: 1.5;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.heart-loss-card {
  width: min(100%, 520px);
}

.heart-loss-card::after {
  background: rgba(240, 87, 87, 0.16);
}

.heart-loss-character {
  width: min(168px, 42vw);
  max-height: 210px;
  object-fit: contain;
  margin: -8px auto 8px;
  display: block;
  filter:
    drop-shadow(0 14px 18px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 14px rgba(240, 87, 87, 0.22));
}

.heart-loss-card h2 {
  color: #ffe0c0;
}

.heart-loss-actions {
  grid-template-columns: 1fr;
}

.heart-loss-actions .button {
  min-height: 52px;
}

@keyframes result-chest-pop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.86);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes result-coin-bob {
  from { transform: translateY(0) rotate(-4deg); }
  to { transform: translateY(-7px) rotate(5deg); }
}

@media (min-width: 760px) and (orientation: landscape) {
  .game-shell {
    width: min(1100px, 100%);
    grid-template-columns: minmax(230px, 0.7fr) minmax(430px, 1.2fr);
    grid-template-rows: auto auto auto auto auto auto;
    grid-template-areas:
      "topbar board"
      "checklist board"
      "mission board"
      "runstats board"
      "itemkey board"
      "controls board";
    align-items: start;
  }

  .topbar {
    grid-area: topbar;
    display: grid;
    gap: 14px;
    margin-top: clamp(44px, 8vh, 84px);
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr);
    align-items: stretch;
  }

  .score-card {
    min-width: 0;
  }

  #level-title {
    max-width: none;
  }

  .mission-strip {
    grid-area: mission;
  }

  .run-stats {
    grid-area: runstats;
  }

  .checklist-panel {
    grid-area: checklist;
  }

  .item-key-panel {
    grid-area: itemkey;
  }

  .board-frame {
    grid-area: board;
    margin-top: clamp(88px, 12vh, 122px);
  }

  .run-stats:not(.hidden) ~ .board-frame {
    margin-top: clamp(88px, 12vh, 122px);
  }

  .controls {
    grid-area: controls;
    align-self: end;
  }

  .item-key-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
    gap: 14px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 42px minmax(0, 1fr);
    align-items: stretch;
  }

  .sound-button {
    min-height: 48px;
  }

  .score-card {
    min-width: 0;
  }

  #level-title {
    max-width: none;
  }
}

@media (max-height: 690px) {
  .home-card {
    min-height: auto;
    padding-top: 30px;
  }

  .home-arch,
  .home-doorway {
    opacity: 0.62;
    transform: scale(0.9);
    transform-origin: top center;
  }

  .game-shell {
    gap: 10px;
  }

  .topbar {
    margin-top: 22px;
  }

  .item-key-panel {
    padding: 10px;
  }

  .item-key-heading strong,
  .item-key-description {
    display: none;
  }

  .item-key-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menu-torch-glow,
  .game-title,
  .home-dungeon-scene::before,
  .home-torch,
  .home-fog,
  .high-five-spark,
  .checklist-item.complete .check-icon,
  .item-key-panel::after {
    animation: none;
  }
}
