/**
 * css/style.css — Cozy Pastel Storybook Stylesheet for Fossilvale: Dino Dig Museum
 * Palette locked to Concept Art HEX: #DEB469, #6B3F21, #B77437, #92D0DC, #EDDA90
 * Strict Hygiene:
 *  - Zero blur filters on backdrops or canvases
 *  - 9-Slice `border-image` on `.panel-9slice`, `.btn-primary-9slice`, `.btn-secondary-9slice`
 *  - Dark cocoa ink (`#2A1810` / `#3A241A`) for >= 8:1 WCAG contrast on warm buttons/panels
 *  - `overflow: visible !important; position: relative;` on all badge hosts
 */

:root {
  --gold: #DEB469;
  --cocoa: #6B3F21;
  --amber-wood: #B77437;
  --sky: #92D0DC;
  --cream-gold: #EDDA90;
  --parchment: #FFF9EE;
  --parchment-warm: #FBF0D9;
  --ink: #3A241A;
  --ink-deep: #2A1810;
  --ink-muted: #6B4A35;
  --font-display: 'Fredoka', 'M PLUS Rounded 1c', 'Segoe UI', sans-serif;
  --font-num: 'Quicksand', 'Fredoka', 'Segoe UI', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #E7CCA0;
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

button {
  font-family: var(--font-display);
  cursor: pointer;
  position: relative;
  overflow: visible !important;
  outline: none;
  transition: filter 0.14s ease, transform 0.12s ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.05);
}

button:disabled:not([data-modal-inert-disabled]) {
  cursor: not-allowed;
}

.btn-label {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.2;
}

/* =========================================================================
 * 9-SLICE PAINTED GAME CHROME (ZERO STRETCH DISTORTION, >= 8:1 CONTRAST)
 * ========================================================================= */
.panel-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 22px 22px 22px 22px;
  border-image: url('../assets/ui/frame_panel.png') 78 80 78 78 fill / 22px 22px 22px 22px / 0 stretch;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(42, 24, 16, 0.32);
  filter: none;
  color: var(--ink);
}

.btn-primary-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 18px 14px 18px;
  border-image: url('../assets/ui/btn_primary.png') 100 75 77 76 fill / 13px 18px 14px 18px / 0 stretch;
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(42, 24, 16, 0.28);
  filter: none;
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(12px, 1vw, 14.5px);
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: visible !important;
}

.btn-secondary-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 13px 16px 14px 16px;
  border-image: url('../assets/ui/btn_secondary.png') 95 65 67 65 fill / 13px 16px 14px 16px / 0 stretch;
  border-radius: 10px;
  box-shadow: 0 2px 0 rgba(42, 24, 16, 0.24);
  filter: none;
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(12px, 0.96vw, 14px);
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: visible !important;
}

.btn-danger-soft {
  filter: hue-rotate(155deg) saturate(0.85) brightness(1.04) drop-shadow(0 3px 0 rgba(42, 24, 16, 0.32));
  color: var(--ink-deep);
}

.btn-compact {
  border-width: 10px 14px 11px 14px;
  font-size: 12.5px;
  padding: 1px 4px;
}

.btn-inline-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 18px;
}

/* =========================================================================
 * RED-DOT NOTIFICATION BADGE (NEVER CLIPPED!)
 * ========================================================================= */
[data-notify-id] {
  position: relative;
  overflow: visible !important;
}

.notify-badge {
  position: absolute;
  top: -6px;
  right: -2px;
  transform-origin: top right;
  z-index: 32;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #D94E28;
  color: #FFF9EE;
  border: 2px solid #FFF9EE;
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
  animation: fvBadgePulse 1.8s ease-in-out infinite;
}

@keyframes fvBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* =========================================================================
 * TITLE SCREEN
 * ========================================================================= */
.title-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #DFB97A;
  overflow: hidden;
}

.title-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.title-top-bar {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-lang-wrap {
  position: relative;
}

.title-lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 165px;
  background: var(--parchment);
  border: 2.5px solid var(--cocoa);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 40;
  box-shadow: 0 8px 20px rgba(42, 24, 16, 0.28);
}

.title-lang-option {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 9px;
  text-align: left;
}

.title-lang-option:hover,
.title-lang-option.active {
  background: var(--cream-gold);
  color: var(--ink-deep);
}

.title-center-card {
  position: relative;
  z-index: 3;
  max-width: 520px;
  width: 90vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 14px;
}

.title-portrait-wrap {
  width: 136px;
  height: 136px;
  position: relative;
  margin: 0 auto 2px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF8E6 35%, rgba(222, 180, 105, 0.35) 100%);
  border: 3px solid var(--amber-wood);
  display: flex;
  align-items: center;
  justify-content: center;
}

#title-curator-portrait {
  width: 124px;
  height: 124px;
  object-fit: contain;
}

.title-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.7vw, 34px);
  font-weight: 800;
  color: #FFF9EE;
  -webkit-text-stroke: 2px #5A3E36;
  text-shadow: 0 3px 0 #5A3E36;
  line-height: 1.12;
}

.title-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-muted);
  max-width: 400px;
}

.boot-progress-wrap {
  width: 100%;
  max-width: 340px;
  margin-top: 6px;
}

.boot-progress-track {
  width: 100%;
  height: 14px;
  background: rgba(107, 63, 33, 0.22);
  border: 2px solid var(--cocoa);
  border-radius: 999px;
  overflow: hidden;
}

.boot-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #DEB469, #92D0DC);
  transition: width 0.18s ease;
}

.boot-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: 4px;
}

.title-play-btn {
  min-width: 210px;
  font-size: 19px;
  margin-top: 6px;
  padding: 6px 24px;
}

/* =========================================================================
 * UNIFIED 16:9 WIDESCREEN WORKSPACE (>= 92% HORIZONTAL UTILIZATION)
 * ========================================================================= */
.app-workspace {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #F6E4BE 0%, #E5C591 100%);
  padding: 6px 10px 8px;
  gap: 6px;
}

/* Top 52px Command Bar */
.top-command-bar {
  height: 52px;
  min-height: 52px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  background: var(--parchment);
  border: 2.5px solid var(--cocoa);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(107, 63, 33, 0.22);
}

.hud-site-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
}

.site-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  border: 2px solid rgba(107, 63, 33, 0.35);
  background: var(--parchment-warm);
  color: var(--ink);
  font-size: clamp(10.5px, 0.85vw, 12.5px);
  font-weight: 700;
  min-width: 0;
}

.site-pill.active {
  background: var(--cream-gold);
  border-color: var(--cocoa);
  box-shadow: 0 2px 0 var(--cocoa);
}

.site-pill.locked {
  opacity: 0.72;
  background: #EFE4CF;
}

.site-pill.can-unlock {
  opacity: 0.96;
  border-color: #C7842A;
  background: #FAF0D7;
}

.site-lock-cost--ready {
  background: #D97543;
  color: #FFF9EE;
  border-radius: 5px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 800;
}

.site-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
  border: 1px solid var(--cocoa);
}

.site-lock-cost {
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 800;
  background: rgba(107, 63, 33, 0.16);
  padding: 1px 5px;
  border-radius: 6px;
}

/* Energy Canteen Bar */
.hud-energy-canteen {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  background: #F4E6CA;
  border: 2px solid var(--amber-wood);
  border-radius: 11px;
  padding: 3px 7px;
}

.hud-energy-canteen.low-energy {
  border-color: #D9532F;
  animation: fvLowEnergyPulse 0.9s ease-in-out infinite;
}

@keyframes fvLowEnergyPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.canteen-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink);
}

.canteen-bar-outer {
  position: relative;
  width: 96px;
  height: 22px;
  background: rgba(58, 36, 26, 0.18);
  border: 2px solid var(--cocoa);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.canteen-bar-outer.is-draining {
  border-color: #FF6B4A;
  box-shadow: 0 0 0 2px rgba(255, 110, 68, 0.45), 0 0 10px rgba(255, 102, 58, 0.58);
}

.canteen-bar-drain {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #FF5A4E, #FFE066);
  transition: width 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.canteen-bar-fill {
  position: relative;
  z-index: 1;
  height: 100%;
  background: linear-gradient(90deg, #64B3D7, #92D0DC);
  transition: width 0.12s ease;
}

.canteen-bar-text {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-deep);
  font-variant-numeric: tabular-nums;
}

.hud-pill-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  border: 2px solid var(--cocoa);
  background: var(--gold);
  color: var(--ink-deep);
  font-size: 11.5px;
  font-weight: 700;
}

.hud-pill-btn--sky {
  background: var(--sky);
}

/* Right Currencies & Meta Strip */
.hud-right-cluster {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.hud-vip-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--cream-gold);
  border: 2px solid var(--amber-wood);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-deep);
}

.hud-vip-pill img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.currency-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 9px;
  border-radius: 999px;
  background: #FFF6E3;
  border: 2px solid var(--gold);
  color: var(--ink-deep);
  font-family: var(--font-num);
  font-weight: 800;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.currency-pill img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.currency-pill--tickets {
  border-color: var(--amber-wood);
}

.currency-pill--gems {
  background: #EEF8FB;
  border-color: var(--sky);
}

.currency-rate {
  font-size: 10.5px;
  font-weight: 800;
  color: #2E6B34;
}

.hud-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 9px;
  border-radius: 10px;
  border: 2px solid var(--cocoa);
  background: var(--parchment-warm);
  color: var(--ink-deep);
  font-size: 12px;
  font-weight: 700;
  position: relative;
  overflow: visible !important;
}

.hud-icon-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 18px;
}

.hud-icon-btn--compact,
.hud-icon-btn--exit {
  padding: 0 8px;
}

.hud-icon-btn--exit {
  background: #F9DFD6;
}

.hud-svg-icon {
  width: 18px;
  height: 18px;
}

/* =========================================================================
 * MAIN SIDE-BY-SIDE 16:9 STAGE (58% DIG / 42% MUSEUM)
 * ========================================================================= */
.main-split-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  gap: 8px;
}

.dig-zone {
  flex: 0 0 57.5%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 249, 238, 0.78);
  border: 2.5px solid var(--cocoa);
  border-radius: 16px;
  padding: 6px 8px 8px;
}

.museum-zone {
  flex: 1 1 42.5%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(255, 249, 238, 0.82);
  border: 2.5px solid var(--cocoa);
  border-radius: 16px;
  padding: 6px 8px 8px;
}

.zone-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  flex-wrap: wrap;
}

.dig-species-tracker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.tracker-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.tracker-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.pity-pill {
  font-size: 9.5px;
  font-weight: 800;
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #81C784;
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.tracker-cards {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  min-width: 0;
}

.tracker-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 10px;
  background: var(--parchment);
  border: 1.5px solid rgba(183, 116, 55, 0.45);
  min-width: 0;
  flex: 1 1 0;
}

.tracker-chip.missing {
  border-style: dashed;
  background: #FFF6E5;
}

.tracker-dino-img {
  width: 28px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 28px;
}

.tracker-chip.missing .tracker-dino-img {
  filter: brightness(0.22);
  opacity: 0.45;
}

.tracker-chip-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tracker-dino-name {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-dino-meta {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.bone-prog {
  font-size: 10px;
  font-weight: 800;
  background: var(--cream-gold);
  color: var(--ink-deep);
  padding: 1px 5px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.bone-prog.done {
  background: #C8E6C9;
  color: #1B5E20;
}

/* Gadgets Strip */
.dig-gadgets-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.gadget-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 8px;
  border-radius: 10px;
  border: 2px solid var(--amber-wood);
  background: var(--parchment);
  color: var(--ink-deep);
  font-size: 11.5px;
  font-weight: 700;
}

.gadget-btn.armed {
  background: #FFE2B8;
  border-color: #D9532F;
}

.gadget-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.gadget-count {
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 800;
  background: var(--cream-gold);
  padding: 1px 5px;
  border-radius: 6px;
}

.gadget-count.buy-amber {
  background: #FFEAC2;
  color: #7A4112;
}

.hotkey-tag {
  position: absolute;
  top: -6px;
  left: -5px;
  background: var(--cocoa);
  color: #FFF9EE;
  font-family: var(--font-num);
  font-size: 9.5px;
  font-weight: 800;
  padding: 1px 4.5px;
  border-radius: 5px;
  line-height: 1.1;
  pointer-events: none;
  z-index: 4;
}

.canvas-stage-box {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(107, 63, 33, 0.35);
  background: #DFC394;
}

#dig-canvas,
#museum-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Museum Header & Footer Strip */
.museum-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}

.museum-header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.museum-hall-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.hall-wing-tab {
  height: 25px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1.5px solid rgba(107, 63, 33, 0.45);
  background: var(--parchment-warm);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 800;
}

.hall-wing-tab.active {
  background: var(--gold);
  border-color: var(--cocoa);
  box-shadow: 0 1.5px 0 var(--cocoa);
}

.hall-wing-tab.locked {
  opacity: 0.58;
}

.museum-pill-hype {
  font-size: 11px;
  font-weight: 800;
  color: #6B3F21;
  background: #FFF3D1;
  border: 1.5px solid #DEB469;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.hud-pill-btn--photo {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  background: var(--cream-gold);
}

.hud-pill-btn--photo.active {
  background: var(--sky);
}

.zone-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-deep);
  white-space: nowrap;
}

.museum-pill-stat {
  font-size: 11px;
  font-weight: 800;
  background: var(--cream-gold);
  color: var(--ink-deep);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1.5px solid var(--amber-wood);
  white-space: nowrap;
}

.museum-pill-rate {
  font-size: 12px;
  font-weight: 800;
  color: #25642B;
  background: #E8F5E9;
  border: 1.5px solid #81C784;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.museum-action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding-top: 2px;
}

.museum-action-strip--4col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.museum-photo-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding-top: 2px;
}

.museum-action-strip > *,
.museum-photo-bar > * {
  min-width: 0;
  max-width: 100%;
}

.dock-tools-list--5col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.site-pill--atlas {
  background: linear-gradient(180deg, #FFF6DF, #F0CE86);
  border-color: var(--cocoa);
}

.site-pill--quick {
}

.site-pill--modes {
  background: #E8F5FA;
  border-color: #4D92B6;
}

.gadget-btn--toggle.active {
  background: #E8F5E9;
  border-color: #2E7D32;
}

/* =========================================================================
 * TUTORIAL NON-BLOCKING BANNER (DOCKED BELOW DIG CANVAS — ZERO TILE OCCLUSION)
 * ========================================================================= */
.tutorial-banner-host {
  position: relative;
  width: 100%;
  z-index: 10;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

.tutorial-card.panel-9slice {
  pointer-events: auto;
  max-width: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border-width: 10px 14px 10px 14px;
  padding: 2px 6px;
  filter: drop-shadow(0 3px 6px rgba(42, 24, 16, 0.18));
}

.tutorial-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid var(--amber-wood);
  background: #FFF6E0;
  object-fit: cover;
  flex: 0 0 36px;
}

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

.tutorial-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1px;
}

.tutorial-step-tag {
  font-size: 9.5px;
  font-weight: 800;
  background: var(--cream-gold);
  color: var(--ink-deep);
  padding: 1px 6px;
  border-radius: 999px;
}

.tutorial-dots {
  display: inline-flex;
  gap: 4px;
}

.tut-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background: rgba(107, 63, 33, 0.25);
}

.tut-dot.active {
  background: var(--cocoa);
  transform: scale(1.2);
}

.tut-dot.done {
  background: var(--amber-wood);
}

.tutorial-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-deep);
  line-height: 1.25;
}

.tutorial-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* =========================================================================
 * BOTTOM 120px TOOL LADDER & WORKSHOP DOCK
 * ========================================================================= */
.bottom-dock {
  height: 112px;
  min-height: 108px;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--parchment);
  border: 2.5px solid var(--cocoa);
  border-radius: 16px;
  box-shadow: 0 3px 0 rgba(107, 63, 33, 0.22);
}

.dock-tools-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1.25 1 0;
  min-width: 0;
}

.dock-tools-list.dock-tools-list--5col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  flex: 1.55 1 0;
}

.dock-tools-list--5col .tool-card {
  padding: 5px 6px;
  gap: 5px;
}

.dock-tools-list--5col .tool-card-img {
  width: 28px;
  height: 34px;
  flex: 0 0 28px;
}

.dock-tools-list--5col .tool-card-name {
  font-size: 11px;
}

.dock-tools-list--5col .tool-card-meta {
  font-size: 9.5px;
}

.tool-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 12px;
  border: 2px solid rgba(183, 116, 55, 0.45);
  background: var(--parchment-warm);
  color: var(--ink-deep);
  text-align: left;
  min-width: 0;
}

.tool-card.active {
  background: linear-gradient(180deg, #FFF9E4, #F7DF9C);
  border-color: var(--cocoa);
}

.tool-card.locked {
  opacity: 0.76;
  background: #EFE3CE;
}

.tool-card.affordable {
  opacity: 1;
  border-color: #2E7D32;
  background: #F1F8E9;
}

.tool-card-img {
  width: 38px;
  height: 44px;
  object-fit: contain;
  flex: 0 0 38px;
}

.tool-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tool-card-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-deep);
}

.tool-card-meta {
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock-quick-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  flex: 1.05 1 0;
  min-width: 0;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 2px solid rgba(107, 63, 33, 0.35);
  background: #FFFDF7;
  color: var(--ink-deep);
  text-align: left;
  min-width: 0;
}

.quick-card.affordable {
  border-color: var(--amber-wood);
  background: #FFF6E0;
}

.quick-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 26px;
}

.quick-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.quick-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-deep);
}

.quick-cost {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
  color: #8D521E;
}

.dock-workshop-cta {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.workshop-main-btn {
  height: 100%;
  min-width: 144px;
  font-size: 14px;
}

/* =========================================================================
 * SHARED MODAL CLASSES (CONTRACT WITH `data-i18n`, ZERO BACKDROP BLUR!)
 * ========================================================================= */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.cutin-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 130;
  pointer-events: none;
}

.exit-modal-root {
  position: fixed;
  inset: 0;
  z-index: 150;
}

.confirm-modal-root {
  position: fixed;
  inset: 0;
  z-index: 160;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 24, 16, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  transition: opacity 0.14s ease;
}

.modal-root.is-closing,
.modal-root.is-closing *,
.exit-modal-root.is-closing,
.exit-modal-root.is-closing *,
.confirm-modal-root.is-closing,
.confirm-modal-root.is-closing *,
.modal-root[inert],
.modal-root[inert] *,
.exit-modal-root[inert],
.exit-modal-root[inert] * {
  pointer-events: none !important;
}

.modal-root.is-closing .modal-backdrop,
.exit-modal-root.is-closing .modal-backdrop,
.confirm-modal-root.is-closing .modal-backdrop {
  background: transparent !important;
  opacity: 0;
}

.modal-card {
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--ink);
}

.modal-card .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #B77437 rgba(222, 180, 105, 0.35);
}

.modal-body::-webkit-scrollbar {
  width: 9px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(222, 180, 105, 0.28);
  border-radius: 999px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #B77437;
  border-radius: 999px;
  border: 2px solid rgba(255, 248, 232, 0.85);
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #8D521E;
}

.workshop-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.workshop-grid-4 > * {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1040px) {
  .workshop-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.shop-card {
  padding: 6px 8px !important;
  gap: 3px !important;
}

.shop-card > div:has(.shop-art) {
  height: 44px !important;
  padding: 2px !important;
}

.shop-art-wrap {
  position: relative;
  overflow: hidden;
  background: linear-gradient(110deg, rgba(222, 180, 105, 0.22) 25%, rgba(255, 246, 218, 0.55) 50%, rgba(222, 180, 105, 0.22) 75%);
  background-size: 200% 100%;
  animation: shopArtShimmer 1.25s linear infinite;
}

.shop-art-wrap.is-loaded {
  animation: none;
  background: rgba(222, 180, 105, 0.16);
}

.shop-art {
  max-height: 40px !important;
  opacity: 0;
  transition: opacity 0.16s ease-out;
}

.shop-art.is-ready {
  opacity: 1;
}

@keyframes shopArtShimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -20% 0; }
}

.shop-card .btn-primary-9slice,
.shop-card .btn-secondary-9slice {
  border-width: 7px 11px 8px 11px;
  padding: 1px 7px !important;
}

.modal-card--compact {
  max-width: 480px;
  width: 92vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(183, 116, 55, 0.32);
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.6vw, 23px);
  font-weight: 800;
  color: var(--ink-deep);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--cocoa);
  background: var(--cream-gold);
  color: var(--ink-deep);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 4px 2px;
  overflow-y: auto;
}

.modal-footer {
  padding-top: 8px;
  border-top: 2px solid rgba(183, 116, 55, 0.25);
}

.modal-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.modal-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid rgba(183, 116, 55, 0.45);
  background: var(--parchment-warm);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.modal-tab.active {
  background: var(--gold);
  border-color: var(--cocoa);
  color: var(--ink-deep);
}

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

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

.modal-grid-2 > *,
.modal-grid-3 > *,
.lang-grid > * {
  min-width: 0;
  max-width: 100%;
}

/* Victory Banner & Toast Root */
.victory-banner-host {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 118;
  pointer-events: none;
}

.victory-banner-card {
  pointer-events: auto;
  min-width: 320px;
  max-width: 480px;
  text-align: center;
  padding: 8px 18px;
}

.toast-root {
  position: fixed;
  bottom: 126px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 180;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.toast-pill {
  background: #3A241A;
  color: #FFF9EE;
  border: 2px solid #DEB469;
  border-radius: 999px;
  padding: 7px 16px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(42, 24, 16, 0.35);
  animation: fvToastIn 0.22s ease-out;
}

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

/* Optional Accessibility Retro CRT Scanlines */
.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(42, 24, 16, 0.06) 0px,
    rgba(42, 24, 16, 0.06) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Preview-Only `[DEV F2]` Panel */
.dev-f2-pill {
  position: fixed;
  bottom: 6px;
  right: 8px;
  z-index: 195;
  background: #3A241A;
  color: #EDDA90;
  border: 1.5px solid #DEB469;
  border-radius: 8px;
  padding: 3px 8px;
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
}

.dev-debug-panel {
  position: fixed;
  bottom: 34px;
  right: 8px;
  z-index: 195;
  width: 280px;
  background: #FFF9EE;
  border: 2.5px solid #3A241A;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(42, 24, 16, 0.38);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dev-debug-panel button {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1.5px solid #6B3F21;
  background: #FBF0D9;
  color: #2A1810;
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
}

/* =========================================================================
 * RESPONSIVE STACK FALLBACK (< 900px)
 * ========================================================================= */
@media (max-width: 900px) {
  .top-command-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 8px;
  }

  .main-split-stage {
    flex-direction: column;
    overflow-y: auto;
  }

  .dig-zone,
  .museum-zone {
    flex: 1 1 50%;
    min-height: 250px;
  }

  .bottom-dock {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 8px;
  }

  .dock-tools-list,
  .dock-quick-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 100%;
  }

  .dock-workshop-cta {
    width: 100%;
  }

  .workshop-main-btn {
    width: 100%;
    height: 42px;
  }

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

/* Energy Empty / Pit Cleared inline guidance bar (docked inside #dig-zone, zero grid blocking) */
.energy-guide-banner {
  position: relative;
  width: 100%;
  z-index: 11;
  flex: 0 0 auto;
  padding: 2px 4px 0;
}

.energy-guide-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 248, 224, 0.96), rgba(249, 232, 188, 0.96));
  border: 2px solid #D48A18;
  box-shadow: 0 4px 12px rgba(48, 26, 14, 0.18);
}

.energy-guide-msg {
  font-size: 11.5px;
  font-weight: 800;
  color: #3A241A;
  flex: 1 1 220px;
  line-height: 1.25;
}

.energy-guide-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.energy-guide-btn-primary {
  background: linear-gradient(180deg, #FFE082, #E6A13C) !important;
  border-color: #8D521E !important;
  color: #2A1810 !important;
}

/* QA fvd: keep background workspace & non-blocking banners inert while any modal / exit / confirm dialog is actively open
   so background HUD buttons & tips never intercept focus/hit-tests or bleed through behind a modal backdrop. */
body.has-open-modal #app-workspace,
body.has-open-modal #app-workspace *,
body.has-open-modal #app-workspace button,
#app-workspace[inert],
#app-workspace[inert] *,
#app-workspace[inert] button,
body.has-open-modal #title-screen,
body.has-open-modal #title-screen *,
#title-screen[inert],
#title-screen[inert] *,
body:has(#modal-root:not(.hidden):not(.is-closing)) #app-workspace,
body:has(#modal-root:not(.hidden):not(.is-closing)) #app-workspace *,
body:has(#exit-modal-root:not(.hidden):not(.is-closing)) #app-workspace,
body:has(#exit-modal-root:not(.hidden):not(.is-closing)) #app-workspace *,
body:has(#confirm-modal-root:not(.hidden):not(.is-closing)) #app-workspace,
body:has(#confirm-modal-root:not(.hidden):not(.is-closing)) #app-workspace * {
  pointer-events: none !important;
}

body:has(#modal-root:not(.hidden):not(.is-closing)) #tutorial-banner,
body:has(#exit-modal-root:not(.hidden):not(.is-closing)) #tutorial-banner,
body:has(#confirm-modal-root:not(.hidden):not(.is-closing)) #tutorial-banner,
body:has(#modal-root:not(.hidden):not(.is-closing)) #energy-guide-banner,
body:has(#exit-modal-root:not(.hidden):not(.is-closing)) #energy-guide-banner,
body:has(#confirm-modal-root:not(.hidden):not(.is-closing)) #energy-guide-banner {
  visibility: hidden !important;
  pointer-events: none !important;
}
