/* SunnyAisle Market Tycoon — Hyper-Casual Bright Toy 3D Commercial Stylesheet
 * 16:9 3-Column Command Layout · CSS 9-Slice Anti-Distortion · Zero Overflow (en/de/ru safe)
 */
:root {
  --cream-bg: #FCFAEB;
  --cream-card: #FFFDF7;
  --teal-main: #2BB3A3;
  --teal-soft: #6FADA7;
  --mint-fresh: #9FD3BD;
  --coral-pop: #C86051;
  --stone-mid: #B7AB9D;
  --slate-muted: #57534E;
  --ink-navy: #1C2B4A;
  --gold-cta: #FDBD17;
  --green-cta: #10B981;
  --green-dark: #059669;
  --sky-accent: #38BDF8;

  --font-display: 'Titan One', 'Fredoka', 'Arial Rounded MT Bold', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Fredoka', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

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

img {
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  position: relative;
  overflow: visible !important;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.18;
  transition: transform 0.1s ease, filter 0.12s ease;
}

button:active:not(:disabled) {
  transform: translateY(2px);
}

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

/* ---------- Strict 9-Slice Primary Sprite CTA (data/art_manifest.json) ---------- */
.btn-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 18px 26px 22px 26px;
  border-image: url('../assets/ui/btn_primary.png') 143 186 178 184 fill / 18px 26px 22px 26px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  color: #14121F;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.03em;
  filter: drop-shadow(0 5px 0 rgba(28, 43, 74, 0.36));
  padding: 2px 18px;
}

.btn-9slice:hover:not(:disabled) {
  filter: brightness(1.05) drop-shadow(0 6px 0 rgba(28, 43, 74, 0.42));
  transform: translateY(-1px);
}

/* ---------- Sculpted Toy 3D Glossy Buttons (for dynamic-width bars) ---------- */
.btn-toy {
  border: 2.5px solid var(--ink-navy);
  border-radius: 12px;
  background: linear-gradient(180deg, #34D399 0%, #10B981 100%);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 12.5px;
  padding: 7px 10px;
  box-shadow: 0 3px 0 var(--ink-navy);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.btn-toy:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-toy.gold {
  background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
  color: var(--ink-navy);
  text-shadow: none;
}

.btn-toy.coral {
  background: linear-gradient(180deg, #FB923C 0%, #EA580C 100%);
  color: #FFFFFF;
}

.btn-toy.sky {
  background: linear-gradient(180deg, #60A5FA 0%, #2563EB 100%);
  color: #FFFFFF;
}

.btn-toy.cream {
  background: #FFFFFF;
  color: var(--ink-navy);
  text-shadow: none;
}

/* ---------- Red-Dot Notification Badge (spec/07 unclipped rule) ---------- */
.notify-badge {
  position: absolute;
  top: -6px;
  right: -2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #EF4444;
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  font-size: 9.5px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 35;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.55);
}

.notify-badge.show {
  display: inline-flex;
}

/* ---------- Title Screen (0-100% Real Preload Gate) ---------- */
#title-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: url('../assets/art/title_bg.jpg') center center / cover no-repeat, linear-gradient(160deg, #6FADA7, #FCFAEB);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

#title-screen.hidden {
  display: none !important;
}

.title-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 45%, rgba(28, 43, 74, 0.16) 0%, rgba(28, 43, 74, 0.54) 100%);
}

.title-card {
  position: relative;
  z-index: 2;
  width: min(620px, 92vw);
  background: rgba(252, 250, 235, 0.94);
  border: 4px solid var(--ink-navy);
  border-radius: 28px;
  padding: 28px 32px 26px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(28, 43, 74, 0.35), 0 6px 0 var(--ink-navy);
}

.title-mascot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.title-mascot-img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(28, 43, 74, 0.25));
}

.game-logo-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 900;
  line-height: 1.08;
  color: #FFFFFF;
  -webkit-text-stroke: 2px var(--ink-navy);
  text-shadow: 0 4px 0 var(--ink-navy), 0 8px 18px rgba(28, 43, 74, 0.28);
}

.game-logo-sub {
  margin: 8px 0 18px;
  font-size: 15px;
  font-weight: 800;
  color: #0F766E;
}

.loading-wrap {
  margin: 12px auto 18px;
  width: min(440px, 100%);
}

.loading-track {
  width: 100%;
  height: 20px;
  background: #E2E8F0;
  border: 2.5px solid var(--ink-navy);
  border-radius: 999px;
  padding: 2px;
}

.loading-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2BB3A3, #34D399, #FDBD17);
  transition: width 0.16s ease;
}

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

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

#btn-title-play {
  min-width: 210px;
}

/* ---------- Main 16:9 3-Column Command HUD ---------- */
#game-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
}

#top-command-bar {
  min-height: 60px;
  height: auto;
  width: 100%;
  padding: 6px 12px;
  background: linear-gradient(180deg, #FFFDF7 0%, #F5F0DC 100%);
  border-bottom: 3px solid var(--ink-navy);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  z-index: 40;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 2.5px solid var(--ink-navy);
  border-radius: 999px;
  padding: 4px 11px;
  box-shadow: 0 2px 0 rgba(28, 43, 74, 0.16);
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.hud-pill img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.hud-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: #059669;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 2.5px solid var(--ink-navy);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--ink-navy);
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 3px 0 var(--ink-navy);
}

.hud-btn.active {
  background: #FDE047;
}

.hud-btn.shop-cta {
  background: linear-gradient(180deg, #FDE047 0%, #FDBD17 100%);
}

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

/* ---------- 3-Column Workspace ---------- */
#workspace-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 276px;
  width: 100%;
}

.side-column {
  background: rgba(252, 250, 235, 0.96);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  box-sizing: border-box;
  z-index: 25;
}

#left-column {
  border-right: 3px solid var(--ink-navy);
}

#right-column {
  border-left: 3px solid var(--ink-navy);
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.section-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 900;
  color: var(--ink-navy);
  display: flex;
  align-items: center;
  gap: 5px;
}

.bulk-bar {
  display: inline-flex;
  gap: 4px;
}

.bulk-btn {
  padding: 3px 7px;
  border: 2px solid var(--ink-navy);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--ink-navy);
  font-size: 11px;
  font-weight: 800;
}

.bulk-btn.active {
  background: #0F766E;
  color: #FFFFFF;
}

/* Next Unlock Guide Banner */
.unlock-guide-box {
  background: linear-gradient(90deg, #FEF3C7, #FFFBEB);
  border: 2px solid #F59E0B;
  border-radius: 12px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 800;
  color: #92400E;
  line-height: 1.25;
}

/* Department Cards */
#dept-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dept-card {
  background: #FFFFFF;
  border: 2.5px solid #CBD5E1;
  border-radius: 14px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 2px 0 rgba(28, 43, 74, 0.08);
}

.dept-card.selected {
  border-color: var(--teal-main);
  box-shadow: 0 0 0 2px rgba(43, 179, 163, 0.25);
}

.dept-card.locked {
  background: #F8FAFC;
  border-style: dashed;
}

.dept-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dept-thumb {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #F1F5F9;
  object-fit: contain;
  flex-shrink: 0;
  border: 1.5px solid #E2E8F0;
}

.dept-info {
  flex: 1;
  min-width: 0;
}

.dept-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.dept-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-navy);
}

.dept-lv {
  font-size: 11px;
  font-weight: 800;
  color: #0F766E;
  font-variant-numeric: tabular-nums;
}

.stock-bar-wrap {
  margin-top: 3px;
  height: 8px;
  width: 100%;
  background: #E2E8F0;
  border-radius: 999px;
  padding: 1px;
}

.stock-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: #22C55E;
  transition: width 0.15s linear;
}

.dept-meta-line {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--slate-muted);
  display: flex;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: wrap;
}

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

.price-btn {
  padding: 3px 4px;
  font-size: 10px;
  font-weight: 800;
  border: 1.5px solid #CBD5E1;
  border-radius: 7px;
  background: #F8FAFC;
  color: #475569;
  text-align: center;
}

.price-btn.active[data-tier="discount"] {
  background: #D1FAE5;
  border-color: #10B981;
  color: #065F46;
}

.price-btn.active[data-tier="fair"] {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

.price-btn.active[data-tier="premium"] {
  background: #F3E8FF;
  border-color: #A855F7;
  color: #6B21A8;
}

.dept-actions-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 5px;
}

.dept-card.locked .dept-actions-row {
  grid-template-columns: 1fr;
}

.dept-actions-row button {
  font-size: 11px;
  padding: 5px 6px;
  white-space: normal;
  overflow-wrap: break-word;
}

/* Staff Card */
.staff-box {
  background: #FFFFFF;
  border: 2.5px solid var(--ink-navy);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.staff-grid button {
  font-size: 10.5px;
  padding: 5px 6px;
}

/* ---------- Center 3D Viewport & Floating Banners ---------- */
#center-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  background: #BCE9F7;
  overflow: hidden;
}

#viewport-3d {
  position: absolute;
  inset: 0;
}

#fx-overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}

#tutorial-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(255, 253, 247, 0.95);
  border: 2.5px solid var(--ink-navy);
  border-radius: 999px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(28, 43, 74, 0.22);
  font-size: 12.5px;
  font-weight: 800;
  max-width: calc(100% - 28px);
}

#cutin-banner {
  position: absolute;
  top: 108px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  z-index: 28;
  background: linear-gradient(90deg, #1C2B4A 0%, #0F766E 55%, #F59E0B 100%);
  border: 3px solid #FDE047;
  border-radius: 20px;
  padding: 8px 20px;
  color: #FFFFFF;
  display: none;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 28px rgba(28, 43, 74, 0.42);
  pointer-events: none;
}

#cutin-banner.show {
  display: flex;
  animation: cutinPop 0.35s cubic-bezier(0.22, 1.28, 0.36, 1) forwards;
}

@keyframes cutinPop {
  from { opacity: 0; transform: translateX(-50%) scale(0.8); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

#cutin-banner img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

/* ---------- Right Column Cards (Supply Drop, Flash Sale, 12-Tile Board, Challenges) ---------- */
.widget-card {
  background: #FFFFFF;
  border: 2.5px solid var(--ink-navy);
  border-radius: 15px;
  padding: 8px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 3px 0 rgba(28, 43, 74, 0.12);
}

.drop-card {
  background: linear-gradient(180deg, #ECFEFF 0%, #FFFFFF 100%);
  border-color: #0891B2;
}

.flash-card {
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 100%);
  border-color: #D97706;
}

/* 12-Tile Perimeter Supply Route Mini-Board (4x4 ring = 12 outer cells!) */
.supply-board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, 46px);
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  align-items: stretch;
  justify-items: stretch;
}

.board-tile {
  border: 2px solid #CBD5E1;
  border-radius: 10px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--ink-navy);
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

.board-tile img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.board-tile.active-token {
  border-color: #F59E0B;
  background: #FEF3C7;
  box-shadow: inset 0 0 0 2px #FDBD17, 0 1px 4px rgba(245, 158, 11, 0.35);
  transform: none;
  z-index: 2;
}

.board-center-hub {
  grid-column: 2 / 4;
  grid-row: 2 / 4;
  background: linear-gradient(160deg, #FFFDF7, #FEF3C7);
  border: 2px dashed #F59E0B;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  text-align: center;
}

.dice-count-big {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--ink-navy);
}

.mini-progress-bar {
  width: 100%;
  height: 7px;
  background: #E2E8F0;
  border-radius: 999px;
  margin-top: 3px;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3B82F6, #2BB3A3);
}

/* Right-column Mini Tabs */
.mini-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.mini-tab-btn {
  padding: 5px 4px;
  border: 2px solid var(--ink-navy);
  border-radius: 9px;
  background: #F1F5F9;
  color: var(--ink-navy);
  font-size: 11px;
  font-weight: 800;
}

.mini-tab-btn.active {
  background: #0F766E;
  color: #FFFFFF;
}

.challenge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 6px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  background: #F8FAFC;
  font-size: 11px;
}

/* ---------- Modals (Shop, Branches, Settings, Offline) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

body.shop-modal-open #left-column,
body.shop-modal-open #right-column,
body.shop-modal-open #ops-dock,
body.shop-modal-open #stage-status-strip,
body.shop-modal-open #btn-stage-offline-lock {
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  width: min(860px, 94vw);
  max-height: 88vh;
  overflow: hidden;
  background: var(--cream-card);
  border: 4px solid var(--ink-navy);
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.45), 0 6px 0 var(--ink-navy);
  animation: modalSpring 0.22s cubic-bezier(0.22, 1.25, 0.36, 1);
}

.modal-dialog.compact {
  width: min(560px, 94vw);
}

@keyframes modalSpring {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 8px;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-navy);
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 4px;
}

#modal-shop .modal-body {
  padding: 10px 8px 6px 4px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 12px;
}

.shop-card {
  background: #FFFFFF;
  border: 2.5px solid #CBD5E1;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  position: relative;
}

.shop-card.featured {
  border-color: #F59E0B;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 100%);
}

.shop-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #F59E0B;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
}

.shop-art {
  width: 78px;
  height: 78px;
  object-fit: contain;
}

.shop-card-name {
  font-weight: 900;
  font-size: 14px;
  color: #1C2B4A;
}

.shop-card-desc {
  font-size: 12px;
  color: #475569;
  flex: 1;
}

.shop-buy-btn {
  width: 100%;
  font-size: 13px;
}

.branch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.branch-card {
  background: #FFFFFF;
  border: 2.5px solid #CBD5E1;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.branch-card.current {
  border-color: var(--teal-main);
  background: #F0FDFA;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #E2E8F0;
}

.settings-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Preview-only [DEV F2] Debug Pill & Drawer (hidden by default on Web Playtest unless ?dev=1 or F2; strictly unmounted in ReleaseHost) */
#dev-f2-pill {
  position: fixed;
  bottom: 5px;
  left: clamp(248px, 16.5vw, 290px);
  transform: none;
  z-index: 85;
  display: none;
  background: rgba(15, 23, 42, 0.85);
  color: #38BDF8;
  border: 1.5px solid #38BDF8;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 800;
}

#dev-f2-pill.dev-visible {
  display: inline-flex;
  align-items: center;
}

#debug-panel {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 260;
  background: rgba(15, 23, 42, 0.95);
  color: #F8FAFC;
  border: 2px solid #38BDF8;
  border-radius: 14px;
  padding: 12px;
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  width: min(640px, 92vw);
}

#debug-panel.open {
  display: flex;
}

@media (max-width: 960px) {
  #workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh auto auto;
    overflow-y: auto;
  }
  #center-stage {
    order: -1;
    min-height: 300px;
  }
}

/* ---------- 1.0.0.0-rc3 UX & Polish Additions ---------- */
#game-shell.shell-preloading {
  visibility: hidden;
}

.hud-pill-btn {
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hud-pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 0 rgba(28, 43, 74, 0.25);
}

.hud-info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #F59E0B;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  margin-left: 2px;
}

#tutorial-banner {
  width: min(640px, calc(100% - 24px));
  max-width: calc(100% - 24px);
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  border-radius: 16px !important;
  padding: 9px 14px !important;
  gap: 10px !important;
  align-items: flex-start;
  z-index: 32;
}

.tutorial-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  overflow: visible;
}

.tutorial-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tutorial-step-badge {
  background: #0F766E;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 999px;
}

.tutorial-title {
  font-size: 12px;
  font-weight: 900;
  color: #1C2B4A;
}

.tutorial-desc {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
  line-height: 1.36;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
}

.tutorial-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

#game-toast-stack {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(460px, 92%);
}

.game-toast {
  background: rgba(28, 43, 74, 0.94);
  color: #FFFFFF;
  border: 2px solid #38BDF8;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
  text-align: center;
}

.game-toast.gold {
  border-color: #FACC15;
  background: linear-gradient(90deg, rgba(28, 43, 74, 0.96), rgba(15, 118, 110, 0.95));
}

.game-toast.sky {
  border-color: #38BDF8;
}

.game-toast.danger {
  border-color: #F87171;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.96), rgba(185, 28, 28, 0.95));
  color: #FEF2F2;
}

.board-hint-line {
  font-size: 9.5px;
  font-weight: 700;
  color: #0F766E;
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  border-radius: 7px;
  padding: 2px 6px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-gain-log {
  font-size: 9px;
  font-weight: 800;
  color: #075985;
  background: #F0F9FF;
  border: 1px solid #7DD3FC;
  border-radius: 6px;
  padding: 2px 5px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-gain-log.tray-full {
  color: #92400E;
  background: #FEF3C7;
  border-color: #F59E0B;
}

.board-last-roll {
  font-size: 9.5px;
  font-weight: 800;
  color: #1C2B4A;
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  border-radius: 7px;
  padding: 2px 6px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes dicePopAnim {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); color: #0284C7; }
  100% { transform: scale(1); }
}

.dice-pop {
  animation: dicePopAnim 0.45s ease;
}

@keyframes hudEarnPopAnim {
  0% { transform: scale(1); }
  42% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.hud-earn-pop {
  animation: hudEarnPopAnim 0.34s ease-out;
}

.earned-pulse {
  animation: hudEarnPopAnim 0.38s ease-out;
}

.checkin-mini-row {
  background: #F0FDFA !important;
  border-color: #5EEAD4 !important;
}

.checkin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
  gap: 10px;
}

.checkin-day-card {
  background: #FFFFFF;
  border: 2.5px solid #CBD5E1;
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.checkin-day-card.today {
  border-color: #F59E0B;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.checkin-day-card.claimed {
  border-color: #10B981;
  background: #ECFDF5;
  opacity: 0.85;
}

.checkin-day-label {
  font-size: 12px;
  font-weight: 900;
  color: #1C2B4A;
}

.checkin-day-rewards {
  font-size: 11px;
  font-weight: 800;
  color: #334155;
  line-height: 1.35;
}

.giftcode-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: 12px;
}

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

.giftcode-row input {
  flex: 1;
  padding: 7px 10px;
  border: 2px solid #1C2B4A;
  border-radius: 9px;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
}

.giftcode-feedback {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

.stars-guide-card {
  background: #FFFBEB;
  border: 2px solid #F59E0B;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.stars-guide-section {
  font-size: 12.5px;
  color: #334155;
  margin-bottom: 10px;
}

.stars-guide-section ul {
  margin: 5px 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* ---------- Season 2–4 (v2.1 -> v5.0) Operations Dock, Modals & Codex ---------- */
#ops-dock {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 253, 247, 0.92);
  border: 2.5px solid var(--ink-navy);
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(28, 43, 74, 0.24);
  max-width: calc(100% - 24px);
}

#ops-dock button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 6px 10px;
}

#ops-dock button.surge-active,
#ops-dock button.hardcore-active,
#btn-title-hardcore.hardcore-active {
  border-image: none !important;
  background: linear-gradient(180deg, #FB923C 0%, #DC2626 100%) !important;
  color: #FFFFFF !important;
  border: 2px solid #7F1D1D !important;
  border-radius: 12px !important;
  padding: 0 12px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

#btn-title-offline-lock.offline-lock-active,
#btn-settings-offline-lock.offline-lock-active {
  border-image: none !important;
  background: linear-gradient(180deg, #10B981 0%, #0F766E 100%) !important;
  color: #FFFFFF !important;
  border: 2px solid #134E4A !important;
  border-radius: 12px !important;
  padding: 0 12px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ---------- rc26: Title HUD Isolation, Uniform Title Row, Happy Popover, Modal Art Cards & 720p Zero-Offscreen Controls ---------- */
body.title-active #top-command-bar,
body.title-active .side-column,
body.title-active #ops-dock,
body.title-active #stage-status-strip,
body.title-active #tutorial-banner,
body.title-active #active-trial-banner,
body.title-active #dev-f2-pill,
body.title-active #sat-popover {
  display: none !important;
}

.title-actions .btn-toy,
.title-actions select#title-lang-select {
  height: 38px !important;
  min-height: 38px !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.15 !important;
  white-space: nowrap !important;
}

#btn-title-offline-lock,
#btn-title-hardcore,
#btn-title-quit {
  padding: 0 12px !important;
}

.hud-sat-label {
  display: inline;
  white-space: nowrap;
}

.sat-popover {
  position: fixed;
  top: 60px;
  left: 340px;
  z-index: 95;
  width: 256px;
  background: #FFFDF7;
  border: 2.5px solid #1C2B4A;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  color: #1C2B4A;
  font-size: 12px;
}

.sat-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.sat-popover-score {
  font-weight: 900;
  font-size: 14px;
  color: #059669;
}

.sat-popover-bar {
  height: 8px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
  border: 1.5px solid #1C2B4A;
  margin-bottom: 8px;
}

.sat-popover-fill {
  height: 100%;
  background: #22C55E;
  transition: width 0.2s ease;
}

.sat-popover-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sat-popover-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.sat-popover-row strong.pos { color: #059669; }
.sat-popover-row strong.neg { color: #DC2626; }

.giftcode-row input.is-error {
  border-color: #DC2626 !important;
  background: #FEF2F2 !important;
}

.giftcode-feedback.is-error {
  color: #DC2626 !important;
  background: #FEF2F2;
  border: 1.5px solid #FCA5A5;
  border-radius: 8px;
  padding: 5px 8px;
  font-weight: 800;
}

.giftcode-feedback.is-success {
  color: #047857 !important;
  background: #ECFDF5;
  border: 1.5px solid #6EE7B7;
  border-radius: 8px;
  padding: 5px 8px;
  font-weight: 800;
}

/* Crisp Visual Art Cards inside All 5 Modals ([VD-112] >= 55% visual art density, zero imageless text boxes) */
.modal-art-frame {
  width: 100%;
  height: 84px;
  border-radius: 10px;
  background: linear-gradient(180deg, #F0F9FF 0%, #FFFBEB 100%);
  border: 2px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
  box-sizing: border-box;
  margin-bottom: 4px;
}

.modal-art-frame.compact {
  height: 68px;
}

.modal-art-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.modal-banner-art {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid #CBD5E1;
  padding: 3px;
  flex-shrink: 0;
}

.checkin-art-frame {
  width: 100%;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FEF9C3 0%, #FFFBEB 100%);
  border-radius: 8px;
  border: 1.5px solid #FDE68A;
  margin: 2px 0 4px;
}

.checkin-art-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.curr-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 800;
  white-space: nowrap;
}

.curr-chip img,
.inline-curr-ico {
  width: 15px;
  height: 15px;
  object-fit: contain;
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}

.curr-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
}

.theme-swatch-banner {
  width: 100%;
  height: 76px;
  border-radius: 10px;
  border: 2px solid #1C2B4A;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px;
  box-sizing: border-box;
  margin-bottom: 4px;
}

.theme-swatch-banner img {
  height: 60px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(15, 23, 42, 0.28));
}

.codex-chip img.codex-ico-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Left Column Stalls / Staff Tabs & Compact Pager (0 offscreen buttons at 1280x720) */
.left-subtabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.left-subtabs .mini-tab-btn {
  flex: 1;
  padding: 3px 6px;
  font-size: 11px;
}

.dept-pager {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 253, 247, 0.92);
  border: 2px solid #1C2B4A;
  border-radius: 9px;
  padding: 1px 4px;
}

.dept-page-btn {
  border: none;
  background: transparent;
  color: #1C2B4A;
  font-weight: 900;
  font-size: 11px;
  padding: 2px 5px;
  cursor: pointer;
  line-height: 1;
}

.dept-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.dept-page-lbl {
  font-size: 10px;
  font-weight: 900;
  color: #0F766E;
  min-width: 24px;
  text-align: center;
}

#left-stalls-pane {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#left-stalls-pane[hidden],
#left-staff-pane[hidden] {
  display: none !important;
}

.mini-tab-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 800;
  color: #475569;
}

.mini-tab-pager button {
  padding: 1px 7px !important;
  font-size: 10px !important;
  min-height: 20px !important;
}

.stage-status-strip {
  position: fixed;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  pointer-events: auto;
}

.stage-lock-pill {
  position: static;
  transform: none;
  height: 22px;
  line-height: 18px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1.5px solid #334155;
  background: rgba(248, 250, 252, 0.92);
  color: #1E293B;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.stage-lock-pill.offline-lock-active {
  background: linear-gradient(180deg, #10B981 0%, #0F766E 100%);
  border-color: #134E4A;
  color: #FFFFFF;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.stage-lock-pill.idle-guard-paused {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%);
  border-color: #78350F;
  color: #FFFFFF;
}

.stage-reload-pill {
  position: relative;
  z-index: 2;
  height: 22px;
  line-height: 18px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1.5px solid #1E3A8A;
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.stage-reload-pill:hover {
  filter: brightness(1.08);
}

.stage-earned-pill {
  height: 22px;
  line-height: 18px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1.5px solid #92400E;
  background: rgba(254, 252, 232, 0.94);
  color: #78350F;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

#modal-reload-guard .modal-head {
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
}

#modal-reload-guard .modal-head h2 {
  flex: 1 1 auto;
  min-width: 0;
}

#btn-close-reload-guard {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  min-width: 78px !important;
}

.hud-sat-pill {
  position: relative;
}

.sat-meter-track {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 3px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
  overflow: hidden;
  pointer-events: none;
}

.sat-meter-fill {
  display: block;
  height: 100%;
  width: 90%;
  border-radius: 999px;
  background: #10B981;
  transition: width 0.25s ease, background-color 0.25s ease;
}

.reload-guard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 4px;
}

.reload-guard-stat {
  background: #F8FAFC;
  border: 2px solid #CBD5E1;
  border-radius: 12px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.reload-guard-stat span {
  font-size: 10.5px;
  font-weight: 800;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.reload-guard-stat strong {
  font-size: 12.5px;
  font-weight: 900;
  color: #0F172A;
}

.trial-live-banner {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 42;
  max-width: min(760px, calc(100vw - 480px));
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(90deg, #0F766E, #0284C7);
  color: #FFFFFF;
  border: 2.5px solid #FDE047;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.3);
  pointer-events: none;
  white-space: nowrap;
}

.trial-live-banner.trial-danger {
  background: linear-gradient(90deg, #991B1B, #DC2626);
  border-color: #FCA5A5;
}

.shift-policy-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 2px;
}

.combo-mini-pill {
  background: #FEF3C7;
  border: 1.5px solid #D97706;
  color: #92400E;
  font-size: 10.5px;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 999px;
}

.modal-tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.subtab-btn {
  padding: 5px 11px;
  border: 2px solid var(--ink-navy);
  border-radius: 10px;
  background: #F1F5F9;
  color: var(--ink-navy);
  font-size: 11.5px;
  font-weight: 800;
}

.subtab-btn.active {
  background: var(--teal-main);
  color: #FFFFFF;
}

.season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 10px;
}

.season-card {
  background: #FFFFFF;
  border: 2px solid #CBD5E1;
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.season-card.highlight {
  border-color: #F59E0B;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 100%);
}

.season-card.active-card {
  border-color: var(--teal-main);
  background: #F0FDFA;
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 7px;
}

.codex-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1.5px solid #CBD5E1;
  background: #FFFFFF;
  font-size: 11.5px;
  font-weight: 800;
}

.codex-chip.locked {
  opacity: 0.52;
  background: #F8FAFC;
  border-style: dashed;
}

.shard-progress-wrap {
  background: #1E293B;
  border-radius: 999px;
  height: 14px;
  padding: 2px;
  width: 100%;
}

.shard-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38BDF8, #A855F7, #FACC15);
  transition: width 0.2s ease;
}

@keyframes deptUnlockPop {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.85); }
  40% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.35), 0 8px 20px rgba(250, 204, 21, 0.45); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); }
}

.dept-card.dept-just-unlocked {
  animation: deptUnlockPop 0.95s cubic-bezier(0.22, 1, 0.36, 1);
  border-color: #F59E0B !important;
}
