/* ==========================================================================
   Sunline Railworks: Idle Tycoon — Play Store Glossy Casual Stylesheet
   Visual Archetype: `playstore_glossy_casual` (Sunlit Parchment, Brass, Meadow & Terracotta)
   100% Offline Typography · Exact 9-Slice `border-image` · WCAG AA High-Contrast
   ========================================================================== */

:root {
  /* Extracted Concept & Binary Palette */
  --sun-terracotta: #DB9A68;
  --sun-gold: #EEC081;
  --sun-sand-gold: #E6B582;
  --sun-cocoa: #6C4938;
  --sun-cream: #EEF1E3;
  --sun-parchment: #FBF0D7;
  --sun-parchment-hi: #FFF9EB;
  --sun-card-border: #AD8A70;
  --sun-ballast: #9D8963;
  --sun-meadow: #9FB18F;
  --sun-auto-green: #7EA87A;
  --sun-pine-sage: #6D8575;
  --sun-iron-slate: #515353;
  --sun-limestone: #BFAF96;
  --sun-burgundy: #975965;

  /* High-Contrast Ink & Action Tokens */
  --ink-dark: #2B1A12;
  --ink-muted: #5A3B29;
  --cta-green-top: #2ECA50;
  --cta-green-bot: #1A8232;
  --cta-green-lip: #105720;
  --cta-amber-top: #FFD25A;
  --cta-amber-bot: #E6951C;
  --cta-amber-lip: #8F5206;
  --cta-terra-top: #D96448;
  --cta-terra-bot: #A63D24;
  --cta-terra-lip: #692110;

  --font-display: 'Lilita One', 'Fredoka', 'Arial Rounded MT Bold', 'Segoe UI Rounded', 'Trebuchet MS', sans-serif;
  --font-body: 'Nunito', 'Fredoka', 'Segoe UI', system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #F3DFBA;
  color: var(--ink-dark);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Mandatory Button Anti-Clip & Truncation Safety */
button {
  font-family: var(--font-body);
  cursor: pointer;
  overflow: visible !important;
  position: relative;
  touch-action: manipulation;
  transition: transform 0.1s ease, filter 0.12s ease;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  filter: grayscale(0.28);
}

.btn-label {
  display: inline-block;
  max-width: 100%;
  min-width: 0;
  padding: 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.is-hidden {
  display: none !important;
}

.icon-18 { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }
.icon-20 { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }
.icon-22 { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }
.icon-24 { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }

/* ==========================================================================
   STRICT 9-SLICE `border-image` CHROME (from `data/art_manifest.json`)
   ZERO `background-size: 100% 100%`, ZERO rectangular box-shadow behind corners!
   ========================================================================== */
.btn-primary-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 24px 28px 20px 28px;
  border-image: url('../assets/ui/btn_primary.png') 202 187 155 188 fill / 24px 28px 20px 28px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  color: #102B16;
  font-family: var(--font-display);
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
  filter: drop-shadow(0 5px 10px rgba(28, 18, 10, 0.35));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary-9slice:hover:not(:disabled) {
  filter: brightness(1.05) drop-shadow(0 6px 12px rgba(28, 18, 10, 0.4));
}

.panel-frame-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 18.5px 20px 19.75px 20px;
  border-image: url('../assets/ui/frame_panel.png') 74 80 79 80 fill / 18.5px 20px 19.75px 20px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink-dark);
  filter: drop-shadow(0 18px 36px rgba(32, 18, 8, 0.42));
}

/* ==========================================================================
   SCULPTED 3D GLOSSY CASUAL BUTTONS (WCAG AA Verified)
   ========================================================================== */
.btn-parchment {
  background-color: #F8EAD0;
  background-image: linear-gradient(180deg, #FFFDF7 0%, #F2DEC0 100%);
  border: 2.5px solid #8A6141;
  border-radius: 13px;
  color: var(--ink-dark);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3px 0 #8A6141;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
}

.btn-parchment:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #FFFFFF 0%, #F9E9CE 100%);
}

.btn-glossy-green {
  background-color: #1D8235;
  background-image: linear-gradient(180deg, var(--cta-green-top) 0%, var(--cta-green-bot) 100%);
  border: 2.5px solid var(--cta-green-lip);
  border-radius: 13px;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  text-shadow: 0 1.5px 0 #0D4519;
  box-shadow: 0 3.5px 0 var(--cta-green-lip);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
}

.btn-glossy-amber {
  background-color: #EAA024;
  background-image: linear-gradient(180deg, var(--cta-amber-top) 0%, var(--cta-amber-bot) 100%);
  border: 2.5px solid var(--cta-amber-lip);
  border-radius: 13px;
  color: var(--ink-dark);
  font-weight: 800;
  font-size: 13px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow: 0 3.5px 0 var(--cta-amber-lip);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
}

.btn-glossy-terracotta {
  background-color: #A63D24;
  background-image: linear-gradient(180deg, var(--cta-terra-top) 0%, var(--cta-terra-bot) 100%);
  border: 2.5px solid var(--cta-terra-lip);
  border-radius: 13px;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3.5px 0 var(--cta-terra-lip);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
}

/* Universal Red-Dot Notification Badge (NEVER clipped) */
.notify-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background-color: #D93025;
  border: 2px solid #FFFDF8;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  line-height: 15px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 8;
}

/* ==========================================================================
   TITLE SCREEN (`#title-screen`)
   ========================================================================== */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.title-bg-layer {
  position: absolute;
  inset: 0;
  background: #87C5EC url('../assets/art/title_bg.jpg') center center / cover no-repeat;
  z-index: -2;
}

.title-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 46%, rgba(255, 248, 228, 0.08) 0%, rgba(36, 20, 10, 0.38) 100%);
  z-index: -1;
}

.title-top-bar {
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.edition-pill,
.zero-ads-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 20px 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFFDF5 0%, #F7E4BD 100%);
  border: 2.5px solid #4A2B18;
  color: var(--ink-dark);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(24, 12, 5, 0.36);
}

.zero-ads-pill > span {
  padding-right: 2px;
}

.title-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-pill-sm {
  min-height: 38px;
  padding: 6px 15px;
}

.btn-title-lang {
  background-color: #3D2417;
  background-image: linear-gradient(180deg, #563623 0%, #341E12 100%);
  border: 2.5px solid #FFE3A3;
  border-radius: 13px;
  color: #FFFDF7;
  font-weight: 900;
  font-size: 13.5px;
  letter-spacing: 0.4px;
  text-shadow: 0 1.5px 0 #180C06;
  box-shadow: 0 3.5px 0 #1E1008, 0 5px 14px rgba(18, 10, 5, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-title-lang:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #68422C 0%, #432718 100%);
}

.btn-title-exit {
  background-color: #9A2F1B;
  background-image: linear-gradient(180deg, #D9553B 0%, #9A2F1B 100%);
  border: 2.5px solid #FFE3A3;
  border-radius: 13px;
  color: #FFFDF7;
  font-weight: 900;
  font-size: 13.5px;
  text-shadow: 0 1.5px 0 #4D1308;
  box-shadow: 0 3.5px 0 #5C170A, 0 5px 14px rgba(18, 10, 5, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-title-exit:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #E86449 0%, #AD3620 100%);
}

.title-center-card {
  width: min(560px, 92vw);
}

.title-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 18px 16px;
  background-color: rgba(251, 240, 215, 0.65);
  border-radius: 12px;
}

.title-mascot-stage {
  position: relative;
  width: 118px;
  height: 118px;
  margin-top: -54px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%, #FFFDF4 0%, #FCE1A4 62%, #E5A746 100%);
  border: 4px solid #7A4B21;
  box-shadow: 0 8px 20px rgba(43, 26, 18, 0.38), inset 0 0 0 2.5px #FFF6D6;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden !important;
}

.title-mascot {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 15%;
  margin-top: 0;
  margin-bottom: 0;
  -webkit-mask-image: radial-gradient(circle at 50% 48%, #000 72%, rgba(0, 0, 0, 0) 99%);
  mask-image: radial-gradient(circle at 50% 48%, #000 72%, rgba(0, 0, 0, 0) 99%);
}

#ui-vfx-overlay.tb-vfx-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 320;
}

.tb-slot-vfx-host {
  overflow: visible !important;
}

.title-logo-heading {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.12;
  color: #3B1E10;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
}

.title-subtitle {
  margin: 0 0 18px;
  font-size: clamp(14px, 1.3vw, 16.5px);
  font-weight: 800;
  color: var(--ink-muted);
}

.title-loading-box {
  width: 100%;
  max-width: 380px;
  margin-bottom: 8px;
}

.title-loading-track {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4B2E1E 0%, #6A442D 100%);
  border: 2.5px solid #3B2012;
  box-shadow: inset 0 2px 5px rgba(15, 7, 3, 0.65), 0 2px 0 rgba(255, 250, 232, 0.72), 0 0 16px rgba(74, 224, 102, 0.35);
  overflow: hidden;
  padding: 2.5px;
}

.title-loading-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #9CFF6B 0%, #37D658 46%, #1B9136 100%);
  box-shadow: 0 0 14px rgba(84, 240, 108, 0.85), inset 0 2px 1px rgba(255, 255, 255, 0.72), inset 0 -2px 2px rgba(10, 62, 22, 0.55);
  transition: width 0.18s ease;
  overflow: hidden;
}

.title-loading-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.55) 48%, rgba(255, 255, 255, 0) 76%);
  background-size: 200% 100%;
  animation: sunlineLoadSheen 1.6s linear infinite;
}

@keyframes sunlineLoadSheen {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

.title-loading-label {
  margin-top: 7px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-dark);
}

.title-play-btn {
  min-width: 220px;
  min-height: 68px;
  font-size: clamp(18px, 1.8vw, 24px);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* ==========================================================================
   16:9 DESKTOP 3-ZONE COMMAND SHELL (`#game-shell`)
   Top Command Bar 56px | 3D Viewport + 340px Inspector | Bottom Dock 112px
   ========================================================================== */
.game-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 112px;
  background-color: #EAD6B3;
}

/* 1. Top Command Bar */
.top-command-bar {
  height: 56px;
  padding: 0 12px;
  background: linear-gradient(180deg, #FFF7E4 0%, #F1DFBE 100%);
  border-bottom: 3px solid var(--sun-cocoa);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 30;
}

.hud-currencies {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-shrink: 1;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 3px 11px 3px 8px;
  border-radius: 13px;
  background-color: #FFFDF7;
  border: 2px solid var(--sun-card-border);
  box-shadow: inset 0 -2px 0 #EEDAB8;
  min-width: 0;
  transition: transform 0.14s ease;
}

.hud-pill.hud-pulse {
  transform: scale(1.1);
}

.hud-pill-stack {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}

.hud-val {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14.5px;
  color: var(--ink-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hud-sub {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.hud-action-btn {
  height: 38px;
  padding: 0 10px;
  max-width: 132px;
}

.hud-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  flex-shrink: 0;
}

/* 2. Middle Workspace */
.middle-workspace {
  display: grid;
  grid-template-columns: calc(100% - 340px) 340px;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.viewport-3d-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #7AC6F0 0%, #F5E1BB 100%);
}

#rail-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#vfx-canvas,
#cutin-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
}

#cutin-canvas {
  z-index: 18;
}

.floating-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 8;
}

/* World-Projected Station Radial Cycle Rings */
.station-world-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 2.5px solid var(--sun-cocoa);
  background-color: rgba(255, 250, 238, 0.94);
  color: var(--ink-dark);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(43, 26, 18, 0.28);
}

.station-world-ring.is-selected {
  box-shadow: 0 0 0 3px #FFFFFF, 0 5px 14px rgba(43, 26, 18, 0.4);
}

.station-world-ring .ring-svg {
  position: absolute;
  inset: 1px;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.station-world-ring .ring-track {
  fill: none;
  stroke: #E5D4B7;
  stroke-width: 4.2;
}

.station-world-ring .ring-fill {
  fill: none;
  stroke: var(--sun-sand-gold);
  stroke-width: 4.5;
  stroke-linecap: round;
}

.station-world-ring.mode-auto .ring-fill {
  stroke: #22A847;
}

.station-world-ring.mode-locked {
  background-color: rgba(238, 226, 204, 0.92);
  border-style: dashed;
}

.station-world-ring .ring-tag {
  position: relative;
  z-index: 2;
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink-dark);
  white-space: nowrap;
}

.blimp-world-pill {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: #FFD25A;
  border: 2.5px solid #7A4306;
  color: var(--ink-dark);
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 5px 12px rgba(43, 26, 18, 0.35);
}

/* Special Express Precision-Stop HUD */
.special-train-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 90%);
  background: linear-gradient(180deg, #FFF9EB 0%, #F5E1BC 100%);
  border: 3px solid var(--sun-cocoa);
  border-radius: 18px;
  padding: 10px 14px 12px;
  box-shadow: 0 12px 28px rgba(43, 26, 18, 0.38);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.special-hud-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.special-portrait {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid #B8743B;
  background-color: #FFE7B3;
  object-fit: cover;
  flex-shrink: 0;
}

.special-titles {
  flex: 1;
  min-width: 0;
}

.special-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.special-sub {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.special-gauge-track {
  position: relative;
  width: 100%;
  height: 22px;
  border-radius: 999px;
  background-color: #515353;
  border: 2.5px solid var(--ink-dark);
  overflow: hidden;
}

.special-zone {
  position: absolute;
  top: 0;
  bottom: 0;
}

.special-zone.zone-bronze {
  left: 16%;
  width: 68%;
  background-color: #D98A4E;
}

.special-zone.zone-silver {
  left: 31%;
  width: 38%;
  background-color: #DCE4EC;
}

.special-zone.zone-bullseye {
  left: 43%;
  width: 14%;
  background-color: #FFD43B;
  box-shadow: 0 0 10px rgba(255, 212, 59, 0.9);
}

.special-gauge-needle {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 6px;
  margin-left: -3px;
  background-color: #FFFFFF;
  border: 2px solid #14121F;
  border-radius: 4px;
}

.special-brake-btn {
  width: 100%;
  min-height: 40px;
  font-size: 14px;
}

.blimp-toast-layer {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 16;
  max-width: min(360px, 85%);
}

.rail-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 13px;
  background-color: #FFF9EC;
  border: 2.5px solid var(--sun-cocoa);
  color: var(--ink-dark);
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(43, 26, 18, 0.28);
}

/* ==========================================================================
   DOCKED RIGHT INSPECTOR (`340px`)
   ========================================================================== */
.right-inspector {
  width: 340px;
  height: 100%;
  background: linear-gradient(180deg, #FBF0D7 0%, #F2DFBE 100%);
  border-left: 3px solid var(--sun-cocoa);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 20;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 8px 8px 6px;
  background-color: #ECD4AD;
  border-bottom: 2px solid #C69D6B;
  flex-shrink: 0;
}

.inspector-tabs > * {
  min-width: 0;
  max-width: 100%;
}

.tab-btn {
  height: 36px;
  padding: 0 4px;
  border-radius: 10px;
  border: 2px solid #9B734E;
  background-color: #F9ECD2;
  color: var(--ink-muted);
  font-weight: 800;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.tab-btn .icon-18 {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.tab-btn.is-active {
  background-color: #21853A;
  background-image: linear-gradient(180deg, #2ECA50 0%, #1B8032 100%);
  border-color: #105720;
  color: #FFFFFF;
  text-shadow: 0 1px 0 #0D4519;
}

.inspector-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background-color: #F6E6C6;
  border-bottom: 2px solid #DFC398;
  flex-shrink: 0;
}

.bulk-group {
  display: inline-flex;
  gap: 5px;
}

.bulk-btn {
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 2px solid #9B734E;
  background-color: #FFFDF7;
  color: var(--ink-dark);
  font-weight: 800;
  font-size: 11.5px;
}

.bulk-btn.is-active {
  background-color: #EAA024;
  border-color: #7D4605;
  color: var(--ink-dark);
}

.help-chip-btn {
  min-width: 36px;
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  font-weight: 900;
  font-size: 14px;
}

.inspector-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-body::-webkit-scrollbar { width: 7px; }
.inspector-body::-webkit-scrollbar-thumb { background: #C29666; border-radius: 99px; }

/* Inspector Cards (Stations, Dispatchers, Contracts) */
.insp-card {
  background-color: #FFFDF7;
  background-image: linear-gradient(180deg, #FFFFFF 0%, #FBF0D7 100%);
  border: 2.5px solid var(--sun-card-border);
  border-radius: 14px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 3px 7px rgba(43, 26, 18, 0.08);
  min-width: 0;
}

.insp-card.is-selected {
  border-color: #1F9D3E;
  box-shadow: 0 0 0 2px rgba(31, 157, 62, 0.25);
}

.insp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.insp-card-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.status-chip {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 900;
  flex-shrink: 0;
  white-space: nowrap;
}

.status-chip.chip-auto {
  background-color: #DCF5E2;
  border: 1.5px solid #238A3D;
  color: #125623;
}

.status-chip.chip-manual {
  background-color: #FDEBC8;
  border: 1.5px solid #B57219;
  color: #593305;
}

.status-chip.chip-locked {
  background-color: #EAE1D2;
  border: 1.5px solid #8F7C68;
  color: #4A3B2D;
}

.insp-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-muted);
}

.insp-prog-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background-color: #E7D5B7;
  overflow: hidden;
}

.insp-prog-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #E69A28 0%, #F5C242 100%);
}

.insp-prog-fill.is-auto {
  background: linear-gradient(90deg, #25A847 0%, #65DC78 100%);
}

.insp-btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.insp-btn-row > * {
  min-width: 0;
  max-width: 100%;
}

.insp-btn-sm {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 11.5px;
  width: 100%;
}

.disp-row-top {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.disp-portrait {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  border: 2px solid #B68250;
  background-color: #FFEAC2;
  object-fit: cover;
  object-position: 50% 12%;
  flex-shrink: 0;
}

.loco-assign-select {
  width: 100%;
  height: 28px;
  border-radius: 8px;
  border: 1.5px solid #AD8A70;
  background-color: #FFF9ED;
  color: var(--ink-dark);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 800;
  padding: 0 6px;
}

/* ==========================================================================
   3. BOTTOM FLEET & OFFLINE DOCK (`112px`)
   ========================================================================== */
.bottom-dock {
  height: 112px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #F6E5C5 0%, #E7CEAA 100%);
  border-top: 3px solid var(--sun-cocoa);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  z-index: 25;
}

.fleet-cards-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.fleet-cards-row > * {
  min-width: 0;
  max-width: 100%;
}

.fleet-card {
  background-color: #FFFDF7;
  border: 2px solid var(--sun-card-border);
  border-radius: 12px;
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  height: 96px;
}

.fleet-card.is-locked-biome {
  background-color: #EFE3CE;
}

.fleet-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.fleet-name {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--ink-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.fleet-badge {
  font-size: 10px;
  font-weight: 900;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.fleet-stats-mini {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-muted);
}

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

.fleet-upg-grid > * {
  min-width: 0;
  max-width: 100%;
}

.fleet-stat-btn {
  height: 30px;
  padding: 2px 3px;
  border-radius: 7px;
  border: 1.5px solid #8A6141;
  background-color: #FBF0D7;
  color: var(--ink-dark);
  font-size: 9.5px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.fleet-stat-btn.can-afford {
  background-color: #DCF5E2;
  border-color: #1E8236;
  color: #103D1A;
}

.dock-right-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 96px;
  flex-shrink: 0;
}

/* Express Overdrive Wide Action Bar (Pure CSS sculpted per Spec 03 Rule #2) */
.overdrive-box {
  width: 158px;
  height: 96px;
  display: flex;
}

.overdrive-btn {
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  border-radius: 14px;
  border: 3px solid var(--sun-cocoa);
  background-color: #4A3222;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 0 var(--sun-cocoa);
}

.overdrive-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 11px;
  background: linear-gradient(90deg, #E88915 0%, #DF4B1F 100%);
  transition: width 0.16s linear;
  pointer-events: none;
  z-index: 1;
}

.overdrive-btn.is-ready {
  border-color: #105720;
  background-color: #1B8032;
}

.overdrive-btn.is-active {
  border-color: #8F5206;
  background-color: #C7670A;
}

.overdrive-content {
  position: relative;
  z-index: 2;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 1.5px 0 #1E1109;
}

.overdrive-content > img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  position: static !important;
}

.overdrive-content > .btn-label {
  display: block;
  width: 100%;
}

/* Modal Header Subtitle Wrapping (Zero mid-word truncation) */
.rm-subtitle,
.rm-modal-sub,
.rail-exit-sub,
.exit-card-desc {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.28 !important;
}

.dock-meta-btn {
  width: 108px;
  height: 96px;
  flex-direction: column;
  gap: 5px;
  padding: 6px 6px;
  text-align: center;
}

/* ==========================================================================
   TUTORIAL COACH OVERLAY (`#tutorial-root`)
   ========================================================================== */
#tutorial-root.is-modal-suppressed {
  display: none !important;
}

.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0 16px 122px;
}

.tut-card {
  pointer-events: auto;
  width: min(392px, 44vw);
  min-width: 280px;
  background: linear-gradient(180deg, #FFFDF7 0%, #F7E5C0 100%);
  border: 3px solid var(--sun-cocoa);
  border-radius: 18px;
  padding: 13px 15px 14px;
  box-shadow: 0 14px 32px rgba(28, 16, 8, 0.40);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink-dark);
  overflow: visible;
}

.tut-portrait-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid #7A4B21;
  background: radial-gradient(circle at 50% 36%, #FFFDF4 0%, #FCE1A4 65%, #E5A746 100%);
  box-shadow: 0 4px 12px rgba(43, 26, 18, 0.28), inset 0 0 0 2px #FFF6D6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  margin-top: 2px;
}

.tut-portrait {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 16%;
  flex-shrink: 0;
  -webkit-mask-image: radial-gradient(circle at 50% 48%, #000 72%, rgba(0, 0, 0, 0) 99%);
  mask-image: radial-gradient(circle at 50% 48%, #000 72%, rgba(0, 0, 0, 0) 99%);
}

.tut-body {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.tut-step-kicker {
  font-size: 11px;
  font-weight: 900;
  color: #7A4310;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.tut-title {
  margin: 3px 0 6px;
  font-family: var(--font-display);
  font-size: 16.5px;
  line-height: 1.2;
  color: var(--ink-dark);
}

.tut-text {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.44;
  color: #3D2618;
  overflow: visible;
}

.tut-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.tut-actions button:active:not(:disabled) {
  transform: none;
}

.btn-tut-secondary {
  background-color: #42281A;
  background-image: linear-gradient(180deg, #5C3A26 0%, #3A2215 100%);
  border: 2.5px solid #24130B;
  border-radius: 13px;
  color: #FFFDF7;
  font-weight: 800;
  font-size: 13px;
  text-shadow: 0 1.5px 0 #1A0D07;
  box-shadow: 0 3.5px 0 #24130B;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 16px;
}

.btn-tut-secondary:hover:not(:disabled) {
  background-image: linear-gradient(180deg, #6E462E 0%, #4A2C1B 100%);
}

.btn-tut-primary {
  min-height: 36px;
  padding: 6px 18px;
  font-size: 13.5px;
}

.tut-highlight-ring {
  outline: none !important;
}

/* ==========================================================================
   PREVIEW-ONLY `[DEV F2]` PILL & PANEL (`#debug-root`)
   ========================================================================== */
#btn-dev-f2 {
  position: fixed;
  bottom: 120px;
  left: 10px;
  z-index: 300;
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1.5px solid #6C4938;
  background-color: rgba(43, 26, 18, 0.86);
  color: #FFE5A3;
  font-size: 11px;
  font-weight: 800;
}

#debug-panel {
  position: fixed;
  bottom: 152px;
  left: 10px;
  z-index: 301;
  width: 270px;
  background-color: #FFF8E7;
  border: 3px solid var(--sun-cocoa);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
}

.dbg-btn {
  min-height: 29px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1.5px solid #8A6141;
  background-color: #FBF0D7;
  color: var(--ink-dark);
  font-size: 11.5px;
  font-weight: 800;
  text-align: left;
}

/* ==========================================================================
   SEASONS 2–4 DIORAMA RIBBONS, HEATMAP, PHOTO MODE & FLEET PAGER (`v2.1-v5.0`)
   ========================================================================== */
.diorama-ribbon {
  position: absolute;
  top: 10px;
  z-index: 11;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.diorama-ribbon-left {
  left: 12px;
  max-width: calc(50% - 14px);
}

.diorama-ribbon-right {
  right: 12px;
  justify-content: flex-end;
}

.region-pill-group,
.scenic-pill-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 12px;
  background-color: rgba(255, 249, 235, 0.92);
  border: 2px solid var(--sun-cocoa);
  box-shadow: 0 4px 10px rgba(43, 26, 18, 0.24);
}

.diorama-chip {
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1.5px solid #9B734E;
  background-color: #FFFDF7;
  color: var(--ink-dark);
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.diorama-chip.is-active {
  background: linear-gradient(180deg, #2ECA50 0%, #1B8032 100%);
  border-color: #105720;
  color: #FFFFFF;
  text-shadow: 0 1px 0 #0D4519;
}

.diorama-chip.is-locked-reg {
  background-color: #EAE0CF;
  color: #6B5744;
  border-style: dashed;
}

.diorama-hub-btn {
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  box-shadow: 0 4px 10px rgba(43, 26, 18, 0.28);
}

.active-mode-banner {
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF5D1 0%, #FFD463 100%);
  border: 2px solid #7A4306;
  color: var(--ink-dark);
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 5px 12px rgba(43, 26, 18, 0.3);
  pointer-events: none;
}

.photo-exit-pill {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 260;
  height: 40px;
  padding: 0 16px;
  font-size: 13px;
}

.game-shell.is-photo-mode {
  grid-template-rows: 0px minmax(0, 1fr) 0px;
}
.game-shell.is-photo-mode #top-command-bar,
.game-shell.is-photo-mode #right-inspector,
.game-shell.is-photo-mode #bottom-dock,
.game-shell.is-photo-mode #diorama-top-ribbon,
.game-shell.is-photo-mode #diorama-hub-ribbon,
.game-shell.is-photo-mode #active-mode-banner {
  display: none !important;
}
.game-shell.is-photo-mode .middle-workspace {
  grid-template-columns: 100% 0px;
}

.station-world-ring.heat-high {
  border-color: #15803D;
  background-color: rgba(220, 252, 231, 0.96);
}
.station-world-ring.heat-mid {
  border-color: #B45309;
  background-color: rgba(254, 243, 199, 0.96);
}
.station-world-ring.heat-bottleneck {
  border-color: #B91C1C;
  background-color: rgba(254, 226, 226, 0.96);
}

.toolbar-right-btns {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.smart-upg-chip {
  height: 30px;
  padding: 0 9px;
  border-radius: 9px;
  font-size: 11px;
}

.roi-pill {
  padding: 1px 6px;
  border-radius: 999px;
  background-color: #FEF08A;
  border: 1.5px solid #A16207;
  color: #422006;
  font-size: 9.5px;
  font-weight: 900;
  flex-shrink: 0;
}

.fleet-dock-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.fleet-page-btn {
  width: 44px;
  height: 96px;
  padding: 4px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE COMPACT DESKTOP (`<= 1360px` & `< 960px` Split-Screen)
   ========================================================================== */
@media (max-width: 1360px) {
  .hud-biome-pill {
    display: none;
  }
  .overdrive-box {
    width: 132px;
  }
  .dock-meta-btn {
    width: 92px;
  }
}

@media (max-width: 960px) {
  .game-shell {
    grid-template-rows: 52px minmax(0, 1fr) 104px;
  }
  .middle-workspace {
    grid-template-columns: calc(100% - 280px) 280px;
  }
  .right-inspector {
    width: 280px;
  }
  .hud-action-btn .btn-label {
    max-width: 68px;
  }
  .fleet-stats-mini {
    display: none;
  }
}
