:root {
  --ink: #060706;
  --ink-soft: #0c0e0c;
  --bone: #d3c7b4;
  --bone-dim: #8f877b;
  --ash: #62665f;
  --blood: #8f1e17;
  --blood-bright: #c44132;
  --ember: #c8813a;
  --ember-hot: #f2b05f;
  --moss: #667257;
  --fog: #9da8a0;
  --line: rgba(203, 190, 168, 0.16);
  --serif: "Cormorant Garamond", "Times New Roman", "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 1px solid rgba(222, 169, 101, 0.75);
  outline-offset: 3px;
}

#game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, #111712 0%, #080a08 48%, #040504 100%);
}

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.grain,
.vignette,
#damageFlash,
#fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grain {
  z-index: 4;
  opacity: 0.06;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
}

/* Weak GPUs skip the full-screen noise layer to save compositing work. */
.lowfx .grain {
  display: none;
}

.vignette {
  z-index: 5;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(0, 0, 0, 0.2) 72%, rgba(0, 0, 0, 0.72) 120%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.24), transparent 18%, transparent 72%, rgba(0, 0, 0, 0.38));
}

#damageFlash {
  z-index: 8;
  opacity: 0;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(112, 9, 6, 0.38) 75%, rgba(148, 12, 8, 0.72) 120%);
}

#damageFlash.flash {
  animation: damageFlash 0.48s ease-out;
}

@keyframes damageFlash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}

#fade {
  z-index: 50;
  background: #020302;
  opacity: 0;
  transition: opacity 0.7s ease;
}

#fade.dark {
  opacity: 1;
}

/* ───────────────────────── HUD ───────────────────────── */

#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#hud.hidden {
  display: none;
}

#hud.entering {
  animation: hudEnter 1.4s ease both;
}

@keyframes hudEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hud-area {
  position: absolute;
  top: 32px;
  left: 38px;
  width: min(360px, 34vw);
  text-shadow: 0 2px 14px #000;
  opacity: 0.88;
}

.kicker {
  margin: 0;
  color: var(--ember);
  font-family: var(--sans);
  font-size: 0.61rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.hud-area .kicker {
  font-size: 0.56rem;
  opacity: 0.62;
}

.hud-area h2 {
  margin: 7px 0 8px;
  color: #ded4c2;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.area-objective {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #8d8a80;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.area-objective .objective-mark {
  flex: 0 0 18px;
  width: 18px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--ember));
}

#areaObjectiveText {
  color: #8d8a80;
}

.hud-right {
  position: absolute;
  top: 30px;
  right: 38px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.soul-wallet {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 118px;
  padding: 8px 2px 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  justify-content: flex-end;
  text-shadow: 0 2px 10px #000;
}

.soul-wallet #soulValue {
  color: #d5cabd;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.soul-wallet small {
  color: #77746d;
  font-size: 0.56rem;
  letter-spacing: 0.24em;
}

.soul-mark {
  position: relative;
  display: inline-block;
  width: 9px;
  height: 13px;
  background: radial-gradient(ellipse at 50% 68%, #ffe2a6 0%, #d29245 30%, rgba(156, 70, 23, 0.5) 64%, transparent 72%);
  filter: drop-shadow(0 0 7px rgba(225, 150, 68, 0.8));
  transform: translateY(2px);
}

.soul-mark::before {
  content: "";
  position: absolute;
  inset: -5px -6px -2px;
  background: radial-gradient(ellipse, rgba(221, 151, 70, 0.22), transparent 70%);
}

.soul-mark.small {
  width: 6px;
  height: 9px;
  filter: drop-shadow(0 0 5px rgba(110, 172, 187, 0.9));
  background: radial-gradient(ellipse at 50% 68%, #e7ffff 0%, #76b4bd 34%, rgba(37, 103, 117, 0.45) 66%, transparent 74%);
}

.icon-button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(195, 180, 154, 0.12);
  border-radius: 50%;
  background: rgba(8, 10, 8, 0.36);
  color: #77776f;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.icon-button:hover {
  color: #d0c2ac;
  border-color: rgba(195, 180, 154, 0.34);
  background: rgba(20, 22, 18, 0.6);
}

.icon-button svg {
  width: 15px;
  height: 15px;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button svg .sound-wave {
  fill: none;
}

.icon-button.muted .sound-wave {
  opacity: 0.15;
}

.icon-button.muted::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 1px;
  background: #786e63;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.icon-button {
  position: relative;
}

.hud-status {
  position: absolute;
  bottom: 34px;
  left: 38px;
  width: 350px;
  filter: drop-shadow(0 3px 12px rgba(0, 0, 0, 0.8));
}

.level-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #76736b;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.level-line strong {
  margin-left: auto;
  color: #b9ad9c;
  font-family: var(--serif);
  font-size: 0.79rem;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.ember-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 9px 2px rgba(203, 127, 54, 0.32);
}

.bar {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(182, 166, 142, 0.18);
  background: rgba(5, 6, 5, 0.8);
  clip-path: polygon(0 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}

.hp-bar {
  height: 13px;
  padding: 2px;
}

.stamina-bar {
  height: 8px;
  margin-top: 5px;
  padding: 1px;
  border-color: rgba(163, 174, 143, 0.13);
}

.bar-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transition: width 0.14s linear;
  clip-path: polygon(0 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}

.hp-bar .bar-fill {
  background:
    linear-gradient(to bottom, rgba(255, 166, 132, 0.28), transparent 45%),
    linear-gradient(to right, #64130f, #9b241d 55%, #78201a);
  box-shadow: 0 0 8px rgba(143, 30, 23, 0.35);
}

.stamina-bar .bar-fill {
  background:
    linear-gradient(to bottom, rgba(224, 232, 191, 0.15), transparent 55%),
    linear-gradient(to right, #4c5840, #788363);
}

.bar-shine {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 7px;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 207, 180, 0.25), transparent 65%);
  pointer-events: none;
}

.status-bottom {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
}

.estus-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.flask-icon {
  width: 16px;
  height: 20px;
  overflow: visible;
  fill: rgba(75, 45, 22, 0.35);
  stroke: #9e7d4e;
  stroke-width: 1.2;
  filter: drop-shadow(0 0 5px rgba(221, 146, 60, 0.24));
}

.flask-icon .flask-glow {
  fill: rgba(219, 138, 47, 0.48);
  stroke: none;
}

.estus-pips {
  display: flex;
  gap: 4px;
}

.estus-pips .pip {
  width: 4px;
  height: 12px;
  background: linear-gradient(to top, #a74d1f, #edaa55);
  box-shadow: 0 0 6px rgba(203, 111, 43, 0.35);
  clip-path: polygon(50% 0, 100% 25%, 76% 100%, 24% 100%, 0 25%);
  transition: opacity 0.25s, background 0.25s;
}

.estus-pips .pip.empty {
  background: #34352f;
  box-shadow: none;
  opacity: 0.45;
}

#estusCount {
  color: #8d7f6d;
  font-family: var(--serif);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  min-width: 12px;
}

.soul-stain-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #6e9ba2;
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

/* ───────────────────── Boss / prompts ───────────────────── */

.boss-bar {
  position: absolute;
  bottom: 54px;
  left: 50%;
  width: min(620px, 56vw);
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 16px #000);
  transition: opacity 0.6s ease;
}

.boss-bar.hidden {
  display: none;
}

.boss-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  text-align: center;
  text-shadow: 0 2px 10px #000;
}

.boss-epithet {
  color: #8b765b;
  font-size: 0.52rem;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
}

.boss-name {
  color: #ded0b9;
  font-family: var(--serif);
  font-size: 1.14rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}

.boss-track {
  position: relative;
  height: 8px;
  border: 1px solid rgba(169, 145, 113, 0.28);
  background: rgba(3, 3, 3, 0.86);
  padding: 2px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 7px 100%);
}

.boss-fill {
  height: 100%;
  width: 100%;
  background:
    linear-gradient(to bottom, rgba(255, 196, 125, 0.2), transparent 60%),
    linear-gradient(to right, #6c1712, #a93326 55%, #7e2119);
  transition: width 0.18s linear;
}

.boss-track-glow {
  position: absolute;
  inset: -7px 0;
  background: radial-gradient(ellipse at center, rgba(146, 35, 22, 0.16), transparent 70%);
  pointer-events: none;
}

.interact-prompt {
  position: absolute;
  bottom: 146px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px 9px;
  border: 1px solid rgba(201, 185, 157, 0.14);
  background: linear-gradient(90deg, rgba(8, 9, 7, 0.84), rgba(13, 14, 11, 0.68));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
  color: #c5b9a5;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  backdrop-filter: blur(4px);
  animation: promptIn 0.25s ease both;
}

.interact-prompt.hidden {
  display: none;
}

@keyframes promptIn {
  from { opacity: 0; transform: translate(-50%, 5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid rgba(200, 184, 158, 0.22);
  border-bottom-color: rgba(200, 184, 158, 0.12);
  background: rgba(30, 31, 26, 0.7);
  color: #bdb09d;
  font-family: var(--sans);
  font-size: 0.55rem;
  font-style: normal;
  letter-spacing: 0.12em;
  line-height: 1.4;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.interact-prompt kbd {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--ember-hot);
  border-color: rgba(204, 135, 67, 0.35);
  background: rgba(65, 40, 18, 0.5);
  font-family: var(--serif);
  font-size: 0.75rem;
}

.toast {
  position: absolute;
  top: 11%;
  left: 50%;
  padding: 9px 26px;
  border-top: 1px solid transparent;
  border-bottom: 1px solid transparent;
  color: #d0c3ae;
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.16em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 0.35s ease, transform 0.35s ease, border-color 0.35s;
  text-shadow: 0 3px 16px #000;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  border-color: rgba(196, 176, 145, 0.15);
  background: linear-gradient(90deg, transparent, rgba(8, 9, 7, 0.55) 22%, rgba(8, 9, 7, 0.55) 78%, transparent);
}

.toast.danger {
  color: #d88a76;
}

.control-legend {
  position: absolute;
  right: 36px;
  bottom: 32px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px 18px;
  color: #7f7f75;
  font-size: 0.55rem;
  letter-spacing: 0.09em;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.control-legend:hover {
  opacity: 0.85;
}

.control-legend > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-legend kbd {
  padding: 1px 4px;
  border-color: rgba(200, 184, 158, 0.1);
  background: rgba(10, 11, 9, 0.4);
  font-size: 0.48rem;
}

/* ───────────────────────── Overlays ───────────────────────── */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

#restScreen,
#pauseScreen,
#deathScreen,
#victoryScreen,
#boonScreen,
#routeScreen,
#guideScreen,
#bestiaryScreen {
  display: none;
}

#restScreen.show,
#pauseScreen.show,
#deathScreen.show,
#victoryScreen.show,
#boonScreen.show,
#routeScreen.show,
#guideScreen.show,
#bestiaryScreen.show {
  display: grid;
}

.start-screen {
  z-index: 30;
  overflow: hidden;
  background-color: #050705;
  background:
    radial-gradient(ellipse at 50% 43%, rgba(22, 27, 21, 0.12) 0%, rgba(4, 5, 4, 0.46) 53%, rgba(2, 3, 2, 0.88) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.2) 45%, rgba(0, 0, 0, 0.72));
}

.title-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.start-screen::before,
.start-screen::after {
  z-index: 1;
}

.start-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 60%, rgba(169, 111, 45, 0.055), transparent 28%),
    repeating-linear-gradient(90deg, transparent 0 119px, rgba(201, 187, 163, 0.012) 119px 120px);
}

.start-screen::after {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 50%;
  width: min(760px, 88vw);
  border-left: 1px solid rgba(203, 187, 160, 0.035);
  border-right: 1px solid rgba(203, 187, 160, 0.035);
  transform: translateX(-50%);
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}

.start-screen.leaving {
  animation: startLeave 1.2s ease both;
  pointer-events: none;
}

@keyframes startLeave {
  0% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

.start-frame {
  position: relative;
  z-index: 2;
  width: min(860px, 94vw);
  padding: 18px 24px 16px;
  text-align: center;
  animation: startReveal 1.9s cubic-bezier(0.22, 0.75, 0.2, 1) both;
}

@keyframes startReveal {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.start-crest {
  position: relative;
  width: 1px;
  height: 58px;
  margin: 0 auto 24px;
  background: linear-gradient(to bottom, transparent, rgba(196, 141, 81, 0.55));
}

.start-crest span {
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 9px;
  height: 14px;
  background: radial-gradient(ellipse at 50% 65%, #ffe3a9, #db9344 33%, rgba(134, 59, 18, 0.55) 63%, transparent 72%);
  filter: drop-shadow(0 0 12px rgba(224, 149, 68, 0.78));
  transform: translateX(-50%);
  animation: emberBreathe 2.8s ease-in-out infinite;
}

@keyframes emberBreathe {
  0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(0.9); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.12); }
}

.start-frame .kicker {
  margin-bottom: 24px;
  font-size: 0.64rem;
  letter-spacing: 0.44em;
  opacity: 0.7;
}

.start-frame h1 {
  position: relative;
  display: inline-block;
  margin: 0;
  color: #ddd2c0;
  font-family: var(--serif);
  font-size: clamp(4.4rem, 10vw, 8.8rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.08em;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1),
    0 18px 60px rgba(0, 0, 0, 0.75);
}

.start-frame h1::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -30% -18%;
  background: radial-gradient(ellipse at 68% 55%, rgba(168, 90, 31, 0.17), transparent 56%);
  filter: blur(14px);
}

.start-frame h1 span {
  position: relative;
  color: #b96d34;
  text-shadow:
    0 0 28px rgba(191, 104, 42, 0.25),
    0 18px 60px rgba(0, 0, 0, 0.75);
}

.title-en {
  margin: 12px 0 0;
  color: #7d7264;
  font-family: var(--serif);
  font-size: clamp(0.7rem, 1.3vw, 0.94rem);
  letter-spacing: 0.76em;
  text-indent: 0.76em;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  width: min(290px, 52vw);
  margin: 28px auto 25px;
  opacity: 0.62;
}

.ornament i {
  height: 1px;
  flex: 1;
  background: linear-gradient(to right, transparent, rgba(202, 182, 150, 0.42));
}

.ornament i:last-child {
  background: linear-gradient(to left, transparent, rgba(202, 182, 150, 0.42));
}

.ornament b {
  width: 6px;
  height: 6px;
  border: 1px solid rgba(202, 182, 150, 0.58);
  transform: rotate(45deg);
}

.lore {
  margin: 0 auto;
  max-width: 600px;
  color: #a29a8c;
  font-family: var(--serif);
  font-size: clamp(0.82rem, 1.2vw, 0.98rem);
  line-height: 2.05;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 14px #000;
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  margin-top: 37px;
}

.start-actions .primary-button {
  margin-top: 0;
}

.start-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 13px auto 0;
}

.start-guide {
  display: block;
  width: min(235px, 100%);
  margin: 0;
  padding: 9px 18px 8px;
  background: transparent;
}

.start-guide span {
  font-size: 0.78rem;
}

.start-guide small {
  font-size: 0.46rem;
}

.start-secondary-actions .start-guide {
  width: min(235px, 100%);
}

.tower-entry {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 238px;
  padding: 15px 28px 14px;
  border: 1px solid rgba(155, 174, 158, 0.24);
  background: linear-gradient(180deg, rgba(20, 30, 23, 0.38), rgba(7, 10, 8, 0.62));
  color: #aab5a5;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, background 0.3s, box-shadow 0.3s;
}

.tower-entry span {
  font-family: var(--serif);
  font-size: 0.96rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
}

.tower-entry small {
  color: #657062;
  font-size: 0.45rem;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
}

.tower-entry:hover,
.tower-entry:focus-visible {
  border-color: rgba(164, 197, 168, 0.5);
  color: #d8e2d2;
  background: linear-gradient(180deg, rgba(34, 53, 39, 0.5), rgba(10, 15, 11, 0.72));
  box-shadow: 0 0 30px rgba(89, 138, 94, 0.1), inset 0 0 18px rgba(102, 144, 102, 0.05);
}

.primary-button {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 252px;
  margin-top: 37px;
  padding: 17px 32px 14px;
  overflow: hidden;
  border: 1px solid rgba(194, 167, 127, 0.36);
  background:
    linear-gradient(90deg, rgba(103, 55, 22, 0.08), rgba(163, 96, 42, 0.16) 50%, rgba(103, 55, 22, 0.08)),
    rgba(7, 8, 6, 0.6);
  color: #d6c6ae;
  cursor: pointer;
  transition: border-color 0.3s, box-shadow 0.3s, color 0.3s, background 0.3s;
}

.primary-button::before,
.primary-button::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(207, 177, 132, 0.34);
  transform: translateY(-50%) rotate(45deg);
  transition: background 0.3s;
}

.primary-button::before { left: 11px; }
.primary-button::after { right: 11px; }

.primary-button:hover,
.primary-button:focus-visible {
  border-color: rgba(221, 169, 100, 0.68);
  background:
    linear-gradient(90deg, rgba(117, 60, 22, 0.16), rgba(183, 112, 49, 0.25) 50%, rgba(117, 60, 22, 0.16)),
    rgba(10, 11, 8, 0.8);
  color: #f0e3cd;
  box-shadow: 0 0 34px rgba(172, 92, 33, 0.12), inset 0 0 22px rgba(165, 87, 31, 0.06);
}

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

.primary-button span {
  font-family: var(--serif);
  font-size: 1.02rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
}

.primary-button small {
  color: #70675a;
  font-family: var(--sans);
  font-size: 0.46rem;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
}

.primary-button.compact {
  min-width: 210px;
  padding: 13px 30px 11px;
  margin-top: 24px;
}

.start-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px 18px;
  width: min(700px, 90vw);
  margin: 37px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(196, 177, 148, 0.1);
}

.start-controls > div {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #7e7a6e;
  font-size: 0.57rem;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.start-controls kbd {
  border: 0;
  background: transparent;
  color: #9e9585;
  font-family: var(--serif);
  font-size: 0.4rem;
  letter-spacing: 0.13em;
  box-shadow: none;
}

.start-footnote {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 3;
  margin: 0;
  color: #45453f;
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  transform: translateX(-50%);
  white-space: nowrap;
}

.stone-panel {
  position: relative;
  width: min(520px, 92vw);
  overflow: hidden;
  border: 1px solid rgba(193, 174, 145, 0.17);
  background:
    linear-gradient(180deg, rgba(23, 24, 20, 0.96), rgba(9, 10, 8, 0.98)),
    radial-gradient(ellipse at 50% 0%, rgba(150, 93, 39, 0.08), transparent 60%);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 240, 209, 0.035);
  padding: 44px 46px 38px;
  text-align: center;
  animation: panelIn 0.4s cubic-bezier(0.22, 0.75, 0.2, 1) both;
}

.stone-panel::before,
.stone-panel::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-color: rgba(202, 176, 135, 0.26);
  border-style: solid;
  pointer-events: none;
}

.stone-panel::before {
  top: 8px;
  left: 8px;
  border-width: 1px 0 0 1px;
}

.stone-panel::after {
  right: 8px;
  bottom: 8px;
  border-width: 0 1px 1px 0;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-screen {
  background: rgba(3, 4, 3, 0.72);
  backdrop-filter: blur(5px) saturate(0.6);
}

.guide-screen {
  z-index: 60;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(78, 58, 34, 0.18), rgba(2, 4, 3, 0.88) 62%, rgba(1, 2, 1, 0.96)),
    rgba(2, 3, 2, 0.78);
  backdrop-filter: blur(7px) saturate(0.62);
}

.guide-panel {
  position: relative;
  width: min(920px, 94vw);
  max-height: 91vh;
  overflow-y: auto;
  text-align: left;
}

.guide-top-close {
  position: absolute;
  top: 17px;
  right: 19px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(194, 170, 135, 0.22);
  border-radius: 50%;
  background: rgba(8, 9, 7, 0.5);
  color: #a89b86;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}

.guide-top-close:hover,
.guide-top-close:focus-visible {
  border-color: rgba(222, 172, 106, 0.6);
  background: rgba(54, 34, 17, 0.65);
  color: #f0d3a1;
}

.guide-panel h2 {
  text-align: left;
}

.guide-panel .panel-lore {
  margin-bottom: 20px;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 30px;
}

.guide-section {
  padding-top: 16px;
  border-top: 1px solid rgba(192, 175, 148, 0.11);
}

.guide-story {
  grid-column: 1 / -1;
  padding-bottom: 4px;
}

.guide-story p {
  margin: 7px 0 0;
  color: #948b7d;
  font-family: var(--serif);
  font-size: 0.72rem;
  line-height: 1.85;
  letter-spacing: 0.04em;
}

.guide-section h3 {
  margin: 0 0 12px;
  color: #c5ad86;
  font-family: var(--serif);
  font-size: 0.94rem;
  font-weight: 400;
  letter-spacing: 0.18em;
}

.guide-keys {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.guide-keys > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #8f887b;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
}

.guide-keys > div span {
  min-width: 0;
}

.guide-keys kbd {
  flex: none;
  min-width: 58px;
  text-align: center;
}

.guide-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #8b8477;
  font-size: 0.66rem;
  line-height: 1.8;
  letter-spacing: 0.04em;
}

.guide-list li {
  position: relative;
  padding-left: 14px;
}

.guide-list li::before {
  content: "◇";
  position: absolute;
  left: 0;
  color: rgba(200, 147, 86, 0.65);
  font-size: 0.55rem;
  top: 0.3em;
}

.guide-close {
  display: flex;
  margin: 24px auto 0;
}

.bestiary-screen {
  z-index: 61;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(77, 53, 29, 0.2), rgba(2, 4, 3, 0.88) 64%, rgba(1, 2, 1, 0.97)),
    rgba(2, 3, 2, 0.8);
  backdrop-filter: blur(7px) saturate(0.62);
}

.bestiary-panel {
  position: relative;
  width: min(980px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: rgba(173, 143, 98, 0.32) transparent;
}

.bestiary-panel::-webkit-scrollbar {
  width: 6px;
}

.bestiary-panel::-webkit-scrollbar-track {
  background: transparent;
}

.bestiary-panel::-webkit-scrollbar-thumb {
  border-radius: 3px;
  background: rgba(173, 143, 98, 0.26);
}

.bestiary-panel h2 {
  text-align: left;
}

.bestiary-panel .panel-lore {
  margin-bottom: 20px;
}

.bestiary-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(192, 175, 148, 0.12);
}

.bestiary-tabs button {
  position: relative;
  padding: 9px 16px 11px;
  border: 0;
  background: transparent;
  color: #756e62;
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  cursor: pointer;
}

.bestiary-tabs button small {
  margin-left: 5px;
  color: #5e5a51;
  font-family: var(--sans);
  font-size: 0.46rem;
  letter-spacing: 0.06em;
}

.bestiary-tabs button::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 1px;
  background: transparent;
}

.bestiary-tabs button:hover,
.bestiary-tabs button.active {
  color: #d8b77f;
}

.bestiary-tabs button.active::after {
  background: rgba(208, 150, 82, 0.72);
}

.bestiary-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}

.bestiary-card {
  --beast-color: #9f8e76;
  display: flex;
  gap: 13px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid rgba(190, 173, 146, 0.11);
  background:
    linear-gradient(90deg, rgba(70, 48, 27, 0.09), transparent 68%),
    rgba(12, 13, 10, 0.34);
}

.bestiary-glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(194, 177, 148, 0.24);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(48, 37, 24, 0.8), rgba(9, 10, 8, 0.9));
  color: var(--beast-color);
  font-family: var(--serif);
  font-size: 1rem;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 0, 0, 0.24);
}

.bestiary-thumb {
  display: block;
  flex: none;
  width: 90px;
  height: 84px;
  border: 1px solid rgba(194, 177, 148, 0.18);
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 238, 204, 0.035), transparent 58%),
    rgba(5, 7, 5, 0.58);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.38);
}

.bestiary-info {
  min-width: 0;
}

.bestiary-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.bestiary-title strong {
  overflow: hidden;
  color: #cbbca7;
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bestiary-title small {
  flex: none;
  color: #77654f;
  font-size: 0.45rem;
  letter-spacing: 0.12em;
}

.bestiary-card p {
  margin: 5px 0 0;
  color: #7f786c;
  font-size: 0.58rem;
  line-height: 1.7;
  letter-spacing: 0.03em;
}

.bestiary-meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  color: #605b52;
  font-size: 0.48rem;
  letter-spacing: 0.08em;
}

.bestiary-empty {
  grid-column: 1 / -1;
  padding: 30px;
  color: #70695d;
  text-align: center;
}

#restScreen.bonfire-rest {
  background:
    radial-gradient(ellipse at 50% 55%, rgba(30, 17, 7, 0.24), rgba(2, 3, 2, 0.54) 60%, rgba(1, 2, 1, 0.8)),
    rgba(3, 4, 3, 0.35);
  backdrop-filter: blur(2px) saturate(0.72);
}

#restScreen.bonfire-rest .stone-panel {
  background:
    linear-gradient(180deg, rgba(27, 23, 17, 0.94), rgba(9, 9, 7, 0.97)),
    radial-gradient(ellipse at 50% 0%, rgba(175, 99, 38, 0.14), transparent 62%);
}

.panel-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  width: 330px;
  height: 260px;
  background: radial-gradient(ellipse, rgba(172, 91, 31, 0.14), transparent 68%);
  transform: translateX(-50%);
  pointer-events: none;
}

.stone-panel h2 {
  margin: 13px 0 12px;
  color: #d5c7b2;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 0.16em;
}

.pause-panel {
  width: min(920px, 94vw);
  text-align: left;
}

.pause-layout {
  display: grid;
  grid-template-columns: minmax(290px, 0.82fr) minmax(360px, 1.18fr);
  align-items: stretch;
  gap: 38px;
}

.pause-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
}

.pause-main .primary-button {
  align-self: center;
  margin-top: 28px;
}

.pause-main .tower-leave,
.pause-main .pause-guide {
  align-self: center;
  width: min(250px, 100%);
  margin-top: 10px;
}

.pause-main .pause-guide {
  background: transparent;
}

.pause-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 34px;
  border-left: 1px solid rgba(192, 175, 148, 0.11);
  text-align: left;
}

.pause-controls .pause-section-title {
  margin-top: 0;
}

.pause-controls .pause-keys {
  grid-template-columns: 1fr;
  gap: 8px;
}

.pause-controls .pause-tip {
  margin-top: 18px;
  text-align: left;
}

.panel-lore {
  margin: 0 0 26px;
  color: #777164;
  font-family: var(--serif);
  font-size: 0.77rem;
  line-height: 1.8;
  letter-spacing: 0.09em;
}

.rest-summary,
.pause-stats,
.victory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(192, 175, 148, 0.1);
  border-bottom: 1px solid rgba(192, 175, 148, 0.1);
  padding: 16px 0;
}

.rest-summary > div,
.pause-stats > div,
.victory-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid rgba(192, 175, 148, 0.08);
}

.rest-summary > div:last-child,
.pause-stats > div:last-child,
.victory-stats > div:last-child {
  border-right: 0;
}

.rest-summary span,
.pause-stats span,
.victory-stats span {
  color: #6e6b62;
  font-size: 0.55rem;
  letter-spacing: 0.14em;
}

.rest-summary strong,
.pause-stats strong,
.victory-stats strong {
  color: #c8b9a2;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 0.07em;
}

.rest-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 22px;
}

.text-button {
  position: relative;
  width: 100%;
  padding: 12px 18px 10px;
  border: 1px solid rgba(188, 160, 121, 0.19);
  background: linear-gradient(90deg, rgba(85, 50, 25, 0.08), rgba(133, 81, 35, 0.13), rgba(85, 50, 25, 0.08));
  color: #b8ab96;
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}

.text-button span {
  display: block;
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.13em;
}

.text-button small {
  display: block;
  margin-top: 4px;
  color: #6d675c;
  font-size: 0.5rem;
  letter-spacing: 0.11em;
}

.text-button:hover:not(:disabled) {
  border-color: rgba(208, 158, 92, 0.46);
  color: #e0cfb4;
  background: linear-gradient(90deg, rgba(104, 59, 27, 0.14), rgba(155, 94, 41, 0.2), rgba(104, 59, 27, 0.14));
}

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

.text-button.quiet {
  border-color: rgba(172, 160, 140, 0.1);
  background: transparent;
}

.text-button.quiet:hover {
  background: rgba(44, 43, 37, 0.2);
}

.rest-message {
  min-height: 18px;
  margin: 14px 0 0;
  color: #9b7049;
  font-family: var(--serif);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.pause-section-title {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin-top: 20px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(192, 175, 148, 0.1);
  text-align: left;
}

.pause-section-title span {
  color: #c5b6a0;
  font-family: var(--serif);
  font-size: 0.86rem;
  letter-spacing: 0.18em;
}

.pause-section-title small {
  color: #6f675b;
  font-size: 0.47rem;
  letter-spacing: 0.2em;
}

.pause-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 18px;
  margin-top: 13px;
  text-align: left;
}

.pause-keys > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: #8d887b;
  font-size: 0.57rem;
  letter-spacing: 0.07em;
}

.pause-keys > div span {
  min-width: 0;
  white-space: nowrap;
}

.pause-keys kbd {
  flex: 0 0 78px;
  text-align: center;
  font-size: 0.47rem;
}

.pause-tip {
  margin: 16px 0 0;
  padding-top: 13px;
  border-top: 1px solid rgba(192, 175, 148, 0.08);
  color: #6f685c;
  font-family: var(--serif);
  font-size: 0.64rem;
  line-height: 1.7;
  letter-spacing: 0.07em;
  text-align: center;
}

.pause-tip b {
  color: #b98d57;
  font-weight: 500;
}

.route-screen {
  z-index: 28;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(31, 38, 29, 0.5), rgba(3, 5, 4, 0.9) 66%, rgba(1, 2, 2, 0.97)),
    rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.route-frame {
  --route-accent: 184, 154, 112;
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(820px, 94vw);
  height: min(860px, 92vh);
  overflow: hidden;
  padding: 30px 38px 24px;
  border: 1px solid rgba(193, 174, 145, 0.18);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(175, 112, 54, 0.07), transparent 46%),
    linear-gradient(180deg, rgba(19, 21, 17, 0.97), rgba(6, 8, 6, 0.98));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.78), inset 0 1px 0 rgba(255, 240, 209, 0.03);
  animation: panelIn 0.5s cubic-bezier(0.22, 0.75, 0.2, 1) both;
}

.route-frame::before,
.route-frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: rgba(var(--route-accent), 0.34);
  border-style: solid;
  pointer-events: none;
}

.route-frame::before {
  top: 10px;
  left: 10px;
  border-width: 1px 0 0 1px;
}

.route-frame::after {
  right: 10px;
  bottom: 10px;
  border-width: 0 1px 1px 0;
}

.route-screen.route-short .route-frame {
  height: min(650px, 94vh);
}

.route-screen.route-mid .route-frame {
  height: min(735px, 95vh);
}

.route-screen.route-long .route-frame {
  height: min(825px, 96vh);
}

.route-screen.route-short .route-map-wrap {
  min-height: 340px;
}

.route-screen.act-1 .route-frame {
  --route-accent: 160, 184, 170;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(82, 115, 89, 0.1), transparent 46%),
    linear-gradient(180deg, rgba(20, 25, 20, 0.97), rgba(6, 8, 6, 0.98));
}

.route-screen.act-2 .route-frame {
  --route-accent: 219, 148, 82;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(155, 83, 39, 0.14), transparent 48%),
    linear-gradient(180deg, rgba(27, 21, 16, 0.98), rgba(8, 7, 5, 0.99));
}

.route-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(var(--route-accent), 0.13);
}

.route-heading {
  min-width: 0;
  text-align: left;
}

.route-heading h2 {
  margin: 6px 0 4px;
  color: #d9cbb4;
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: 0.16em;
}

.route-subtitle {
  margin: 0;
  color: #777065;
  font-family: var(--serif);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
}

.route-summary {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 17px;
  text-align: right;
}

.route-summary > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.route-summary span {
  color: #6b675e;
  font-size: 0.51rem;
  letter-spacing: 0.16em;
}

.route-summary strong {
  color: #c7b8a2;
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.route-map-wrap {
  position: relative;
  flex: 1;
  min-height: 390px;
  margin: 9px 0 6px;
  overflow: hidden;
  border-bottom: 1px solid rgba(var(--route-accent), 0.08);
  background:
    radial-gradient(ellipse at 50% 10%, rgba(208, 130, 65, 0.09), transparent 36%),
    radial-gradient(ellipse at 50% 52%, rgba(var(--route-accent), 0.085), transparent 64%),
    radial-gradient(ellipse at 50% 100%, rgba(74, 98, 77, 0.075), transparent 56%),
    repeating-linear-gradient(115deg, transparent 0 43px, rgba(212, 194, 164, 0.012) 43px 44px),
    linear-gradient(180deg, rgba(6, 9, 6, 0.18), rgba(2, 3, 2, 0.52));
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.48);
}

.route-map-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 32%, rgba(0, 0, 0, 0.42) 100%);
}

#routeLines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#routeLines path {
  fill: none;
  stroke: rgba(var(--route-accent), 0.52);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Dotted branches read as "yet to be walked"; the active trail stays solid. */
  stroke-dasharray: 0 2.1;
  vector-effect: non-scaling-stroke;
}

#routeLines path.active {
  stroke: rgba(231, 186, 113, 0.82);
  stroke-width: 2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 5px rgba(224, 157, 73, 0.38));
}

#routeLines path.visited {
  stroke: rgba(var(--route-accent), 0.46);
  stroke-dasharray: none;
}

.route-nodes {
  position: absolute;
  inset: 0;
}

.route-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(196, 180, 154, 0.23);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #1c1e19, #0a0c09 72%);
  color: #8e887b;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: border-color 0.22s, color 0.22s, background 0.22s, box-shadow 0.22s, opacity 0.22s;
}

.route-node::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.1;
  pointer-events: none;
  transition: opacity 0.22s, inset 0.22s;
}

.route-node.available::before {
  inset: -7px;
  opacity: 0.24;
}

.route-node.current::before {
  inset: -6px;
  opacity: 0.3;
}

.route-node.boss::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(231, 138, 89, 0.3);
  border-radius: 50%;
  pointer-events: none;
  animation: bossOrbit 30s linear infinite;
}

@keyframes bossOrbit {
  to { transform: rotate(360deg); }
}

.route-node .node-glyph {
  display: block;
  font-family: var(--serif);
  font-size: 0.98rem;
  line-height: 1;
  transform: translateY(-0.5px);
}

.route-node .node-label {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  color: #6e6a61;
  font-family: var(--serif);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 0.22s;
  text-shadow: 0 0 4px rgba(3, 4, 3, 0.92), 0 1px 2px rgba(0, 0, 0, 0.8);
}

.route-node.available .node-label,
.route-node.current .node-label,
.route-node:hover .node-label,
.route-node:focus-visible .node-label {
  color: #c9b083;
  opacity: 1;
}

/* Regular nodes label to the side so long maps never stack text into the
   row below. Boss and start keep their label underneath the emblem. */
.route-node:not(.boss):not(.start) .node-label {
  top: 50%;
  left: calc(100% + 7px);
  transform: translateY(-50%);
}

.route-node.label-left:not(.boss):not(.start) .node-label {
  right: calc(100% + 7px);
  left: auto;
}

.route-node.current {
  border-color: rgba(226, 194, 139, 0.78);
  color: #f1d39b;
  box-shadow: 0 0 0 4px rgba(202, 155, 90, 0.08), 0 0 24px rgba(208, 155, 81, 0.2);
}

.route-node.visited {
  opacity: 0.5;
  color: #9a927e;
}

.route-node.available {
  border-color: rgba(228, 188, 124, 0.72);
  color: #f0d29b;
  background: radial-gradient(circle at 50% 42%, #3d2b18, #11110d 74%);
  box-shadow: 0 0 0 4px rgba(200, 145, 73, 0.07), 0 0 26px rgba(203, 145, 71, 0.22);
  animation: routeNodePulse 2.6s ease-in-out infinite;
}

.route-node.available:hover {
  border-color: rgba(255, 219, 160, 0.95);
  color: #fff2d4;
  box-shadow: 0 0 0 6px rgba(220, 164, 88, 0.11), 0 0 34px rgba(216, 157, 78, 0.3);
  transform: translate(-50%, -50%) scale(1.08);
}

.route-node:disabled {
  cursor: default;
  opacity: 0.62;
}

.route-node.current:disabled {
  opacity: 0.92;
}

.route-node.locked {
  pointer-events: none;
}

.route-node.battle { border-color: rgba(151, 101, 72, 0.34); }
.route-node.elite { border-color: rgba(196, 118, 58, 0.62); color: #d79a61; }
.route-node.rest { border-color: rgba(159, 169, 122, 0.47); color: #b9c18f; }
.route-node.treasure { border-color: rgba(111, 153, 165, 0.57); color: #a9d0d2; }
.route-node.boss {
  width: 62px;
  height: 62px;
  border-color: rgba(211, 91, 55, 0.74);
  color: #efae78;
  background: radial-gradient(circle at 50% 42%, #321b12, #0e0907 72%);
  box-shadow: 0 0 0 7px rgba(154, 45, 25, 0.055), 0 0 46px rgba(180, 61, 34, 0.28);
}

.route-node.boss .node-label,
.route-node.start .node-label {
  color: #a98f6c;
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  opacity: 1;
}

/* The start sits on the bottom edge; keep its label beside the ember so
   short maps on narrow screens do not clip it against the frame. */
.route-node.start .node-label {
  top: 50%;
  left: calc(100% + 7px);
  transform: translateY(-50%);
}

.route-node.boss .node-glyph {
  font-size: 1.25rem;
}

@keyframes routeNodePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(200, 145, 73, 0.06), 0 0 20px rgba(203, 145, 71, 0.16); }
  50% { box-shadow: 0 0 0 6px rgba(200, 145, 73, 0.1), 0 0 30px rgba(203, 145, 71, 0.27); }
}

.route-legend {
  position: absolute;
  right: 12px;
  bottom: 8px;
  display: flex;
  gap: 14px;
  padding: 5px 9px 4px;
  border-top: 1px solid rgba(var(--route-accent), 0.1);
  background: linear-gradient(180deg, rgba(5, 7, 5, 0.36), rgba(3, 4, 3, 0.72));
  color: #6f6b61;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.route-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8f8878;
}

.legend-dot.battle { background: #a26a49; }
.legend-dot.elite { background: #d18c52; }
.legend-dot.rest { background: #b9c18f; }
.legend-dot.treasure { background: #9ac4c7; }
.legend-dot.boss { background: #d15b3b; }

.route-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding-top: 15px;
}

.route-footer p {
  margin: 0;
  color: #777166;
  font-family: var(--serif);
  font-size: 0.69rem;
  line-height: 1.7;
  letter-spacing: 0.07em;
}

.route-leave {
  flex: 0 0 176px;
  margin: 0;
}

.boon-screen {
  z-index: 24;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(36, 45, 34, 0.3), rgba(3, 5, 4, 0.88) 62%, rgba(1, 2, 2, 0.96)),
    rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.boon-panel {
  width: min(1020px, 94vw);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  text-align: center;
}

.boon-panel h2 {
  margin-bottom: 14px;
}

.boon-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
  text-align: left;
}

.boon-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  min-height: 190px;
  padding: 20px 19px 17px;
  overflow: hidden;
  border: 1px solid rgba(176, 167, 143, 0.16);
  background:
    linear-gradient(160deg, rgba(37, 44, 33, 0.36), rgba(8, 10, 8, 0.75) 60%),
    rgba(7, 9, 7, 0.65);
  color: #bdb09b;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.boon-card::before,
.boon-card::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: rgba(199, 176, 137, 0.3);
  border-style: solid;
  opacity: 0.65;
}

.boon-card::before {
  top: 7px;
  left: 7px;
  border-width: 1px 0 0 1px;
}

.boon-card::after {
  right: 7px;
  bottom: 7px;
  border-width: 0 1px 1px 0;
}

.boon-card:hover,
.boon-card:focus-visible {
  border-color: rgba(198, 167, 116, 0.58);
  background:
    linear-gradient(160deg, rgba(58, 60, 40, 0.5), rgba(12, 15, 10, 0.82) 62%),
    rgba(9, 12, 9, 0.8);
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42), inset 0 0 25px rgba(144, 112, 57, 0.06);
}

.boon-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(200, 167, 112, 0.34);
  border-radius: 50%;
  color: #d5a15f;
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(214, 144, 68, 0.3);
}

.boon-tag {
  color: #776a58;
  font-size: 0.49rem;
  letter-spacing: 0.22em;
}

.boon-card strong {
  color: #d8c9b0;
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 400;
  letter-spacing: 0.12em;
}

.boon-card p {
  margin: 0;
  color: #8d8577;
  font-size: 0.65rem;
  line-height: 1.8;
  letter-spacing: 0.05em;
}

.boon-card small {
  margin-top: auto;
  color: #6c5e4b;
  font-family: var(--serif);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
}

.boon-footnote {
  margin: 20px 0 0;
  color: #706a5d;
  font-family: var(--serif);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
}

.death-screen {
  z-index: 25;
  background:
    radial-gradient(ellipse at center, rgba(29, 4, 3, 0.38), rgba(0, 0, 0, 0.92) 74%),
    rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.death-screen.show {
  pointer-events: auto;
  animation: deathBackdrop 1.6s ease both;
}

@keyframes deathBackdrop {
  from { background-color: rgba(48, 3, 2, 0.36); }
  to { background-color: rgba(0, 0, 0, 0.72); }
}

.death-content {
  text-align: center;
  animation: deathReveal 2.4s ease both;
}

@keyframes deathReveal {
  0% { opacity: 0; transform: scale(1.025); }
  40% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

.death-title {
  margin: 0;
  color: #8d1e17;
  font-family: var(--serif);
  font-size: clamp(4.4rem, 11vw, 8.8rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  text-shadow:
    0 0 30px rgba(127, 16, 10, 0.35),
    0 14px 50px rgba(0, 0, 0, 0.9);
}

.death-en {
  margin: 7px 0 0;
  color: rgba(137, 52, 42, 0.48);
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.72em;
  text-indent: 0.72em;
}

.death-hint {
  margin: 36px 0 0;
  color: #71685b;
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}

.death-hint.has-stain {
  color: #86a8a8;
}

.death-button {
  width: auto;
  min-width: 250px;
  margin-top: 39px;
  pointer-events: auto;
  opacity: 0;
  animation: fadeUp 0.9s 1.25s forwards;
}

.death-exit {
  width: auto;
  min-width: 200px;
  margin-top: 12px;
  pointer-events: auto;
}

.death-checkpoint {
  width: auto;
  min-width: 250px;
  margin-top: 13px;
  pointer-events: auto;
  border-color: rgba(189, 144, 80, 0.28);
  background: rgba(43, 28, 15, 0.22);
}

.death-content .death-exit,
.death-content .death-checkpoint {
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.death-content .death-checkpoint.hidden {
  display: none !important;
}

.no-anim .death-button {
  opacity: 1;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.victory-screen {
  z-index: 26;
  background:
    radial-gradient(ellipse at 50% 54%, rgba(103, 59, 22, 0.28), rgba(3, 4, 3, 0.9) 58%, rgba(0, 0, 0, 0.96)),
    rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(3px);
}

.victory-content {
  width: min(680px, 92vw);
  text-align: center;
  animation: victoryReveal 2.8s ease both;
}

@keyframes victoryReveal {
  0% { opacity: 0; transform: scale(0.98); }
  35% { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

.victory-content h2 {
  margin: 18px 0 0;
  color: #d9cab3;
  font-family: var(--serif);
  font-size: clamp(3.2rem, 7vw, 5.7rem);
  font-weight: 400;
  letter-spacing: 0.19em;
  text-indent: 0.19em;
  text-shadow: 0 0 40px rgba(195, 120, 49, 0.16);
}

.victory-en {
  margin: 8px 0 0;
  color: #855d36;
  font-family: var(--serif);
  font-size: 0.65rem;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
}

.victory-line {
  width: 160px;
  height: 1px;
  margin: 29px auto;
  background: linear-gradient(to right, transparent, rgba(204, 162, 106, 0.5), transparent);
}

.victory-lore {
  margin: 0;
  color: #8c8477;
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 2;
  letter-spacing: 0.1em;
}

.victory-stats {
  margin: 27px auto 0;
  max-width: 470px;
}

.victory-content .primary-button {
  margin-top: 31px;
}

.hidden {
  display: none !important;
}

.no-anim *,
.no-anim *::before,
.no-anim *::after {
  animation: none !important;
  transition: none !important;
}

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

/* ───────────────────────── Responsive ───────────────────────── */

@media (max-width: 980px) {
  .route-frame {
    padding: 24px 26px 19px;
    height: min(800px, 94vh);
  }

  .route-heading h2 {
    font-size: 1.9rem;
  }

  .route-summary {
    gap: 12px;
  }

  .route-map-wrap {
    min-height: 330px;
  }

  .pause-panel {
    width: min(700px, 94vw);
  }

  .pause-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .pause-controls {
    padding-top: 21px;
    padding-left: 0;
    border-top: 1px solid rgba(192, 175, 148, 0.11);
    border-left: 0;
  }

  .pause-controls .pause-keys {
    grid-template-columns: 1fr 1fr;
  }

  .pause-main .primary-button {
    margin-top: 22px;
  }
}

@media (max-width: 900px) {
  .hud-area {
    top: 24px;
    left: 24px;
    width: 42vw;
  }

  .start-actions {
    gap: 10px;
  }

  .start-actions .primary-button {
    min-width: 230px;
  }

  .tower-entry {
    min-width: 220px;
  }

  .boon-choices {
    gap: 10px;
  }

  .boon-card {
    min-height: 175px;
    padding: 17px 15px 15px;
  }

  .hud-right {
    top: 22px;
    right: 24px;
  }

  .hud-status {
    left: 24px;
    bottom: 24px;
    width: 290px;
  }

  .control-legend {
    display: none;
  }

  .boss-bar {
    width: min(560px, 72vw);
    bottom: 110px;
  }

  .start-controls {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
  }
}

@media (max-width: 680px) {
  .hud-area {
    width: 50vw;
  }

  .hud-area h2 {
    font-size: 1.35rem;
  }

  .area-objective {
    display: none;
  }

  .hud-right {
    gap: 9px;
  }

  .soul-wallet {
    min-width: 88px;
  }

  .soul-wallet #soulValue {
    font-size: 1.2rem;
  }

  .hud-status {
    width: 250px;
  }

  .boss-bar {
    width: 82vw;
    bottom: 118px;
  }

  .boss-name {
    font-size: 0.82rem;
  }

  .boss-epithet {
    display: none;
  }

  .interact-prompt {
    bottom: 158px;
    font-size: 0.63rem;
  }

  .toast {
    top: 14%;
    font-size: 0.88rem;
  }

  .start-frame h1 {
    font-size: clamp(3.5rem, 16vw, 5.6rem);
  }

  .start-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(330px, 88vw);
    margin-left: auto;
    margin-right: auto;
  }

  .start-actions .primary-button,
  .tower-entry {
    width: 100%;
    min-width: 0;
  }

  .start-secondary-actions {
    flex-direction: column;
    align-items: stretch;
    width: min(330px, 88vw);
    margin-left: auto;
    margin-right: auto;
  }

  .start-secondary-actions .start-guide {
    width: 100%;
  }

  .boon-choices {
    grid-template-columns: 1fr;
  }

  .boon-card {
    min-height: auto;
  }

  .route-frame {
    height: 94vh;
    padding: 20px 16px 17px;
  }

  .route-head {
    display: block;
    padding-bottom: 12px;
  }

  .route-heading h2 {
    font-size: 1.6rem;
  }

  .route-summary {
    display: none;
  }

  .route-subtitle {
    font-size: 0.66rem;
  }

  .route-map-wrap {
    min-height: 350px;
    margin-top: 9px;
  }

  .route-node {
    width: 32px;
    height: 32px;
  }

  .route-node.boss {
    width: 46px;
    height: 46px;
  }

  .route-node .node-label {
    font-size: 0.44rem;
  }

  .route-legend {
    left: 8px;
    right: auto;
    bottom: 4px;
    gap: 8px;
    font-size: 0.44rem;
  }

  .route-footer {
    display: block;
    padding-top: 10px;
  }

  .route-footer p {
    font-size: 0.6rem;
    margin-bottom: 10px;
  }

  .route-leave {
    width: 100%;
  }

  .lore {
    font-size: 0.75rem;
  }

  .start-controls {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 28px;
    padding-top: 19px;
  }

  .start-controls > div {
    font-size: 0.52rem;
  }

  .start-screen::after {
    display: none;
  }

  .stone-panel {
    padding: 34px 24px 29px;
  }

  .stone-panel h2 {
    font-size: 1.55rem;
  }

  .pause-tip {
    display: none;
  }

  .pause-panel {
    max-height: 92vh;
    overflow-y: auto;
  }

  .pause-controls {
    padding-top: 16px;
    border-top: 1px solid rgba(192, 175, 148, 0.11);
  }

  .guide-panel,
  .bestiary-panel {
    padding: 28px 20px 24px;
    max-height: 92vh;
  }

  .guide-grid,
  .bestiary-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .guide-panel h2,
  .bestiary-panel h2 {
    font-size: 1.6rem;
  }

  .death-title {
    font-size: 4.2rem;
  }

  .death-hint {
    margin-top: 25px;
    font-size: 0.72rem;
  }

  .victory-content h2 {
    font-size: 3rem;
  }

  .start-footnote {
    bottom: 12px;
    font-size: 0.43rem;
  }
}

@media (max-height: 720px) {
  .start-crest {
    height: 33px;
    margin-bottom: 15px;
  }

  .start-frame .kicker {
    margin-bottom: 14px;
  }

  .start-frame h1 {
    font-size: clamp(3.7rem, 9vw, 6.4rem);
  }

  .ornament {
    margin: 18px auto;
  }

  .lore {
    line-height: 1.8;
  }

  .primary-button {
    margin-top: 24px;
  }

  .start-actions {
    margin-top: 24px;
  }

  .start-actions .primary-button {
    margin-top: 0;
  }

  .start-controls {
    margin-top: 24px;
    padding-top: 17px;
  }

  .start-footnote {
    display: none;
  }
}

/* ───────────────────────── 3D renderer (Babylon.js) ───────────────────────── */

#world3d {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: #040605;
}

#world3d.off {
  display: none;
}

#game {
  z-index: 1;
}

.render-mode-button {
  font-family: var(--sans, "Segoe UI", sans-serif);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #c8a36a;
}

.render-mode-button.off {
  color: #6f6c63;
}

.start-render-mode {
  margin-top: 2px;
}

.fade-note {
  transition: opacity 0.4s ease;
}

/* ── Bestiary: 3D display ─────────────────────────────────── */

.bestiary-viewbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(192, 175, 148, 0.12);
}

.bestiary-viewbar .bestiary-tabs {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.bestiary-3d-launch {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 7px;
  padding: 7px 13px 6px;
  border: 1px solid rgba(208, 150, 82, 0.34);
  background:
    linear-gradient(180deg, rgba(97, 63, 30, 0.28), rgba(18, 15, 10, 0.5)),
    rgba(8, 10, 8, 0.46);
  color: #dfbc83;
  font-family: var(--serif);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.bestiary-3d-launch small {
  color: #75664e;
  font-family: var(--sans);
  font-size: 0.42rem;
  letter-spacing: 0.14em;
}

.bestiary-3d-launch:hover,
.bestiary-3d-launch:focus-visible {
  border-color: rgba(235, 181, 106, 0.7);
  background:
    linear-gradient(180deg, rgba(128, 82, 38, 0.4), rgba(23, 18, 11, 0.58)),
    rgba(8, 10, 8, 0.46);
  color: #ffe2aa;
}

.bestiary3d-bar {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100vw - 48px));
  gap: 22px;
  padding: 13px 16px;
  border: 1px solid rgba(199, 175, 134, 0.25);
  background:
    linear-gradient(180deg, rgba(30, 25, 18, 0.9), rgba(7, 9, 7, 0.94)),
    rgba(5, 7, 5, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 229, 179, 0.05);
  backdrop-filter: blur(10px);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.bestiary3d-bar.show {
  display: flex;
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.bestiary3d-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.bestiary3d-copy .kicker {
  margin: 0;
  color: #93784f;
  font-size: 0.44rem;
  letter-spacing: 0.2em;
}

.bestiary3d-copy h2 {
  margin: 3px 0 2px;
  color: #dbc7a4;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.bestiary3d-copy p:last-child {
  margin: 0;
  color: #70695d;
  font-size: 0.5rem;
  letter-spacing: 0.04em;
}

.bestiary3d-tabs {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(181, 157, 119, 0.16);
  background: rgba(4, 6, 4, 0.5);
}

.bestiary3d-tabs button {
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: #746a59;
  font-family: var(--serif);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.bestiary3d-tabs button small {
  margin-left: 3px;
  color: #5d5549;
  font-family: var(--sans);
  font-size: 0.4rem;
}

.bestiary3d-tabs button:hover,
.bestiary3d-tabs button.active {
  color: #edc78e;
  background: rgba(126, 86, 42, 0.22);
}

.bestiary3d-close {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 14px;
  border: 1px solid rgba(208, 150, 82, 0.4);
  background: rgba(31, 23, 14, 0.65);
  color: #d8b47b;
  font-family: var(--serif);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.bestiary3d-close small {
  color: #75664e;
  font-family: var(--sans);
  font-size: 0.4rem;
  letter-spacing: 0.12em;
}

.bestiary3d-close:hover,
.bestiary3d-close:focus-visible {
  border-color: rgba(235, 181, 106, 0.75);
  color: #ffe2aa;
}

@media (max-width: 760px) {
  .bestiary-viewbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .bestiary-viewbar .bestiary-tabs {
    flex: 1 1 100%;
  }

  .bestiary-3d-launch {
    align-self: flex-start;
    margin-bottom: 10px;
  }

  .bestiary3d-bar {
    bottom: 12px;
    width: calc(100vw - 24px);
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 11px;
  }

  .bestiary3d-copy {
    flex: 1 1 100%;
  }

  .bestiary3d-copy p:last-child {
    display: none;
  }

  .bestiary3d-tabs {
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .bestiary3d-tabs button {
    flex: 1;
    padding: 7px 5px;
    font-size: 0.6rem;
  }

  .bestiary3d-close {
    flex: none;
  }
}

