:root {
  color-scheme: dark;
  --ink: #0b1111;
  --ink-soft: #121a19;
  --paper: #eee7d4;
  --paper-muted: #b8b5a8;
  --ember: #c94d2a;
  --ember-bright: #ed7a32;
  --brass: #c6a15b;
  --brass-pale: #e1c787;
  --teal: #4f8580;
  --island-sea: #3f7370;
  --island-grove: #365a45;
  --island-field: #8f8b55;
  --island-earth: #705b43;
  --peach-blossom: #d58f98;
  --line: rgba(225, 199, 135, 0.32);
  --shadow: rgba(0, 0, 0, 0.54);
  font-family: "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

button {
  font: inherit;
  letter-spacing: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brass-pale);
  outline-offset: 4px;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 4px;
  transform: translateY(-160%);
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 0;
  isolation: isolate;
  overflow: hidden;
  background: var(--island-grove);
}

.scene-art,
.scene-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-art {
  z-index: -4;
  object-fit: cover;
  object-position: center 48%;
  filter: saturate(0.88) brightness(1.04) hue-rotate(-6deg);
  transform: scale(1.015);
  transition: transform 900ms ease, filter 500ms ease;
}

.scene-shade {
  z-index: -3;
  background:
    linear-gradient(0deg, rgba(112, 91, 67, 0.42), transparent 42%),
    linear-gradient(90deg, rgba(14, 31, 26, 0.84) 0%, rgba(54, 90, 69, 0.42) 43%, rgba(213, 143, 152, 0.12) 70%, rgba(63, 115, 112, 0.34) 100%);
}

.app[data-state="playing"] .scene-art,
.app[data-state="paused"] .scene-art,
.app[data-state="inventory"] .scene-art,
.app[data-state="quests"] .scene-art,
.app[data-state="character-stats"] .scene-art,
.app[data-state="skills"] .scene-art,
.app[data-state="drop-history"] .scene-art,
.app[data-state="dialogue"] .scene-art,
.app[data-state="merchant"] .scene-art,
.app[data-state="dead"] .scene-art {
  transform: scale(1.06);
}

.app[data-state="playing"] .scene-shade,
.app[data-state="paused"] .scene-shade,
.app[data-state="inventory"] .scene-shade,
.app[data-state="quests"] .scene-shade,
.app[data-state="character-stats"] .scene-shade,
.app[data-state="skills"] .scene-shade,
.app[data-state="drop-history"] .scene-shade,
.app[data-state="dialogue"] .scene-shade,
.app[data-state="merchant"] .scene-shade,
.app[data-state="dead"] .scene-shade {
  background:
    linear-gradient(0deg, rgba(112, 91, 67, 0.14), transparent 48%),
    rgba(17, 39, 32, 0.14);
}

.game-screen {
  isolation: isolate;
  overflow: hidden;
  background-color: #171512;
  background-image:
    linear-gradient(180deg, rgba(9, 12, 12, 0.72), rgba(36, 28, 21, 0.46)),
    repeating-linear-gradient(
      90deg,
      rgba(112, 82, 48, 0.13) 0,
      rgba(112, 82, 48, 0.13) 2px,
      rgba(15, 18, 17, 0.08) 2px,
      rgba(15, 18, 17, 0.08) 12px
    );
}

.game-world-frame {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  overflow: hidden;
  background: var(--island-grove);
  border: 1px solid #8d7448;
  border-radius: 2px;
  box-shadow:
    0 0 0 2px #252825,
    0 0 0 4px rgba(168, 133, 73, 0.46),
    0 14px 38px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(236, 208, 143, 0.24);
  transform: translate(-50%, -50%);
}

.game-world-frame::before {
  position: absolute;
  z-index: 2;
  inset: 3px;
  content: "";
  border: 1px solid rgba(20, 23, 21, 0.72);
  box-shadow: inset 0 0 0 1px rgba(225, 199, 135, 0.14);
  pointer-events: none;
}

.game-canvas {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--island-grove);
  outline: none;
  touch-action: none;
}

.game-canvas:focus-visible {
  outline: 2px solid var(--brass-pale);
  outline-offset: -4px;
}

.game-vignette {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 150px rgba(9, 25, 22, 0.3),
    inset 0 -60px 90px rgba(9, 10, 9, 0.12);
}

.screen {
  position: absolute;
  inset: 0;
}

.screen[hidden],
.pause-layer[hidden],
.death-layer[hidden],
.inventory-layer[hidden],
.quest-log-layer[hidden],
.character-stats-layer[hidden],
.skills-layer[hidden],
.drop-history-layer[hidden],
.dialogue-layer[hidden],
.merchant-layer[hidden],
.npc-interact-button[hidden],
.dialogue-quest[hidden],
.dialogue-quest-reward[hidden],
.dialogue-actions .button[hidden],
.target-frame[hidden],
.quest-tracker[hidden],
.quest-log-empty[hidden],
.skills-empty[hidden],
.merchant-tab-panel[hidden],
.inventory-tab-panel[hidden],
.merchant-empty[hidden],
.quest-completion-banner[hidden],
.inventory-notice[hidden],
.drop-history-notice[hidden],
.menu-save-summary[hidden],
.menu-save-status[hidden],
.menu-actions .button[hidden],
.toast[hidden] {
  display: none;
}

.menu-screen {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: max(44px, env(safe-area-inset-top)) max(56px, env(safe-area-inset-right))
    max(46px, env(safe-area-inset-bottom)) max(64px, env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand-block {
  width: min(610px, 54vw);
  margin-bottom: 34px;
}

.brand-seal {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 19px;
  place-items: center;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
}

.brand-seal span {
  width: 12px;
  height: 12px;
  background: var(--ember);
  border: 2px solid var(--ink);
}

.eyebrow,
.pause-kicker,
.dialog-kicker {
  margin: 0;
  color: var(--brass-pale);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 8px 0 4px;
  color: var(--paper);
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 5.1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.72);
}

.tagline {
  margin: 13px 0 0;
  color: var(--paper-muted);
  font-size: 1rem;
  line-height: 1.7;
}

.menu-actions {
  display: grid;
  width: 272px;
  gap: 10px;
}

.menu-save-summary {
  display: flex;
  width: min(420px, 100%);
  margin: 0 0 13px;
  align-items: baseline;
  gap: 10px;
  color: var(--paper-muted);
  font-size: 0.8rem;
}

.menu-save-summary > span {
  color: var(--brass-pale);
  font-weight: 700;
}

.menu-save-summary strong {
  color: var(--paper);
  font-size: 0.86rem;
}

.menu-save-status {
  width: min(440px, 100%);
  margin: 12px 0 0;
  color: var(--paper-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease,
    transform 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fff8e8;
  background: var(--ember);
  border-color: #ec764e;
  box-shadow: 0 10px 34px rgba(91, 21, 10, 0.34);
}

.button-primary:hover {
  background: #dc5a32;
}

.button-secondary {
  color: var(--paper);
  background: #1b2524;
  border-color: rgba(225, 199, 135, 0.38);
}

.button-secondary:hover {
  background: #25302e;
  border-color: var(--brass);
}

.button-quiet {
  color: var(--paper-muted);
  background: transparent;
  border-color: rgba(184, 181, 168, 0.18);
}

.button-quiet:hover {
  color: var(--paper);
  border-color: rgba(184, 181, 168, 0.42);
}

.button-danger {
  color: #fff8e8;
  background: #9f3526;
  border-color: #d05b43;
}

.button-danger:hover {
  background: #b8442e;
}

#primary-action,
#new-game-action {
  width: 100%;
}

#primary-action {
  min-height: 56px;
  justify-content: space-between;
  padding: 0 20px 0 24px;
  font-size: 1rem;
}

.button-arrow {
  font-family: Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
}

.menu-meta {
  display: flex;
  margin-top: 20px;
  align-items: center;
  gap: 10px;
  color: rgba(238, 231, 212, 0.58);
  font-size: 0.72rem;
}

.meta-divider {
  width: 3px;
  height: 3px;
  background: var(--brass);
  transform: rotate(45deg);
}

.embers {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ember {
  position: absolute;
  top: -18px;
  width: 7px;
  height: 11px;
  background: var(--peach-blossom);
  border-radius: 60% 16% 58% 30%;
  box-shadow: 0 2px 5px rgba(43, 28, 28, 0.24);
  opacity: 0;
  animation: petal-drift 8s linear infinite;
}

.ember-1 { left: 42%; animation-delay: -1s; }
.ember-2 { left: 48%; animation-delay: -5s; animation-duration: 10s; }
.ember-3 { left: 56%; animation-delay: -3s; animation-duration: 7s; }
.ember-4 { left: 63%; animation-delay: -7s; animation-duration: 11s; }
.ember-5 { left: 72%; animation-delay: -4s; animation-duration: 9s; }
.ember-6 { left: 81%; animation-delay: -6s; animation-duration: 8s; }
.ember-7 { left: 88%; animation-delay: -2s; animation-duration: 12s; }
.ember-8 { left: 35%; animation-delay: -8s; animation-duration: 13s; }

@keyframes petal-drift {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  12% { opacity: 0.9; }
  72% { opacity: 0.46; }
  100% { transform: translate3d(42px, 86vh, 0) rotate(280deg); opacity: 0; }
}

.hud {
  position: absolute;
  z-index: 6;
  top: max(22px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  left: max(24px, env(safe-area-inset-left));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.player-summary {
  display: flex;
  width: 294px;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px 8px 8px;
  background: rgba(8, 14, 14, 0.82);
  border: 1px solid rgba(225, 199, 135, 0.28);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.player-summary.is-hit {
  animation: player-hit 240ms ease-out;
}

.player-summary.is-rebirth {
  animation: player-rebirth 720ms ease-out;
}

.player-summary.is-critical {
  border-color: rgba(201, 77, 42, 0.72);
  box-shadow: 0 0 0 1px rgba(201, 77, 42, 0.16), 0 12px 30px rgba(0, 0, 0, 0.32);
}

.player-summary.is-dead {
  filter: grayscale(0.7);
  opacity: 0.72;
}

@keyframes player-hit {
  0% { transform: translateX(0); }
  35% { transform: translateX(-5px); background: rgba(113, 34, 28, 0.94); }
  70% { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

@keyframes player-rebirth {
  0% {
    border-color: rgba(255, 246, 184, 0.96);
    box-shadow: 0 0 0 1px rgba(255, 246, 184, 0.72), 0 0 28px rgba(113, 230, 218, 0.66);
    filter: brightness(1.5);
  }
  55% {
    border-color: rgba(112, 214, 205, 0.84);
    box-shadow: 0 0 0 1px rgba(112, 214, 205, 0.42), 0 0 18px rgba(112, 214, 205, 0.34);
  }
  100% {
    filter: brightness(1);
  }
}

.hud-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}

.hud-action-row {
  display: flex;
  gap: 8px;
}

.gold-balance {
  display: flex;
  min-width: 98px;
  min-height: 30px;
  padding: 5px 9px;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: #f2d47f;
  background: rgba(8, 14, 14, 0.82);
  border: 1px solid rgba(225, 199, 135, 0.3);
  border-radius: 5px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

.gold-balance > span:last-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 4px;
}

.gold-balance strong {
  overflow: hidden;
  max-width: 100px;
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.gold-balance small {
  color: var(--paper-muted);
  font-size: 0.56rem;
}

.gold-balance-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  background: #d8a936;
  border: 1px solid #ffe19a;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #a66d20, 0 1px 4px rgba(0, 0, 0, 0.42);
}

.gold-balance-icon::after {
  position: absolute;
  inset: 3px;
  content: "";
  border: 1px solid rgba(255, 238, 174, 0.7);
  border-radius: 50%;
}

.quest-tracker {
  position: absolute;
  z-index: 6;
  top: max(114px, calc(env(safe-area-inset-top) + 98px));
  left: max(24px, env(safe-area-inset-left));
  display: grid;
  width: min(294px, calc(100% - 48px));
  padding: 2px 0 2px 12px;
  gap: 3px;
  color: var(--paper);
  border-left: 2px solid rgba(198, 161, 91, 0.82);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.92);
  pointer-events: none;
}

.quest-tracker-kicker,
.quest-tracker small {
  color: var(--brass-pale);
  font-size: 0.6rem;
  font-weight: 700;
}

.quest-tracker strong {
  overflow: hidden;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quest-tracker > span:not(.quest-tracker-kicker) {
  color: var(--paper-muted);
  font-size: 0.7rem;
}

.quest-tracker.is-complete,
.quest-tracker.is-ready {
  border-left-color: #70b7a6;
}

.quest-tracker.is-complete small,
.quest-tracker.is-ready small {
  color: #9bd1c3;
}

.quest-tracker.is-completed {
  border-left-color: rgba(184, 181, 168, 0.72);
}

.quest-tracker.is-completed > span:not(.quest-tracker-kicker),
.quest-tracker.is-completed small {
  color: rgba(238, 231, 212, 0.7);
}

.target-frame {
  position: absolute;
  z-index: 6;
  top: max(24px, env(safe-area-inset-top));
  left: 50%;
  width: min(270px, calc(100% - 48px));
  padding: 8px 10px 10px;
  color: var(--paper);
  background: rgba(8, 14, 14, 0.84);
  border: 1px solid rgba(225, 199, 135, 0.34);
  border-radius: 5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.target-line {
  display: flex;
  margin-bottom: 6px;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.73rem;
}

.target-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.target-line span {
  flex: 0 0 auto;
  color: var(--brass-pale);
  font-size: 0.61rem;
}

.target-health {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: #241d1b;
  border: 1px solid rgba(238, 231, 212, 0.16);
  border-radius: 2px;
}

.target-health > span {
  display: block;
  width: 100%;
  height: 100%;
  background: #a94031;
  transition: width 120ms ease, background-color 120ms ease;
}

.target-health small {
  position: absolute;
  inset: -1px 0 0;
  color: #fff7ea;
  font-size: 0.5rem;
  line-height: 10px;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.target-frame.is-broken .target-health > span,
.target-frame.is-defeated .target-health > span {
  background: #62564d;
}

.target-frame.is-paralyzed {
  border-color: #73ddd4;
  box-shadow:
    0 0 0 1px rgba(100, 72, 166, 0.9),
    0 0 18px rgba(73, 218, 207, 0.34),
    0 12px 30px rgba(0, 0, 0, 0.32),
    inset 0 0 12px rgba(104, 73, 172, 0.18);
}

.target-frame.is-paralyzed .target-line span {
  color: #baf8f0;
  text-shadow: 0 0 8px rgba(80, 223, 213, 0.52);
}

.target-frame.is-paralyzed .target-health {
  border-color: rgba(134, 231, 220, 0.56);
}

.target-frame.is-paralyzed .target-health > span {
  background: linear-gradient(90deg, #6257ad, #43bfb8 58%, #9c72cc);
}

.portrait {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  overflow: hidden;
  background: #315f5a;
  border: 1px solid var(--brass);
  border-radius: 4px;
}

.portrait::before {
  position: absolute;
  top: 8px;
  left: 11px;
  width: 24px;
  height: 23px;
  content: "";
  background: #efbd91;
  border: 2px solid #422d39;
  border-radius: 48% 48% 45% 45%;
}

.portrait::after {
  position: absolute;
  bottom: -10px;
  left: 4px;
  width: 38px;
  height: 31px;
  content: "";
  background: #cf5b45;
  border: 2px solid #422d39;
  border-radius: 44% 44% 6px 6px;
}

.portrait-mark {
  position: absolute;
  z-index: 2;
  top: 3px;
  left: 8px;
  width: 30px;
  height: 18px;
  background: #382d3b;
  border-radius: 50% 50% 28% 24%;
}

.player-vitals {
  flex: 1;
  min-width: 0;
}

.player-line {
  display: flex;
  margin-bottom: 6px;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--paper);
  font-size: 0.76rem;
}

.player-line strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-line span {
  flex: 0 0 auto;
  color: var(--brass-pale);
  font-size: 0.66rem;
}

.player-line .player-stats {
  display: flex;
  align-items: center;
  gap: 4px;
}

.player-stats span {
  color: var(--brass-pale);
  font-size: 0.63rem;
}

.meter {
  position: relative;
  height: 11px;
  overflow: hidden;
  background: #222a28;
  border: 1px solid rgba(238, 231, 212, 0.16);
  border-radius: 2px;
}

.meter + .meter {
  height: 5px;
  margin-top: 4px;
}

.meter > span {
  display: block;
  height: 100%;
}

.health-meter > span {
  background: #a94031;
  transition: width 140ms ease, background-color 140ms ease;
}

.player-summary.is-critical .health-meter > span {
  background: #d55335;
}

.mana-meter {
  height: 9px !important;
  margin-top: 3px !important;
  border-color: rgba(105, 166, 220, 0.32);
}

.mana-meter > span {
  background: #397fba;
  transition: width 160ms ease, background-color 160ms ease;
}

.mana-meter small {
  font-size: 0.45rem;
  line-height: 9px;
}

.player-summary.is-mana-empty .mana-meter > span {
  background: #536f86;
}

.player-summary.is-mana-insufficient .mana-meter {
  animation: mana-insufficient 360ms ease-out 2;
  border-color: rgba(118, 191, 255, 0.9);
}

@keyframes mana-insufficient {
  0%, 100% { box-shadow: 0 0 0 rgba(82, 158, 222, 0); }
  50% { box-shadow: 0 0 10px rgba(82, 158, 222, 0.82); }
}

.experience-meter {
  height: 9px !important;
  margin-top: 3px !important;
}

.experience-meter > span {
  background: var(--teal);
  transition: width 180ms ease;
}

.experience-meter small {
  font-size: 0.45rem;
  line-height: 9px;
}

.meter small {
  position: absolute;
  inset: -1px 0 0;
  color: #fff7ea;
  font-size: 0.5rem;
  line-height: 11px;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  color: var(--paper);
  background: rgba(8, 14, 14, 0.82);
  border: 1px solid rgba(225, 199, 135, 0.32);
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.icon-button:hover {
  background: #202b29;
  border-color: var(--brass);
}

.inventory-button,
.drop-history-button {
  position: relative;
}

.character-stats-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}

.character-stats-icon::before {
  position: absolute;
  top: 1px;
  left: 8px;
  width: 8px;
  height: 8px;
  content: "";
  background: var(--brass-pale);
  border: 1px solid rgba(23, 29, 28, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(225, 199, 135, 0.36);
}

.character-stats-icon::after {
  position: absolute;
  right: 3px;
  bottom: 1px;
  left: 3px;
  height: 10px;
  content: "";
  background: linear-gradient(180deg, #a8503d, #61372f);
  border: 1px solid rgba(225, 199, 135, 0.72);
  border-radius: 8px 8px 2px 2px;
  box-shadow: inset 0 0 0 1px rgba(18, 23, 22, 0.45);
}

.skills-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  transform: rotate(-45deg);
}

.skills-icon::before,
.skills-icon::after {
  position: absolute;
  left: 10px;
  width: 4px;
  content: "";
  background: currentColor;
  border-radius: 1px;
}

.skills-icon::before {
  top: 1px;
  height: 15px;
  clip-path: polygon(50% 0, 100% 18%, 100% 100%, 0 100%, 0 18%);
}

.skills-icon::after {
  top: 17px;
  height: 6px;
  background: var(--brass-pale);
}

.skills-icon > span {
  position: absolute;
  top: 14px;
  left: 5px;
  width: 14px;
  height: 3px;
  background: var(--brass-pale);
  border-radius: 1px;
}

.quest-log-icon {
  position: relative;
  width: 23px;
  height: 18px;
}

.quest-log-icon::before {
  position: absolute;
  top: 1px;
  right: 0;
  width: 16px;
  height: 2px;
  content: "";
  background: currentColor;
  box-shadow: 0 7px 0 currentColor, 0 14px 0 currentColor;
}

.quest-log-icon::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 4px;
  content: "";
  background: var(--brass-pale);
  border-radius: 1px;
  box-shadow: 0 7px 0 var(--brass-pale), 0 14px 0 var(--brass-pale);
}

.bag-icon {
  position: relative;
  width: 22px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.bag-icon::before {
  position: absolute;
  top: -8px;
  left: 4px;
  width: 10px;
  height: 8px;
  content: "";
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.bag-icon::after {
  position: absolute;
  top: 6px;
  left: 4px;
  width: 10px;
  height: 2px;
  content: "";
  background: currentColor;
}

.inventory-notice {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  background: var(--ember-bright);
  border: 1px solid #fff1c8;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(237, 122, 50, 0.72);
}

.drop-history-icon {
  position: relative;
  display: block;
  width: 19px;
  height: 22px;
  border-right: 2px solid currentColor;
  border-left: 2px solid currentColor;
}

.drop-history-icon::before,
.drop-history-icon::after {
  position: absolute;
  left: -4px;
  width: 23px;
  height: 5px;
  content: "";
  border: 2px solid currentColor;
  border-radius: 5px;
}

.drop-history-icon::before {
  top: -1px;
  background: rgba(225, 199, 135, 0.16);
}

.drop-history-icon::after {
  bottom: -1px;
  background: rgba(79, 133, 128, 0.22);
}

.drop-history-notice {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  place-items: center;
  color: #fff8e5;
  background: #a7442d;
  border: 1px solid #ffe5a7;
  border-radius: 9px;
  box-shadow: 0 2px 9px rgba(0, 0, 0, 0.5), 0 0 10px rgba(237, 122, 50, 0.48);
  font-size: 0.52rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
}

.minimap-shell {
  position: relative;
  width: 162px;
  height: 106px;
  overflow: hidden;
  background: rgba(8, 14, 14, 0.86);
  border: 1px solid rgba(225, 199, 135, 0.38);
  border-radius: 5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.minimap-canvas {
  display: block;
  width: 160px;
  height: 104px;
}

.minimap-label {
  position: absolute;
  right: 6px;
  bottom: 5px;
  padding: 2px 5px;
  color: rgba(238, 231, 212, 0.8);
  background: rgba(7, 12, 12, 0.72);
  border-radius: 2px;
  font-size: 0.58rem;
  pointer-events: none;
}

.pause-icon {
  position: relative;
  width: 14px;
  height: 18px;
}

.pause-icon::before,
.pause-icon::after {
  position: absolute;
  top: 0;
  width: 4px;
  height: 18px;
  content: "";
  background: currentColor;
  border-radius: 1px;
}

.pause-icon::before { left: 1px; }
.pause-icon::after { right: 1px; }

.location-banner {
  position: absolute;
  z-index: 5;
  top: 14%;
  left: 50%;
  display: flex;
  width: 380px;
  align-items: center;
  gap: 14px;
  color: var(--paper);
  text-align: center;
  text-shadow: 0 2px 8px #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms ease;
  transform: translate(-50%, -8px);
}

.location-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.location-banner > div {
  flex: 0 0 auto;
}

.location-banner strong,
.location-banner small {
  display: block;
}

.location-banner strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.4rem;
}

.location-banner small {
  margin-top: 3px;
  color: var(--brass-pale);
  font-size: 0.65rem;
}

.location-rule {
  width: 100%;
  height: 1px;
  background: var(--line);
}

.movement-pad {
  position: absolute;
  z-index: 7;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: max(22px, env(safe-area-inset-left));
  display: none;
  width: 120px;
  height: 120px;
  place-items: center;
  touch-action: none;
  user-select: none;
}

.movement-pad-ring {
  position: relative;
  width: 112px;
  height: 112px;
  background: rgba(8, 14, 14, 0.5);
  border: 1px solid rgba(225, 199, 135, 0.32);
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}

.movement-pad-ring::before,
.movement-pad-ring::after {
  position: absolute;
  content: "";
  background: rgba(225, 199, 135, 0.14);
}

.movement-pad-ring::before {
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 1px;
}

.movement-pad-ring::after {
  top: 50%;
  right: 12px;
  left: 12px;
  height: 1px;
}

.movement-knob {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  background: rgba(198, 161, 91, 0.72);
  border: 2px solid rgba(238, 231, 212, 0.72);
  border-radius: 50%;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.38);
  transform: translate(-50%, -50%);
}

.attack-button {
  position: absolute;
  z-index: 7;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: grid;
  width: 64px;
  height: 64px;
  padding: 0;
  place-items: center;
  color: var(--paper);
  background: rgba(126, 50, 36, 0.88);
  border: 2px solid rgba(225, 199, 135, 0.76);
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38), inset 0 0 18px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  touch-action: none;
  transition: background-color 100ms ease, transform 100ms ease, box-shadow 100ms ease;
}

.attack-button:hover {
  background: rgba(157, 62, 40, 0.96);
}

.attack-button.is-attacking {
  background: #bd5030;
  box-shadow: 0 0 0 4px rgba(225, 199, 135, 0.12), 0 8px 24px rgba(0, 0, 0, 0.4);
  transform: scale(0.93);
}

.attack-icon {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  transform: rotate(-42deg);
}

.attack-icon::before {
  position: absolute;
  top: 1px;
  left: 14px;
  width: 7px;
  height: 25px;
  content: "";
  background: #e8e3d2;
  clip-path: polygon(50% 0, 100% 20%, 100% 100%, 0 100%, 0 20%);
  box-shadow: inset -2px 0 rgba(74, 91, 88, 0.5);
}

.attack-icon::after {
  position: absolute;
  bottom: 4px;
  left: 7px;
  width: 21px;
  height: 6px;
  content: "";
  background: var(--brass-pale);
  border: 1px solid #3e2d21;
  box-shadow: 0 8px 0 -1px #513728;
}

.skill-hotbar {
  position: absolute;
  z-index: 7;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  max-width: calc(100vw - 240px);
  grid-template-columns: repeat(12, 56px);
  gap: 4px;
  pointer-events: auto;
  transform: translateX(-50%);
}

.skill-quick-slot {
  position: relative;
  display: grid;
  width: 56px;
  height: 64px;
  padding: 6px 4px 5px;
  overflow: hidden;
  align-content: center;
  justify-items: center;
  gap: 2px;
  color: var(--paper);
  background: rgba(12, 20, 19, 0.92);
  border: 1px solid rgba(225, 199, 135, 0.42);
  border-radius: 5px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), inset 0 0 14px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  touch-action: manipulation;
}

.skill-quick-slot:hover,
.skill-quick-slot:focus-visible {
  background: rgba(28, 48, 44, 0.96);
  border-color: rgba(143, 204, 190, 0.78);
}

.skill-quick-slot.is-selected {
  border-color: #9bd1c3;
  box-shadow: 0 0 0 2px rgba(112, 183, 166, 0.2), 0 8px 22px rgba(0, 0, 0, 0.38);
}

.skill-quick-slot.is-active {
  background: rgba(29, 66, 59, 0.96);
  border-color: #e5d08f;
  box-shadow:
    0 0 0 2px rgba(112, 183, 166, 0.26),
    0 0 18px rgba(112, 183, 166, 0.34),
    inset 0 0 16px rgba(229, 208, 143, 0.12);
}

.skill-quick-slot.is-active::after {
  position: absolute;
  inset: 3px;
  content: "";
  pointer-events: none;
  border: 1px solid rgba(229, 208, 143, 0.5);
  border-radius: 3px;
  animation: skill-aura-pulse 1.6s ease-in-out infinite;
}

.skill-quick-slot.is-active .skill-quick-slot-mark {
  color: #fff2bc;
  background: rgba(69, 121, 109, 0.88);
  border-color: rgba(229, 208, 143, 0.72);
}

.skill-quick-slot.is-active small {
  color: #d9eee8;
  font-weight: 700;
}

.skill-quick-slot.is-enabled {
  background: rgba(57, 48, 28, 0.96);
  border-color: #dfbd6b;
  box-shadow:
    0 0 0 2px rgba(223, 189, 107, 0.16),
    0 8px 22px rgba(0, 0, 0, 0.38),
    inset 0 0 15px rgba(223, 189, 107, 0.1);
}

.skill-quick-slot.is-enabled .skill-quick-slot-mark {
  color: #fff0b7;
  background: rgba(123, 89, 39, 0.9);
  border-color: rgba(240, 207, 131, 0.72);
}

.skill-quick-slot.is-enabled small {
  color: #f0d897;
  font-weight: 700;
}

.skill-quick-slot.is-cooldown {
  background: rgba(21, 29, 28, 0.96);
  border-color: rgba(147, 159, 154, 0.5);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), inset 0 0 14px rgba(0, 0, 0, 0.36);
}

.skill-quick-slot.is-cooldown .skill-quick-slot-mark {
  color: #bdc6c2;
  background: rgba(55, 65, 62, 0.88);
  border-color: rgba(172, 184, 179, 0.42);
}

.skill-quick-slot.is-cooldown small {
  color: #c3cbc7;
}

.skill-quick-slot.is-insufficient {
  border-color: rgba(213, 125, 91, 0.72);
  background: rgba(63, 31, 27, 0.94);
}

.skill-quick-slot.is-empty {
  color: rgba(238, 231, 212, 0.58);
  background: rgba(8, 14, 14, 0.72);
  border-style: dashed;
}

.skill-quick-slot kbd {
  position: absolute;
  top: 3px;
  left: 4px;
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: #f2dfad;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(225, 199, 135, 0.36);
  border-radius: 3px;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.56rem;
  font-weight: 800;
}

.skill-quick-slot[data-auto="on"]::before {
  position: absolute;
  z-index: 2;
  top: 3px;
  right: 4px;
  display: grid;
  width: 17px;
  height: 17px;
  content: "自";
  place-items: center;
  pointer-events: none;
  color: #2b2419;
  background: #dfbd6b;
  border: 1px solid #f0d897;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
}

.skill-quick-slot-mark {
  display: grid;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  place-items: center;
  color: #f0cf83;
  background: rgba(112, 59, 47, 0.72);
  border: 1px solid rgba(225, 199, 135, 0.36);
  border-radius: 3px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 0.78rem;
  font-weight: 700;
}

.skill-quick-slot.is-passive .skill-quick-slot-mark {
  color: #c5e5dc;
  background: rgba(60, 110, 101, 0.72);
  border-color: rgba(112, 183, 166, 0.54);
}

.skill-quick-slot strong,
.skill-quick-slot small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-quick-slot strong {
  font-size: 0.62rem;
  line-height: 1.15;
}

.skill-quick-slot small {
  color: var(--paper-muted);
  font-size: 0.51rem;
  line-height: 1.1;
}

.skill-quick-slot.is-insufficient small {
  color: #efb098;
}

@keyframes skill-aura-pulse {
  0%,
  100% {
    opacity: 0.46;
  }

  50% {
    opacity: 1;
  }
}

.app:not([data-state="playing"]) .skill-hotbar {
  visibility: hidden;
  pointer-events: none;
}

.npc-interact-button {
  position: absolute;
  z-index: 8;
  bottom: max(102px, calc(env(safe-area-inset-bottom) + 86px));
  left: 50%;
  display: flex;
  min-width: 188px;
  min-height: 46px;
  padding: 9px 16px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--paper);
  background: rgba(15, 29, 27, 0.94);
  border: 1px solid rgba(112, 183, 166, 0.72);
  border-radius: 5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.46);
  cursor: pointer;
  transform: translateX(-50%);
}

.npc-interact-button:hover {
  background: #1c3733;
  border-color: #8bc5b7;
}

.npc-interact-button kbd {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--ink);
  background: var(--brass-pale);
  border: 1px solid #f2dfad;
  border-radius: 4px;
  box-shadow: 0 2px 0 #765b31;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.72rem;
  font-weight: 800;
}

.npc-interact-button span {
  font-size: 0.82rem;
}

.npc-interact-button strong {
  color: #9bd1c3;
}

.scene-footer {
  position: absolute;
  z-index: 5;
  right: max(104px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  color: var(--paper);
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}

.day-marker span,
.day-marker strong {
  display: block;
}

.day-marker span {
  color: var(--brass-pale);
  font-size: 0.7rem;
}

.day-marker strong {
  margin-top: 3px;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.stage-mark {
  color: rgba(238, 231, 212, 0.72);
  font-size: 0.72rem;
}

.inventory-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.inventory-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.62);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.inventory-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(680px, calc(100% - 24px));
  height: 100%;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) 20px;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: var(--paper);
  background: #101a17;
  border-left: 1px solid rgba(225, 199, 135, 0.4);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.48);
}

.inventory-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.2);
}

.panel-kicker,
.inventory-label {
  margin: 0;
  color: var(--brass-pale);
  font-size: 0.65rem;
  letter-spacing: 0;
}

.inventory-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.inventory-tabs {
  display: grid;
  width: min(320px, 100%);
  min-height: 40px;
  margin-top: 12px;
  padding: 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  background: #0b1211;
  border: 1px solid rgba(225, 199, 135, 0.2);
  border-radius: 5px;
}

.inventory-tab {
  min-width: 0;
  padding: 7px 14px;
  color: var(--paper-muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
}

.inventory-tab:hover,
.inventory-tab:focus-visible {
  color: var(--paper);
  background: rgba(112, 183, 166, 0.12);
}

.inventory-tab.is-active,
.inventory-tab[aria-selected="true"] {
  color: #10221e;
  background: #9bd1c3;
  box-shadow: inset 0 0 0 1px #c5e5dc;
}

.inventory-tab-panel {
  min-width: 0;
}

.gem-fusion-alert {
  min-height: 32px;
  padding: 5px 10px;
  color: #e4ffdc;
  background: #23463b;
  border: 1px solid #94c79a;
  border-radius: 5px;
  font-size: 0.68rem;
  cursor: pointer;
}

.gem-fusion-alert[hidden] { display: none; }

.gem-fusion-section {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 0 10px;
  background: linear-gradient(130deg, #18322d, #19221f);
  border: 1px solid rgba(135, 190, 165, 0.35);
  border-radius: 6px;
}

.gem-fusion-section.is-ready { border-color: #c4b46c; }

.gem-fusion-section summary {
  min-height: 36px;
  padding-block: 10px;
  color: var(--brass-pale);
  font-size: 0.74rem;
  cursor: pointer;
}

.gem-fusion-help, .gem-fusion-status {
  margin: 0 0 10px;
  color: var(--paper-muted);
  font-size: 0.68rem;
  line-height: 1.65;
}

.gem-fusion-status:empty { display: none; }
.gem-fusion-status { color: #b4dfae; }

.gem-fusion-recipes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.gem-fusion-card {
  display: flex;
  min-width: 0;
  padding: 10px;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(173, 202, 177, 0.25);
  background: rgba(5, 17, 15, 0.5);
  border-radius: 5px;
}

.gem-fusion-card.is-ready { border-color: #b5a566; }
.gem-fusion-card strong { font-size: 0.8rem; color: #daf3e4; }
.gem-fusion-count { font-size: 0.68rem; color: var(--brass-pale); }
.gem-fusion-card p {
  margin: 0;
  color: var(--paper-muted);
  font-size: 0.66rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.gem-fusion-button.button {
  width: 100%;
  min-height: 38px;
  margin-top: auto;
  padding: 8px;
  font-size: 0.7rem;
}
.gem-fusion-button:disabled { opacity: 0.5; cursor: default; }

.gem-quantity {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 3;
  padding: 1px 3px;
  color: #efffea;
  background: rgba(6, 20, 17, 0.92);
  border-radius: 2px;
  font-size: 0.58rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

@media (max-width: 520px) {
  .gem-fusion-recipes { grid-template-columns: minmax(0, 1fr); }
  .gem-fusion-card { padding: 8px; }
  .gem-fusion-alert { max-width: 145px; font-size: 0.6rem; }
}

.close-button span {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
}

.close-button span::before,
.close-button span::after {
  position: absolute;
  top: 9px;
  left: 1px;
  width: 18px;
  height: 2px;
  content: "";
  background: currentColor;
}

.close-button span::before { transform: rotate(45deg); }
.close-button span::after { transform: rotate(-45deg); }

.equipment-section,
.bag-section {
  padding-top: 10px;
}

.inventory-section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inventory-section-line > span {
  color: var(--paper-muted);
  font-size: 0.66rem;
}

.bag-automation {
  display: flex;
  min-width: 0;
  margin-top: 6px;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bag-auto-recycle-toggle {
  display: grid;
  min-width: 210px;
  min-height: 42px;
  padding: 7px 9px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  color: var(--paper);
  background: rgba(27, 39, 36, 0.86);
  border: 1px solid rgba(225, 199, 135, 0.22);
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease;
}

.bag-auto-recycle-toggle:hover {
  background: rgba(39, 54, 49, 0.96);
  border-color: rgba(225, 199, 135, 0.42);
}

.bag-auto-recycle-toggle[aria-checked="true"] {
  background: rgba(39, 65, 57, 0.92);
  border-color: rgba(108, 166, 145, 0.64);
}

.bag-auto-recycle-toggle > span:first-child {
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
}

.bag-auto-recycle-toggle > small {
  color: var(--paper-muted);
  font-size: 0.6rem;
  white-space: nowrap;
}

.bag-auto-recycle-toggle[aria-checked="true"] > small {
  color: #a9dcca;
}

.bag-switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  flex: 0 0 auto;
  background: #303936;
  border: 1px solid rgba(238, 231, 212, 0.3);
  border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.36);
}

.bag-switch-track > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #c5c5ba;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 140ms ease, background 140ms ease;
}

.bag-auto-recycle-toggle[aria-checked="true"] .bag-switch-track {
  background: #416f60;
  border-color: rgba(185, 221, 208, 0.62);
}

.bag-auto-recycle-toggle[aria-checked="true"] .bag-switch-track > span {
  background: #e8e5d7;
  transform: translateX(16px);
}

.bag-protection-badge {
  display: inline-flex;
  min-height: 30px;
  padding: 5px 8px;
  align-items: center;
  gap: 5px;
  color: #e9c875;
  background: rgba(66, 52, 25, 0.58);
  border: 1px solid rgba(241, 184, 75, 0.34);
  border-radius: 4px;
  font-size: 0.6rem;
  white-space: nowrap;
}

.bag-protection-badge > span {
  width: 8px;
  height: 10px;
  background: #dba848;
  border: 1px solid #ffe3a0;
  clip-path: polygon(50% 0, 100% 20%, 88% 76%, 50% 100%, 12% 76%, 0 20%);
}

.spirit-pet-summary {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 78px;
  margin-top: 10px;
  padding: 9px 10px;
  align-items: center;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 11px;
  overflow: hidden;
  background: #172521;
  border: 1px solid rgba(112, 183, 166, 0.34);
  border-radius: 6px;
  box-shadow: inset 3px 0 0 rgba(213, 143, 152, 0.7);
}

.spirit-pet-summary::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 92px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(225, 199, 135, 0.45));
}

.spirit-pet-portrait {
  position: relative;
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  background: #243b36;
  border: 1px solid rgba(225, 199, 135, 0.5);
  border-radius: 50%;
  box-shadow: inset 0 -8px 0 rgba(12, 24, 22, 0.24);
}

.spirit-pet-portrait::before {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 34px;
  height: 35px;
  content: "";
  background:
    radial-gradient(circle at 35% 59%, #30282b 0 1.5px, transparent 1.8px),
    radial-gradient(circle at 65% 59%, #30282b 0 1.5px, transparent 1.8px),
    linear-gradient(145deg, #df816c, #d58f98 58%, #f1c083);
  border: 2px solid #5a3940;
  clip-path: polygon(6% 30%, 1% 0, 30% 16%, 50% 7%, 70% 16%, 99% 0, 94% 31%, 100% 55%, 84% 88%, 50% 100%, 16% 88%, 0 55%);
}

.spirit-pet-portrait::after {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 19px;
  height: 13px;
  content: "";
  background: #f0bd79;
  border: 2px solid #70464a;
  border-radius: 70% 30% 70% 30%;
  transform: rotate(-20deg);
}

.spirit-pet-portrait > span {
  position: absolute;
  z-index: 2;
  top: 31px;
  left: 25px;
  width: 5px;
  height: 4px;
  background: #633b43;
  border-radius: 50% 50% 60% 60%;
  transform: translateX(-50%);
}

.spirit-pet-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.spirit-pet-copy small {
  color: var(--brass-pale);
  font-size: 0.58rem;
}

.spirit-pet-copy strong {
  overflow: hidden;
  color: #fff0da;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spirit-pet-copy > span {
  overflow: hidden;
  color: var(--paper-muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spirit-pet-trait {
  padding: 5px 7px;
  color: #9ed3c4;
  background: rgba(57, 101, 89, 0.28);
  border: 1px solid rgba(112, 183, 166, 0.36);
  border-radius: 4px;
  font-size: 0.58rem;
  white-space: nowrap;
}

.spirit-pet-bag-section {
  padding-bottom: 2px;
}

.item-slot {
  position: relative;
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  color: var(--paper);
  background: #182220;
  border: 1px solid rgba(225, 199, 135, 0.26);
  border-radius: 5px;
  --item-quality: rgba(204, 208, 198, 0.72);
}

.item-slot[data-quality="common"] { --item-quality: #b8beb4; }
.item-slot[data-quality="refined"] { --item-quality: #65c59f; }
.item-slot[data-quality="rare"] { --item-quality: #67aee8; }
.item-slot[data-quality="legendary"] { --item-quality: #f1b84b; }
.item-slot[data-quality="mythic"] { --item-quality: #8eeef1; }
.item-slot[data-quality="artifact"] { --item-quality: #f4dc91; }
.item-slot[data-quality="immortal"] { --item-quality: #ff9d72; }
.item-slot[data-quality="supreme"] { --item-quality: #f6cf78; }
.item-slot[data-quality="divine"] { --item-quality: #a8fff2; }
.item-slot[data-quality="venom"] { --item-quality: #baff6a; }

.item-slot.has-item {
  border-color: var(--item-quality);
  box-shadow: inset 0 0 0 1px rgba(8, 16, 15, 0.7);
}

.item-slot[data-quality="refined"].has-item { background: #172a25; }
.item-slot[data-quality="rare"].has-item { background: #17242c; }
.item-slot[data-quality="legendary"].has-item { background: #2b2518; }
.item-slot[data-quality="mythic"].has-item {
  background: #152a32;
  box-shadow: inset 0 0 0 1px rgba(238, 202, 105, 0.38);
}
.item-slot[data-quality="artifact"].has-item {
  background: #203035;
  box-shadow: inset 0 0 0 1px rgba(244, 220, 145, 0.5), 0 0 8px rgba(153, 222, 211, 0.16);
}
.item-slot[data-quality="immortal"].has-item {
  background: #352027;
  box-shadow: inset 0 0 0 1px rgba(255, 207, 125, 0.54), 0 0 9px rgba(255, 99, 74, 0.2);
}
.item-slot[data-quality="supreme"].has-item {
  background: linear-gradient(145deg, #421d39, #291929 58%, #3b2b1c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 215, 126, 0.66),
    inset 0 0 12px rgba(168, 55, 113, 0.28),
    0 0 10px rgba(236, 178, 78, 0.24);
}

.item-slot[data-quality="divine"].has-item {
  background: linear-gradient(145deg, #163f43, #182d35 58%, #3d3420);
  box-shadow:
    inset 0 0 0 1px rgba(168, 255, 242, 0.7),
    0 0 10px rgba(93, 229, 217, 0.24);
}

.item-slot[data-quality="venom"].has-item {
  background: linear-gradient(145deg, #18331e, #1c2f25 58%, #36421d);
  box-shadow:
    inset 0 0 0 1px rgba(186, 255, 106, 0.72),
    0 0 10px rgba(89, 203, 82, 0.26);
}

.item-slot:not(:disabled) {
  cursor: pointer;
}

.item-slot:not(:disabled):hover,
.item-slot.is-selected {
  background: #202d2a;
  border-color: var(--brass);
}

.item-slot:disabled {
  opacity: 0.54;
}

.equipment-layout {
  display: grid;
  min-width: 0;
  margin-top: 6px;
  padding: 5px 0 3px;
  grid-template-columns: minmax(150px, 1fr) 112px minmax(150px, 1fr);
  grid-template-rows: repeat(5, minmax(52px, auto));
  gap: 5px;
}

.equipment-slot {
  display: grid;
  width: auto;
  min-height: 52px;
  margin: 0;
  padding: 5px 6px;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
  text-align: left;
}

.equipment-slot:disabled {
  opacity: 1;
}

.equipment-slot-label {
  display: grid;
  min-width: 0;
  padding: 4px;
  place-items: center;
  color: var(--brass-pale);
  background: rgba(198, 161, 91, 0.08);
  border: 1px solid rgba(225, 199, 135, 0.2);
  border-radius: 4px;
  font-size: 0.6rem;
  line-height: 1.25;
  text-align: center;
}

.equipment-slot.has-item .equipment-slot-label {
  z-index: 2;
  padding: 32px 1px 1px;
  align-items: end;
  background: transparent;
  border-color: transparent;
  font-size: 0.5rem;
}

.equipment-slot-gem { grid-column: 1; grid-row: 1; }
.equipment-slot-helmet { grid-column: 2; grid-row: 1; }
.equipment-slot-necklace { grid-column: 3; grid-row: 1; }
.equipment-slot-weapon { grid-column: 1; grid-row: 2; }
.equipment-slot-armor { grid-column: 3; grid-row: 2; }
.equipment-slot-bracelet-left { grid-column: 1; grid-row: 3; }
.equipment-slot-bracelet-right { grid-column: 3; grid-row: 3; }
.equipment-slot-ring-left { grid-column: 1; grid-row: 4; }
.equipment-slot-ring-right { grid-column: 3; grid-row: 4; }
.equipment-slot-belt { grid-column: 1; grid-row: 5; }
.equipment-slot-boots { grid-column: 3; grid-row: 5; }

.equipment-avatar {
  position: relative;
  min-height: 223px;
  grid-column: 2;
  grid-row: 2 / 6;
  color: rgba(238, 231, 212, 0.48);
}

.equipment-avatar::before {
  position: absolute;
  inset: 6px 6px 24px;
  content: "";
  background:
    radial-gradient(circle at 50% 34%, rgba(246, 204, 91, 0.17), transparent 35%),
    linear-gradient(180deg, rgba(91, 157, 137, 0.13), rgba(17, 36, 34, 0.03));
  border: 1px solid rgba(117, 195, 170, 0.23);
  border-radius: 50%;
  box-shadow: inset 0 -24px 34px rgba(11, 23, 22, 0.24);
}

.equipment-avatar-head,
.equipment-avatar-body,
.equipment-avatar-feet {
  position: absolute;
  left: 50%;
  display: block;
  border: 3px solid #422d39;
  transform: translateX(-50%);
}

.equipment-avatar-head {
  z-index: 3;
  top: 17px;
  width: 58px;
  height: 54px;
  background:
    radial-gradient(circle at 35% 61%, #3a2d39 0 2px, transparent 2.4px),
    radial-gradient(circle at 65% 61%, #3a2d39 0 2px, transparent 2.4px),
    linear-gradient(90deg, #d98d6f 0 12%, #efbd91 13% 86%, #d98d6f 87%);
  border-radius: 48% 48% 45% 45%;
  box-shadow: inset 0 -8px 0 rgba(185, 103, 80, 0.17);
}

.equipment-avatar-head::before {
  position: absolute;
  top: -13px;
  right: 2px;
  left: 2px;
  height: 31px;
  content: "";
  background: #382d3b;
  border: 3px solid #422d39;
  border-bottom: 0;
  border-radius: 52% 52% 30% 24%;
  clip-path: polygon(0 47%, 10% 13%, 48% 0, 83% 10%, 100% 45%, 88% 39%, 78% 86%, 63% 54%, 50% 92%, 34% 51%, 18% 82%);
}

.equipment-avatar-head::after {
  position: absolute;
  top: -13px;
  right: 8px;
  width: 15px;
  height: 10px;
  content: "";
  background: #f2bb52;
  border: 2px solid #704330;
  border-radius: 70% 30% 70% 30%;
  transform: rotate(-20deg);
}

.equipment-avatar-body {
  z-index: 2;
  top: 69px;
  width: 88px;
  height: 87px;
  background:
    linear-gradient(90deg, transparent 0 43%, #f2bb52 44% 56%, transparent 57%),
    linear-gradient(180deg, #e47858 0 55%, #3f8274 56% 68%, #ae463c 69%);
  border-radius: 35% 35% 18% 18%;
  clip-path: polygon(24% 0, 76% 0, 100% 28%, 85% 96%, 15% 96%, 0 28%);
  box-shadow:
    inset 11px 0 0 rgba(108, 48, 52, 0.2),
    inset -11px 0 0 rgba(108, 48, 52, 0.13);
}

.equipment-avatar-body::after {
  position: absolute;
  right: 15px;
  bottom: 12px;
  left: 15px;
  height: 5px;
  content: "";
  background: #f2bb52;
  border: 1px solid #704330;
  border-radius: 3px;
}

.equipment-avatar-feet {
  z-index: 1;
  bottom: 31px;
  width: 70px;
  height: 56px;
  background: linear-gradient(90deg, #397568 0 43%, #422d39 44% 56%, #4c9583 57%);
  border-radius: 8px 8px 19px 19px;
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 60% 100%, 50% 31%, 40% 100%, 0 100%);
}

.equipment-avatar strong {
  position: absolute;
  right: -18px;
  bottom: 4px;
  left: -18px;
  overflow-wrap: anywhere;
  color: var(--paper-muted);
  font-size: 0.6rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
}

.item-icon {
  position: relative;
  display: block;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  background: rgba(198, 161, 91, 0.1);
  border: 1px solid rgba(225, 199, 135, 0.25);
  border-radius: 4px;
}

.item-icon::before {
  position: absolute;
  top: 7px;
  left: 18px;
  width: 6px;
  height: 24px;
  content: "";
  background: #d7d1bd;
  border: 1px solid #454b47;
  transform: rotate(38deg);
}

.item-icon::after {
  position: absolute;
  top: 25px;
  left: 10px;
  width: 20px;
  height: 5px;
  content: "";
  background: var(--brass);
  border: 1px solid #4c3526;
  transform: rotate(38deg);
}

.item-slot-copy {
  display: flex;
  min-width: 0;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
}

.item-slot-copy strong {
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.25;
}

.item-slot-copy small {
  color: var(--brass-pale);
  font-size: 0.56rem;
  line-height: 1.25;
}

.inventory-grid {
  display: grid;
  min-width: 0;
  margin-top: 6px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.bag-slot {
  width: 100%;
  height: 52px;
  min-height: 52px;
}

.item-slot.has-item::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 36px;
  content: "";
  background: linear-gradient(90deg, #355d59 0 22%, #d9e3cf 23% 56%, #7ba99c 57% 75%, #203c3b 76%);
  border: 2px solid #182724;
  clip-path: polygon(50% 0, 100% 17%, 73% 79%, 100% 84%, 82% 92%, 57% 87%, 57% 100%, 43% 100%, 43% 87%, 18% 92%, 0 84%, 27% 79%, 0 17%);
  filter: drop-shadow(0 0 4px var(--item-quality)) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.55));
  transform: translate(-50%, -50%) rotate(40deg);
}

.equipment-slot.has-item::before {
  left: 23px;
}

.item-slot.has-item[data-item-id="sanjiang-kaitian-sword"]::before {
  width: 15px;
  height: 41px;
  background:
    linear-gradient(90deg, #0d5f67 0 20%, #8fe2d1 21% 43%, #fff1a7 44% 57%, #42a9a1 58% 79%, #123e45 80%);
  border-color: #6f4a18;
  clip-path: polygon(50% 0, 92% 14%, 72% 73%, 100% 80%, 80% 91%, 57% 86%, 57% 100%, 43% 100%, 43% 86%, 20% 91%, 0 80%, 28% 73%, 8% 14%);
  filter: drop-shadow(0 0 4px #68d6c5) drop-shadow(0 0 7px rgba(241, 184, 75, 0.7));
}

.item-slot.has-item[data-item-type="armor"]::before {
  width: 32px;
  height: 35px;
  background:
    linear-gradient(90deg, transparent 47%, rgba(247, 222, 151, 0.72) 48% 52%, transparent 53%),
    linear-gradient(135deg, #9b4a35 0 28%, #592d30 29% 68%, #263e3b 69%);
  border-color: #281f25;
  clip-path: polygon(27% 0, 42% 8%, 58% 8%, 73% 0, 100% 24%, 82% 43%, 76% 100%, 24% 100%, 18% 43%, 0 24%);
  transform: translate(-50%, -50%);
}

.item-slot.has-item[data-item-type="helmet"]::before {
  width: 32px;
  height: 28px;
  background:
    linear-gradient(90deg, transparent 43%, #d4b86c 44% 56%, transparent 57%),
    linear-gradient(135deg, #416562, #8e7048 62%, #3b3130 63%);
  border-color: #241f23;
  border-radius: 50% 50% 18% 18%;
  clip-path: polygon(12% 100%, 4% 48%, 17% 14%, 50% 0, 83% 14%, 96% 48%, 88% 100%, 68% 76%, 32% 76%);
  transform: translate(-50%, -50%);
}

.item-slot.has-item[data-item-type="gem"]::before {
  width: 28px;
  height: 32px;
  background:
    radial-gradient(circle at 42% 30%, rgba(255, 255, 255, 0.92) 0 6%, transparent 8%),
    linear-gradient(145deg, #d8fff7 0 10%, #66d9d3 11% 38%, #267e94 39% 68%, #173b61 69%);
  border: 2px solid #b8f5e9;
  clip-path: polygon(50% 0, 91% 24%, 78% 78%, 50% 100%, 22% 78%, 9% 24%);
  filter:
    drop-shadow(0 0 4px #8dfff0)
    drop-shadow(0 0 8px rgba(77, 194, 224, 0.66));
  transform: translate(-50%, -50%);
}

.item-slot.has-item[data-item-type="necklace"]::before,
.item-slot.has-item[data-item-type="bracelet"]::before,
.item-slot.has-item[data-item-type="ring"]::before {
  width: 24px;
  height: 24px;
  background: radial-gradient(circle at 50% 86%, #f3d57d 0 12%, transparent 14%);
  border: 5px solid #b99b50;
  border-radius: 50%;
  clip-path: none;
  transform: translate(-50%, -50%);
}

.item-slot.has-item[data-item-type="necklace"]::before {
  width: 28px;
  height: 35px;
  border-width: 3px;
  border-top-color: transparent;
  border-radius: 42% 42% 50% 50%;
}

.item-slot.has-item[data-item-type="bracelet"]::before {
  width: 26px;
  height: 19px;
  background: linear-gradient(135deg, transparent 40%, #d9c480 41% 56%, transparent 57%);
  border-width: 4px;
  border-left-color: transparent;
  border-radius: 50%;
}

.item-slot.has-item[data-item-type="ring"]::before {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 50% 0, #8ee0d1 0 16%, #e7c863 18% 27%, transparent 29%);
  border-width: 4px;
}

.item-slot.has-item[data-item-type="belt"]::before {
  width: 34px;
  height: 13px;
  background:
    linear-gradient(90deg, transparent 40%, #d7bc69 41% 59%, transparent 60%),
    linear-gradient(#6d3f2d, #3e2928);
  border-color: #241d20;
  border-radius: 3px;
  clip-path: none;
  transform: translate(-50%, -50%);
}

.item-slot.has-item[data-item-type="boots"]::before {
  width: 29px;
  height: 34px;
  background: linear-gradient(135deg, #8e5b39, #3a302c 68%);
  border-color: #211d20;
  clip-path: polygon(15% 0, 70% 0, 67% 61%, 100% 72%, 100% 100%, 0 100%, 0 68%, 16% 58%);
  transform: translate(-50%, -50%);
}

.equipment-slot[data-equipment-slot="braceletLeft"].has-item::before,
.equipment-slot[data-equipment-slot="ringLeft"].has-item::before {
  transform: translate(-50%, -50%) rotate(-18deg);
}

.equipment-slot[data-equipment-slot="braceletRight"].has-item::before,
.equipment-slot[data-equipment-slot="ringRight"].has-item::before {
  transform: translate(-50%, -50%) rotate(18deg);
}

.bag-slot.has-item::after {
  position: absolute;
  right: 4px;
  bottom: 3px;
  content: attr(data-rarity);
  color: var(--item-quality);
  font-size: 0.48rem;
  font-weight: 700;
  text-shadow: 0 1px 2px #080d0c;
}

.item-details {
  display: flex;
  margin-top: 12px;
  padding-top: 12px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(225, 199, 135, 0.2);
}

.item-details > div {
  min-width: 0;
}

.item-details strong {
  display: block;
  color: var(--paper);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.item-details strong[data-quality="common"] { color: #d2d7cd; }
.item-details strong[data-quality="refined"] { color: #82d7b6; }
.item-details strong[data-quality="rare"] { color: #83c3f2; }
.item-details strong[data-quality="legendary"] { color: #f3c35e; }
.item-details strong[data-quality="mythic"] { color: #a9f4ef; }
.item-details strong[data-quality="artifact"] { color: #ffe9a7; }
.item-details strong[data-quality="immortal"] { color: #ffb58d; }
.item-details strong[data-quality="supreme"] {
  color: #ffdc86;
  text-shadow: 0 0 7px rgba(180, 65, 127, 0.48);
}
.item-details strong[data-quality="divine"] {
  color: #c5fff5;
  text-shadow: 0 0 7px rgba(94, 225, 215, 0.5);
}
.item-details strong[data-quality="venom"] {
  color: #d2ff93;
  text-shadow: 0 0 7px rgba(121, 230, 89, 0.44);
}

.item-details p {
  margin: 6px 0 0;
  color: var(--paper-muted);
  font-size: 0.69rem;
  line-height: 1.55;
}

.item-detail-comparison {
  display: flex;
  min-width: 0;
  margin-top: 7px;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--paper-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}

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

.item-comparison-slot {
  flex: 1 0 100%;
  overflow-wrap: anywhere;
  color: rgba(238, 231, 212, 0.72);
}

.item-comparison-value {
  white-space: nowrap;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-weight: 700;
}

.item-comparison-value.is-positive { color: #72d6a2; }
.item-comparison-value.is-negative { color: #ff8876; }
.item-comparison-value.is-neutral { color: #aeb7ad; }

.item-detail-actions {
  display: grid;
  flex: 0 0 176px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.item-details .button {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
}

.merchant-layer {
  position: absolute;
  z-index: 15;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.merchant-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.66);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.merchant-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(700px, calc(100% - 24px));
  height: 100%;
  min-width: 0;
  padding: max(22px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom)) 22px;
  flex-direction: column;
  overflow: hidden;
  color: var(--paper);
  background: #101917;
  border-left: 1px solid rgba(225, 199, 135, 0.42);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.52);
}

.merchant-header {
  display: flex;
  padding-bottom: 14px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.2);
}

.merchant-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.merchant-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.merchant-wallet {
  display: flex;
  min-height: 40px;
  padding: 7px 10px;
  align-items: center;
  gap: 6px;
  color: #f2d47f;
  background: rgba(38, 34, 22, 0.72);
  border: 1px solid rgba(225, 199, 135, 0.3);
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

.merchant-wallet strong {
  max-width: 120px;
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
}

.merchant-wallet small {
  color: var(--paper-muted);
  font-size: 0.58rem;
}

.merchant-intro {
  margin: 13px 0 0;
  color: var(--paper-muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.merchant-tabs {
  display: grid;
  width: min(320px, 100%);
  min-height: 40px;
  margin-top: 16px;
  padding: 3px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  background: #0b1211;
  border: 1px solid rgba(225, 199, 135, 0.2);
  border-radius: 5px;
}

.merchant-tab {
  min-width: 0;
  padding: 7px 14px;
  color: var(--paper-muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
}

.merchant-tab:hover,
.merchant-tab:focus-visible {
  color: var(--paper);
  background: rgba(112, 183, 166, 0.12);
}

.merchant-tab.is-active,
.merchant-tab[aria-selected="true"] {
  color: #10221e;
  background: #9bd1c3;
  box-shadow: inset 0 0 0 1px #c5e5dc;
}

.merchant-tab-panel {
  display: flex;
  min-height: 0;
  padding-top: 16px;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.merchant-list-heading {
  display: flex;
  padding-bottom: 9px;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.18);
}

.merchant-list-heading strong {
  font-size: 0.8rem;
}

.merchant-list-heading span {
  color: var(--paper-muted);
  font-size: 0.63rem;
}

.merchant-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.merchant-item {
  display: grid;
  min-width: 0;
  padding: 11px 2px;
  align-items: center;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.13);
}

.merchant-item[data-quality="common"] { --item-quality: #b8beb4; }
.merchant-item[data-quality="refined"] { --item-quality: #65c59f; }
.merchant-item[data-quality="rare"] { --item-quality: #67aee8; }
.merchant-item[data-quality="legendary"] { --item-quality: #f1b84b; }
.merchant-item[data-quality="mythic"] { --item-quality: #8eeef1; }
.merchant-item[data-quality="artifact"] { --item-quality: #f4dc91; }
.merchant-item[data-quality="immortal"] { --item-quality: #ff9d72; }
.merchant-item[data-quality="supreme"] {
  --item-quality: #f6cf78;
  background: linear-gradient(90deg, rgba(123, 38, 91, 0.16), rgba(203, 151, 60, 0.08) 72%, transparent);
}
.merchant-item[data-quality="divine"] {
  --item-quality: #a8fff2;
  background: linear-gradient(90deg, rgba(36, 135, 139, 0.18), rgba(213, 182, 92, 0.08) 72%, transparent);
}
.merchant-item[data-quality="venom"] {
  --item-quality: #baff6a;
  background: linear-gradient(90deg, rgba(69, 145, 65, 0.2), rgba(186, 255, 106, 0.07) 72%, transparent);
}

.merchant-item-icon.item-slot {
  width: 52px;
  height: 52px;
  min-height: 52px;
  pointer-events: none;
}

.merchant-item-copy {
  min-width: 0;
}

.merchant-item-title {
  display: flex;
  min-width: 0;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.merchant-item-title strong {
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.merchant-item-title span {
  color: var(--item-quality, var(--brass-pale));
  font-size: 0.56rem;
  font-weight: 700;
}

.merchant-item-stats,
.merchant-item-reason {
  margin: 4px 0 0;
  color: var(--paper-muted);
  font-size: 0.65rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.merchant-item-reason {
  color: #d4a89a;
}

.merchant-item-trade {
  display: grid;
  min-width: 112px;
  justify-items: stretch;
  gap: 5px;
}

.merchant-item-price {
  color: #f2d47f;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.merchant-item-trade .button {
  min-width: 112px;
  min-height: 38px;
  padding: 7px 10px;
}

.merchant-item-trade .button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.5;
}

.merchant-empty {
  margin: auto 0;
  padding: 30px 12px;
  color: var(--paper-muted);
  font-size: 0.76rem;
  text-align: center;
}

.quest-log-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.quest-log-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.62);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.quest-log-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(440px, calc(100% - 24px));
  height: 100%;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) 24px;
  flex-direction: column;
  color: var(--paper);
  background: #111918;
  border-left: 1px solid rgba(112, 183, 166, 0.42);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.48);
}

.quest-log-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.2);
}

.quest-log-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.quest-log-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(225, 199, 135, 0.34) transparent;
}

.quest-log-group {
  padding-top: 22px;
}

.quest-log-group + .quest-log-group {
  margin-top: 22px;
  border-top: 1px solid rgba(225, 199, 135, 0.2);
}

.quest-log-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quest-log-group-heading h3 {
  margin: 0;
  color: var(--brass-pale);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

.quest-log-group-heading span {
  display: grid;
  min-width: 24px;
  height: 20px;
  padding-inline: 6px;
  place-items: center;
  color: var(--paper-muted);
  background: rgba(238, 231, 212, 0.07);
  border-radius: 3px;
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
}

.quest-log-list {
  display: grid;
  margin-top: 10px;
  gap: 9px;
}

.quest-log-empty {
  margin: 10px 0 0;
  padding: 18px 12px;
  color: rgba(184, 181, 168, 0.72);
  border: 1px dashed rgba(184, 181, 168, 0.22);
  border-radius: 5px;
  font-size: 0.72rem;
  text-align: center;
}

.quest-log-item {
  padding: 13px 14px;
  background: #182220;
  border: 1px solid rgba(225, 199, 135, 0.22);
  border-radius: 5px;
}

.quest-log-item.is-ready {
  border-color: rgba(112, 183, 166, 0.6);
}

.quest-log-item-heading,
.quest-log-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quest-log-item-heading strong {
  min-width: 0;
  overflow: hidden;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quest-log-item-heading span {
  flex: 0 0 auto;
  color: #9bd1c3;
  font-size: 0.62rem;
  font-weight: 700;
}

.quest-log-objective,
.quest-log-reward {
  margin: 8px 0 0;
  color: var(--paper-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.quest-log-reward {
  margin-top: 3px;
  color: var(--brass-pale);
}

.quest-log-item-footer {
  margin-top: 11px;
  justify-content: flex-end;
}

.quest-track-toggle {
  min-height: 36px;
  padding: 7px 13px;
  font-size: 0.7rem;
}

.quest-log-claimed {
  color: rgba(238, 231, 212, 0.64);
  font-size: 0.66rem;
  font-weight: 700;
}

.drop-history-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.drop-history-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.62);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.drop-history-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(460px, calc(100% - 24px));
  height: 100%;
  min-width: 0;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) 24px;
  flex-direction: column;
  overflow: hidden;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(66, 51, 36, 0.13), transparent 140px),
    #111918;
  border-left: 1px solid rgba(225, 199, 135, 0.44);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.5);
}

.drop-history-header {
  display: flex;
  flex: 0 0 auto;
  padding-bottom: 18px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.22);
}

.drop-history-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.drop-history-summary {
  display: flex;
  margin: 7px 0 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--paper-muted);
  font-size: 0.62rem;
}

.drop-history-summary span:first-child {
  color: var(--brass-pale);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.drop-history-header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.drop-history-clear {
  min-width: 48px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--paper-muted);
  background: rgba(8, 14, 14, 0.62);
  border: 1px solid rgba(225, 199, 135, 0.26);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.66rem;
}

.drop-history-clear:hover,
.drop-history-clear:focus-visible {
  color: var(--paper);
  background: rgba(112, 183, 166, 0.14);
  border-color: rgba(112, 183, 166, 0.58);
}

.drop-history-clear:disabled {
  cursor: default;
  opacity: 0.42;
}

.drop-history-list {
  display: grid;
  min-height: 0;
  margin-top: 14px;
  padding-right: 4px;
  flex: 1;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(225, 199, 135, 0.34) transparent;
}

.drop-history-list[hidden] {
  display: none;
}

.drop-history-entry {
  --drop-quality: #b8beb4;
  display: grid;
  min-width: 0;
  padding: 11px 12px;
  align-items: center;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  background: rgba(24, 34, 32, 0.9);
  border: 1px solid rgba(225, 199, 135, 0.2);
  border-left: 3px solid var(--drop-quality);
  border-radius: 5px;
}

.drop-history-entry[data-quality="refined"] { --drop-quality: #65c59f; }
.drop-history-entry[data-quality="rare"] { --drop-quality: #67aee8; }
.drop-history-entry[data-quality="legendary"] { --drop-quality: #f1b84b; }
.drop-history-entry[data-quality="mythic"] { --drop-quality: #8eeef1; }
.drop-history-entry[data-quality="artifact"] { --drop-quality: #f4dc91; }
.drop-history-entry[data-quality="immortal"] { --drop-quality: #ff9d72; }
.drop-history-entry[data-quality="supreme"] { --drop-quality: #f6cf78; }
.drop-history-entry[data-quality="divine"],
.drop-history-entry[data-quality="celestial"] { --drop-quality: #a8fff2; }
.drop-history-entry[data-quality="venom"] { --drop-quality: #baff6a; }

.drop-history-item-icon {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--drop-quality);
  background: rgba(5, 10, 10, 0.64);
  border: 1px solid color-mix(in srgb, var(--drop-quality) 58%, transparent);
  border-radius: 4px;
  box-shadow: inset 0 0 13px color-mix(in srgb, var(--drop-quality) 12%, transparent);
}

.drop-history-item-icon::before {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid currentColor;
  box-shadow: 0 0 8px color-mix(in srgb, var(--drop-quality) 45%, transparent);
  transform: rotate(45deg);
}

.drop-history-item-icon::after {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 5px;
  height: 5px;
  content: "";
  background: currentColor;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.drop-history-entry-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.drop-history-entry-heading,
.drop-history-entry-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.drop-history-entry-heading strong {
  min-width: 0;
  overflow: hidden;
  color: var(--drop-quality);
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-history-entry-heading time {
  flex: 0 0 auto;
  color: rgba(184, 181, 168, 0.74);
  font-size: 0.56rem;
  font-variant-numeric: tabular-nums;
}

.drop-history-entry-meta {
  justify-content: flex-start;
  color: var(--paper-muted);
  font-size: 0.62rem;
}

.drop-history-quality {
  flex: 0 0 auto;
  color: var(--drop-quality);
  font-weight: 700;
}

.drop-history-source {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-history-outcome {
  margin: 0;
  color: #d7d2c4;
  font-size: 0.65rem;
  line-height: 1.45;
}

.drop-history-empty {
  display: grid;
  min-height: 0;
  padding: 34px 18px;
  flex: 1;
  place-content: center;
  place-items: center;
  gap: 8px;
  color: var(--paper-muted);
  text-align: center;
}

.drop-history-empty[hidden] {
  display: none;
}

.drop-history-empty-mark {
  position: relative;
  width: 42px;
  height: 42px;
  margin-bottom: 5px;
  color: rgba(225, 199, 135, 0.58);
  border: 1px solid rgba(225, 199, 135, 0.3);
  transform: rotate(45deg);
}

.drop-history-empty-mark::before {
  position: absolute;
  inset: 10px;
  content: "";
  border: 1px solid currentColor;
}

.drop-history-empty strong {
  color: var(--paper);
  font-size: 0.82rem;
}

.drop-history-empty small {
  max-width: 270px;
  font-size: 0.66rem;
  line-height: 1.6;
}

.character-stats-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.character-stats-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.66);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.character-stats-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(560px, calc(100% - 24px));
  height: 100%;
  min-width: 0;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) 24px;
  flex-direction: column;
  overflow: hidden;
  color: var(--paper);
  background:
    linear-gradient(180deg, rgba(112, 183, 166, 0.08), transparent 180px),
    #111918;
  border-left: 1px solid rgba(112, 183, 166, 0.46);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.52);
}

.character-stats-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.22);
}

.character-stats-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.character-stats-content {
  min-height: 0;
  padding-right: 4px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(225, 199, 135, 0.34) transparent;
}

.character-stat-group {
  padding: 15px 0 14px;
}

.character-stat-group + .character-stat-group {
  border-top: 1px solid rgba(225, 199, 135, 0.18);
}

.character-stat-group h3 {
  margin: 0 0 9px;
  color: var(--brass-pale);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

.character-stat-list {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
}

.character-stat-list > div {
  display: flex;
  min-width: 0;
  min-height: 31px;
  padding: 6px 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(238, 231, 212, 0.07);
}

.character-stat-list dt,
.character-stat-list dd {
  min-width: 0;
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.45;
  letter-spacing: 0;
}

.character-stat-list dt {
  flex: 0 0 auto;
  color: var(--paper-muted);
}

.character-stat-list dd {
  color: #f0dfb2;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.character-stat-list-wide {
  grid-template-columns: 1fr;
}

.skills-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: flex;
  justify-content: flex-end;
}

.skills-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: rgba(4, 8, 8, 0.66);
  border: 0;
  cursor: default;
  backdrop-filter: blur(4px);
}

.skills-panel {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(520px, calc(100% - 24px));
  height: 100%;
  padding: max(28px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) 24px;
  flex-direction: column;
  overflow: hidden;
  color: var(--paper);
  background: #111918;
  border-left: 1px solid rgba(112, 183, 166, 0.46);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.52);
}

.skills-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(225, 199, 135, 0.2);
}

.skills-header h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0;
}

.skills-profession {
  display: grid;
  flex: 0 0 auto;
  min-height: 62px;
  margin-top: 16px;
  padding: 10px 12px;
  align-items: center;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 11px;
  background: rgba(79, 133, 128, 0.12);
  border-block: 1px solid rgba(112, 183, 166, 0.28);
}

.skills-profession-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #f2dfaa;
  background: #703b2f;
  border: 1px solid rgba(225, 199, 135, 0.58);
  border-radius: 4px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.24rem;
  font-weight: 700;
}

.skills-profession div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.skills-profession div span,
.skills-profession small {
  color: var(--paper-muted);
  font-size: 0.64rem;
}

.skills-profession strong {
  font-size: 0.9rem;
}

.skills-profession small {
  text-align: right;
  white-space: nowrap;
}

.skills-branch-note {
  flex: 0 0 auto;
  margin: 12px 0 0;
  padding: 10px 12px;
  color: #cfcbc0;
  background: rgba(201, 77, 42, 0.08);
  border-left: 3px solid rgba(201, 77, 42, 0.72);
  font-size: 0.68rem;
  line-height: 1.55;
}

.skills-branch-note strong {
  margin-right: 5px;
  color: #efb080;
}

.skills-list {
  display: grid;
  min-height: 0;
  margin-top: 13px;
  padding-right: 4px;
  flex: 1;
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(225, 199, 135, 0.34) transparent;
}

.skills-empty {
  margin: 14px 0 0;
  padding: 22px 12px;
  color: rgba(184, 181, 168, 0.72);
  border: 1px dashed rgba(184, 181, 168, 0.24);
  border-radius: 5px;
  font-size: 0.72rem;
  text-align: center;
}

.skill-entry {
  padding: 13px 14px;
  background: #182220;
  border: 1px solid rgba(225, 199, 135, 0.22);
  border-radius: 5px;
}

.skill-entry.is-learned {
  border-color: rgba(112, 183, 166, 0.58);
}

.skill-entry.is-future {
  background: #151d1c;
  border-color: rgba(184, 181, 168, 0.14);
}

.skill-entry-heading {
  display: grid;
  align-items: start;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
}

.skill-order {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--brass-pale);
  background: rgba(198, 161, 91, 0.1);
  border: 1px solid rgba(225, 199, 135, 0.28);
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.skill-entry.is-learned .skill-order {
  color: #c5e5dc;
  background: rgba(79, 133, 128, 0.2);
  border-color: rgba(112, 183, 166, 0.44);
}

.skill-identity {
  min-width: 0;
}

.skill-identity strong {
  display: block;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1rem;
  font-weight: 600;
}

.skill-identity p {
  margin: 4px 0 0;
  color: var(--paper-muted);
  font-size: 0.67rem;
  line-height: 1.5;
}

.skill-state-badge {
  min-width: 54px;
  padding: 4px 6px;
  color: #d0cdc3;
  background: rgba(238, 231, 212, 0.06);
  border: 1px solid rgba(238, 231, 212, 0.13);
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.skill-entry.is-learned .skill-state-badge {
  color: #bfe1d8;
  background: rgba(79, 133, 128, 0.18);
  border-color: rgba(112, 183, 166, 0.34);
}

.skill-entry.is-future .skill-state-badge {
  color: rgba(184, 181, 168, 0.76);
}

.skill-details {
  display: flex;
  margin-top: 9px;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--paper-muted);
  font-size: 0.63rem;
  line-height: 1.45;
}

.skill-branch {
  color: #dfa57f;
}

.skill-mana-cost {
  color: #8fc8f3;
  font-weight: 700;
}

.skill-mastery {
  margin-top: 10px;
}

.skill-mastery-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--paper-muted);
  font-size: 0.62rem;
}

.skill-mastery-line strong {
  color: #bfe1d8;
  font-size: 0.66rem;
}

.skill-mastery-meter {
  height: 5px;
  margin-top: 6px;
  overflow: hidden;
  background: #222a28;
  border-radius: 2px;
}

.skill-mastery-meter > span {
  display: block;
  height: 100%;
  background: #5f9d90;
  transition: width 180ms ease;
}

.skill-entry-footer {
  display: flex;
  min-height: 36px;
  margin-top: 10px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.skill-entry-footer:has(.skill-quick-config) {
  align-items: stretch;
  flex-direction: column;
}

.skill-effect {
  color: var(--brass-pale);
  font-size: 0.65rem;
  line-height: 1.5;
}

.skill-entry.is-future .skill-effect {
  color: rgba(184, 181, 168, 0.7);
}

.skill-learn-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 88px;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.68rem;
}

.skill-quick-config {
  display: grid;
  width: 100%;
  flex: 0 0 auto;
  grid-template-columns: repeat(6, 44px);
  align-items: center;
  justify-content: start;
  gap: 5px;
}

.skill-quick-config > span {
  grid-column: 1 / -1;
  margin-right: 2px;
  color: var(--paper-muted);
  font-size: 0.62rem;
  white-space: nowrap;
}

.skill-quick-option {
  display: grid;
  width: 44px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: var(--brass-pale);
  background: rgba(8, 14, 14, 0.72);
  border: 1px solid rgba(225, 199, 135, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.65rem;
  font-weight: 800;
}

.skill-quick-option:hover,
.skill-quick-option:focus-visible {
  background: rgba(79, 133, 128, 0.24);
  border-color: rgba(112, 183, 166, 0.68);
}

.skill-quick-option[aria-pressed="true"] {
  color: #10221e;
  background: #9bd1c3;
  border-color: #c5e5dc;
}

.dialogue-layer {
  position: absolute;
  z-index: 14;
  inset: 0;
  display: flex;
  padding: 24px;
  align-items: flex-end;
  justify-content: center;
  background: rgba(4, 8, 8, 0.34);
}

.dialogue-panel {
  display: grid;
  width: min(780px, 100%);
  max-height: min(44dvh, 360px);
  padding: 24px 26px;
  overflow: hidden;
  align-items: end;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 26px;
  color: var(--paper);
  background: #111918;
  border: 1px solid rgba(112, 183, 166, 0.52);
  border-radius: 7px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
}

.dialogue-copy {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: rgba(225, 199, 135, 0.34) transparent;
}

.dialogue-role {
  margin: 0;
  color: #9bd1c3;
  font-size: 0.68rem;
  font-weight: 700;
}

.dialogue-panel h2 {
  margin: 5px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0;
}

.dialogue-text {
  margin: 11px 0 0;
  color: var(--paper-muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.dialogue-quest {
  margin-top: 16px;
  padding: 13px 0 0 14px;
  border-top: 1px solid rgba(225, 199, 135, 0.24);
  border-left: 2px solid rgba(198, 161, 91, 0.68);
}

.dialogue-quest-status {
  margin: 0;
  color: #d7b96f;
  font-size: 0.64rem;
  font-weight: 700;
}

.dialogue-quest h3 {
  margin: 4px 0 0;
  color: var(--paper);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0;
}

.dialogue-quest-objective,
.dialogue-quest-reward {
  display: flex;
  margin: 7px 0 0;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--paper-muted);
  font-size: 0.75rem;
}

.dialogue-quest-reward {
  margin-top: 5px;
}

.dialogue-quest-reward strong {
  color: var(--brass-pale);
}

.dialogue-quest.is-ready {
  border-left-color: rgba(112, 183, 166, 0.84);
}

.dialogue-quest.is-ready .dialogue-quest-status {
  color: #9bd1c3;
}

.dialogue-quest.is-completed {
  border-left-color: rgba(184, 181, 168, 0.58);
}

.dialogue-quest.is-completed .dialogue-quest-status {
  color: rgba(238, 231, 212, 0.72);
}

.dialogue-actions {
  display: grid;
  align-self: end;
  gap: 10px;
}

#dialogue-accept[hidden] ~ #dialogue-complete[hidden] ~ #dialogue-close {
  grid-column: 1 / -1;
}

.dialogue-panel .button {
  width: 100%;
  min-height: 46px;
  min-width: 0;
  padding-inline: 12px;
  white-space: nowrap;
}

.app[data-state="dialogue"] .movement-pad,
.app[data-state="dialogue"] .attack-button,
.app[data-state="dialogue"] .target-frame,
.app[data-state="dialogue"] .npc-interact-button {
  visibility: hidden;
  pointer-events: none;
}

.pause-layer,
.death-layer {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(4, 8, 8, 0.7);
  backdrop-filter: blur(8px);
}

.death-layer {
  justify-items: start;
}

.pause-panel,
.death-panel {
  width: min(360px, 100%);
  padding: 34px 32px 30px;
  background: #111918;
  border: 1px solid rgba(225, 199, 135, 0.4);
  border-radius: 7px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  text-align: center;
}

.pause-panel {
  width: min(440px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pause-panel h2,
.death-panel h2,
.confirm-dialog h2 {
  margin: 8px 0 0;
  color: var(--paper);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 2rem;
  letter-spacing: 0;
}

.death-copy {
  margin: 12px 0 0;
  color: var(--paper-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.pause-rule {
  width: 54px;
  height: 1px;
  margin: 22px auto 24px;
  background: var(--brass);
}

.combat-automation-controls {
  width: min(390px, 100%);
  max-width: 390px;
  pointer-events: auto;
}

.combat-setting-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.combat-setting-toggle {
  display: grid;
  width: 100%;
  min-height: 56px;
  padding: 6px 8px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  color: var(--paper);
  background: rgba(30, 42, 39, 0.82);
  border: 1px solid rgba(225, 199, 135, 0.2);
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.combat-setting-toggle:hover {
  background: rgba(40, 55, 50, 0.94);
  border-color: rgba(225, 199, 135, 0.4);
}

.combat-setting-toggle[aria-checked="true"] {
  background: rgba(39, 65, 57, 0.92);
  border-color: rgba(108, 166, 145, 0.64);
}

.combat-setting-toggle[data-active="true"] {
  border-color: rgba(237, 122, 50, 0.78);
  box-shadow: inset 3px 0 0 var(--ember-bright);
}

.combat-setting-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.combat-setting-copy {
  display: grid;
  min-width: 0;
}

.combat-setting-copy strong {
  overflow: hidden;
  font-size: 0.7rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combat-setting-copy small {
  color: var(--paper-muted);
  font-size: 0.64rem;
  line-height: 1.45;
}

.combat-setting-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.combat-setting-state {
  min-width: 36px;
  color: var(--paper-muted);
  font-size: 0.58rem;
  font-weight: 700;
  text-align: right;
}

.combat-setting-toggle[aria-checked="true"] .combat-setting-state {
  color: #b9ddd0;
}

.combat-setting-toggle[data-active="true"] .combat-setting-state {
  color: #f2bd79;
}

.combat-switch-track {
  position: relative;
  width: 32px;
  height: 18px;
  flex: 0 0 auto;
  background: #303936;
  border: 1px solid rgba(238, 231, 212, 0.3);
  border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.36);
}

.combat-switch-track > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #c5c5ba;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: transform 140ms ease, background 140ms ease;
}

.combat-setting-toggle[aria-checked="true"] .combat-switch-track {
  background: #416f60;
  border-color: rgba(185, 221, 208, 0.62);
}

.combat-setting-toggle[aria-checked="true"] .combat-switch-track > span {
  background: #e8e5d7;
  transform: translateX(14px);
}

.pause-actions {
  display: grid;
  gap: 10px;
}

.pause-actions .button {
  width: 100%;
}

.confirm-dialog {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  color: var(--paper);
  background: #111918;
  border: 1px solid rgba(225, 199, 135, 0.45);
  border-radius: 7px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
}

.confirm-dialog::backdrop {
  background: rgba(2, 5, 5, 0.78);
  backdrop-filter: blur(4px);
}

.confirm-dialog form {
  padding: 30px;
}

.confirm-dialog h2 {
  font-size: 1.65rem;
}

.confirm-dialog p:not(.dialog-kicker) {
  margin: 12px 0 24px;
  color: var(--paper-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

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

.quest-completion-banner {
  position: absolute;
  z-index: 20;
  top: max(104px, calc(env(safe-area-inset-top) + 86px));
  left: 50%;
  display: grid;
  width: min(430px, calc(100% - 32px));
  padding: 16px 20px;
  justify-items: center;
  gap: 4px;
  color: var(--paper);
  background: rgba(17, 25, 24, 0.97);
  border: 1px solid rgba(112, 183, 166, 0.72);
  border-radius: 6px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.5);
  opacity: 0;
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 180ms ease, transform 220ms ease;
}

.quest-completion-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.quest-completion-banner > span {
  color: #9bd1c3;
  font-size: 0.64rem;
  font-weight: 700;
}

.quest-completion-banner strong {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 1.24rem;
  font-weight: 600;
}

.quest-completion-banner small {
  color: var(--brass-pale);
  font-size: 0.7rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 30;
  bottom: max(104px, calc(env(safe-area-inset-bottom) + 88px));
  left: 50%;
  min-width: 190px;
  padding: 12px 18px;
  color: var(--paper);
  background: rgba(17, 25, 24, 0.96);
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: 0 12px 30px var(--shadow);
  font-size: 0.8rem;
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
}

@media (min-width: 900px) and (min-height: 581px) and (pointer: fine) {
  .app[data-state="playing"] .toast {
    bottom: max(160px, calc(env(safe-area-inset-bottom) + 144px));
    max-width: min(520px, calc(100% - 48px));
  }
}

.app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
  bottom: max(214px, calc(env(safe-area-inset-bottom) + 198px));
}

.app[data-state="paused"] .ember,
.app[data-state="inventory"] .ember,
.app[data-state="quests"] .ember,
.app[data-state="character-stats"] .ember,
.app[data-state="skills"] .ember,
.app[data-state="drop-history"] .ember,
.app[data-state="dialogue"] .ember,
.app[data-state="merchant"] .ember,
.app[data-state="dead"] .ember {
  animation-play-state: paused;
}

/* Classic game surface: restrained iron, dark timber and brass hierarchy. */
@media (min-width: 900px) and (min-height: 581px) {
  .game-world-frame {
    width: min(calc(100% - 12px), 175dvh);
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.hud {
  top: max(16px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  left: max(18px, env(safe-area-inset-left));
}

.player-summary {
  position: relative;
  width: 310px;
  min-height: 84px;
  padding: 9px 13px 9px 9px;
  background:
    linear-gradient(180deg, rgba(54, 49, 39, 0.96), rgba(16, 23, 22, 0.96) 34%),
    #101716;
  border-color: #8d7448;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(17, 20, 19, 0.9),
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(225, 199, 135, 0.12);
  backdrop-filter: blur(5px);
}

.player-summary::before {
  position: absolute;
  top: 3px;
  right: 10px;
  left: 64px;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, rgba(225, 199, 135, 0.52), transparent);
  pointer-events: none;
}

.portrait {
  flex-basis: 50px;
  width: 50px;
  height: 50px;
  isolation: isolate;
  background:
    radial-gradient(circle at 70% 18%, rgba(255, 222, 125, 0.32), transparent 26%),
    linear-gradient(145deg, #4c9583 0 48%, #234d4a 49% 100%);
  border: 2px solid #c69b4f;
  border-radius: 5px;
  box-shadow:
    inset 0 0 0 1px rgba(35, 30, 37, 0.82),
    inset 0 -11px 0 rgba(24, 48, 47, 0.25);
}

.portrait::before {
  z-index: 1;
  top: 9px;
  left: 10px;
  width: 29px;
  height: 27px;
  background:
    radial-gradient(circle at 35% 62%, #352a2c 0 1.6px, transparent 1.9px),
    radial-gradient(circle at 65% 62%, #352a2c 0 1.6px, transparent 1.9px),
    linear-gradient(90deg, #d58b70 0 11%, #efbd91 12% 87%, #d58b70 88%);
  border: 2px solid #422d39;
  border-radius: 48% 48% 45% 45%;
  box-shadow:
    inset 0 -5px 0 rgba(185, 103, 80, 0.15),
    0 2px 0 rgba(31, 31, 38, 0.18);
  transform: none;
}

.portrait::after {
  z-index: 0;
  bottom: -9px;
  left: 3px;
  width: 42px;
  height: 29px;
  background:
    linear-gradient(90deg, transparent 0 42%, #f2bb52 43% 56%, transparent 57%),
    linear-gradient(180deg, #df7255 0 57%, #3f8274 58% 72%, #b7443d 73%);
  border: 2px solid #422d39;
  border-radius: 44% 44% 4px 4px;
  box-shadow:
    inset 7px 0 0 rgba(107, 43, 49, 0.18),
    inset -7px 0 0 rgba(107, 43, 49, 0.12);
}

.portrait-mark {
  z-index: 3;
  top: 3px;
  left: 7px;
  width: 36px;
  height: 22px;
  background: #382d3b;
  border: 1px solid #422d39;
  border-radius: 52% 52% 30% 24%;
  clip-path: polygon(2% 48%, 12% 12%, 50% 0, 84% 9%, 100% 44%, 88% 39%, 79% 88%, 63% 55%, 50% 91%, 34% 53%, 18% 84%);
  filter: drop-shadow(0 1px 0 rgba(21, 20, 27, 0.72));
}

.portrait-mark::before {
  position: absolute;
  top: 1px;
  right: 3px;
  width: 11px;
  height: 7px;
  content: "";
  background: #f2bb52;
  border: 1px solid #704330;
  border-radius: 70% 30% 70% 30%;
  transform: rotate(-18deg);
}

.portrait-mark::after {
  position: absolute;
  top: 16px;
  left: 13px;
  width: 2px;
  height: 3px;
  content: "";
  background: #fff8df;
  border-radius: 50%;
  box-shadow: 9px 0 0 #fff8df;
}

.player-line {
  margin-bottom: 7px;
}

.player-line strong {
  color: #fff2cf;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 0.82rem;
}

.meter,
.target-health {
  background: #151b1a;
  border-color: rgba(209, 187, 137, 0.32);
  border-radius: 1px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.health-meter > span {
  background: linear-gradient(180deg, #cf5c45, #862b25);
}

.mana-meter > span {
  background: linear-gradient(180deg, #5598cc, #285b96);
}

.experience-meter > span {
  background: linear-gradient(180deg, #7bb09c, #376f62);
}

.hud-tools {
  gap: 8px;
}

.hud-action-row {
  gap: 4px;
  padding: 4px;
  background: linear-gradient(180deg, rgba(57, 49, 36, 0.94), rgba(16, 22, 21, 0.94));
  border: 1px solid #806a43;
  border-radius: 2px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.36), inset 0 0 0 1px rgba(225, 199, 135, 0.1);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: #f0e4c8;
  background: linear-gradient(180deg, rgba(56, 61, 55, 0.96), rgba(21, 27, 26, 0.98));
  border-color: rgba(179, 148, 87, 0.68);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(8, 10, 10, 0.82);
  backdrop-filter: none;
}

.icon-button:hover {
  background: linear-gradient(180deg, #4a5149, #29312e);
  border-color: #d0ad67;
}

.minimap-shell {
  width: 168px;
  height: 112px;
  padding: 3px;
  background: #151b19;
  border-color: #806a43;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(13, 16, 15, 0.9),
    0 8px 22px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(225, 199, 135, 0.12);
}

.minimap-label {
  right: 7px;
  bottom: 6px;
  color: #f4dfaa;
  background: rgba(13, 17, 16, 0.88);
  border: 1px solid rgba(198, 161, 91, 0.34);
  border-radius: 1px;
}

.quest-tracker {
  top: max(112px, calc(env(safe-area-inset-top) + 96px));
  left: max(18px, env(safe-area-inset-left));
  width: min(310px, calc(100% - 36px));
  padding: 8px 12px 8px 14px;
  background: linear-gradient(90deg, rgba(15, 22, 20, 0.88), rgba(15, 22, 20, 0.34) 74%, transparent);
  border-left: 3px solid #b99551;
}

.target-frame {
  width: min(310px, calc(100% - 48px));
  padding: 8px 12px 10px;
  background: linear-gradient(180deg, rgba(56, 43, 35, 0.96), rgba(17, 22, 21, 0.96) 42%);
  border-color: #8d7448;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(15, 18, 17, 0.88),
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(225, 199, 135, 0.1);
  backdrop-filter: blur(5px);
}

.target-line strong {
  color: #fff0ce;
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 0.82rem;
}

.target-health {
  height: 12px;
}

.target-health > span {
  background: linear-gradient(180deg, #d05e48, #8d2f28);
}

.target-health small {
  line-height: 12px;
}

.skill-hotbar {
  bottom: max(14px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 236px);
  grid-template-columns: repeat(12, 56px);
  gap: 4px;
  padding: 5px;
  background: linear-gradient(180deg, rgba(66, 51, 36, 0.96), rgba(18, 23, 22, 0.97));
  border: 1px solid #8d7448;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(13, 16, 15, 0.9),
    0 9px 24px rgba(0, 0, 0, 0.44),
    inset 0 0 0 1px rgba(225, 199, 135, 0.12);
}

.skill-quick-slot {
  width: 56px;
  height: 64px;
  background: linear-gradient(180deg, rgba(38, 47, 43, 0.98), rgba(13, 18, 17, 0.98));
  border-color: rgba(184, 151, 86, 0.72);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(5, 7, 7, 0.78), inset 0 0 14px rgba(0, 0, 0, 0.28);
}

.skill-quick-slot strong {
  color: #fff0ce;
  font-size: 0.64rem;
}

.skill-quick-slot small {
  color: #c9c1ae;
  font-size: 0.52rem;
}

.skill-quick-slot kbd,
.skill-quick-slot-mark {
  border-radius: 1px;
}

.attack-button {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(145deg, #a94a37, #61241f 76%);
  border-color: #b8995b;
  box-shadow:
    0 0 0 2px #262724,
    0 9px 24px rgba(0, 0, 0, 0.42),
    inset 0 0 16px rgba(0, 0, 0, 0.38);
}

.npc-interact-button {
  border-color: #a4874e;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(45, 54, 48, 0.98), rgba(14, 22, 20, 0.98));
}

@media (min-width: 721px) and (max-width: 1000px) {
  .skill-hotbar {
    grid-template-columns: repeat(6, 54px);
  }

  .skill-quick-slot {
    width: 54px;
    height: 62px;
  }

  .target-frame {
    top: max(112px, calc(env(safe-area-inset-top) + 100px));
  }

  .quest-tracker:not([hidden]) ~ .target-frame {
    top: max(180px, calc(env(safe-area-inset-top) + 168px));
  }

  .location-banner {
    top: max(174px, 27%);
  }

  .quest-tracker:not([hidden]) ~ .location-banner {
    top: max(224px, 32%);
  }
}

@media (min-width: 721px) and (max-width: 820px) and (min-height: 581px) {
  .skill-hotbar {
    grid-template-columns: repeat(6, 50px);
    gap: 3px;
  }

  .skill-quick-slot {
    width: 50px;
    height: 58px;
  }
}

@media (max-width: 720px) {
  .scene-art {
    object-position: 62% center;
  }

  .scene-shade {
    background:
      linear-gradient(0deg, rgba(18, 37, 31, 0.88) 0%, rgba(54, 90, 69, 0.44) 48%, rgba(63, 115, 112, 0.12) 100%),
      linear-gradient(90deg, rgba(213, 143, 152, 0.08), rgba(143, 139, 85, 0.1));
  }

  .menu-screen {
    padding: max(28px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  }

  .brand-block {
    width: min(100%, 460px);
    margin-bottom: 24px;
  }

  h1 {
    font-size: 3.25rem;
  }

  .menu-actions {
    width: min(100%, 340px);
  }

  .hud {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
  }

  .player-summary {
    width: min(260px, calc(100vw - 176px));
  }

  .hud-action-row .icon-button {
    width: 44px;
    height: 44px;
  }

  .hud-action-row {
    display: grid;
    grid-template-columns: repeat(2, 44px);
    gap: 7px;
  }

  .combat-automation-controls {
    width: 120px;
    max-width: 120px;
  }

  .combat-setting-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .combat-setting-toggle {
    min-height: 31px;
    padding: 4px 6px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
  }

  .combat-setting-copy strong {
    font-size: 0.6rem;
  }

  .combat-setting-control {
    justify-content: flex-end;
    gap: 4px;
  }

  .combat-setting-state {
    min-width: 34px;
    font-size: 0.52rem;
  }

  .combat-automation-controls .combat-switch-track {
    display: none;
  }

  .gold-balance {
    width: 95px;
    min-width: 95px;
    min-height: 28px;
    padding: 4px 7px;
    gap: 5px;
  }

  .gold-balance strong {
    max-width: 50px;
    font-size: 0.7rem;
  }

  .gold-balance small {
    display: none;
  }

  .minimap-shell {
    display: none;
  }

  .location-banner {
    top: max(182px, 26%);
    right: auto;
    left: max(12px, env(safe-area-inset-left));
    width: min(210px, calc(100% - 156px));
    transform: translateY(-8px);
  }

  .location-banner.is-visible {
    transform: translateY(0);
  }

  .scene-footer {
    display: none;
  }

  .movement-pad {
    display: grid;
  }

  .target-frame {
    top: max(118px, calc(env(safe-area-inset-top) + 106px));
    right: auto;
    left: max(12px, env(safe-area-inset-left));
    width: min(230px, calc(100% - 148px));
    transform: none;
  }

  .quest-tracker {
    top: max(102px, calc(env(safe-area-inset-top) + 90px));
    left: max(12px, env(safe-area-inset-left));
    width: min(210px, calc(100% - 142px));
  }

  .quest-tracker:not([hidden]) ~ .target-frame {
    top: max(184px, calc(env(safe-area-inset-top) + 172px));
  }

  .quest-tracker:not([hidden]) ~ .location-banner {
    top: max(232px, 31%);
  }

  .attack-button {
    right: max(22px, env(safe-area-inset-right));
    bottom: max(26px, env(safe-area-inset-bottom));
    width: 72px;
    height: 72px;
  }

  .skill-hotbar {
    right: max(18px, env(safe-area-inset-right));
    bottom: max(116px, calc(env(safe-area-inset-bottom) + 100px));
    left: auto;
    max-width: none;
    grid-template-columns: repeat(4, 48px);
    gap: 4px;
    transform: none;
  }

  .skill-quick-slot {
    width: 48px;
    height: 48px;
    padding: 5px 3px 4px;
    gap: 1px;
  }

  .skill-quick-config {
    width: 100%;
    grid-template-columns: repeat(4, 44px);
    justify-content: start;
  }

  .skill-quick-config > span {
    grid-column: 1 / -1;
  }

  .skill-quick-slot-mark {
    width: 17px;
    height: 17px;
    font-size: 0.67rem;
  }

  .skill-quick-slot strong {
    font-size: 0.56rem;
  }

  .skill-quick-slot small {
    font-size: 0.48rem;
  }

  .npc-interact-button {
    bottom: max(290px, calc(env(safe-area-inset-bottom) + 274px));
    width: min(230px, calc(100% - 48px));
  }

  .dialogue-layer {
    padding: 16px max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .dialogue-panel {
    width: 100%;
    max-height: min(52dvh, 420px);
    padding: 21px 20px;
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 18px;
  }

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

  .inventory-layer,
  .quest-log-layer,
  .character-stats-layer,
  .skills-layer,
  .drop-history-layer,
  .merchant-layer {
    align-items: flex-end;
  }

  .inventory-panel {
    width: 100%;
    height: min(82dvh, 680px);
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border-top: 1px solid rgba(225, 199, 135, 0.4);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.48);
  }

  .quest-log-panel {
    width: 100%;
    height: min(82dvh, 680px);
    padding: 20px max(20px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border-top: 1px solid rgba(112, 183, 166, 0.42);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.48);
  }

  .character-stats-panel {
    width: 100%;
    height: min(86dvh, 720px);
    padding: 20px max(18px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-top: 1px solid rgba(112, 183, 166, 0.46);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.5);
  }

  .drop-history-panel {
    width: 100%;
    height: min(82dvh, 680px);
    padding: 20px max(18px, env(safe-area-inset-right))
      max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-top: 1px solid rgba(225, 199, 135, 0.44);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.5);
  }

  .skills-panel {
    width: 100%;
    height: min(86dvh, 720px);
    padding: 20px max(20px, env(safe-area-inset-right))
      max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border-top: 1px solid rgba(112, 183, 166, 0.46);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.5);
  }

  .merchant-panel {
    width: 100%;
    height: min(86dvh, 720px);
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid rgba(225, 199, 135, 0.42);
    border-left: 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.52);
  }

  .merchant-header {
    padding-bottom: 11px;
  }

  .merchant-intro {
    margin-top: 10px;
  }

  .merchant-tabs {
    width: 100%;
    margin-top: 12px;
  }

  .merchant-tab-panel {
    padding-top: 12px;
  }

  .merchant-item {
    padding-block: 9px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .merchant-item-icon.item-slot {
    width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .merchant-item-trade,
  .merchant-item-trade .button {
    min-width: 96px;
  }

  .skills-header {
    padding-bottom: 14px;
  }

  .skills-profession {
    min-height: 54px;
    margin-top: 12px;
    padding-block: 7px;
  }

  .skills-profession-mark {
    width: 36px;
    height: 36px;
  }

  .skills-branch-note {
    margin-top: 9px;
    padding-block: 8px;
  }

  .skill-entry-footer {
    align-items: flex-end;
    flex-wrap: wrap;
  }

  .quest-log-header {
    padding-bottom: 14px;
  }

  .drop-history-header {
    padding-bottom: 14px;
  }

  .drop-history-list {
    margin-top: 10px;
  }

  .quest-log-group {
    padding-top: 14px;
  }

  .quest-log-group + .quest-log-group {
    margin-top: 16px;
  }

  .quest-completion-banner {
    top: max(82px, calc(env(safe-area-inset-top) + 68px));
  }

  .inventory-header {
    padding-bottom: 10px;
  }

  .inventory-tabs {
    width: 100%;
    margin-top: 10px;
  }

  .inventory-tab {
    min-height: 40px;
  }

  .equipment-section,
  .bag-section {
    padding-top: 10px;
  }

  .equipment-layout {
    margin-top: 5px;
    padding-block: 4px 2px;
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
    grid-template-rows: repeat(5, 48px);
    gap: 4px;
  }

  .equipment-slot {
    min-height: 48px;
    padding: 4px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 4px;
  }

  .equipment-slot-label {
    padding: 3px;
    font-size: 0.54rem;
  }

  .equipment-slot.has-item::before {
    left: 19px;
  }

  .equipment-slot.has-item .equipment-slot-label {
    padding: 28px 1px 1px;
    font-size: 0.46rem;
  }

  .equipment-slot-helmet {
    padding: 4px;
    grid-template-columns: 1fr;
    grid-template-rows: 18px minmax(0, 1fr);
    gap: 2px;
    text-align: center;
  }

  .equipment-slot-helmet .equipment-slot-label {
    padding: 1px 4px;
    background: transparent;
    border: 0;
  }

  .equipment-slot-helmet .item-slot-copy {
    align-items: center;
    gap: 1px;
  }

  .equipment-slot-helmet .item-slot-copy small {
    display: none;
  }

  .equipment-slot-helmet.has-item::before {
    top: 31px;
    left: 50%;
    width: 25px;
    height: 21px;
  }

  .equipment-slot-helmet.has-item .equipment-slot-label {
    padding: 1px 4px;
    align-items: center;
  }

  .equipment-slot-helmet.has-item .item-slot-copy {
    visibility: hidden;
  }

  .equipment-avatar {
    min-height: 204px;
  }

  .equipment-avatar-head {
    top: 15px;
    width: 52px;
    height: 48px;
  }

  .equipment-avatar-body {
    top: 62px;
    width: 76px;
    height: 77px;
  }

  .equipment-avatar-feet {
    bottom: 28px;
    width: 62px;
    height: 50px;
  }

  .equipment-avatar strong {
    right: -25px;
    left: -25px;
    font-size: 0.54rem;
  }

  .inventory-grid {
    margin-top: 5px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .bag-slot {
    height: 48px;
    min-height: 48px;
  }

  .item-details {
    margin-top: 10px;
    padding-top: 10px;
  }
}

@media (min-width: 520px) and (max-width: 720px) {
  .inventory-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .eyebrow {
    font-size: 0.68rem;
  }

  h1 {
    font-size: 2.75rem;
  }

  .tagline {
    font-size: 0.88rem;
  }

  .portrait {
    display: none;
  }

  .player-summary {
    width: min(210px, calc(100vw - 148px));
    min-height: 72px;
  }

  .player-line {
    gap: 5px;
  }

  .player-stats span {
    font-size: 0.56rem;
  }

  .location-banner {
    top: max(182px, 26%);
  }

  .location-banner strong {
    font-size: 1.15rem;
  }

  .stage-mark {
    max-width: 48%;
    text-align: right;
  }

  .pause-panel,
  .death-panel {
    padding: 28px 22px 24px;
  }

  .dialogue-panel {
    padding: 18px;
    gap: 14px;
  }

  .dialogue-panel h2 {
    font-size: 1.42rem;
  }

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

  .inventory-panel {
    height: min(82dvh, 660px);
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .bag-automation {
    flex-wrap: nowrap;
  }

  .bag-auto-recycle-toggle {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 auto;
  }

  .bag-protection-badge {
    flex: 0 0 auto;
  }

  .quest-log-panel {
    height: min(84dvh, 700px);
  }

  .drop-history-panel {
    height: min(84dvh, 700px);
  }

  .skills-panel {
    height: min(88dvh, 740px);
  }

  .character-stats-panel {
    height: min(88dvh, 740px);
  }

  .character-stat-list {
    grid-template-columns: 1fr;
  }

  .merchant-panel {
    height: min(88dvh, 740px);
  }

  .skill-entry {
    padding: 12px;
  }

  .skill-entry-heading {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .skill-order {
    width: 34px;
    height: 34px;
  }

  .skill-entry-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .skill-quick-config {
    grid-template-columns: repeat(4, 44px);
  }

  .skill-learn-button {
    width: 100%;
  }

  .item-details {
    align-items: stretch;
    flex-direction: column;
  }

  .item-detail-actions {
    width: 100%;
    flex-basis: auto;
  }

  .merchant-header-actions {
    gap: 7px;
  }

  .merchant-wallet {
    min-height: 38px;
    padding-inline: 8px;
  }

  .merchant-wallet strong {
    max-width: 70px;
  }

  .merchant-wallet small {
    display: none;
  }

  .merchant-item {
    align-items: start;
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .merchant-item-icon.item-slot {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .merchant-item-trade {
    width: 100%;
    min-width: 0;
    grid-column: 2;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 0.7fr);
    align-items: center;
    gap: 8px;
  }

  .merchant-item-trade .button {
    width: 100%;
    min-width: 0;
  }

  .merchant-item-price {
    text-align: left;
  }
}

@media (max-width: 340px) {
  .inventory-panel {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .inventory-grid {
    gap: 3px;
  }

  .spirit-pet-summary {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 9px;
  }

  .spirit-pet-trait {
    grid-column: 2;
    justify-self: start;
  }

  .bag-auto-recycle-toggle {
    padding-inline: 7px;
    gap: 6px;
  }

  .bag-protection-badge {
    padding-inline: 6px;
  }

  .merchant-header {
    gap: 8px;
  }

  .merchant-header h2 {
    font-size: 1.48rem;
    white-space: nowrap;
  }

  .merchant-header-actions {
    gap: 5px;
  }

  .merchant-wallet strong {
    max-width: 58px;
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  .menu-screen {
    padding-top: 22px;
    padding-bottom: 20px;
  }

  .brand-seal {
    display: none;
  }

  .hud-action-row {
    display: grid;
    grid-template-columns: repeat(3, 44px);
  }

  .hud-action-row .icon-button {
    width: 44px;
    height: 44px;
  }

  .brand-block {
    margin-bottom: 16px;
  }

  h1 {
    font-size: 3.25rem;
  }

  .tagline {
    margin-top: 7px;
  }

  .menu-meta {
    margin-top: 10px;
  }

  #primary-action {
    min-height: 48px;
  }

  .pause-panel,
  .death-panel {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .dialogue-panel {
    max-height: calc(100dvh - 24px);
    overflow: hidden;
  }

  .skills-panel {
    height: 100dvh;
    max-height: 100dvh;
  }

  .character-stats-panel {
    height: 100dvh;
    max-height: 100dvh;
  }

  .drop-history-panel {
    height: 100dvh;
    max-height: 100dvh;
  }

  .inventory-panel {
    height: 100dvh;
    max-height: 100dvh;
  }

  .merchant-panel {
    height: 100dvh;
    max-height: 100dvh;
  }

  .location-banner {
    top: 182px;
  }

  .movement-pad {
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(14px, env(safe-area-inset-left));
    width: 108px;
    height: 108px;
  }

  .movement-pad-ring {
    width: 102px;
    height: 102px;
  }

  .target-frame {
    top: max(118px, calc(env(safe-area-inset-top) + 106px));
    width: 230px;
  }

  .attack-button {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 66px;
    height: 66px;
  }
}

@media (pointer: coarse) {
  .movement-pad {
    display: grid;
  }

  .scene-footer {
    display: none;
  }

  .skill-quick-slot kbd {
    display: none;
  }

  .skill-quick-option {
    width: 44px;
    height: 44px;
  }

  .npc-interact-button {
    bottom: max(238px, calc(env(safe-area-inset-bottom) + 222px));
  }

  .npc-interact-button kbd {
    display: none;
  }

  .toast {
    bottom: max(238px, calc(env(safe-area-inset-bottom) + 222px));
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(296px, calc(env(safe-area-inset-bottom) + 280px));
  }
}

@media (pointer: coarse) and (min-width: 721px) and (min-height: 581px) {
  .skill-hotbar {
    left: calc(50% + 26px);
    grid-template-columns: repeat(6, 54px);
  }

  .skill-quick-slot {
    width: 54px;
    height: 62px;
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(386px, calc(env(safe-area-inset-bottom) + 370px));
  }
}

@media (max-width: 720px) {
  .npc-interact-button {
    bottom: max(290px, calc(env(safe-area-inset-bottom) + 274px));
  }

  .toast {
    bottom: max(290px, calc(env(safe-area-inset-bottom) + 274px));
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(348px, calc(env(safe-area-inset-bottom) + 332px));
  }
}

@media (max-width: 340px) and (min-height: 581px) {
  .combat-automation-controls {
    width: 108px;
    max-width: 108px;
  }

  .skill-hotbar {
    right: max(10px, env(safe-area-inset-right));
    grid-template-columns: repeat(3, 44px);
    gap: 4px;
  }

  .skill-quick-slot {
    width: 44px;
    height: 44px;
  }

  .npc-interact-button {
    bottom: max(328px, calc(env(safe-area-inset-bottom) + 312px));
  }

  .toast {
    bottom: max(330px, calc(env(safe-area-inset-bottom) + 314px));
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(388px, calc(env(safe-area-inset-bottom) + 372px));
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  .combat-automation-controls {
    width: 168px;
    max-width: 168px;
  }

  .combat-setting-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .combat-setting-toggle {
    min-height: 28px;
    padding: 3px 6px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
  }

  .combat-setting-copy strong {
    font-size: 0.58rem;
  }

  .combat-setting-control {
    justify-content: flex-end;
  }

  .combat-setting-state {
    min-width: 34px;
    font-size: 0.52rem;
  }

  .combat-automation-controls .combat-switch-track {
    display: none;
  }

  .skill-hotbar {
    right: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 50%;
    grid-template-columns: repeat(6, 44px);
    gap: 4px;
    transform: translateX(-50%);
  }

  .skill-quick-slot {
    width: 44px;
    height: 48px;
    padding: 4px 3px;
  }

  .npc-interact-button {
    bottom: max(136px, calc(env(safe-area-inset-bottom) + 124px));
  }

  .toast {
    bottom: max(138px, calc(env(safe-area-inset-bottom) + 126px));
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(196px, calc(env(safe-area-inset-bottom) + 184px));
  }
}

@media (max-width: 600px) and (max-height: 580px) and (orientation: landscape) {
  .skill-hotbar {
    grid-template-columns: repeat(6, 44px);
  }

  .npc-interact-button {
    bottom: max(136px, calc(env(safe-area-inset-bottom) + 124px));
  }

  .toast {
    bottom: max(138px, calc(env(safe-area-inset-bottom) + 126px));
  }

  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(196px, calc(env(safe-area-inset-bottom) + 184px));
  }
}

.app[data-state="inventory"] .toast,
.app[data-state="quests"] .toast,
.app[data-state="character-stats"] .toast,
.app[data-state="skills"] .toast,
.app[data-state="drop-history"] .toast,
.app[data-state="merchant"] .toast {
  top: max(18px, env(safe-area-inset-top));
  bottom: auto;
}

@media (min-width: 900px) {
  .app[data-state="inventory"] .toast {
    left: calc((100% - min(680px, calc(100% - 24px))) / 2);
    max-width: calc(100% - min(680px, calc(100% - 24px)) - 24px);
  }
}

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

/* Local battlefield map: iron-and-brass frame with a compact mobile drawer. */
.minimap-cluster {
  position: relative;
  width: 168px;
  min-height: 112px;
}

.minimap-toggle {
  position: relative;
  z-index: 3;
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  color: #f4dfaa;
  background: linear-gradient(180deg, rgba(57, 62, 56, 0.98), rgba(17, 23, 22, 0.98));
  border: 1px solid #8d7448;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(12, 15, 14, 0.9),
    0 7px 18px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(225, 199, 135, 0.12);
  cursor: pointer;
}

.minimap-toggle:hover,
.minimap-toggle:focus-visible {
  color: #fff2c9;
  background: linear-gradient(180deg, #4a5149, #29312e);
  border-color: #d0ad67;
  outline: none;
}

.minimap-toggle-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 16px;
  border: 1px solid currentColor;
  clip-path: polygon(0 12%, 31% 0, 67% 15%, 100% 2%, 100% 88%, 68% 100%, 32% 85%, 0 98%);
}

.minimap-toggle-icon::before,
.minimap-toggle-icon::after {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 1px;
  content: "";
  background: currentColor;
}

.minimap-toggle-icon::before {
  left: 31%;
  transform: rotate(-5deg);
}

.minimap-toggle-icon::after {
  right: 31%;
  transform: rotate(5deg);
}

.minimap-cluster.is-collapsed {
  width: 168px;
  min-height: 40px;
}

.minimap-cluster.is-collapsed .minimap-toggle {
  display: flex;
  width: 100%;
  padding-right: 10px;
  align-items: center;
  justify-content: flex-end;
}

.minimap-cluster.is-collapsed .minimap-shell {
  display: none;
}

.minimap-shell {
  isolation: isolate;
}

.minimap-canvas {
  background: #163d4b;
  image-rendering: auto;
}

.minimap-zone-context,
.minimap-coordinates,
.minimap-compass {
  position: absolute;
  z-index: 2;
  color: #f7e8bd;
  background: rgba(9, 14, 14, 0.82);
  border: 1px solid rgba(208, 173, 103, 0.32);
  border-radius: 1px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
  line-height: 1;
  pointer-events: none;
}

.minimap-zone-context {
  top: 7px;
  left: 7px;
  display: flex;
  max-width: 110px;
  padding: 3px 5px 4px;
  flex-direction: column;
  gap: 3px;
}

.minimap-zone-name,
.minimap-entry-threshold {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.minimap-zone-name {
  font-family: "STKaiti", "KaiTi", "Microsoft YaHei", serif;
  font-size: 0.66rem;
  font-weight: 700;
}

.minimap-entry-threshold {
  color: #d9d2bd;
  font-size: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.minimap-zone-context.has-entry-requirement .minimap-entry-threshold {
  color: #f1cc73;
}

.minimap-cluster.is-collapsed .minimap-zone-context {
  top: 6px;
  right: 42px;
  left: 8px;
  z-index: 4;
  max-width: none;
  padding: 0;
  gap: 3px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.minimap-coordinates {
  bottom: 6px;
  left: 7px;
  padding: 2px 4px;
  color: #d9d2bd;
  font-size: 0.52rem;
  font-variant-numeric: tabular-nums;
}

.minimap-compass {
  top: 7px;
  right: 7px;
  display: grid;
  width: 20px;
  height: 20px;
  padding-top: 6px;
  place-items: center;
  color: #f1cc73;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 0.48rem;
  font-weight: 800;
}

.minimap-compass::before {
  position: absolute;
  top: 2px;
  left: 7px;
  width: 0;
  height: 0;
  content: "";
  border-right: 3px solid transparent;
  border-bottom: 5px solid #f1cc73;
  border-left: 3px solid transparent;
}

@media (max-width: 720px) {
  .minimap-cluster {
    width: 120px;
    min-height: 81px;
  }

  .minimap-toggle {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    width: 25px;
    height: 25px;
    background: rgba(12, 18, 17, 0.9);
  }

  .minimap-toggle-icon {
    width: 14px;
    height: 11px;
  }

  .minimap-cluster.is-collapsed {
    width: 120px;
    min-height: 40px;
  }

  .minimap-cluster.is-collapsed .minimap-toggle {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 40px;
    padding-right: 8px;
  }

  .minimap-shell {
    display: block;
    width: 120px;
    height: 81px;
    padding: 3px;
  }

  .minimap-canvas {
    width: 112px;
    height: 73px;
  }

  .minimap-zone-context {
    top: 5px;
    left: 5px;
    max-width: 72px;
    padding: 2px 4px 3px;
    gap: 2px;
  }

  .minimap-zone-name {
    font-size: 0.52rem;
  }

  .minimap-entry-threshold {
    font-size: 0.42rem;
  }

  .minimap-cluster.is-collapsed .minimap-zone-context {
    top: 6px;
    right: 32px;
    left: 7px;
    max-width: none;
    padding: 0;
  }

  .minimap-compass {
    top: 5px;
    right: 5px;
    width: 17px;
    height: 17px;
    padding-top: 5px;
    font-size: 0.42rem;
  }

  .minimap-compass::before {
    top: 2px;
    left: 5px;
  }

  .minimap-coordinates {
    bottom: 5px;
    left: 5px;
    font-size: 0.46rem;
  }

  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame {
    right: auto;
    left: max(12px, env(safe-area-inset-left));
    width: min(210px, calc(100% - 168px));
    transform: none;
  }
}

@media (max-width: 340px) {
  .minimap-cluster {
    width: 108px;
    min-height: 73px;
  }

  .minimap-cluster.is-collapsed {
    width: 108px;
    min-height: 40px;
  }

  .minimap-cluster.is-collapsed .minimap-zone-context {
    right: 30px;
  }

  .minimap-shell {
    width: 108px;
    height: 73px;
  }

  .minimap-canvas {
    width: 100px;
    height: 65px;
  }
}

/* Public playtest HUD: keep touch controls at the edges of the battlefield. */
@media (max-width: 720px), (max-height: 580px) and (orientation: landscape) {
  .game-world-frame {
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    max-height: calc(100dvh - 8px);
    aspect-ratio: auto;
  }

  .hud {
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    left: max(6px, env(safe-area-inset-left));
    height: 166px;
    display: block;
  }

  .hud-tools {
    display: contents;
    pointer-events: none;
  }

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

  .player-summary {
    width: calc(100% - 118px);
    min-height: 72px;
    height: 72px;
    padding: 6px 7px;
    gap: 0;
  }

  .player-summary .portrait,
  .player-summary::before,
  .player-stats > span:not(#player-level) {
    display: none;
  }

  .player-vitals {
    width: 100%;
    min-width: 0;
  }

  .player-line {
    margin-bottom: 5px;
    gap: 4px;
  }

  .player-line strong {
    font-size: 0.72rem;
  }

  .player-stats #player-level {
    font-size: 0.56rem;
  }

  .hud-action-row {
    position: absolute;
    top: 78px;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(6, minmax(44px, 1fr));
    gap: 4px;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .hud-action-row .icon-button {
    width: 100%;
    height: 44px;
    min-width: 44px;
  }

  .gold-balance {
    position: absolute;
    top: 48px;
    right: 0;
    width: 112px;
    min-width: 0;
    min-height: 24px;
    height: 24px;
    padding: 2px 6px;
  }

  .gold-balance strong {
    max-width: 82px;
    font-size: 0.65rem;
  }

  .gold-balance small {
    display: none;
  }

  .combat-automation-controls {
    position: absolute;
    top: 128px;
    right: 0;
    left: 0;
    width: auto;
    max-width: none;
  }

  .combat-setting-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .combat-setting-toggle {
    min-height: 44px;
    height: 44px;
    padding: 4px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 2px;
    border-radius: 2px;
  }

  .combat-setting-copy strong {
    font-size: 0.65rem;
  }

  .combat-setting-control {
    justify-content: center;
    gap: 0;
  }

  .combat-setting-state {
    min-width: 0;
    font-size: 0.56rem;
    line-height: 1;
  }

  .combat-automation-controls .combat-switch-track {
    display: none;
  }

  .minimap-cluster,
  .minimap-cluster.is-collapsed {
    position: absolute;
    top: 0;
    right: 0;
    width: 112px;
    min-height: 44px;
    height: 44px;
  }

  .minimap-cluster .minimap-toggle,
  .minimap-cluster.is-collapsed .minimap-toggle {
    position: relative;
    top: 0;
    right: auto;
    bottom: auto;
    display: flex;
    width: 100%;
    height: 44px;
    padding-right: 7px;
    align-items: center;
    justify-content: flex-end;
  }

  .minimap-cluster .minimap-zone-context,
  .minimap-cluster.is-collapsed .minimap-zone-context {
    top: 8px;
    right: 26px;
    left: 6px;
    z-index: 4;
    max-width: none;
    padding: 0;
    gap: 4px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .minimap-zone-name {
    font-size: 0.6rem;
  }

  .minimap-entry-threshold {
    font-size: 0.49rem;
  }

  .minimap-shell {
    position: absolute;
    top: 178px;
    right: 0;
    display: block;
    width: 168px;
    height: 112px;
  }

  .minimap-canvas {
    width: 160px;
    height: 104px;
  }

  .target-frame,
  .quest-tracker:not([hidden]) ~ .target-frame,
  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame {
    top: max(184px, calc(env(safe-area-inset-top) + 178px));
    right: auto;
    left: max(6px, env(safe-area-inset-left));
    width: min(216px, calc(100% - 20px));
    padding: 5px 8px;
    transform: none;
  }

  .target-line {
    margin-bottom: 4px;
    gap: 5px;
  }

  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame {
    width: min(216px, calc(100% - 190px));
  }

  .target-line strong {
    font-size: 0.69rem;
  }

  .target-line span {
    font-size: 0.54rem;
  }

  .quest-tracker {
    top: max(184px, calc(env(safe-area-inset-top) + 178px));
    left: max(6px, env(safe-area-inset-left));
    width: 170px;
    padding: 5px 8px;
    font-size: 0.62rem;
  }

  .app:has(.target-frame:not([hidden])) .quest-tracker {
    display: none;
  }

  .location-banner,
  .quest-tracker:not([hidden]) ~ .location-banner {
    top: 232px;
    right: auto;
    left: 12px;
    width: min(200px, calc(100% - 24px));
  }

  .skill-hotbar {
    right: max(6px, env(safe-area-inset-right));
    bottom: max(6px, env(safe-area-inset-bottom));
    left: max(6px, env(safe-area-inset-left));
    width: auto;
    max-width: none;
    grid-template-columns: repeat(6, minmax(44px, 1fr));
    grid-template-rows: repeat(2, 48px);
    gap: 3px;
    padding: 4px;
    transform: none;
  }

  .skill-quick-slot {
    width: 100%;
    min-width: 44px;
    height: 48px;
    padding: 3px 1px;
    gap: 1px;
  }

  .skill-quick-slot-mark {
    width: 15px;
    height: 15px;
    font-size: 0.62rem;
  }

  .skill-quick-slot strong {
    font-size: 0.56rem;
  }

  .skill-quick-slot small {
    font-size: 0.49rem;
  }

  .movement-pad {
    bottom: max(118px, calc(env(safe-area-inset-bottom) + 112px));
    left: max(8px, env(safe-area-inset-left));
    width: 96px;
    height: 96px;
  }

  .movement-pad-ring {
    width: 90px;
    height: 90px;
  }

  .movement-knob {
    width: 40px;
    height: 40px;
  }

  .attack-button {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(128px, calc(env(safe-area-inset-bottom) + 122px));
    width: 72px;
    height: 72px;
  }

  .npc-interact-button {
    bottom: max(124px, calc(env(safe-area-inset-bottom) + 118px));
    width: min(164px, calc(100% - 202px));
    min-width: 96px;
    min-height: 44px;
    padding: 8px 5px;
    font-size: 0.65rem;
  }

  .npc-interact-button span {
    font-size: 0.65rem;
  }

  .toast,
  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(224px, calc(env(safe-area-inset-bottom) + 218px));
    max-width: calc(100% - 32px);
    padding: 8px 12px;
    font-size: 0.72rem;
  }

  .gem-fusion-alert {
    position: absolute;
    top: 228px;
    right: 0;
    max-width: 180px;
  }
}

@media (max-height: 580px) and (orientation: landscape) {
  .hud {
    height: 94px;
  }

  .player-summary {
    width: 208px;
    height: 70px;
    min-height: 70px;
  }

  .hud-action-row {
    top: 0;
    left: auto;
    width: 284px;
  }

  .combat-automation-controls {
    top: 50px;
    left: auto;
    width: 284px;
  }

  .minimap-cluster,
  .minimap-cluster.is-collapsed {
    right: auto;
    left: 214px;
  }

  .minimap-shell {
    top: 100px;
  }

  .gold-balance {
    top: 48px;
    right: auto;
    left: 214px;
  }

  .target-frame,
  .quest-tracker:not([hidden]) ~ .target-frame,
  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame {
    top: max(84px, calc(env(safe-area-inset-top) + 78px));
    width: 208px;
  }

  .quest-tracker {
    top: max(84px, calc(env(safe-area-inset-top) + 78px));
  }

  .location-banner,
  .quest-tracker:not([hidden]) ~ .location-banner {
    top: 130px;
  }

  .skill-hotbar {
    right: auto;
    left: 50%;
    width: min(382px, calc(100% - 236px));
    transform: translateX(-50%);
  }

  .movement-pad {
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .attack-button {
    bottom: max(22px, env(safe-area-inset-bottom));
  }

  .npc-interact-button {
    bottom: max(120px, calc(env(safe-area-inset-bottom) + 114px));
    width: 190px;
  }

  .toast,
  .app[data-state="playing"]:has(.npc-interact-button:not([hidden])) .toast {
    bottom: max(172px, calc(env(safe-area-inset-bottom) + 166px));
  }

  .gem-fusion-alert {
    top: 100px;
  }
}

@media (max-width: 660px) and (max-height: 580px) and (orientation: landscape) {
  .player-summary {
    width: calc(100% - 294px);
  }

  .minimap-cluster,
  .minimap-cluster.is-collapsed {
    top: 76px;
    left: 0;
  }

  .minimap-shell {
    top: 50px;
    right: auto;
    left: 0;
  }

  .gold-balance {
    top: 76px;
    left: 118px;
    width: 82px;
  }

  .target-frame,
  .quest-tracker:not([hidden]) ~ .target-frame,
  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame,
  .quest-tracker {
    top: 132px;
  }

  .app:has(.minimap-cluster:not(.is-collapsed)) .target-frame {
    left: 184px;
    width: min(208px, calc(100% - 196px));
  }
}
