:root {
  --ink: #f8f3da;
  --muted: #cfc49d;
  --navy: #081329;
  --midnight: #111d3b;
  --blue: #173b7a;
  --blue-2: #24509a;
  --gold: #d8aa3d;
  --gold-2: #f1d06b;
  --parchment: #f0dfb4;
  --parchment-ink: #2d2417;
  --green: #2d7749;
  --green-2: #4e9a57;
  --stone: #747a83;
  --danger: #ba4b4b;
  --ok: #62be70;
  --shadow: #020611;
  --tile: 28px;
  --asset-mystic: url("assets/vendor/mystic_woods/sprites/tilesets/grass.png");
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(43, 80, 143, 0.35), transparent 34rem),
    linear-gradient(180deg, #071022 0%, #050914 100%);
  color: var(--ink);
  font-family: "Lucida Console", "Courier New", monospace;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.game-root {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-shell {
  width: min(1024px, 100%);
  min-height: 576px;
  background: #0b1731;
  border: 4px solid var(--gold);
  box-shadow:
    0 0 0 4px #5e4214,
    0 20px 60px rgba(0, 0, 0, 0.48);
  position: relative;
  overflow: hidden;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, rgba(255,255,255,0.02), transparent 18%, transparent 82%, rgba(0,0,0,0.18));
  mix-blend-mode: screen;
  opacity: 0.65;
}

.game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.38), transparent 10%, transparent 90%, rgba(0,0,0,0.38)),
    linear-gradient(0deg, rgba(0,0,0,0.3), transparent 22%, transparent 78%, rgba(255,255,255,0.04));
  z-index: 0;
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 568px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.title-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  background:
    linear-gradient(0deg, rgba(9, 36, 27, 0.84), rgba(11, 23, 49, 0.86)),
    repeating-linear-gradient(90deg, rgba(72, 147, 80, 0.12) 0 28px, rgba(31, 75, 62, 0.12) 28px 56px);
}

.game-title {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.6rem);
  line-height: 1;
  color: var(--gold-2);
  text-shadow:
    4px 4px 0 #513611,
    8px 8px 0 var(--shadow);
}

.subtitle {
  margin: 8px 0 20px;
  color: var(--ink);
  font-size: 1rem;
}

.menu-stack {
  width: min(340px, 100%);
  display: grid;
  gap: 10px;
}

.window,
.dialogue,
.menu-box {
  background: var(--blue);
  border: 3px solid var(--gold);
  box-shadow:
    inset 0 0 0 3px #0c2148,
    5px 5px 0 rgba(0, 0, 0, 0.38);
}

.window {
  padding: 14px;
}

.window.parchment {
  background: var(--parchment);
  color: var(--parchment-ink);
  box-shadow:
    inset 0 0 0 3px #b8872f,
    5px 5px 0 rgba(0, 0, 0, 0.34);
}

.window h2,
.window h3,
.panel-title {
  margin: 0 0 10px;
  color: var(--gold-2);
  font-size: 1rem;
  line-height: 1.25;
}

.window.parchment h2,
.window.parchment h3 {
  color: #5b3f12;
}

.dialogue {
  min-height: 78px;
  padding: 14px;
  line-height: 1.45;
}

.dialogue strong {
  color: var(--gold-2);
}

.rpg-button,
.choice-button,
.chip,
.icon-button {
  background: #152b58;
  color: var(--ink);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 2px #071733;
  min-height: 42px;
  padding: 8px 12px;
  text-align: left;
}

.rpg-button:hover,
.choice-button:hover,
.chip:hover,
.icon-button:hover,
.node.available:hover,
.node.mastered:hover,
.node.boss-ready:hover {
  background: var(--blue-2);
  transform: translateY(-1px);
}

.rpg-button:active,
.choice-button:active,
.chip:active,
.icon-button:active {
  transform: translateY(1px);
}

.rpg-button[disabled],
.choice-button[disabled],
.node.locked {
  opacity: 0.48;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.small-button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.82rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 14px;
  align-items: stretch;
}

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

.stat {
  background: rgba(3, 10, 28, 0.42);
  border: 2px solid rgba(216, 170, 61, 0.7);
  padding: 8px;
  min-height: 58px;
}

.stat b {
  display: block;
  color: var(--gold-2);
  margin-bottom: 4px;
}

.meter {
  width: 100%;
  height: 14px;
  background: #061022;
  border: 2px solid #051024;
  margin-top: 6px;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #58b46d, var(--gold-2));
}

.creation-form {
  display: grid;
  gap: 14px;
}

.input-field {
  display: grid;
  gap: 7px;
}

.input-field input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 3px solid var(--gold);
  background: #060f20;
  color: var(--ink);
  outline: none;
}

.class-grid,
.sprite-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.class-card,
.sprite-card {
  border: 2px solid var(--gold);
  background: #112753;
  color: var(--ink);
  padding: 10px;
  min-height: 106px;
  display: grid;
  align-content: start;
  gap: 5px;
  text-align: left;
}

.class-card.selected,
.sprite-card.selected,
.chip.selected {
  background: #28569f;
  outline: 3px solid var(--gold-2);
}

.class-card b,
.sprite-card b {
  color: var(--gold-2);
}

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

.pixel-map {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  grid-auto-rows: minmax(24px, 1fr);
  min-height: 330px;
  border: 3px solid #0a1c3d;
  background: #183923;
  position: relative;
  overflow: hidden;
}

.pixel-map::before,
.pixel-map::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.pixel-map::before {
  background:
    radial-gradient(circle at 22% 24%, rgba(241, 208, 107, 0.24) 0 4%, transparent 5%),
    radial-gradient(circle at 70% 42%, rgba(240, 223, 180, 0.18) 0 3%, transparent 4%),
    linear-gradient(120deg, transparent 0 35%, rgba(255, 255, 255, 0.07) 36% 38%, transparent 39% 100%);
  animation: map-light 5s steps(5) infinite;
}

.pixel-map::after {
  background:
    repeating-linear-gradient(90deg, transparent 0 27px, rgba(0,0,0,0.16) 27px 28px),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(0,0,0,0.16) 27px 28px);
}

.tile {
  min-height: 24px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.tile.grass {
  background:
    linear-gradient(rgba(255,255,255,0.04), rgba(0,0,0,0.06)),
    url("assets/tiles/grass.png") center / cover;
}

.tile.forest {
  background:
    url("assets/tiles/forest.png") center / cover,
    #19532f;
}

.tile.path {
  background:
    url("assets/tiles/path.png") center / cover,
    #8d662f;
}

.tile.water {
  background:
    url("assets/tiles/water.png") center / cover;
  animation: water-shift 1.6s steps(2) infinite;
}

.tile.stone {
  background:
    url("assets/tiles/stone.png") center / cover,
    var(--stone);
}

.tile.shrine {
  background:
    url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/column.png") center / contain no-repeat,
    linear-gradient(180deg, #ece1b4 0 25%, #8f8f8f 25% 74%, #595f68 74%),
    #7c838b;
}

.tile.chest {
  background:
    url("assets/tiles/chest.png") center / 90% auto no-repeat,
    url("assets/tiles/grass.png") center / cover,
    #7d4219;
}

.node {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 3px solid #4a330d;
  background: var(--gold);
  color: #181106;
  display: grid;
  place-items: center;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.42);
  transform: translate(-50%, -50%);
  font-weight: 700;
  z-index: 2;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.35);
}

.node.available {
  background: #f4d065;
  animation: node-pulse 1.8s steps(2) infinite;
}

.node.started {
  background: #8bb8ef;
}

.node.mastered {
  background: #8bdc7c;
}

.node.review {
  background: #e79255;
}

.node.boss,
.node.boss-ready {
  width: 56px;
  height: 56px;
  background: #c15454;
  color: #fff4da;
}

.node.boss-ready {
  outline: 3px solid var(--gold-2);
  animation: boss-pulse 1.1s steps(2) infinite;
}

.region-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quest-list,
.library-list,
.daily-list,
.inventory-list {
  display: grid;
  gap: 8px;
}

.quest-row,
.library-row,
.daily-row,
.item-row {
  background: rgba(3, 10, 28, 0.42);
  border: 2px solid rgba(216, 170, 61, 0.72);
  padding: 9px;
  display: grid;
  gap: 4px;
}

.quest-row b,
.library-row b {
  color: var(--gold-2);
}

.status-pill {
  display: inline-block;
  width: fit-content;
  padding: 2px 6px;
  border: 1px solid var(--gold);
  background: #071733;
  color: var(--muted);
  font-size: 0.75rem;
}

.battlefield {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 205px;
  align-items: end;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(16, 27, 61, 0.96) 0 36%, rgba(37, 57, 102, 0.96) 36% 38%, rgba(23, 38, 75, 0.96) 38% 60%, rgba(29, 69, 44, 0.94) 60% 100%),
    url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/floor_1.png") center / 48px 48px;
  border: 3px solid #09142b;
  position: relative;
  overflow: hidden;
}

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

.battlefield::before {
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, #f1d06b 0 2px, transparent 3px),
    radial-gradient(circle at 28% 24%, #f8f3da 0 1px, transparent 2px),
    radial-gradient(circle at 76% 16%, #f8f3da 0 2px, transparent 3px),
    linear-gradient(135deg, transparent 0 49%, rgba(255,255,255,0.08) 50%, transparent 51%),
    linear-gradient(28deg, transparent 0 48%, #314b6f 49% 60%, transparent 61%),
    linear-gradient(150deg, transparent 0 55%, #263c5f 56% 66%, transparent 67%);
  opacity: 0.95;
  animation: sky-shimmer 4s steps(4) infinite;
}

.battlefield::after {
  left: 8%;
  right: 8%;
  bottom: 16px;
  height: 44px;
  background:
    radial-gradient(ellipse at 24% 80%, rgba(7, 12, 20, 0.38) 0 20%, transparent 21%),
    radial-gradient(ellipse at 74% 80%, rgba(7, 12, 20, 0.4) 0 22%, transparent 23%),
    repeating-linear-gradient(90deg, rgba(98,190,112,0.22) 0 8px, rgba(41, 110, 55, 0.12) 8px 16px);
  border-top: 3px solid rgba(216, 170, 61, 0.35);
  z-index: 0;
}

.combatant {
  display: grid;
  justify-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.combat-name {
  color: var(--gold-2);
}

.sprite {
  width: 84px;
  height: 84px;
  position: relative;
  image-rendering: pixelated;
  animation: sprite-idle 1.4s steps(2) infinite;
  filter: drop-shadow(5px 8px 0 rgba(0,0,0,0.32));
}

.sprite-pilgrim,
.sprite-scribe,
.sprite-defender,
.sprite-herald,
.sprite-watchman,
.asset-enemy {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.sprite-pilgrim::before,
.sprite-pilgrim::after,
.sprite-scribe::before,
.sprite-scribe::after,
.sprite-defender::before,
.sprite-defender::after,
.sprite-herald::before,
.sprite-herald::after,
.sprite-watchman::before,
.sprite-watchman::after,
.asset-enemy::before,
.asset-enemy::after {
  display: none;
}

.sprite-pilgrim {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/doc_idle_anim_f0.png");
}

.sprite-scribe {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/wizzard_m_idle_anim_f0.png");
}

.sprite-defender {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/knight_m_idle_anim_f0.png");
}

.sprite-herald {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/elf_f_idle_anim_f0.png");
}

.sprite-watchman {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/dwarf_m_idle_anim_f0.png");
}

.sprite::before,
.sprite::after,
.sprite span {
  content: "";
  position: absolute;
  display: block;
}

.sprite-pilgrim::before {
  width: 42px;
  height: 52px;
  left: 21px;
  top: 22px;
  background: #7051b8;
  box-shadow:
    0 -14px 0 #d8b070,
    0 -22px 0 #3e2b18,
    -14px 18px 0 #513b8c,
    14px 18px 0 #513b8c,
    -12px 50px 0 #2e233e,
    12px 50px 0 #2e233e;
}

.sprite-scribe::before {
  width: 44px;
  height: 50px;
  left: 20px;
  top: 24px;
  background: #2f7d79;
  box-shadow:
    0 -14px 0 #e2b878,
    -10px -23px 0 #f0dfb4,
    10px -23px 0 #f0dfb4,
    -14px 16px 0 #1b5956,
    14px 16px 0 #1b5956,
    -12px 50px 0 #23394e,
    12px 50px 0 #23394e;
}

.sprite-defender::before {
  width: 46px;
  height: 48px;
  left: 19px;
  top: 25px;
  background: #8a3939;
  box-shadow:
    0 -14px 0 #d5a36c,
    0 -24px 0 #bfc8d0,
    -18px 12px 0 #bfc8d0,
    18px 14px 0 #7040a0,
    -12px 48px 0 #282d35,
    12px 48px 0 #282d35;
}

.sprite-herald::before {
  width: 42px;
  height: 52px;
  left: 21px;
  top: 23px;
  background: #d19a3d;
  box-shadow:
    0 -15px 0 #d7a979,
    0 -25px 0 #214777,
    -15px 15px 0 #a96b22,
    15px 15px 0 #a96b22,
    -12px 51px 0 #2c2d43,
    12px 51px 0 #2c2d43;
}

.sprite-watchman::before {
  width: 44px;
  height: 52px;
  left: 20px;
  top: 23px;
  background: #305f9d;
  box-shadow:
    0 -14px 0 #d5aa74,
    0 -25px 0 #152f57,
    -16px 14px 0 #223f71,
    16px 14px 0 #223f71,
    -12px 51px 0 #232b3c,
    12px 51px 0 #232b3c;
}

.enemy-sprite::before {
  width: 54px;
  height: 54px;
  left: 15px;
  top: 14px;
  background: #6f79d8;
  box-shadow:
    0 10px 0 #4b519d,
    -12px 18px 0 #4b519d,
    12px 18px 0 #4b519d,
    -22px 36px 0 rgba(111,121,216,0.72),
    22px 36px 0 rgba(111,121,216,0.72);
  clip-path: polygon(50% 0, 88% 16%, 100% 56%, 72% 100%, 50% 76%, 28% 100%, 0 56%, 12% 16%);
  animation: enemy-float 1.2s steps(2) infinite;
}

.enemy-sprite::after {
  width: 8px;
  height: 8px;
  left: 30px;
  top: 34px;
  background: #fff1a6;
  box-shadow: 18px 0 0 #fff1a6;
}

.boss-sprite::before {
  width: 64px;
  height: 64px;
  left: 10px;
  top: 10px;
  background: #8c344c;
  box-shadow:
    0 -8px 0 #ccad53,
    -14px 12px 0 #61283b,
    14px 12px 0 #61283b,
    -24px 38px 0 #3f2032,
    24px 38px 0 #3f2032;
  clip-path: polygon(50% 0, 95% 22%, 84% 100%, 50% 82%, 16% 100%, 5% 22%);
}

.enemy-wisp::before {
  background: #78a6ff;
  box-shadow:
    0 10px 0 #4c67c8,
    -12px 18px 0 #4c67c8,
    12px 18px 0 #4c67c8,
    -22px 36px 0 rgba(120,166,255,0.72),
    22px 36px 0 rgba(120,166,255,0.72);
}

.enemy-imp::before {
  background: #b9586b;
  box-shadow:
    -16px -6px 0 #f1d06b,
    16px -6px 0 #f1d06b,
    0 10px 0 #75334f,
    -16px 24px 0 #75334f,
    16px 24px 0 #75334f;
  clip-path: polygon(50% 0, 70% 20%, 100% 18%, 82% 48%, 92% 100%, 50% 78%, 8% 100%, 18% 48%, 0 18%, 30% 20%);
}

.enemy-bat::before {
  background: #5b4ea8;
  box-shadow:
    -28px 18px 0 #3c3478,
    28px 18px 0 #3c3478,
    0 12px 0 #332d68;
  clip-path: polygon(50% 10%, 62% 35%, 100% 6%, 82% 70%, 62% 58%, 50% 92%, 38% 58%, 18% 70%, 0 6%, 38% 35%);
}

.enemy-slime::before {
  top: 26px;
  background: #63b86b;
  box-shadow:
    0 10px 0 #3e7d46,
    -20px 26px 0 #3e7d46,
    20px 26px 0 #3e7d46;
  clip-path: polygon(20% 30%, 44% 0, 72% 12%, 100% 58%, 82% 100%, 18% 100%, 0 58%);
}

.enemy-shade::before {
  background: #6b6178;
  box-shadow:
    0 10px 0 #41394c,
    -18px 22px 0 rgba(65,57,76,0.82),
    18px 22px 0 rgba(65,57,76,0.82),
    0 42px 0 rgba(30, 27, 39, 0.74);
}

.enemy-boss::after {
  background: #f1d06b;
  box-shadow: 20px 0 0 #f1d06b;
}

.asset-enemy.enemy-wisp {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/wogol_idle_anim_f0.png");
}

.asset-enemy.enemy-imp {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/imp_idle_anim_f0.png");
}

.asset-enemy.enemy-bat {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/chort_idle_anim_f0.png");
}

.asset-enemy.enemy-slime {
  background-image: url("assets/vendor/mystic_woods/sprites/characters/slime.png");
  background-size: 588px 1092px;
  background-position: 0 0;
}

.asset-enemy.enemy-shade {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/skelet_idle_anim_f0.png");
}

.asset-enemy.enemy-boss {
  width: 110px;
  height: 110px;
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/big_demon_idle_anim_f0.png");
}

.battle-menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}

.battle-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.command-hot {
  background: #315fa8;
  outline: 2px solid var(--gold-2);
}

.hp-meter {
  width: min(180px, 100%);
  height: 12px;
  margin-top: 0;
}

.hp-meter span {
  background: linear-gradient(90deg, #62be70, #c7e77d);
}

.enemy-hp span {
  background: linear-gradient(90deg, #ba4b4b, #f1d06b);
}

.answer-area {
  min-height: 145px;
  display: grid;
  gap: 10px;
}

.choice-list,
.chip-bank {
  display: grid;
  gap: 8px;
}

.choice-button {
  position: relative;
  overflow: hidden;
}

.choice-button::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: var(--gold);
}

.chip-bank {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.answer-slots {
  min-height: 36px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.24);
  border: 2px solid rgba(216, 170, 61, 0.55);
  color: var(--gold-2);
}

.typed-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.feedback {
  min-height: 28px;
  color: var(--gold-2);
}

.feedback.bad {
  color: #ffb0a8;
}

.feedback.good {
  color: #b9ffbf;
  animation: text-pop 0.3s steps(2);
}

@keyframes map-light {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.9; }
}

@keyframes water-shift {
  0% { background-position: 0 0; }
  100% { background-position: 0 12px; }
}

@keyframes node-pulse {
  0%, 100% { box-shadow: 4px 4px 0 rgba(0,0,0,0.42), 0 0 0 rgba(241,208,107,0); }
  50% { box-shadow: 4px 4px 0 rgba(0,0,0,0.42), 0 0 18px rgba(241,208,107,0.55); }
}

@keyframes boss-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

@keyframes sky-shimmer {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

@keyframes sprite-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes enemy-float {
  0%, 100% { transform: translateY(0) scaleX(1); }
  50% { transform: translateY(-5px) scaleX(0.96); }
}

@keyframes text-pop {
  0% { transform: translateX(0); }
  50% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.answer-text {
  line-height: 1.55;
}

.blank {
  display: inline-block;
  min-width: 82px;
  border-bottom: 3px solid currentColor;
  color: var(--gold-2);
  text-align: center;
}

.footer-note {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .game-root {
    padding: 0;
    align-items: stretch;
  }

  .game-shell {
    min-height: 100vh;
    border-width: 0;
    box-shadow: none;
  }

  .screen {
    min-height: 100vh;
    padding: 12px;
  }

  .grid-2,
  .grid-3,
  .main-grid,
  .battlefield {
    grid-template-columns: 1fr;
  }

  .class-grid,
  .sprite-grid {
    grid-template-columns: 1fr;
  }

  .battle-menu {
    grid-template-columns: repeat(2, 1fr);
  }

  .pixel-map {
    grid-template-columns: repeat(12, 1fr);
    min-height: 430px;
  }

  .tile:nth-child(n + 145) {
    display: none;
  }

  .typed-row {
    grid-template-columns: 1fr;
  }
}

/* Imported asset skin. Kept at the end so it wins over CSS fallback sprites. */
.screen {
  background:
    radial-gradient(circle at 16% 12%, rgba(241, 208, 107, 0.08), transparent 18rem),
    radial-gradient(circle at 86% 72%, rgba(78, 154, 87, 0.12), transparent 20rem);
}

.creation-form .window,
.class-card,
.sprite-card {
  background:
    linear-gradient(rgba(17, 39, 83, 0.9), rgba(9, 24, 54, 0.94)),
    url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/floor_2.png") center / 32px 32px !important;
}

.sprite-card {
  min-height: 142px;
  align-content: center;
  justify-items: center;
  overflow: hidden;
}

.sprite-card .sprite {
  width: 108px;
  height: 96px;
}

.sprite-pilgrim,
.sprite-scribe,
.sprite-defender,
.sprite-herald,
.sprite-watchman,
.asset-enemy {
  background-position: center bottom !important;
  background-repeat: no-repeat !important;
  image-rendering: pixelated;
}

.sprite-pilgrim,
.sprite-scribe,
.sprite-defender,
.sprite-herald,
.sprite-watchman {
  background-size: auto 84px !important;
}

.sprite-pilgrim::before,
.sprite-pilgrim::after,
.sprite-scribe::before,
.sprite-scribe::after,
.sprite-defender::before,
.sprite-defender::after,
.sprite-herald::before,
.sprite-herald::after,
.sprite-watchman::before,
.sprite-watchman::after,
.asset-enemy::before,
.asset-enemy::after {
  content: "" !important;
  display: none !important;
  background: none !important;
  box-shadow: none !important;
}

.sprite-pilgrim {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/doc_idle_anim_f0.png") !important;
}

.sprite-scribe {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/wizzard_m_idle_anim_f0.png") !important;
}

.sprite-defender {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/knight_m_idle_anim_f0.png") !important;
}

.sprite-herald {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/elf_f_idle_anim_f0.png") !important;
}

.sprite-watchman {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/dwarf_m_idle_anim_f0.png") !important;
}

.asset-enemy {
  background-size: auto 78px !important;
}

.asset-enemy.enemy-wisp {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/wogol_idle_anim_f0.png") !important;
}

.asset-enemy.enemy-imp {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/imp_idle_anim_f0.png") !important;
}

.asset-enemy.enemy-bat {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/chort_idle_anim_f0.png") !important;
}

.asset-enemy.enemy-slime {
  background-image: url("assets/vendor/mystic_woods/sprites/characters/slime.png") !important;
  background-size: 588px 1092px !important;
  background-position: left top !important;
}

.asset-enemy.enemy-shade {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/skelet_idle_anim_f0.png") !important;
}

.asset-enemy.enemy-boss {
  width: 112px;
  height: 112px;
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/big_demon_idle_anim_f0.png") !important;
  background-size: auto 108px !important;
}

.pixel-map {
  background:
    url("assets/tiles/grass.png") center / 28px 28px,
    #183923 !important;
}

.tile.grass {
  background:
    linear-gradient(rgba(255,255,255,0.05), rgba(0,0,0,0.05)),
    url("assets/tiles/grass.png") center / cover !important;
}

.tile.forest {
  background:
    url("assets/tiles/forest.png") center / cover !important;
}

.tile.path {
  background:
    url("assets/tiles/path.png") center / cover !important;
}

.tile.water {
  background:
    url("assets/tiles/water.png") center / cover !important;
}

.tile.stone {
  background:
    url("assets/tiles/stone.png") center / cover !important;
}

.tile.chest {
  background:
    url("assets/tiles/chest.png") center / 90% auto no-repeat,
    url("assets/tiles/grass.png") center / cover !important;
}

.battlefield {
  min-height: 240px;
  padding: 20px 30px 24px;
}

.battlefield::after {
  bottom: 20px;
  height: 52px;
}

.combatant {
  gap: 5px;
  padding-bottom: 6px;
}

.combat-name,
.combatant > div:not(.meter) {
  position: relative;
  z-index: 2;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.7);
}

.combatant .sprite {
  width: 76px;
  height: 90px;
}

.sprite-pilgrim,
.sprite-scribe,
.sprite-defender,
.sprite-herald,
.sprite-watchman {
  background-size: auto 76px !important;
}

.asset-enemy {
  width: 76px;
  height: 86px;
  background-size: auto 70px !important;
}

.asset-enemy.enemy-boss {
  width: 102px;
  height: 104px;
  background-size: auto 98px !important;
}

.hp-meter {
  position: relative;
  z-index: 2;
  width: 180px;
}

/* Classic JRPG field-map pass. */
.pixel-map {
  border-color: #d8aa3d !important;
  box-shadow:
    inset 0 0 0 3px #071733,
    0 6px 0 rgba(0,0,0,0.38);
}

.pixel-map::before {
  background:
    radial-gradient(circle at 18% 76%, rgba(241, 208, 107, 0.24) 0 5%, transparent 6%),
    radial-gradient(circle at 55% 45%, rgba(240, 223, 180, 0.15) 0 4%, transparent 5%) !important;
}

.pixel-map::after {
  opacity: 0.24;
}

.map-route {
  position: absolute;
  left: 18%;
  top: 36%;
  width: 48%;
  height: 42%;
  border-left: 12px solid rgba(156, 120, 58, 0.45);
  border-bottom: 12px solid rgba(156, 120, 58, 0.45);
  border-radius: 0 0 0 36px;
  z-index: 1;
  pointer-events: none;
}

.node,
.node.boss,
.node.boss-ready {
  width: 34px !important;
  height: 34px !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none;
  color: transparent;
  transform: translate(-50%, -50%) !important;
  transition: filter 0.12s steps(2), scale 0.12s steps(2);
  z-index: 3;
  opacity: 1;
}

.node:hover,
.node.available:hover,
.node.mastered:hover,
.node.boss-ready:hover {
  transform: translate(-50%, -50%) !important;
  filter: brightness(1.25);
}

.node[disabled],
.node.locked {
  opacity: 0.46;
}

.node-icon {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.45));
}

.node-camp .node-icon {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/chest_full_open_anim_f0.png");
}

.node-scroll .node-icon {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/doors_leaf_closed.png");
}

.node-tower .node-icon {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/column.png");
}

.node.mastered .node-icon {
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.45)) saturate(1.2) brightness(1.25);
}

.node.review .node-icon,
.node.available .node-icon {
  animation: node-bob 1.4s steps(2) infinite;
}

.node.boss .node-icon,
.node.boss-ready .node-icon {
  background-image: url("assets/vendor/dungeon_tileset_0x72/0x72_DungeonTilesetII_v1.7/frames/skull.png");
  background-size: 88% auto;
}

.node.boss-ready .node-icon {
  animation: boss-pulse 1.1s steps(2) infinite;
}

.party-marker {
  position: absolute;
  width: 38px !important;
  height: 44px !important;
  transform: translate(-50%, -50%) !important;
  z-index: 4;
  pointer-events: none;
  background-size: auto 38px !important;
  filter: drop-shadow(3px 5px 0 rgba(0,0,0,0.45));
}

@keyframes node-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}
