:root {
  color-scheme: dark;
  --bg: #070805;
  --bg-deep: #050704;
  --panel: #0c140d;
  --panel-highlight: #132016;
  --border: #2d5534;
  --border-dim: #1c331f;
  --text: #c9f7c4;
  --muted: #5f9968;
  --accent: #5dff73;
  --accent-soft: rgba(93, 255, 115, 0.22);
  --accent-dim: #38b54c;
  --warm: #ffe566;
  --danger: #ff7a7a;
  --danger-dim: #994040;
  --tile-face: #ebe4d6;
  --tile-edge: #8f7f68;
  --tile-ink: #141207;
  --tile-pip: #4b453b;
  --amber: #ffc74d;
  --font: "VT323", ui-monospace, monospace;
  --font-pixel: "Press Start 2P", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 112%;
  overflow-x: hidden;
}

body.phosphor {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg-deep);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 4px
    ),
    var(--bg-deep);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  text-rendering: optimizeSpeed;
}

.crt-vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.72) 100%);
}

.crt-scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 51;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0),
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.34) 2px,
    rgba(0, 0, 0, 0.34) 4px
  );
}

.crt-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 52;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.15rem 1rem calc(3.65rem + env(safe-area-inset-bottom, 0px));
}

.boot-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid var(--border-dim);
  background: var(--panel);
  padding: 0.35rem 0.55rem;
  margin-bottom: 1rem;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.35),
    0 0 0 2px #030503;
}

.boot-mid {
  letter-spacing: 0.35em;
  opacity: 0.65;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem 1rem;
  padding-bottom: 0.15rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Home — inline with SCRAMBBLE wordmark (header stays visible in stall / vault) */
.top .brand .btn-home {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  margin: 0;
  margin-left: 0;
  border-width: 2px;
  border-radius: 3px;
  color: var(--warm);
  background: rgba(8, 12, 8, 0.88);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 #050805,
    0 0 0 2px rgba(45, 85, 52, 0.55);
  cursor: pointer;
  transition:
    border-color 0.08s ease,
    background 0.08s ease,
    opacity 0.12s ease;
}

.top .brand .btn-home:hover:not(:disabled) {
  border-color: rgba(255, 230, 140, 0.55);
  background: rgba(18, 28, 18, 0.92);
}

.top .brand .btn-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.top .brand .btn-home:disabled {
  opacity: 0.38;
  cursor: default;
}

.btn-home-icon {
  display: block;
  margin-top: 1px;
}

.brand-mark {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 0.12rem;
}

.brand-title {
  font-family: var(--font-pixel);
  font-size: clamp(0.95rem, 4vw, 1.25rem);
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.02em;
  line-height: 1.45;
  text-transform: uppercase;
}

.brand-scram {
  color: var(--accent);
}

.brand-bble {
  color: var(--amber);
}

.top-meta {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.intro-music-row {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 2;
}

.intro-leaderboard-btn {
  margin-left: 0 !important;
}

.intro-leaderboard-icon-btn {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  margin: 0 !important;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.intro-leaderboard-icon {
  display: block;
  color: #ffd866;
  filter: drop-shadow(0 0 4px rgba(255, 216, 102, 0.45));
}

.btn-music-toggle {
  font-family: var(--font);
  font-size: 1.05rem;
  letter-spacing: 0;
  padding: 0.28rem 0.5rem;
}

.coin-purse {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.32rem 0.6rem;
  border: 2px solid rgba(255, 180, 72, 0.42);
  background:
    linear-gradient(165deg, rgba(58, 38, 18, 0.92) 0%, rgba(24, 16, 8, 0.94) 100%);
  border-radius: 3px;
  font-family: var(--font-pixel);
  font-size: clamp(0.52rem, 2.4vw, 0.66rem);
  color: #ffd866;
  letter-spacing: 0.06em;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 210, 0.14),
    0 4px 0 #120c06,
    0 0 14px rgba(255, 170, 64, 0.08);
}

.coin-purse-ico {
  display: flex;
  align-items: center;
  opacity: 0.95;
}

.coin-hud-num {
  font-variant-numeric: tabular-nums;
}

.tagline.narration {
  flex: 1 1 100%;
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.35;
  max-width: 42rem;
  padding-left: 0.05rem;
}

.tagline.narration::before {
  content: "> ";
  color: var(--accent-dim);
}

.adv-panel {
  position: relative;
  margin-top: 1rem;
  padding: 1rem 0.85rem 0.95rem;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(93, 255, 115, 0.06),
    inset 0 -8px 22px rgba(0, 0, 0, 0.35),
    0 4px 0 #030503,
    0 0 0 3px #050805;
}

.panel-rule {
  font-family: var(--font);
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: -0.1rem 0 0.5rem;
}

.region-label {
  font-family: var(--font-pixel);
  font-size: clamp(0.4rem, 1.65vw, 0.5rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(95, 153, 104, 0.72);
  margin: 0 0 0.42rem;
  line-height: 1.4;
}

.goal-tag-hint {
  display: block;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  text-transform: none;
  margin: -0.02rem 0 0.32rem;
  line-height: 1.28;
}

#game-screen[data-phase="playing"] .region-label {
  margin-bottom: 0.28rem;
  opacity: 0.92;
}

#game-screen[data-phase="playing"] .actions .primary {
  padding: 0.48rem 0.95rem;
  min-height: 2.6rem;
}

#game-screen[data-phase="playing"] .actions button:not(.primary):not(.danger) {
  padding: 0.42rem 0.82rem;
  min-height: 2.42rem;
}

.enemy-panel {
  margin-top: 1.25rem;
}

#game-screen[data-phase="reward"] .goal-deck {
  display: none;
}

/* Stall / relic: combat UI hidden — keep header brand row (home + logo) */
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) .boot-bar,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) header.top .top-meta,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) header.top .tagline,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) #chamber-panel,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) .hand-section,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) .word-panel,
#game-screen[data-phase="reward"]:not([data-reward-mode=""]) .footer {
  display: none !important;
}

#game-screen[data-phase="reward"]:not([data-reward-mode=""]) header.top {
  justify-content: flex-start;
  padding-bottom: 0.35rem;
  margin-bottom: 0.15rem;
  border-bottom: 2px dashed rgba(255, 199, 77, 0.18);
}

#game-screen[data-phase="reward"]:not([data-reward-mode=""]) .app {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 100vh;
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

#game-screen[data-phase="reward"]:not([data-reward-mode=""]) #reward-panel {
  flex: 0 0 auto;
  align-self: center;
  margin-top: 0;
  width: 100%;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

/* Stall: use horizontal space so the five bench slots fit without page scrollbars */
#game-screen[data-phase="reward"][data-reward-mode="shop"] .app {
  max-width: 100%;
  width: 100%;
  padding-left: max(0.65rem, env(safe-area-inset-left, 0px));
  padding-right: max(0.65rem, env(safe-area-inset-right, 0px));
}

#game-screen[data-phase="reward"][data-reward-mode="shop"] #reward-panel {
  max-width: min(40rem, calc(100vw - 1.3rem));
  width: 100%;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
  box-sizing: border-box;
}

.reward-panel.shop-panel #reward-choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
  overflow-y: visible;
}

.reward-panel.shop-panel .shop-bench-key {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.stall-marquee {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.stall-marquee.hidden {
  display: none !important;
}

.stall-mark {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: var(--accent);
}

.stall-marquee-word {
  font-family: var(--font-pixel);
  font-size: clamp(0.52rem, 2.4vw, 0.66rem);
  letter-spacing: 0.18em;
  color: var(--amber);
}

.shop-stall-index {
  font-family: var(--font-pixel);
  font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  letter-spacing: 0.24em;
  margin-bottom: 0.35rem !important;
}

.ico-stall {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ico-stall svg,
.ico-stall .stall-svg {
  display: block;
  width: 1.65rem;
  height: 1.65rem;
}

.ico-stall--sm svg,
.ico-stall--sm .stall-svg {
  width: 1.12rem;
  height: 1.12rem;
}

.ico-stall--lg svg,
.ico-stall--lg .stall-svg {
  width: 2rem;
  height: 2rem;
}

.ico-stall--hero svg,
.ico-stall--hero .stall-svg {
  width: 2.35rem;
  height: 2.35rem;
}

.coin-purse-ico svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
}

.shop-purse-num {
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 2.8vw, 0.82rem);
  color: #ffd866;
  letter-spacing: 0.06em;
}

.shop-action-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
  width: 100%;
}

.shop-action-label {
  flex: 1 1 auto;
  min-width: 8rem;
}

.shop-action-price {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.48rem, 2vw, 0.58rem);
  color: #ffd866;
}

.shop-bench-key {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.45rem;
  font-size: 1rem;
}

.shop-leave-cta {
  font-weight: 400;
}

.relic-purse-strip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.52rem, 2.4vw, 0.65rem);
  color: #c8e8ff;
}

.relic-pick-cue {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.5rem, 2.2vw, 0.6rem);
  color: var(--warm);
}

.battle-outcome-stats--visual {
  border-left: none !important;
  background: transparent !important;
  padding: 0 !important;
}

.outcome-stat-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
}

.outcome-stat-row:last-child {
  margin-bottom: 0;
}

.outcome-stat-delta {
  font-family: var(--font-pixel);
  font-size: clamp(0.72rem, 3vw, 0.92rem);
  color: var(--accent);
  letter-spacing: 0.06em;
}

.outcome-stat-total {
  font-family: var(--font-pixel);
  font-size: clamp(0.72rem, 3vw, 0.92rem);
  color: #ffd866;
  letter-spacing: 0.06em;
}

.outcome-stat-plain {
  font-family: var(--font-pixel);
  font-size: clamp(0.58rem, 2.6vw, 0.72rem);
  letter-spacing: 0.08em;
}

.outcome-stat-plain--danger {
  color: var(--danger);
}

.outcome-stat-label--danger {
  font-size: 1.35rem;
  line-height: 1;
  color: var(--danger);
  font-weight: 400;
}

.outcome-stats-divider {
  font-family: var(--font-pixel);
  font-size: clamp(0.46rem, 2vw, 0.54rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.55rem 0 0.38rem;
  padding-top: 0.42rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

.outcome-stat-row--run {
  gap: 0.42rem;
  margin-bottom: 0.32rem;
}

.outcome-stat-row--run .ico-stall--sm svg {
  width: 1.1rem;
  height: 1.1rem;
}

.outcome-stat-run-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.outcome-stat-run-val {
  flex-shrink: 0;
  font-family: var(--font-pixel);
  font-size: clamp(0.52rem, 2.4vw, 0.62rem);
  letter-spacing: 0.06em;
  color: var(--warm);
}

.outcome-stat-run-spacer {
  display: block;
  width: 1.25rem;
  flex-shrink: 0;
}

/* Full-width note (risk route) — avoids long prose in the narrow run-row value column */
.outcome-risk-note {
  margin: 0.28rem 0 0.42rem;
  padding: 0.35rem 0.45rem;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--font);
  font-size: 0.78rem;
  line-height: 1.38;
  letter-spacing: 0.02em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
}

/* Run summary: tower climb graphic beside stat rows */
.outcome-stats-with-tower {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.7rem;
}

.outcome-stats-main {
  flex: 1 1 auto;
  min-width: 0;
}

.outcome-tower-aside {
  flex: 0 0 2rem;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: 0.1rem 0 0;
}

.outcome-tower-cap {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 9px solid rgba(140, 190, 230, 0.55);
  margin-bottom: 1px;
}

.outcome-tower-shaft {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 0.48rem;
  margin: 0 auto;
  border-radius: 5px;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 5px,
      rgba(255, 255, 255, 0.06) 5px,
      rgba(255, 255, 255, 0.06) 6px
    ),
    linear-gradient(180deg, rgba(110, 170, 220, 0.42), rgba(18, 28, 42, 0.95));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 0 12px rgba(80, 140, 200, 0.12);
}

.outcome-tower-flex {
  min-height: 1px;
  width: 100%;
  border-radius: 2px;
}

.outcome-tower-dot {
  flex-shrink: 0;
  align-self: center;
  width: 11px;
  height: 11px;
  margin: 1px 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #e8fff0, var(--accent) 55%, #2a6a38);
  box-shadow:
    0 0 10px rgba(93, 255, 115, 0.55),
    0 0 2px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.outcome-tower-base {
  flex-shrink: 0;
  width: 1.35rem;
  height: 6px;
  margin-top: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, #4a3a2a, #1c1410);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

.outcome-run-seed--toolbar {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 0.28rem;
  column-gap: 0.35rem;
}

.outcome-run-seed--toolbar .outcome-stat-run-label {
  flex: 0 0 auto;
}

.outcome-run-seed--toolbar .outcome-seed-hash {
  flex: 0 1 auto;
  min-width: 0;
}

.outcome-replay-info-btn {
  flex-shrink: 0;
  box-sizing: border-box;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0 0.06rem 0 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(180, 210, 255, 0.45);
  background: rgba(6, 12, 20, 0.55);
  color: rgba(210, 225, 245, 0.92);
  font: italic 700 0.62rem/1 var(--font, Georgia, serif);
  line-height: 1;
  cursor: help;
}

.outcome-replay-info-btn:hover {
  border-color: rgba(140, 200, 255, 0.65);
  color: #fff;
}

.outcome-seed-copy-icon-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border-radius: 5px;
  border: 1px solid rgba(160, 190, 220, 0.28);
  background: rgba(4, 10, 16, 0.45);
  color: #e8c878;
}

.outcome-seed-copy-icon-btn .outcome-copy-svg {
  width: 0.88rem;
  height: 0.88rem;
  display: block;
}

.outcome-seed-copy-icon-btn--ok {
  border-color: rgba(93, 255, 115, 0.55);
  color: var(--accent);
}

.outcome-seed-copy-icon-btn--fail {
  border-color: rgba(255, 120, 120, 0.55);
  color: #ffb0b0;
}

.battle-outcome-stats--relic-preview {
  justify-content: center;
  display: flex;
}

.outcome-relic-face {
  margin: 0 auto;
}

/* During an encounter: tutor prose hidden via .hide-when-playing + data-phase */
#game-screen[data-phase="playing"] {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-x: hidden;
}

#game-screen[data-phase="playing"] .app {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(3.65rem + max(0.5rem, env(safe-area-inset-bottom, 0px)));
}

#game-screen[data-phase="playing"] .hide-when-playing {
  display: none !important;
}

#game-screen[data-phase="playing"] .footer.status-line::before {
  content: none;
}

#game-screen[data-phase="playing"] #phase-label {
  display: none;
}

#game-screen[data-phase="playing"] .footer {
  margin-top: 0.5rem;
  padding-top: 0.2rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

#game-screen[data-phase="playing"] #run-seed-line {
  text-align: right;
  font-size: 0.88rem;
}

#game-screen[data-phase="playing"] .word-row .label {
  display: none;
}

#game-screen[data-phase="playing"] .message:empty {
  display: none;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: 0;
}

#game-screen[data-phase="playing"] .top {
  padding-bottom: 0;
}

#game-screen[data-phase="playing"] .enemy-panel {
  margin-top: 0.65rem;
}

#game-screen[data-phase="playing"] .adv-panel.chamber-panel {
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
}

#game-screen[data-phase="playing"] .limits-block {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
}

#game-screen[data-phase="playing"] .hand-section {
  margin-top: 0.65rem;
}

#game-screen[data-phase="playing"] .word-panel {
  margin-top: 0.65rem;
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#game-screen[data-phase="playing"] .tab-panel--play {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#game-screen[data-phase="playing"] .play-panel-body {
  flex: 0 1 auto;
  min-height: 0;
}

#game-screen[data-phase="playing"] .play-bottom-dock {
  flex-shrink: 0;
  margin-top: 0.45rem;
  padding-top: 0.42rem;
  border-top: 1px dashed rgba(255, 229, 102, 0.22);
  background: linear-gradient(180deg, transparent 0%, rgba(5, 8, 6, 0.38) 42%);
}

#game-screen[data-phase="playing"] .play-bottom-dock .message {
  margin-top: 0;
  margin-bottom: 0.45rem;
}

#game-screen[data-phase="playing"] .exchange-bar {
  margin-top: 0.45rem;
}

#game-screen[data-phase="playing"] .compose-head {
  margin-bottom: 0.35rem;
}

#game-screen[data-phase="playing"] .word-tray {
  min-height: 88px;
  padding: 0.45rem 0.5rem 0.5rem;
  margin-bottom: 0.5rem;
  gap: 0.38rem;
}

#game-screen[data-phase="playing"] .tray-end-cap {
  flex: 1 1 48px;
  min-height: 68px;
}

/* Compact Seal / Patience during combat */
#game-screen[data-phase="playing"] .goal-deck {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.38rem;
  margin-top: 0.42rem;
}

#game-screen[data-phase="playing"] .goal-panel {
  padding: 0.26rem 0.35rem 0.3rem;
}

#game-screen[data-phase="playing"] .goal-tag-hint {
  display: none !important;
}

#game-screen[data-phase="playing"] .goal-tag {
  font-size: 0.92rem;
  letter-spacing: 0;
  margin-bottom: 0.06rem;
}

#game-screen[data-phase="playing"] .goal-numbers {
  font-size: clamp(0.46rem, 2vw, 0.56rem);
  margin-bottom: 0.18rem;
  line-height: 1.25;
}

#game-screen[data-phase="playing"] .bar--goal {
  height: 9px;
}

#game-screen[data-phase="playing"] .goal-hint {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  line-height: 1.22;
}

.goal-hint:empty {
  display: none;
}

.chamber-panel {
  border-color: var(--floor-border-strong, var(--border));
  background: linear-gradient(
      175deg,
      var(--floor-panel-tint, rgba(11, 18, 12, 0.88)) 0%,
      var(--panel) 48%,
      var(--panel-highlight) 100%
    ),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -10px 26px rgba(0, 0, 0, 0.42),
    0 4px 0 #030503,
    0 0 0 3px #050805;
}

.chamber-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.floor-sign {
  font-family: var(--font-pixel);
  font-size: clamp(0.48rem, 2.2vw, 0.62rem);
  letter-spacing: 0.02em;
  color: var(--floor-sign-color, var(--warm));
  line-height: 1.55;
  max-width: min(22rem, 100%);
}

.floor-sign--clear {
  color: #b6ff9a;
}

.tower-pips {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0.28rem 0 0;
  padding: 0;
  list-style: none;
}

.tower-pips:empty {
  display: none;
}

.tower-pip {
  width: 0.55rem;
  height: 0.72rem;
  background: rgba(140, 190, 160, 0.16);
  box-shadow: inset 0 0 0 1px rgba(140, 220, 160, 0.35);
}

.tower-pip.is-act-start {
  margin-left: 0.4rem;
}

.tower-pip.is-cleared {
  background: #3dff6a;
}

.tower-pip.is-current {
  background: #e8ff9a;
  box-shadow: inset 0 0 0 1px rgba(140, 220, 160, 0.35);
}

.card--locked {
  outline: 2px solid #e8ff9a;
  outline-offset: 1px;
}

.blank-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin: 0.4rem 0 0.2rem;
}

.blank-picker button {
  min-width: 1.6rem;
  padding: 0.15rem 0.3rem;
  font-size: 0.85rem;
}

.blank-picker button.is-on {
  border-color: #e8ff9a;
  color: #e8ff9a;
}

.floor-flavor {
  margin: 0 0 0.65rem;
  font-size: 1.08rem;
  line-height: 1.38;
}

.floor-flavor:empty {
  display: none;
}

.rules-head {
  margin-top: 0;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.limits-block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 2px dashed color-mix(in srgb, var(--floor-border-strong) 55%, transparent);
}

.relic-hud {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  line-height: 1.28;
}

.relic-hud-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  padding: 0.08rem 0.2rem;
  border-radius: 2px;
}

.relic-hud-item .relic-slot-icon {
  width: 0.72rem;
  height: 0.72rem;
  color: #9bd1ff;
  flex: 0 0 auto;
}

.relic-hud-item.relic-hud-item--robe,
.relic-hud-item.relic-hud-item--hat,
.relic-hud-item.relic-hud-item--staff,
.relic-hud-item.relic-hud-item--amulet {
  border: 1px solid transparent;
  padding: 0.08rem 0.38rem;
}

.relic-hud-item.relic-hud-item--robe {
  border-color: rgba(255, 199, 77, 0.45);
  background: rgba(255, 199, 77, 0.08);
}

.relic-hud-item.relic-hud-item--hat {
  border-color: rgba(93, 255, 115, 0.4);
  background: rgba(93, 255, 115, 0.08);
}

.relic-hud-item.relic-hud-item--staff {
  border-color: rgba(120, 186, 255, 0.45);
  background: rgba(90, 160, 255, 0.1);
}

.relic-hud-item.relic-hud-item--amulet {
  border-color: rgba(196, 140, 255, 0.45);
  background: rgba(176, 110, 255, 0.1);
}

.relic-hud-item.relic-hud-item--robe .relic-slot-icon,
.relic-hud-item.relic-hud-item--robe .relic-hud-text {
  color: #ffd98a;
}

.relic-hud-item.relic-hud-item--hat .relic-slot-icon,
.relic-hud-item.relic-hud-item--hat .relic-hud-text {
  color: #9dffab;
}

.relic-hud-item.relic-hud-item--staff .relic-slot-icon,
.relic-hud-item.relic-hud-item--staff .relic-hud-text {
  color: #b7dcff;
}

.relic-hud-item.relic-hud-item--amulet .relic-slot-icon,
.relic-hud-item.relic-hud-item--amulet .relic-hud-text {
  color: #e0c2ff;
}

.relic-hud-text {
  color: #cde6ff;
}

.relic-hud-tip {
  position: absolute;
  left: 0;
  top: calc(100% + 0.28rem);
  z-index: 7;
  min-width: 14rem;
  max-width: 20rem;
  padding: 0.32rem 0.4rem 0.36rem;
  background: rgba(6, 10, 8, 0.96);
  border: 1px solid rgba(130, 185, 255, 0.45);
  color: #d9edff;
  font-size: 0.72rem;
  line-height: 1.22;
  box-shadow:
    0 0 0 1px rgba(6, 10, 8, 0.82),
    0 6px 12px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.relic-hud-item:hover .relic-hud-tip,
.relic-hud-item:focus-within .relic-hud-tip {
  opacity: 1;
  visibility: visible;
}

.goal-deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.chamber-foot {
  display: contents;
}

.limits-block {
  grid-column: 1 / -1;
}

.goal-panel {
  padding: 0.55rem 0.55rem 0.45rem;
  border: 2px solid color-mix(in srgb, var(--floor-border-strong) 70%, #000);
  border-radius: 2px;
  background: rgba(4, 8, 5, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.goal-tag {
  display: block;
  font-size: 0.92rem;
  letter-spacing: 0;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.goal-numbers {
  display: block;
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.goal-hint {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  line-height: 1.32;
  min-height: 0;
}

.bar--goal {
  height: 18px;
}

.badge {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.enemy-title-block .enemy-label {
  display: block;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.08rem;
}

.enemy-head h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 14px color-mix(in srgb, var(--floor-sign-color, var(--accent)) 35%, transparent),
    0 0 22px color-mix(in srgb, var(--floor-sign-color, var(--accent)) 15%, transparent);
}

.badge {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--muted);
  border: 2px solid var(--border-dim);
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  background: rgba(3, 6, 3, 0.65);
  letter-spacing: 0.06em;
}

.bar {
  height: 14px;
  background: repeating-linear-gradient(
      90deg,
      #050705,
      #050705 4px,
      #080c09 4px,
      #080c09 8px
    )
    #050705;
  border-radius: 0;
  overflow: hidden;
  border: 2px solid var(--border-dim);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.45);
}

.fill {
  height: 100%;
  width: 0%;
  transition: width 0.22s steps(8, end);
  image-rendering: pixelated;
}

.fill.progress {
  background: repeating-linear-gradient(
      90deg,
      var(--floor-progress-a, #46ff7a),
      var(--floor-progress-a, #46ff7a) 6px,
      var(--floor-progress-b, #29cf56) 6px,
      var(--floor-progress-b, #29cf56) 12px
    )
    var(--floor-progress-a, #46ff7a);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.fill.turns {
  background: repeating-linear-gradient(
      90deg,
      var(--floor-turn-a, #ffe566),
      var(--floor-turn-a, #ffe566) 6px,
      var(--floor-turn-b, #d4b022) 6px,
      var(--floor-turn-b, #d4b022) 12px
    )
    var(--floor-turn-a, #ffe566);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.constraints {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--text);
  font-size: 1.08rem;
}

.constraints--chips {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.constraint-chip {
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: 2px solid color-mix(in srgb, var(--floor-border-strong) 55%, var(--border-dim));
  border-radius: 2px;
  background: rgba(5, 10, 7, 0.58);
  line-height: 1.35;
  position: relative;
}

.constraint-chip--ban {
  border-color: rgba(255, 122, 122, 0.55);
  background: rgba(55, 18, 22, 0.38);
}

.constraint-chip--length {
  border-color: rgba(155, 220, 255, 0.5);
  background: rgba(12, 28, 42, 0.42);
}

.constraint-chip--score-muted {
  padding-left: 1.85rem;
  border-color: rgba(200, 190, 120, 0.45);
  background: rgba(35, 32, 18, 0.48);
}

.constraint-chip--score-muted::before {
  content: "0";
  position: absolute;
  left: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: rgba(255, 216, 130, 0.85);
}

.constraint-chip--baseline {
  border-style: dashed;
  opacity: 0.92;
}

.word-panel {
  margin-top: 1rem;
}

.word-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: -0.15rem 0 0.55rem;
  border-bottom: 2px solid rgba(255, 229, 102, 0.22);
}

.word-tab {
  font-family: var(--font);
  font-size: 1rem;
  letter-spacing: 0;
  padding: 0.38rem 0.75rem;
  margin-bottom: -2px;
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
}

.word-tab:hover {
  color: var(--warm);
}

.word-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: rgba(93, 255, 115, 0.65);
}

.tab-panel.hidden {
  display: none !important;
}

.tab-panel--log .spell-grimoire--tab {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.tab-panel--log .spell-history {
  max-height: none;
}

.compose-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.55rem;
}

.compose-head .label {
  font-size: 0.95rem;
  letter-spacing: 0;
  color: var(--muted);
}

.compose-hint {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.compose-hint--desktop-kb {
  flex-basis: 100%;
  font-size: 0.92rem;
  opacity: 0.88;
  display: none;
}

@media (pointer: fine) {
  .compose-hint--desktop-kb {
    display: inline;
  }
}

.panel-hint {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  line-height: 1.3;
}

.word-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
  min-height: 118px;
  padding: 0.65rem 0.65rem 0.75rem;
  margin-bottom: 0.85rem;
  border: 2px dashed rgba(255, 229, 102, 0.42);
  border-radius: 2px;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 229, 102, 0.03),
      rgba(255, 229, 102, 0.03) 2px,
      transparent 2px,
      transparent 10px
    ),
    linear-gradient(180deg, rgba(18, 24, 16, 0.92), rgba(8, 10, 7, 0.94));
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(255, 229, 102, 0.06);
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.word-tray.tray-active {
  border-color: rgba(93, 255, 115, 0.45);
  box-shadow:
    inset 0 0 26px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(93, 255, 115, 0.14);
}

.tray-slot {
  display: flex;
  align-items: flex-start;
  border-radius: 3px;
  cursor: grab;
  outline-offset: 3px;
}

.tray-slot.tile-mod-help-host {
  padding-bottom: 2.1rem;
}

.tray-slot:active {
  cursor: grabbing;
}

.tray-slot.drop-target {
  outline: 2px dashed var(--accent);
}

.tray-end-cap {
  flex: 1 1 64px;
  min-height: 90px;
  border: 2px dashed var(--border-dim);
  border-radius: 2px;
  background: rgba(5, 8, 5, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tray-end-cap::after {
  content: "End";
  opacity: 0.55;
}

.tray-end-cap.drop-target {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: inset 0 0 18px rgba(93, 255, 115, 0.14);
}

.hand.sack-flap.drop-target-sack {
  border-color: rgba(212, 177, 138, 0.95);
  box-shadow:
    inset 0 0 32px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(93, 255, 115, 0.28),
    0 5px 0 #1a100c;
}

.card--tray {
  cursor: inherit;
  pointer-events: none;
}

.word-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.word-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  width: 100%;
}

.word-display {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.word-score-block {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-variant-numeric: tabular-nums;
  position: relative;
}

.relic-score-pop {
  position: absolute;
  right: -0.2rem;
  top: -0.95rem;
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  color: #ffe07a;
  text-shadow: 0 0 6px rgba(255, 224, 122, 0.5);
  pointer-events: none;
  animation: relicScorePop 0.72s ease-out forwards;
}

@keyframes relicScorePop {
  0% {
    opacity: 0;
    transform: translateY(4px) scale(0.95);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(1.02);
  }
}

.word-score-block .label,
.word-display .label {
  font-size: 0.95rem;
  letter-spacing: 0;
  color: var(--muted);
}

.word-preview {
  font-family: var(--font-pixel);
  font-size: clamp(0.72rem, 3.5vw, 0.92rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warm);
}

#word-score-preview {
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--accent);
}

.message {
  min-height: 1.35rem;
  margin: 0.55rem 0 0.75rem;
  padding: 0.35rem 0.45rem;
  font-size: 1.12rem;
  color: var(--muted);
  border-left: 3px solid var(--border-dim);
  background: rgba(5, 8, 5, 0.55);
}

.message.err {
  color: var(--danger);
  border-left-color: var(--danger-dim);
  text-shadow: 0 0 8px rgba(255, 122, 122, 0.35);
}

.message.ok {
  color: var(--accent);
  border-left-color: var(--accent-dim);
  text-shadow: 0 0 8px rgba(93, 255, 115, 0.28);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

button {
  font-family: var(--font);
  font-size: 1.08rem;
  cursor: pointer;
  border-radius: 2px;
  border: 2px solid var(--border);
  background: var(--panel-highlight);
  color: var(--text);
  padding: 0.38rem 0.75rem;
  letter-spacing: 0;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.35),
    0 2px 0 #020402;
  transition:
    border-color 0.08s ease,
    transform 0.06s ease,
    box-shadow 0.06s ease;
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 1px 0 #020402;
}

button.primary {
  border-color: #23963d;
  color: #050805;
  background: var(--accent);
}

button.primary:hover:not(:disabled) {
  border-color: var(--accent);
}

button.danger {
  border-color: var(--danger-dim);
  color: #2b0b0b;
  background: #e07070;
}

button.danger:hover:not(:disabled) {
  border-color: var(--danger);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-soft {
  border-color: var(--border-dim);
  background: rgba(6, 10, 6, 0.85);
  color: var(--muted);
  margin-left: 0.55rem;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}

.btn-soft:hover:not(:disabled) {
  border-color: var(--border);
  color: var(--text);
}

.hand-section {
  margin-top: 1.15rem;
}

.sack-section .panel-hint {
  border-left: 2px solid rgba(212, 181, 138, 0.35);
  padding-left: 0.45rem;
  margin-left: 0.05rem;
}

.hand-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.45rem;
  font-size: 1.08rem;
}

.hand-label {
  font-weight: 400;
  letter-spacing: 0;
}

.sack-stats {
  font-size: 1.02rem;
  letter-spacing: 0.03em;
}

.btn-sack-peek {
  font-size: 0.9rem;
  padding: 0.26rem 0.52rem;
  flex-shrink: 0;
}

.btn-shuffle-flap {
  font-size: 0.88rem;
  padding: 0.26rem 0.48rem;
  flex-shrink: 0;
  margin-left: 0;
}

/* Full sack inventory (peek) — wide card, CSS grid, no inner scroll; tiles sized to read */
.sack-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(0.55rem, env(safe-area-inset-top, 0px)) max(0.55rem, env(safe-area-inset-right, 0px))
    max(0.55rem, env(safe-area-inset-bottom, 0px)) max(0.55rem, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sack-peek-overlay::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sack-peek-overlay.hidden {
  display: none !important;
}

.sack-peek-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 4, 0.82);
  backdrop-filter: blur(5px);
}

.sack-peek-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(96vw, 52rem);
  max-height: none;
  display: flex;
  flex-direction: column;
  padding: 0.85rem 0.95rem 1rem;
  margin-bottom: auto;
}

.sack-peek-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.28rem;
  flex-shrink: 0;
}

.sack-peek-title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

.sack-peek-blurb {
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  line-height: 1.35;
  flex-shrink: 0;
}

.sack-peek-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 0.42rem 0.36rem;
  justify-items: center;
  align-content: start;
  padding: 0.48rem 0.42rem;
  border: 2px dashed rgba(212, 181, 138, 0.38);
  background: rgba(0, 0, 0, 0.38);
  overflow: visible;
  flex: 0 1 auto;
  min-height: 0;
}

.sack-peek-cell {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.sack-peek-cell--carved .card--peek-mini {
  outline: 2px solid rgba(140, 200, 255, 0.5);
  outline-offset: 1px;
}

.card--peek-mini {
  width: 46px;
  height: 72px;
  padding-top: 6px;
  margin: 0;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 4px 0 #5c5346,
    0 5px 2px rgba(0, 0, 0, 0.45);
}

.card--peek-mini:hover {
  transform: none;
}

.card--peek-mini .tile-points {
  right: 4px;
  bottom: 4px;
  font-size: 0.72rem;
}

.card--peek-mini .card-letter {
  font-size: 0.88rem;
}

.card--peek-mini .card-tag {
  font-size: 0.52rem;
  max-width: 44px;
  margin-bottom: 6px;
}

.card--peek-mini.card--face-carved .card-tag {
  margin-bottom: 2px;
}

.card--peek-mini .card-carved-grooves {
  top: 4px;
  left: 4px;
  right: 4px;
  height: 26%;
}

.card--peek-mini .card-carved-into {
  font-size: clamp(0.34rem, 1.55vw, 0.44rem);
}

.card--peek-mini .card-carved-into--compact {
  font-size: clamp(0.3rem, 1.4vw, 0.4rem);
}

/* After a stall carve: chisel grooves + blessing caption band (no letter repeat) */
.card--face-carved {
  border-color: rgba(200, 165, 80, 0.68);
  padding-bottom: 0;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 6px 0 #5c5346,
    0 8px 2px rgba(0, 0, 0, 0.55),
    inset 0 -18px 20px rgba(40, 28, 18, 0.12),
    0 0 0 1px rgba(255, 224, 130, 0.38),
    0 0 12px rgba(255, 210, 100, 0.28),
    0 0 22px rgba(255, 200, 80, 0.18);
  filter: drop-shadow(0 0 4px rgba(255, 210, 120, 0.35));
}

.card--face-carved .card-letter {
  position: relative;
  z-index: 1;
  color: #1a1814;
  text-shadow:
    0 1px 0 rgba(255, 252, 240, 0.55),
    0 -1px 1px rgba(0, 0, 0, 0.35),
    0 0 8px rgba(255, 214, 120, 0.45);
}

.card-carved-grooves {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  height: 30%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    repeating-linear-gradient(
      -32deg,
      transparent,
      transparent 5px,
      rgba(60, 48, 36, 0.22) 5px,
      rgba(60, 48, 36, 0.22) 6px
    ),
    repeating-linear-gradient(
      24deg,
      transparent,
      transparent 7px,
      rgba(40, 32, 24, 0.18) 7px,
      rgba(40, 32, 24, 0.18) 8px
    );
  border-radius: 2px;
}

.card-carved-into {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 52%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.15em;
  text-align: center;
  font-family: var(--font-pixel);
  font-size: clamp(0.36rem, 1.45vw, 0.46rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: rgba(32, 26, 18, 0.92);
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.35);
  pointer-events: none;
}

.card-carved-into--compact {
  font-size: clamp(0.3rem, 1.25vw, 0.38rem);
  letter-spacing: 0.01em;
  line-height: 1.05;
  min-height: 1.05em;
}

.card-carved-into-caption {
  color: #1e4a28;
  font-weight: 400;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card--face-carved .card-tag {
  position: relative;
  z-index: 1;
  margin-bottom: 4px;
}

.card--bench-mini .card-carved-grooves {
  top: 3px;
  left: 3px;
  right: 3px;
  height: 26%;
  opacity: 0.5;
}

.card--bench-mini.card--face-carved {
  padding-bottom: 0;
}

.card--peek-mini.card--face-carved {
  padding-bottom: 0;
}

.card--bench-mini .card-carved-into {
  font-size: clamp(0.28rem, 1.2vw, 0.36rem);
}

.card--bench-mini .card-carved-into--compact {
  font-size: clamp(0.26rem, 1.1vw, 0.34rem);
}

.shop-tile-chip--carved {
  border-color: rgba(130, 185, 235, 0.42);
}

.shop-tile-chip--carved .card--bench-mini {
  opacity: 0.93;
}

.muted {
  color: var(--muted);
}

.hand.sack-flap .card.tile-mod-help-host {
  margin-bottom: 2rem;
}

.hand.sack-flap {
  --flap-gap: 0.55rem;
  cursor: default;
  display: flex;
  flex-wrap: wrap;
  gap: var(--flap-gap);
  align-items: flex-start;
  padding: 0.85rem 0.75rem 0.95rem;
  border-radius: 4px;
  border: 3px solid #2c1810;
  outline: 2px dashed rgba(212, 181, 138, 0.42);
  outline-offset: -8px;
  background:
    radial-gradient(ellipse 130% 90% at 50% 115%, rgba(0, 0, 0, 0.5), transparent 52%),
    repeating-linear-gradient(
      -18deg,
      rgba(35, 20, 12, 0.4),
      rgba(35, 20, 12, 0.4) 1px,
      transparent 1px,
      transparent 7px
    ),
    repeating-linear-gradient(
      8deg,
      rgba(255, 236, 214, 0.03),
      rgba(255, 236, 214, 0.03) 2px,
      transparent 2px,
      transparent 9px
    ),
    linear-gradient(168deg, #634536 0%, #4d3426 28%, #3d2618 62%, #26170f 100%);
  min-height: 128px;
  box-shadow:
    inset 0 14px 32px rgba(255, 235, 210, 0.07),
    inset 0 -18px 38px rgba(0, 0, 0, 0.62),
    0 6px 0 #140c08,
    0 0 18px rgba(0, 0, 0, 0.35);
}

.card {
  position: relative;
  width: 56px;
  height: 82px;
  border-radius: 3px;
  border: 2px solid var(--tile-edge);
  background: linear-gradient(145deg, var(--tile-face), #cfc3ae);
  color: var(--tile-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
  cursor: pointer;
  user-select: none;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 6px 0 #5c5346,
    0 8px 2px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease,
    border-color 0.08s ease;
}

.card--sack {
  cursor: grab;
}

.card--sack:active {
  cursor: grabbing;
}

.card--sack:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Phone rack: 7 tiles share one row. Open hand keeps that size and gap, and starts a new row after the fifth. */
@media (max-width: 520px) {
  .hand.sack-flap {
    --flap-gap: 0.28rem;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .hand.sack-flap.hand--nine > .card:nth-child(6) {
    grid-column: 1;
  }

  .hand.sack-flap > .card {
    width: auto;
    min-width: 0;
    height: auto;
    aspect-ratio: 56 / 82;
    padding-top: 0.22rem;
  }

  .hand.sack-flap .card-letter {
    font-size: clamp(0.46rem, 3.2vw, 0.9rem);
  }

  .hand.sack-flap .tile-points {
    font-size: clamp(0.58rem, 2.5vw, 0.82rem);
    right: 2px;
    bottom: 2px;
  }

  .hand.sack-flap .card-tag {
    max-width: 100%;
    margin-bottom: 6px;
    font-size: 0.55rem;
  }
}

.card--compact-in {
  animation: flap-compact-settle 220ms ease-out;
}

.card--draw-in {
  animation: flap-draw-in 460ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.card--sack-empty {
  cursor: default;
  pointer-events: none;
  border-style: dashed;
  border-color: rgba(212, 181, 138, 0.45);
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 230, 200, 0.08), transparent 64%),
    rgba(28, 18, 12, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255, 220, 185, 0.08),
    inset 0 -10px 20px rgba(0, 0, 0, 0.22);
}

@keyframes flap-compact-settle {
  0% {
    transform: translateX(7px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes flap-draw-in {
  0% {
    transform: translateY(-88px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card--draw-in {
    animation: none;
  }
}

.tray-slot:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 4px;
}

.tray-slot:hover .card {
  transform: translateY(-2px);
}

.card:hover:not(.spent):not(.card--history):not(.card--sack-empty) {
  transform: translateY(-3px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 9px 0 #5c5346,
    0 12px 4px rgba(0, 0, 0, 0.55);
}

.card.spent {
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.tile-points {
  position: absolute;
  right: 5px;
  bottom: 5px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--tile-pip);
  line-height: 1;
}

.card-letter {
  font-family: var(--font-pixel);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1;
}

.card-tag {
  margin-top: auto;
  margin-bottom: 16px;
  padding: 0 4px;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 400;
  color: #1f5c30;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  max-width: 52px;
  text-align: center;
  line-height: 1.2;
}

/* Powered-up tiles (tag visible; carved faces use caption band instead — no tag in DOM). */
.card:not(.card--face-carved):has(.card-tag) {
  border-color: rgba(210, 175, 95, 0.55);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 6px 0 #5c5346,
    0 8px 2px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 224, 130, 0.28),
    0 0 10px rgba(255, 205, 90, 0.22),
    0 0 18px rgba(255, 195, 70, 0.14);
  filter: drop-shadow(0 0 3px rgba(255, 205, 100, 0.28));
}

.card:not(.card--face-carved):has(.card-tag):hover:not(.spent):not(.card--history) {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 9px 0 #5c5346,
    0 12px 4px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 230, 150, 0.36),
    0 0 14px rgba(255, 210, 95, 0.3),
    0 0 24px rgba(255, 200, 85, 0.2);
}

.card--face-carved:hover:not(.spent):not(.card--history) {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 9px 0 #5c5346,
    0 12px 4px rgba(0, 0, 0, 0.55),
    inset 0 -18px 20px rgba(40, 28, 18, 0.12),
    0 0 0 1px rgba(255, 232, 150, 0.48),
    0 0 16px rgba(255, 215, 110, 0.36),
    0 0 28px rgba(255, 200, 90, 0.24);
  filter: drop-shadow(0 0 6px rgba(255, 215, 120, 0.45));
}

.tile-mod-help-host {
  position: relative;
  z-index: 1;
}

.tile-mod-help-host.tile-mod-help-visible {
  z-index: 8;
}

.card-mod-help {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: max(100%, 11.5rem);
  max-width: min(18rem, calc(100vw - 2.5rem));
  margin-top: 0.28rem;
  z-index: 20;
  padding: 0.38rem 0.45rem 0.42rem;
  font-family: var(--font);
  font-size: 0.68rem;
  line-height: 1.28;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: none;
  font-weight: 400;
  color: #dff9e4;
  background: rgba(6, 12, 8, 0.96);
  border: 1px solid rgba(93, 255, 115, 0.35);
  border-radius: 2px;
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    visibility 0.14s ease;
}

.tile-mod-help-host.tile-mod-help-visible .card-mod-help {
  opacity: 1;
  visibility: visible;
}

.tile-mod-help-host > .card + .card-mod-help {
  font-size: 0.62rem;
  line-height: 1.22;
  padding: 0.32rem 0.38rem 0.36rem;
}

.reward-panel {
  margin-top: 1rem;
  border-style: dashed;
  border-color: rgba(255, 199, 77, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 199, 77, 0.06), rgba(8, 12, 8, 0.92)),
    var(--panel);
}

.reward-panel.hidden {
  display: none;
}

.reward-panel.shop-panel {
  border-style: solid;
  border-width: 3px;
  border-color: rgba(139, 92, 52, 0.55);
  background:
    linear-gradient(165deg, rgba(62, 42, 22, 0.45) 0%, rgba(10, 8, 6, 0.95) 42%),
    repeating-linear-gradient(
      -8deg,
      rgba(0, 0, 0, 0.07),
      rgba(0, 0, 0, 0.07) 3px,
      transparent 3px,
      transparent 22px
    ),
    var(--panel);
  box-shadow:
    inset 0 0 48px rgba(255, 120, 40, 0.07),
    0 6px 0 #120a04,
    0 0 0 3px #050805;
}

.reward-panel.relic-panel {
  border-style: solid;
  border-width: 3px;
  border-color: rgba(100, 170, 230, 0.48);
  background:
    linear-gradient(188deg, rgba(28, 48, 82, 0.42) 0%, rgba(6, 10, 14, 0.96) 48%),
    var(--panel);
  box-shadow:
    inset 0 0 42px rgba(100, 180, 255, 0.08),
    0 6px 0 #060c14,
    0 0 0 3px #050805;
}

.reward-panel.path-choice-panel {
  border-color: rgba(170, 130, 230, 0.48);
  background:
    linear-gradient(188deg, rgba(48, 32, 72, 0.42) 0%, rgba(6, 10, 14, 0.96) 48%),
    var(--panel);
  box-shadow:
    inset 0 0 42px rgba(190, 140, 255, 0.07),
    0 6px 0 #0c0814,
    0 0 0 3px #050805;
}

.act-ii-path-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  max-width: 22rem;
  margin-top: 0.35rem;
}

.act-ii-path-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.28rem;
  padding: 0.72rem 0.85rem;
  border-width: 2px;
  width: 100%;
}

.act-ii-path-btn-title {
  font-family: var(--font-pixel);
  font-size: clamp(0.48rem, 2.4vw, 0.62rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.act-ii-path-btn-blurb {
  font-size: 0.82rem;
  line-height: 1.35;
}

.act-ii-path-btn--primary {
  border-color: rgba(93, 255, 115, 0.38);
}

.relic-dual-slot-section {
  margin-top: 0.55rem;
  width: 100%;
}

.relic-choice-row--dual {
  margin-top: 0.28rem;
}

.relic-card-btn--picked {
  border-color: rgba(93, 255, 115, 0.55);
  box-shadow:
    inset 0 0 0 2px rgba(93, 255, 115, 0.18),
    0 0 18px rgba(93, 255, 115, 0.12);
}

.reward-kicker {
  margin: 0 0 0.35rem;
  letter-spacing: 0.16em;
}

#reward-heading {
  margin: 0 0 0.45rem;
  font-size: 1.32rem;
  font-family: var(--font);
  letter-spacing: 0.05em;
}

.shop-purse-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-pixel);
  font-size: clamp(0.5rem, 2.3vw, 0.58rem);
  letter-spacing: 0.1em;
  color: #ffc978;
  padding: 0.38rem 0.48rem;
  margin-bottom: 0.55rem;
  border: 2px dashed rgba(255, 170, 72, 0.38);
  background: rgba(0, 0, 0, 0.38);
}

.shop-purse-banner--compact {
  margin-bottom: 0.35rem;
  padding: 0.28rem 0.42rem;
}

.shop-purse-banner.shop-purse-with-peek {
  justify-content: space-between;
  flex-wrap: wrap;
  width: 100%;
}

.relic-purse-strip.relic-purse-with-peek {
  justify-content: flex-start;
  flex-wrap: nowrap;
  width: 100%;
}

.relic-purse-strip.relic-purse-with-peek .js-sack-peek {
  margin-left: auto;
}

.reward-panel.shop-panel #reward-heading {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.reward-panel.shop-panel #reward-text {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  line-height: 1.25;
  color: var(--muted);
}

.shop-offers-label {
  font-family: var(--font-pixel);
  font-size: clamp(0.46rem, 2vw, 0.52rem);
  letter-spacing: 0.14em;
  margin-bottom: 0.28rem;
}

.shop-offers-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 0.35rem;
  margin-bottom: 0.42rem;
  overflow: visible;
}

.shop-offer-btn {
  flex: 0 1 auto;
  margin: 0;
  padding: 0.28rem 0.28rem 0.5rem;
  border: 2px solid rgba(255, 200, 120, 0.35);
  border-radius: 3px;
  background: rgba(18, 14, 10, 0.75);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  transition:
    border-color 0.08s ease,
    background 0.08s ease,
    transform 0.08s ease;
}

.shop-offer-btn:hover:not(:disabled) {
  border-color: rgba(126, 255, 148, 0.55);
  background: rgba(24, 42, 28, 0.85);
  transform: translateY(-2px);
}

.shop-offer-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shop-offer-btn .card {
  pointer-events: none;
}

.shop-offer-btn.tile-mod-help-host .card {
  pointer-events: auto;
}

.card--stall-offer {
  width: 46px;
  height: 68px;
  padding-top: 7px;
  margin: 0;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 4px 0 #5c5346,
    0 6px 2px rgba(0, 0, 0, 0.45);
}

.card--stall-offer:hover {
  transform: none;
}

.card--stall-offer .tile-points {
  right: 4px;
  bottom: 4px;
  font-size: 0.72rem;
}

.card--stall-offer .card-letter {
  font-size: 0.88rem;
}

.card--stall-offer .card-tag {
  font-size: 0.52rem;
  max-width: 44px;
  margin-bottom: 10px;
}

.shop-shelf-row--skip {
  margin-bottom: 0.45rem;
}

.shop-skip-btn {
  width: min(100%, 26rem);
  max-width: 26rem;
  padding: 0.38rem 0.55rem;
  font-size: 0.92rem;
}

.shop-shelf-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  width: 100%;
}

.shop-carve-btn,
.shop-remove-btn {
  width: 100%;
}

.shop-actions-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.42rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.shop-action-half {
  min-width: 0;
}

.shop-actions-split .shop-action-label {
  min-width: 0;
  flex: 0 1 auto;
}

.shop-deck-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0.65rem;
  padding: 0.48rem;
  border: 2px dashed rgba(200, 140, 80, 0.38);
  background: rgba(5, 7, 5, 0.52);
  overflow: visible;
}

.shop-deck-grid--compact {
  margin: 0.28rem 0 0.4rem;
  padding: 0.35rem 0.35rem 0.45rem;
  gap: 0.28rem;
  max-height: none;
}

/* Five stall bench slots: natural tile size, spaced evenly across the row */
.shop-deck-grid.shop-deck-grid--compact.shop-deck-grid--bench-five {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-evenly;
  align-items: center;
  width: 100%;
  max-width: 100%;
  max-height: none;
  min-height: 0;
  margin-left: 0;
  margin-right: 0;
  /* overflow-x: hidden + overflow-y: visible computes to y:auto and shows a bogus scrollbar */
  overflow: visible;
  gap: 0;
  padding: 0.32rem 0.28rem 0.42rem;
}

.shop-deck-grid.shop-deck-grid--compact.shop-deck-grid--bench-five .shop-tile-slot,
.shop-deck-grid.shop-deck-grid--compact.shop-deck-grid--bench-five .shop-tile-chip {
  flex: 0 0 auto;
}

.shop-bench-key--compact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
  margin-bottom: 0;
  font-size: 0.82rem;
}

.shop-tile-chip {
  font-family: var(--font-pixel);
  font-size: clamp(0.46rem, 2vw, 0.54rem);
  padding: 0.38rem 0.48rem;
  border: 2px solid rgba(255, 229, 102, 0.26);
  background: rgba(32, 26, 18, 0.88);
  color: var(--warm);
  cursor: pointer;
  text-align: left;
}

.shop-tile-chip--card {
  padding: 0.15rem;
  line-height: 0;
  background: rgba(22, 18, 14, 0.92);
}

.shop-tile-chip--card .card {
  pointer-events: none;
}

.shop-tile-chip--card.tile-mod-help-host .card {
  pointer-events: auto;
}

.shop-tile-chip--card .card--bench-mini {
  width: 36px;
  height: 54px;
  padding-top: 5px;
  margin: 0;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 3px 0 #5c5346,
    0 4px 1px rgba(0, 0, 0, 0.45);
}

.shop-tile-chip--card .card--bench-mini:hover {
  transform: none;
}

.shop-tile-chip--card .card--bench-mini.card--face-carved {
  border-color: rgba(200, 165, 80, 0.68);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 3px 0 #5c5346,
    0 4px 1px rgba(0, 0, 0, 0.45),
    inset 0 -12px 14px rgba(40, 28, 18, 0.1),
    0 0 0 1px rgba(255, 224, 130, 0.38),
    0 0 10px rgba(255, 210, 100, 0.28),
    0 0 18px rgba(255, 200, 80, 0.18);
  filter: drop-shadow(0 0 4px rgba(255, 210, 120, 0.35));
}

.shop-tile-chip--card .card--bench-mini:not(.card--face-carved):has(.card-tag) {
  border-color: rgba(210, 175, 95, 0.55);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 3px 0 #5c5346,
    0 4px 1px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 224, 130, 0.28),
    0 0 8px rgba(255, 205, 90, 0.22),
    0 0 14px rgba(255, 195, 70, 0.14);
  filter: drop-shadow(0 0 3px rgba(255, 205, 100, 0.28));
}

.shop-tile-chip--card .card--bench-mini.card--face-carved:hover:not(.spent):not(.card--history) {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 3px 0 #5c5346,
    0 4px 1px rgba(0, 0, 0, 0.45),
    inset 0 -12px 14px rgba(40, 28, 18, 0.1),
    0 0 0 1px rgba(255, 232, 150, 0.48),
    0 0 13px rgba(255, 215, 110, 0.36),
    0 0 22px rgba(255, 200, 90, 0.24);
  filter: drop-shadow(0 0 6px rgba(255, 215, 120, 0.45));
}

.shop-tile-chip--card .tile-points {
  right: 3px;
  bottom: 3px;
  font-size: 0.62rem;
}

.shop-tile-chip--card .card-letter {
  font-size: 0.72rem;
}

.shop-tile-chip--card .card-tag {
  font-size: 0.45rem;
  max-width: 34px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.shop-tile-chip--card .card--bench-mini.card--face-carved .card-tag {
  margin-bottom: 1px;
}

.shop-tile-chip:hover {
  border-color: rgba(255, 220, 140, 0.45);
}

.shop-tile-chip--pick {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.shop-tile-chip--frozen {
  cursor: default;
  pointer-events: auto;
  opacity: 0.92;
}

.shop-tile-chip--frozen:hover {
  border-color: rgba(255, 229, 102, 0.26);
}

.shop-tile-slot {
  box-sizing: border-box;
  width: calc(36px + 0.3rem);
  min-height: calc(54px + 0.35rem);
  border-radius: 3px;
  border: 2px dashed rgba(90, 70, 50, 0.45);
  background: rgba(12, 10, 8, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shop-tile-slot--vacant {
  border-style: dashed;
  opacity: 0.55;
}

.shop-tile-slot--gone {
  border-color: rgba(180, 60, 60, 0.55);
  background: rgba(40, 12, 12, 0.55);
}

.shop-scrap-x {
  font-family: var(--font);
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1;
  color: #ff4a4a;
  text-shadow:
    0 0 6px rgba(255, 40, 40, 0.65),
    0 2px 0 rgba(60, 0, 0, 0.85);
  user-select: none;
  pointer-events: none;
}

.shop-input-locked {
  pointer-events: none;
  user-select: none;
}

.shop-tile-chip--carving {
  position: relative;
  z-index: 4;
}

.shop-tile-chip--carving .card--bench-mini {
  animation: shop-carve-chisel 0.44s ease-in-out forwards;
  filter: brightness(1.12) drop-shadow(0 0 10px rgba(255, 210, 110, 0.65));
}

@keyframes shop-carve-chisel {
  0% {
    transform: rotate(-3deg) translateY(0);
  }
  17% {
    transform: rotate(6deg) translateY(-4px) scale(1.07);
  }
  34% {
    transform: rotate(-8deg) translateY(2px) scale(0.93);
  }
  52% {
    transform: rotate(5deg) translateY(-3px) scale(1.06);
  }
  72% {
    transform: rotate(-3deg) translateY(1px) scale(1);
  }
  100% {
    transform: rotate(0deg) translateY(0) scale(1);
  }
}

.danger-soft {
  border-color: rgba(220, 96, 72, 0.55);
  color: #ffb8a8;
}

.danger-soft:hover:not(:disabled) {
  border-color: rgba(255, 140, 110, 0.75);
  background: rgba(48, 18, 14, 0.55);
}

.shop-sub {
  margin: 0.35rem 0 0;
}

.shop-shelf-row--done {
  margin-top: 0.85rem;
  padding-top: 0.55rem;
  border-top: 2px dashed rgba(139, 92, 52, 0.38);
}

.shop-leave-btn {
  width: min(100%, 26rem);
  max-width: 26rem;
}

.relic-flair {
  margin: 0 0 0.65rem;
}

.relic-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  width: 100%;
  border-color: rgba(110, 175, 235, 0.42);
}

.shop-offer-btn--tutorial-pick,
.relic-card-btn--tutorial-pick {
  outline: 2px solid var(--warm);
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px rgba(255, 199, 77, 0.35),
    0 0 18px rgba(255, 199, 77, 0.22);
}

.relic-card-btn--tutorial-pick {
  border-color: rgba(255, 199, 77, 0.75);
}

.exchange-bar {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.exchange-actions.hidden {
  display: none;
}

.btn-exchange-open.hidden {
  display: none;
}

.btn-swap-glyphs {
  min-width: 8.6rem;
}

.exchange-hint:empty {
  display: none;
}

.exchange-hint {
  margin-top: 0.35rem;
}

.spell-grimoire {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 2px dashed rgba(255, 229, 102, 0.2);
}

.spell-grimoire-head {
  margin-bottom: 0.35rem;
}

.spell-grimoire-title {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.spell-history {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  overflow: visible;
}

.spell-history-empty {
  margin: 0;
  font-size: 1rem;
}

.spell-log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.35rem 0.65rem;
  padding: 0.38rem 0.42rem;
  background: rgba(5, 8, 5, 0.42);
  border-left: 3px solid rgba(93, 255, 115, 0.28);
  border-radius: 2px;
}

.spell-log-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.5rem;
}

.spell-log-word {
  font-family: var(--font-pixel);
  font-size: clamp(0.52rem, 2.4vw, 0.62rem);
  letter-spacing: 0.1em;
  color: var(--warm);
}

.spell-log-score {
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  color: var(--accent);
}

.spell-log-perks {
  font-size: 0.88rem;
}

.spell-log-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: flex-end;
}

.card--mini.card--history {
  width: 38px;
  height: 56px;
  padding-top: 5px;
  cursor: default;
  transform: none !important;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 4px 0 #5c5346,
    0 5px 2px rgba(0, 0, 0, 0.45);
}

.card--mini.card--history:hover {
  transform: none !important;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 4px 0 #5c5346,
    0 5px 2px rgba(0, 0, 0, 0.45);
}

.card--mini.card--history .tile-points {
  font-size: 0.68rem;
  right: 3px;
  bottom: 3px;
}

.card--mini.card--history .card-letter {
  font-size: 0.68rem;
  padding-top: 0;
}

/* Swap-glyphs selection: accent ring reads on plain + carved faces (gold blessing glow) */
.hand.sack-flap .card.card--sack.card--exchange-mark {
  position: relative;
  z-index: 2;
  border-color: rgba(93, 255, 115, 0.75);
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 6px 0 #5c5346,
    0 8px 2px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(6, 14, 10, 0.92),
    0 0 18px rgba(93, 255, 115, 0.55),
    0 0 28px rgba(93, 255, 115, 0.3);
  filter: drop-shadow(0 0 10px rgba(93, 255, 115, 0.5));
  animation: swap-mark-wiggle 0.92s ease-in-out infinite;
}

.hand.sack-flap .card.card--sack.card--exchange-mark::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 5px;
  border: 2px dashed rgba(201, 247, 209, 0.88);
  pointer-events: none;
  z-index: 5;
  box-shadow:
    0 0 0 1px rgba(12, 36, 22, 0.55) inset,
    0 0 12px rgba(93, 255, 115, 0.35);
}

.hand.sack-flap .card.card--sack.card--face-carved.card--exchange-mark {
  border-color: rgba(93, 255, 115, 0.5);
  outline-width: 3px;
  outline-offset: 4px;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 6px 0 #5c5346,
    0 8px 2px rgba(0, 0, 0, 0.55),
    inset 0 -18px 20px rgba(40, 28, 18, 0.12),
    0 0 0 3px rgba(93, 255, 115, 1),
    0 0 24px rgba(93, 255, 115, 0.62),
    0 0 12px rgba(255, 214, 130, 0.16);
  filter: drop-shadow(0 0 12px rgba(93, 255, 115, 0.78)) drop-shadow(0 0 4px rgba(255, 210, 120, 0.22));
}

.hand.sack-flap .card.card--sack.card--exchange-mark:hover:not(.spent):not(.card--history):not(.card--face-carved) {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.5) inset,
    0 9px 0 #5c5346,
    0 12px 4px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(6, 14, 10, 0.95),
    0 0 24px rgba(93, 255, 115, 0.62),
    0 0 34px rgba(93, 255, 115, 0.35);
  filter: drop-shadow(0 0 14px rgba(93, 255, 115, 0.58));
}

.hand.sack-flap .card.card--sack.card--face-carved.card--exchange-mark:hover:not(.spent):not(.card--history) {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 9px 0 #5c5346,
    0 12px 4px rgba(0, 0, 0, 0.55),
    inset 0 -18px 20px rgba(40, 28, 18, 0.12),
    0 0 0 1px rgba(255, 224, 130, 0.3),
    0 0 0 4px rgba(93, 255, 115, 1),
    0 0 28px rgba(93, 255, 115, 0.68),
    0 0 16px rgba(255, 215, 110, 0.14);
  filter: drop-shadow(0 0 14px rgba(93, 255, 115, 0.82));
}

@keyframes swap-mark-wiggle {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  20% {
    transform: translateY(-1px) rotate(-1.4deg);
  }
  40% {
    transform: translateY(0) rotate(1.3deg);
  }
  60% {
    transform: translateY(-1px) rotate(-1deg);
  }
  80% {
    transform: translateY(0) rotate(0.8deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

.reward-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-family: var(--font);
  letter-spacing: 0.04em;
}

.reward-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.reward-card-btn {
  min-width: 148px;
  text-align: left;
  font-weight: 400;
}

.reward-panel.relic-panel #reward-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

.relic-slot-flair {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  align-self: flex-start;
  padding: 0.24rem 0.5rem;
  border: 1px solid rgba(120, 185, 240, 0.42);
  background: rgba(16, 34, 56, 0.38);
  border-radius: 999px;
}

.relic-slot-icon {
  width: 0.9rem;
  height: 0.9rem;
  color: #9bd1ff;
}

.relic-slot-flair-label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8dcff;
}

.relic-held-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
}

.relic-choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
}

.relic-choice-row.relic-choice-row--roomy {
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.reward-panel.relic-panel #reward-text {
  margin: 0 0 0.55rem;
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: var(--muted);
}

#reward-text.daily-sack-line {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.12rem;
  margin: 0.1rem 0 0.6rem;
  letter-spacing: 0;
}

.daily-sack-letter {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
}

.reward-panel.relic-panel .relic-choice-row .reward-card-btn {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.16rem;
  padding: 0.4rem 0.7rem 0.45rem;
}

.relic-card-btn.relic-slot-robe {
  border-color: rgba(255, 199, 77, 0.62);
  background:
    linear-gradient(90deg, rgba(255, 199, 77, 0.2), rgba(255, 199, 77, 0.04) 48%),
    var(--panel-highlight);
}

.relic-card-btn.relic-slot-hat {
  border-color: rgba(93, 255, 115, 0.55);
  background:
    linear-gradient(90deg, rgba(93, 255, 115, 0.16), rgba(93, 255, 115, 0.03) 48%),
    var(--panel-highlight);
}

.relic-card-btn.relic-slot-staff {
  border-color: rgba(120, 186, 255, 0.62);
  background:
    linear-gradient(90deg, rgba(90, 160, 255, 0.2), rgba(90, 160, 255, 0.04) 48%),
    var(--panel-highlight);
}

.relic-card-btn.relic-slot-amulet {
  border-color: rgba(196, 140, 255, 0.62);
  background:
    linear-gradient(90deg, rgba(176, 110, 255, 0.22), rgba(176, 110, 255, 0.04) 48%),
    var(--panel-highlight);
}

.relic-card-btn.relic-slot-robe .relic-slot-icon,
.relic-card-btn.relic-slot-robe .relic-choice-name {
  color: #ffd98a;
}

.relic-card-btn.relic-slot-hat .relic-slot-icon,
.relic-card-btn.relic-slot-hat .relic-choice-name {
  color: #9dffab;
}

.relic-card-btn.relic-slot-staff .relic-slot-icon,
.relic-card-btn.relic-slot-staff .relic-choice-name {
  color: #b7dcff;
}

.relic-card-btn.relic-slot-amulet .relic-slot-icon,
.relic-card-btn.relic-slot-amulet .relic-choice-name,
.relic-card-btn.relic-slot-relic .relic-slot-icon,
.relic-card-btn.relic-slot-relic .relic-choice-name {
  color: #e0c2ff;
}

.relic-card-btn.relic-slot-relic {
  border-color: rgba(196, 140, 255, 0.62);
  background:
    linear-gradient(90deg, rgba(176, 110, 255, 0.22), rgba(176, 110, 255, 0.04) 48%),
    var(--panel-highlight);
}

.relic-choice-head {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  margin: 0;
  line-height: 1;
}

.relic-choice-head .relic-slot-icon {
  width: 0.85rem;
  height: 0.85rem;
  color: #9bd1ff;
  flex: 0 0 auto;
}

.relic-choice-name {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  line-height: 1.45;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c9e6ff;
}

.relic-choice-effect {
  font-size: 1.15rem;
  line-height: 1.15;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--text);
}

.footer {
  margin-top: 1.65rem;
  font-size: 1.05rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.run-seed-line {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.25;
  opacity: 0.88;
  text-align: left;
  cursor: default;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.outcome-seed-hash {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

.btn-restart-run {
  margin-left: 0;
}

.status-line::before {
  content: "> ";
  color: var(--accent-dim);
}

/* Desktop keyboard shortcuts sheet */
.keyboard-cheats-overlay {
  position: fixed;
  inset: 0;
  z-index: 94;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.keyboard-cheats-overlay.hidden {
  display: none !important;
}

.keyboard-cheats-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 4, 0.88);
  backdrop-filter: blur(5px);
}

.keyboard-cheats-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  padding: 1.05rem 1.05rem 1rem;
  margin: 0 auto;
  border-width: 3px;
  border-color: rgba(120, 200, 160, 0.42);
  background:
    linear-gradient(165deg, rgba(22, 42, 30, 0.38) 0%, rgba(8, 10, 7, 0.96) 52%),
    var(--panel);
  box-shadow:
    inset 0 0 28px rgba(100, 220, 140, 0.05),
    0 6px 0 #0c140f,
    0 0 0 3px #050805;
  animation: outcomePop 0.28s ease-out;
}

.keyboard-cheats-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.keyboard-cheats-title {
  margin: 0;
  font-family: var(--font);
  font-size: 1.22rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: var(--accent-dim);
}

.keyboard-cheats-lede {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.keyboard-cheats-list {
  margin: 0 0 0.65rem;
  padding-left: 1.15rem;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}

.keyboard-cheats-list li {
  margin-bottom: 0.35rem;
}

.keyboard-cheats-note {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.kbd-chip {
  display: inline-block;
  padding: 0.06rem 0.38rem 0.12rem;
  margin: 0 0.06rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  font-weight: 600;
  vertical-align: baseline;
  border: 1px solid rgba(255, 229, 140, 0.35);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-bug-report {
  margin-left: 0;
  font-size: 0.86rem;
  padding: 0.34rem 0.56rem;
}

.bug-report-overlay {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.bug-report-overlay.hidden {
  display: none !important;
}

.bug-report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 4, 0.9);
  backdrop-filter: blur(5px);
}

.bug-report-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 30rem;
  padding: 1rem 1rem 0.9rem;
}

.bug-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.bug-report-title {
  margin: 0;
  font-size: 1.14rem;
  letter-spacing: 0.06em;
}

.bug-report-lede {
  margin: 0 0 0.55rem;
  font-size: 0.94rem;
  line-height: 1.35;
}

.bug-report-label {
  display: block;
  margin: 0.36rem 0 0.2rem;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bug-report-input,
.bug-report-textarea {
  width: 100%;
  border: 2px solid rgba(110, 155, 118, 0.45);
  border-radius: 2px;
  background: rgba(5, 9, 7, 0.82);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.38rem 0.45rem;
}

.bug-report-textarea {
  resize: vertical;
  min-height: 5.8rem;
}

.bug-report-input:focus,
.bug-report-textarea:focus {
  outline: 2px solid rgba(255, 199, 77, 0.45);
  outline-offset: 2px;
}

.bug-report-context {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.bug-report-status {
  margin: 0.35rem 0 0;
  min-height: 1.15rem;
  font-size: 0.94rem;
  line-height: 1.35;
}

.bug-report-status.ok {
  color: var(--accent);
}

.bug-report-status.err {
  color: var(--danger);
}

.bug-report-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: flex-end;
}

/* Chamber / run outcomes */
.battle-outcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.battle-outcome-overlay.hidden {
  display: none !important;
}

.battle-outcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 3, 0.88);
  backdrop-filter: blur(6px);
}

.battle-outcome-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26.5rem;
  padding: 1.2rem 1.1rem 1.05rem;
  margin: 0 auto;
  border-width: 3px;
  animation: outcomePop 0.32s ease-out;
}

@keyframes outcomePop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.battle-outcome-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
}

.battle-outcome-title {
  margin: 0 0 0.45rem;
  font-family: var(--font);
  font-size: 1.38rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.battle-outcome-body {
  margin: 0 0 0.55rem;
  font-size: 1.12rem;
  line-height: 1.42;
  white-space: pre-line;
}

.battle-outcome-cause {
  margin: 0 0 0.65rem;
  font-size: 0.98rem;
  line-height: 1.38;
  letter-spacing: 0.03em;
}

.battle-outcome-stats {
  margin: 0 0 1.05rem;
  padding: 0.48rem 0.55rem;
  font-size: 1.02rem;
  line-height: 1.35;
  border-left: 3px solid rgba(93, 255, 115, 0.4);
  background: rgba(0, 0, 0, 0.4);
}

.battle-leaderboard {
  margin: 0 0 1rem;
  padding: 0.58rem 0.6rem 0.62rem;
  border: 2px dashed rgba(130, 200, 255, 0.35);
  background: rgba(4, 8, 12, 0.45);
  animation: leaderboardDropIn 0.34s ease-out;
}

.battle-leaderboard.hidden {
  display: none !important;
}

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

.battle-leaderboard-head {
  margin-bottom: 0.45rem;
}

.battle-leaderboard-title {
  margin: 0;
  font-size: 1.06rem;
  letter-spacing: 0.08em;
}

.battle-leaderboard-sub {
  margin: 0.12rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.battle-leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-bottom: 0.5rem;
}

.battle-leaderboard-label {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.battle-leaderboard-name {
  width: 8ch;
  max-width: 8ch;
  min-width: 8ch;
  padding: 0.3rem 0.35rem;
  border: 2px solid rgba(130, 200, 255, 0.45);
  border-radius: 2px;
  background: rgba(2, 6, 8, 0.85);
  color: var(--warm);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.battle-leaderboard-name:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.battle-leaderboard-list {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
}

.battle-leaderboard-list li {
  font-size: 0.96rem;
  line-height: 1.3;
}

.intro-leaderboard-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.intro-leaderboard-overlay.hidden {
  display: none !important;
}

.intro-leaderboard-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 3, 0.9);
  backdrop-filter: blur(6px);
}

.intro-leaderboard-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  padding: 1rem;
}

.intro-leaderboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.intro-leaderboard-title {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.08em;
}

.intro-leaderboard-sub {
  margin: 0.32rem 0 0.55rem;
  font-size: 0.92rem;
}

.battle-outcome-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  width: 100%;
}

#btn-outcome-primary {
  margin-left: auto;
  flex-shrink: 0;
}

#btn-outcome-share.hidden {
  display: none;
}

.battle-outcome-seed-slot {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-start;
}

.battle-outcome-seed-slot:empty {
  display: none;
}

.outcome-seed-action-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem 0.45rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.outcome-seed-action-toolbar .outcome-seed-hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.82);
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(12rem, 38vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome-seed-action-toolbar .outcome-seed-copy-icon-btn {
  width: 1.55rem;
  height: 1.55rem;
}

/* Fixed restart + in-game restart confirm (no browser alert) */
.restart-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: none;
  justify-content: center;
  padding: 0.35rem 0.8rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

#game-screen.is-daily[data-phase="playing"] ~ .restart-dock {
  position: static;
  z-index: auto;
}

.restart-dock .btn-restart-run--dock {
  pointer-events: auto;
  width: min(22rem, calc(100vw - 1.6rem));
  max-width: 22rem;
  margin: 0 auto;
  font-size: 0.95rem;
  padding: 0.44rem 0.9rem;
  border-color: rgba(220, 96, 72, 0.8);
  background: linear-gradient(180deg, rgba(98, 26, 20, 0.98), rgba(66, 16, 12, 0.98));
  color: #ffd5cc;
}

#game-screen:not(.is-hidden)[data-phase="playing"] ~ .restart-dock,
#game-screen:not(.is-hidden)[data-phase="reward"] ~ .restart-dock {
  display: flex;
}

.restart-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.restart-confirm-overlay.hidden {
  display: none !important;
}

.restart-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 3, 0.9);
  backdrop-filter: blur(6px);
}

.restart-confirm-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 24rem;
  padding: 1.15rem 1.05rem 1rem;
  margin: 0 auto;
  border-width: 3px;
  border-color: rgba(255, 122, 122, 0.45);
  background:
    linear-gradient(165deg, rgba(40, 14, 14, 0.35) 0%, rgba(8, 10, 7, 0.96) 48%),
    var(--panel);
  box-shadow:
    inset 0 0 32px rgba(255, 80, 60, 0.06),
    0 6px 0 #140808,
    0 0 0 3px #050805;
  animation: outcomePop 0.32s ease-out;
}

.restart-confirm-overlay--title .restart-confirm-card {
  border-color: rgba(255, 199, 77, 0.48);
  background:
    linear-gradient(165deg, rgba(50, 38, 14, 0.35) 0%, rgba(8, 10, 7, 0.96) 48%),
    var(--panel);
  box-shadow:
    inset 0 0 32px rgba(255, 180, 80, 0.05),
    0 6px 0 #140c06,
    0 0 0 3px #050805;
}

.restart-confirm-overlay--title .restart-confirm-title {
  color: var(--warm);
  text-shadow: 0 0 14px rgba(255, 199, 77, 0.22);
}

.restart-confirm-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.restart-confirm-title {
  margin: 0 0 0.45rem;
  font-family: var(--font);
  font-size: 1.32rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: var(--danger);
  text-shadow: 0 0 12px rgba(255, 122, 122, 0.28);
}

.restart-confirm-body {
  margin: 0 0 1rem;
  font-size: 1.08rem;
  line-height: 1.42;
  color: var(--text);
}

.restart-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.battle-outcome-overlay[data-outcome="guardian-win"] .battle-outcome-card {
  border-color: rgba(255, 180, 96, 0.52);
  box-shadow:
    inset 0 0 36px rgba(255, 150, 60, 0.06),
    0 6px 0 #140c06,
    0 0 28px rgba(255, 160, 64, 0.08);
}

.battle-outcome-overlay[data-outcome="vault-intro"] .battle-outcome-card {
  border-color: rgba(130, 200, 255, 0.48);
  box-shadow:
    inset 0 0 40px rgba(100, 180, 255, 0.07),
    0 6px 0 #060e14,
    0 0 26px rgba(120, 190, 255, 0.1);
}

.battle-outcome-overlay[data-outcome="tower-win"] .battle-outcome-card {
  border-color: rgba(120, 220, 255, 0.55);
  box-shadow:
    inset 0 0 44px rgba(100, 200, 255, 0.1),
    0 6px 0 #050810,
    0 0 32px rgba(100, 210, 255, 0.14);
}

.battle-outcome-overlay[data-outcome="tower-win"] .battle-outcome-stats {
  border-left-color: rgba(140, 210, 255, 0.55);
}

.battle-outcome-overlay[data-outcome="loss"] .battle-outcome-card {
  border-color: rgba(255, 110, 110, 0.45);
  box-shadow:
    inset 0 0 36px rgba(120, 40, 40, 0.12),
    0 6px 0 #120608,
    0 0 22px rgba(255, 80, 80, 0.08);
}

.battle-outcome-overlay[data-outcome="loss"] .battle-outcome-stats {
  border-left-color: rgba(255, 130, 130, 0.55);
  overflow: visible;
}

/* ─── Studio splash (first landing) ───────────────────────────────── */
.studio-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 1.35rem) 1.25rem;
  --studio-zoom-scale: 14;
  background:
    radial-gradient(ellipse 120% 80% at 50% 40%, rgba(93, 255, 115, 0.07), transparent 52%),
    var(--bg-deep);
  transition:
    opacity 0.52s ease,
    visibility 0.52s ease;
}

@media (max-width: 520px) {
  .studio-intro-overlay {
    --studio-zoom-scale: 11;
  }
}

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

.studio-intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.48rem, 2.4vw, 0.72rem);
  text-align: center;
  max-width: min(96vw, 42rem);
}

.studio-intro-studios-line {
  margin: 0;
  min-height: clamp(3rem, 13.5vmin, 4.35rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.studio-intro-studios-line:not(.is-active) {
  opacity: 0;
  visibility: hidden;
}

.studio-intro-studios-line.is-active {
  opacity: 1;
  visibility: visible;
}

/* Full line in DOM; "+" zooms alone, then prefix/suffix fade in around it (Addi(c)+ive Studios). */
.studio-intro-name-cluster {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
}

/* Prefix/suffix sit in the DOM; they fade in once the "+" finishes zooming out. */
.studio-intro-studios-prefix,
.studio-intro-studios-suffix {
  display: inline-block;
  vertical-align: baseline;
  white-space: nowrap;
  font-family: var(--font-pixel);
  font-size: clamp(0.54rem, 2.75vw, 0.76rem);
  line-height: 1.65;
  letter-spacing: 0.04em;
  color: var(--warm);
  text-shadow:
    0 0 10px rgba(255, 229, 102, 0.35),
    0 0 22px rgba(255, 216, 102, 0.12);
  opacity: 1;
  transition: opacity 1.25s ease;
}

.studio-intro-studios-prefix.studio-intro-studios-rest--fade-pending,
.studio-intro-studios-suffix.studio-intro-studios-rest--fade-pending {
  opacity: 0;
}

.studio-intro-plus-lead {
  font-family: var(--font-pixel);
  font-size: clamp(0.54rem, 2.75vw, 0.76rem);
  line-height: 1.65;
  letter-spacing: 0;
  flex-shrink: 0;
  transform-origin: center center;
  transition:
    transform 1.22s cubic-bezier(0.2, 0.92, 0.22, 1),
    color 0.65s ease 0.45s;
}

.studio-intro-plus-lead.is-zoomed {
  will-change: transform;
  color: var(--accent);
  transform: scale(var(--studio-zoom-scale));
  text-shadow:
    0 0 14px rgba(93, 255, 115, 0.5),
    0 0 28px rgba(93, 255, 115, 0.14);
}

.studio-intro-plus-lead:not(.is-zoomed) {
  will-change: auto;
  color: var(--warm);
  text-shadow:
    0 0 10px rgba(255, 229, 102, 0.35),
    0 0 22px rgba(255, 216, 102, 0.12);
}

.studio-intro-copy {
  font-size: 0.58em;
  vertical-align: super;
  margin: 0 0.02em;
  letter-spacing: 0;
  opacity: 0.95;
}

.studio-intro-presents {
  font-family: var(--font-pixel);
  font-size: clamp(0.5rem, 2.55vw, 0.64rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
  color: var(--muted);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.85s ease,
    transform 0.85s ease;
}

.studio-intro-presents.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.studio-intro-logo-wrap {
  margin: 0;
  padding: 0;
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity 1s ease 0.12s,
    transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.12s;
}

.studio-intro-logo-wrap.is-visible {
  opacity: 1;
  transform: scale(1);
}

.studio-intro-brand-title {
  font-size: clamp(1.05rem, 5vw, 1.55rem);
  margin: 0;
}

.studio-intro-continue-hint {
  font-family: var(--font-pixel);
  font-size: clamp(0.28rem, 1.45vw, 0.38rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0;
  padding: 0;
  color: var(--muted);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.6s ease 0.08s,
    transform 0.6s ease 0.08s;
}

.studio-intro-continue-hint.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .studio-intro-overlay {
    transition-duration: 0.15s;
  }

  .studio-intro-plus-lead {
    transition-duration: 0.01ms !important;
  }

  .studio-intro-studios-prefix,
  .studio-intro-studios-suffix {
    transition-duration: 0.01ms !important;
  }

  .studio-intro-presents,
  .studio-intro-logo-wrap,
  .studio-intro-continue-hint {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    transform: none !important;
  }
}

.intro-screen {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.35rem 1rem calc(4.35rem + env(safe-area-inset-bottom, 0px));
}

.intro-screen.is-hidden {
  display: none;
}

.intro-frame {
  position: relative;
  max-width: 520px;
  width: 100%;
  padding: 1.15rem 1.15rem 2.05rem;
}

#btn-music-intro.btn-music-toggle {
  min-width: 0;
  width: auto;
  height: auto;
  padding: 0.2rem 0.45rem;
  margin-left: 0;
  border-radius: 2px;
  font-size: 1.05rem;
  letter-spacing: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.intro-art-wrap {
  max-width: 228px;
  margin: 0 auto 1rem;
  border: 2px solid var(--border);
  background: #030504;
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.65),
    0 0 20px rgba(93, 255, 115, 0.09),
    0 5px 0 #030503;
}

.intro-pixel-svg {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.intro-kicker {
  margin-bottom: 0.45rem;
}

.intro-title {
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 3vw, 0.82rem);
  line-height: 1.55;
  text-transform: uppercase;
  margin: 0 0 0.85rem;
  color: var(--warm);
}

.intro-story {
  margin-bottom: 1rem;
}

.intro-lead {
  margin: 0 0 0.65rem;
  font-size: 1.2rem;
  line-height: 1.38;
}

.intro-lead strong {
  color: var(--accent);
  font-weight: 400;
  text-shadow: 0 0 10px rgba(93, 255, 115, 0.28);
}

.intro-tag {
  margin: 0;
  padding: 0.55rem 0.6rem 0.58rem;
  font-size: 1.05rem;
  line-height: 1.42;
  border-left: 3px solid rgba(93, 255, 115, 0.35);
  background: rgba(5, 9, 6, 0.45);
}

.intro-seed-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: center;
  margin-top: 0.85rem;
}

.intro-seed-label {
  flex: 0 0 auto;
  font-size: 1rem;
  letter-spacing: 0.03em;
}

.intro-seed-field {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(5, 9, 7, 0.75);
  border: 2px solid rgba(110, 155, 118, 0.45);
  border-radius: 3px;
}

.intro-seed-field::placeholder {
  color: rgba(220, 238, 226, 0.45);
}

.intro-seed-field:focus {
  outline: 2px solid rgba(255, 199, 77, 0.45);
  outline-offset: 2px;
}

.intro-url-error {
  margin: 0.35rem 0 0;
  font-size: 0.98rem;
  line-height: 1.38;
  max-width: 42rem;
  color: var(--danger);
  text-shadow: 0 0 8px rgba(255, 122, 122, 0.35);
}

.intro-cta {
  flex: 1 1 200px;
  min-width: 0;
  margin-top: 0.15rem;
  padding: 0.55rem 1rem;
  font-size: 1.18rem;
}

.intro-cta-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
  width: 100%;
}

.intro-cta-stack .intro-cta-row {
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  margin-top: 0;
  flex-wrap: nowrap;
}

/* Override .btn-soft horizontal margin so Guided tutorial lines up with Begin ascent */
.intro-cta-stack .intro-cta {
  flex: 0 1 auto;
  width: 100%;
  max-width: min(24rem, 100%);
  margin-top: 0;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.85rem;
}

.intro-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: stretch;
  margin-top: 0.15rem;
}

.intro-cta-row .intro-cta {
  margin-top: 0;
}

.intro-cta--secondary {
  font-size: 1.05rem;
}

.tutorial-banner {
  margin: 0 0 0.85rem;
  padding: 0.45rem 0.55rem;
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--warm);
  border: 2px solid rgba(255, 199, 77, 0.45);
  background: rgba(36, 24, 8, 0.55);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.tutorial-banner.hidden {
  display: none;
}

.game-screen[data-tutorial="1"] .tutorial-banner {
  border-color: rgba(93, 255, 115, 0.35);
  color: var(--text);
  background: rgba(8, 18, 12, 0.65);
}

.tutorial-buddy {
  position: fixed;
  z-index: 36;
  display: inline-flex;
  align-items: flex-start;
  gap: 0.36rem;
  pointer-events: none;
}

.tutorial-buddy.hidden {
  display: none;
}

.tutorial-buddy-icon {
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid rgba(255, 208, 120, 0.62);
  background: rgba(26, 17, 8, 0.92);
  color: #ffd866;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(6, 10, 8, 0.7),
    0 4px 10px rgba(0, 0, 0, 0.38);
}

.tutorial-buddy-bubble {
  position: relative;
  max-width: min(22rem, calc(100vw - 2rem));
  border: 2px solid rgba(130, 214, 160, 0.5);
  background: rgba(8, 16, 10, 0.95);
  color: #d9f7e5;
  padding: 0.4rem 0.48rem;
  box-shadow:
    inset 0 0 0 1px rgba(6, 10, 8, 0.55),
    0 6px 12px rgba(0, 0, 0, 0.34);
}

.tutorial-buddy-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.2;
}

.tutorial-buddy-notch {
  position: absolute;
  width: 0.62rem;
  height: 0.62rem;
  background: rgba(8, 16, 10, 0.95);
  border-left: 2px solid rgba(130, 214, 160, 0.5);
  border-top: 2px solid rgba(130, 214, 160, 0.5);
  transform: rotate(45deg);
}

.tutorial-buddy[data-side="top"] .tutorial-buddy-notch {
  left: 0.7rem;
  bottom: -0.39rem;
}

.tutorial-buddy[data-side="bottom"] .tutorial-buddy-notch {
  left: 0.7rem;
  top: -0.39rem;
}

.tutorial-buddy[data-side="left"] .tutorial-buddy-notch {
  right: -0.39rem;
  top: 0.62rem;
  transform: rotate(135deg);
}

.tutorial-buddy[data-side="right"] .tutorial-buddy-notch {
  left: -0.39rem;
  top: 0.62rem;
  transform: rotate(-45deg);
}

/* ─── Developer tools (unlock via tower seed //dev or //scrambble-dev) ─ */
.dev-tools-overlay {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 85;
  font-family: var(--font-pixel);
  font-size: clamp(0.34rem, 1.65vw, 0.44rem);
  letter-spacing: 0.06em;
  max-width: min(92vw, 17rem);
}

.dev-tools-overlay.hidden {
  display: none !important;
}

.dev-tools-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border: 2px solid rgba(255, 200, 72, 0.45);
  background: rgba(8, 6, 4, 0.92);
  color: var(--warm);
  cursor: pointer;
  box-shadow: 0 4px 0 #1a1208;
}

.dev-tools-badge kbd {
  font-family: inherit;
  padding: 0.08rem 0.22rem;
  border: 1px solid rgba(255, 220, 160, 0.35);
  border-radius: 2px;
  color: var(--accent);
}

.dev-tools-panel {
  border: 2px solid rgba(100, 200, 255, 0.4);
  background: rgba(6, 12, 18, 0.96);
  color: #dce8f0;
  padding: 0.55rem 0.65rem;
  box-shadow: 0 6px 0 #080c10;
}

.dev-tools-panel.hidden {
  display: none !important;
}

.dev-tools-panel h3 {
  margin: 0 0 0.4rem;
  font-size: clamp(0.42rem, 2vw, 0.52rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.dev-tools-meta {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.dev-tools-actions {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.dev-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.dev-tools-row label {
  letter-spacing: 0.04em;
}

.dev-tools-panel select {
  flex: 1;
  min-width: 5rem;
  font-family: var(--font-pixel);
  font-size: 0.42rem;
  padding: 0.22rem 0.35rem;
  background: #0e141c;
  color: #e8f4ff;
  border: 1px solid rgba(100, 160, 220, 0.35);
}

.dev-tools-panel .btn-dev-tool {
  font-family: var(--font-pixel);
  font-size: 0.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.32rem 0.45rem;
  border-width: 2px;
  cursor: pointer;
}

.dev-tools-panel input[type="password"] {
  flex: 1;
  min-width: 6rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  padding: 0.28rem 0.4rem;
  background: #0a1018;
  border: 1px solid rgba(120, 140, 170, 0.35);
  color: #e4eaf4;
}

.dev-tools-divider {
  margin: 0.5rem 0 0.35rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.dev-tools-status {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.dev-tools-meta a {
  color: #8fd4ff;
  text-decoration: underline;
}

.dev-tools-meta a:hover,
.dev-tools-meta a:focus {
  color: #b8e6ff;
}

.dev-tools-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.dev-tools-close {
  flex-shrink: 0;
  padding: 0.15rem 0.35rem;
  font-family: var(--font-pixel);
  font-size: 0.34rem;
  letter-spacing: 0.1em;
}

.intro-foot {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 1.05rem;
}

.intro-version {
  display: block;
  margin: 0.35rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-decoration: underline;
  text-decoration-color: rgba(201, 230, 255, 0.45);
  text-underline-offset: 0.13em;
}

.intro-version:hover,
.intro-version:focus {
  color: #d9eeff;
  text-decoration-color: rgba(217, 238, 255, 0.8);
}

.game-screen.is-hidden {
  display: none;
}

.game-screen {
  animation: gameFadeIn 0.38s ease-out;
}

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

.changelog-page {
  overflow-x: hidden;
}

.bug-report-row-tag {
  margin: 0.2rem 0 0.35rem;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.bug-reports-nav {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.bug-reports-nav a {
  color: var(--accent);
  text-decoration: none;
}

.bug-reports-nav a:hover,
.bug-reports-nav a:focus {
  text-decoration: underline;
}

.bug-reports-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.35rem;
}

.bug-reports-label {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bug-reports-input {
  padding: 0.42rem 0.5rem;
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(5, 9, 7, 0.75);
  border: 2px solid rgba(110, 155, 118, 0.45);
  border-radius: 3px;
}

.bug-reports-input--secret {
  flex: 1 1 12rem;
  min-width: 0;
  font-family: var(--font-mono, monospace);
}

.bug-reports-input--limit {
  width: 4.2rem;
}

.bug-reports-load-btn {
  flex: 0 0 auto;
}

.bug-reports-status {
  min-height: 1.35rem;
  margin: 0 0 0.65rem;
  font-size: 1.02rem;
}

.bug-reports-status--err {
  color: var(--danger);
}

.bug-reports-code {
  font-family: var(--font-mono, monospace);
  font-size: 0.95em;
}

.bug-report-entry .bug-report-contact {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.bug-report-github {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.bug-report-github a {
  color: var(--accent);
}

.bug-report-details {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.bug-report-context {
  margin: 0;
  padding: 0.45rem 0.5rem;
  max-height: 14rem;
  overflow: auto;
  font-family: var(--font-mono, monospace);
  font-size: 0.88rem;
  line-height: 1.35;
  background: rgba(4, 8, 6, 0.55);
  border: 1px solid rgba(110, 155, 118, 0.28);
  border-radius: 2px;
}

.changelog-main {
  width: min(60rem, calc(100vw - 1.5rem));
  margin: 1rem auto 1.4rem;
}

.changelog-panel {
  border-style: solid;
  border-width: 3px;
  border-color: rgba(255, 199, 77, 0.42);
  background:
    linear-gradient(185deg, rgba(20, 28, 20, 0.86) 0%, rgba(6, 10, 8, 0.95) 50%),
    var(--panel);
}

.changelog-title {
  margin: 0.1rem 0 0.35rem;
  font-size: clamp(1.35rem, 5vw, 1.95rem);
  letter-spacing: 0.06em;
}

.changelog-sub {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  line-height: 1.35;
}

.changelog-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.changelog-entry {
  border: 2px dashed rgba(120, 168, 128, 0.42);
  padding: 0.65rem 0.75rem;
  background: rgba(4, 8, 5, 0.45);
}

.changelog-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.7rem;
  margin-bottom: 0.3rem;
}

.changelog-entry-version {
  margin: 0;
  font-size: clamp(0.74rem, 2.6vw, 0.95rem);
  letter-spacing: 0.1em;
  color: var(--warm);
}

.changelog-entry-date {
  font-size: 0.92rem;
}

.changelog-entry-notes {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 1.08rem;
  line-height: 1.45;
}

.changelog-entry-notes li + li {
  margin-top: 0.2rem;
}

.changelog-entry-group + .changelog-entry-group {
  margin-top: 0.45rem;
}

.changelog-entry-group-title {
  margin: 0 0 0.14rem;
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #bfe8c9;
}

#game-screen {
  overflow-x: hidden;
  --floor-progress-a: #46ff7a;
  --floor-progress-b: #29cf56;
  --floor-turn-a: #ffe566;
  --floor-turn-b: #d4b022;
  --floor-border-strong: #2d5534;
  --floor-panel-tint: rgba(11, 18, 12, 0.88);
  --floor-sign-color: var(--warm);
}

#game-screen.floor-theme-rookery {
  --floor-progress-a: #64ffa6;
  --floor-progress-b: #32c962;
  --floor-turn-a: #fff59e;
  --floor-turn-b: #e0b535;
  --floor-border-strong: #3d7048;
  --floor-panel-tint: rgba(10, 26, 18, 0.92);
  --floor-sign-color: #b8ffc9;
}

#game-screen.floor-theme-scriptorium {
  --floor-progress-a: #ffd080;
  --floor-progress-b: #d4912e;
  --floor-turn-a: #ffeef0;
  --floor-turn-b: #c97d8a;
  --floor-border-strong: #9a6230;
  --floor-panel-tint: rgba(36, 22, 12, 0.92);
  --floor-sign-color: #ffdca8;
}

#game-screen.floor-theme-vault {
  --floor-progress-a: #9bdcff;
  --floor-progress-b: #4a8fb8;
  --floor-turn-a: #e8f4ff;
  --floor-turn-b: #7aa8cc;
  --floor-border-strong: #4a6578;
  --floor-panel-tint: rgba(10, 18, 28, 0.94);
  --floor-sign-color: #c8e8ff;
}

#game-screen.floor-theme-shop {
  --floor-border-strong: #6b4630;
  --floor-panel-tint: rgba(38, 22, 12, 0.9);
  --floor-sign-color: #ffb86c;
}

#game-screen.floor-theme-relic {
  --floor-border-strong: #4a6080;
  --floor-panel-tint: rgba(12, 20, 34, 0.94);
  --floor-sign-color: #b8e0ff;
}

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

@media (prefers-reduced-motion: reduce) {
  .game-screen {
    animation: none;
  }

  .card--compact-in,
  .card--draw-in,
  .card--exchange-mark {
    animation: none;
  }

  .fill {
    transition: none;
  }

  .crt-scanlines,
  .crt-noise {
    opacity: 0.12;
  }
}

.studio-intro-overlay,
.intro-art-wrap,
.intro-story,
.intro-seed-row,
.intro-foot,
#btn-begin-tutorial,
#btn-intro-leaderboard,
.boot-bar,
.tagline,
.region-label,
.enemy-head,
.rules-head,
.coin-purse,
.brand-mark,
.stall-marquee {
  display: none !important;
}

.intro-lead {
  font-size: 1.35rem;
  line-height: 1.25;
  max-width: 28rem;
  margin: 0 auto 1.25rem;
}

.intro-tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 42px));
  justify-content: center;
  gap: 8px;
  margin: 12px auto;
}

.daily-sack-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.75rem auto;
}

.intro-tiles .card,
.daily-sack-line .card {
  width: 42px;
  height: 62px;
  padding-top: 6px;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.45) inset,
    0 4px 0 #5c5346;
}

.intro-tiles .card {
  width: 100%;
  height: auto;
  aspect-ratio: 42 / 62;
}

.intro-how {
  max-width: 28rem;
  margin: 0 auto 16px;
  text-align: left;
}

.intro-how-title {
  margin: 0 0 8px;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  line-height: 1.6;
  color: var(--text);
}

.intro-how ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.25;
}

.intro-how li + li {
  margin-top: 4px;
}

.intro-boost-label {
  max-width: 28rem;
  margin: 16px auto 8px;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
}

.intro-boost-label[hidden] {
  display: none;
}

.intro-relics .relic-card-btn.relic-slot-relic {
  border: none;
  border-radius: 4px;
  background: var(--tile-face);
  color: var(--tile-ink);
  box-shadow: 0 4px 0 var(--tile-edge);
  padding: 16px;
  gap: 4px;
  transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.intro-relics .relic-card-btn.relic-slot-relic:hover {
  background: #f7f3ea;
}

.intro-relics .relic-card-btn.relic-slot-relic:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--tile-edge);
}

.intro-relics .relic-card-btn.relic-slot-relic:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.intro-relics .relic-slot-icon {
  display: none;
}

.intro-relics .relic-choice-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.intro-relics .relic-choice-kicker {
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--tile-pip);
}

.intro-relics .relic-card-btn .relic-choice-name {
  color: var(--tile-ink);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

.intro-relics .relic-choice-effect {
  color: var(--tile-pip);
  font-size: 1.2rem;
  line-height: 1.2;
}

.intro-relics {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 auto 16px;
  max-width: 28rem;
}

.chamber-card {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: var(--bg-deep);
  text-align: center;
}

.chamber-card.hidden {
  display: none;
}

.chamber-card-kicker,
.chamber-card-title {
  margin: 0;
  font-family: var(--font-pixel);
  line-height: 1.5;
}

.chamber-card-kicker {
  color: var(--accent);
  font-size: 0.55rem;
}

.chamber-card-title {
  color: var(--text);
  font-size: 0.95rem;
}

.chamber-card-detail {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.45rem;
  line-height: 1.3;
  white-space: pre-line;
}

#btn-begin-ascent[hidden],
#intro-tiles[hidden] {
  display: none !important;
}

.intro-results {
  margin: 0;
}

#intro-attempt {
  display: block;
  width: auto;
  margin: 0 0 0.45rem;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.2rem;
  letter-spacing: 0;
  text-align: left;
  cursor: default;
}

#intro-attempt.attempt-open {
  cursor: pointer;
}

#intro-attempt:disabled {
  opacity: 1;
}

.attempt-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.attempt-modal.hidden {
  display: none;
}

.attempt-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 3, 0.88);
}

.attempt-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  max-height: min(32rem, calc(100vh - 2rem));
  overflow: auto;
  margin: 0;
  padding: 1rem;
}

.attempt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.attempt-modal-head h2 {
  margin: 0;
  font-family: var(--font);
  font-size: 1.35rem;
  font-weight: 400;
}

.attempt-modal-head .btn-soft {
  margin-left: 0;
}

.attempt-block + .attempt-block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.attempt-block h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--muted);
}

.attempt-block .btn-soft {
  margin: 0.35rem 0 0;
}

.daily-share {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--text);
}

.daily-edit-note {
  flex-basis: 100%;
  margin: 0.35rem 0 0;
  text-align: center;
}

.card--in-word {
  border-color: var(--accent);
}

.card-order {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.75rem;
  line-height: 1;
}

#game-screen.is-daily #btn-bug-report,
#game-screen.is-daily #run-seed-line,
#game-screen.is-daily .word-tray,
#game-screen.is-daily .compose-head .label {
  display: none !important;
}
