/**
 * Cloverbell Market: Cozy Shop Sim — Cozy Pastel Storybook Stylesheet (`css/game.css`)
 * Palette locked to extracted Art Kit DNA: `#FDF6E3`, `#FFEFDC`, `#C6A17B`, `#DECDAA`, `#5A3E36`.
 * STRICT INVARIANTS:
 *   - ZERO `backdrop-filter: blur()` anywhere!
 *   - Exact 9-slice `border-image` on `.frame-9slice` and `.btn-9slice` (`background: transparent; border-radius: 0; box-shadow: none;`)
 *   - `overflow: visible; position: relative;` on all buttons hosting `.notify-badge`
 *   - High WCAG AA contrast (`>= 4.5:1`) using warm dark cocoa `#3E2922` / `#5A3E36` on cream & sage!
 */

:root {
  --bg-cream: #FDF6E3;
  --bg-warm: #FFEFDC;
  --bg-linen: #F9EEE0;
  --wood-oak: #DCB999;
  --wood-tan: #C6A17B;
  --wood-sand: #DECDAA;
  --wall-sage: #A8B3A3;
  --sage-btn: #A6C296;
  --sage-soft: #DBDFCD;
  --ink-cocoa: #4A312A;
  --ink-deep: #3A241E;
  --ink-muted: #78554B;
  --outline-cocoa: #8E5D53;
  --alert-coral: #E86255;
  --gold-warm: #F0BE59;
  --font-display: 'Fredoka', 'M PLUS Rounded 1c', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-body: 'Quicksand', 'M PLUS Rounded 1c', 'Segoe UI', sans-serif;
  --font-lcd: 'Consolas', 'Courier New', monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-cream);
  color: var(--ink-cocoa);
  font-family: var(--font-body);
  font-weight: 700;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

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

.cm-tabular {
  font-variant-numeric: tabular-nums;
}

/* ========================================================================= */
/* 9-SLICE ANTI-DISTORTION CHROME (Exact `art_manifest.json` slices)         */
/* ========================================================================= */

.frame-9slice {
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 28px 30px 32px 30px;
  border-image: url('../assets/ui/frame_panel.png') 138 143 158 143 fill / 28px 30px 32px 30px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 8px 18px rgba(62, 39, 32, 0.26));
}

.btn-9slice {
  position: relative;
  overflow: visible !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: transparent;
  border-style: solid;
  border-color: transparent;
  border-width: 16px 22px 16px 22px;
  border-image: url('../assets/ui/btn_primary.png') 206 199 197 201 fill / 16px 22px 16px 22px / 0 stretch;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 253, 247, 0.72);
  cursor: pointer;
  filter: drop-shadow(0 3px 0 rgba(74, 49, 42, 0.42));
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-9slice:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04) drop-shadow(0 4px 0 rgba(74, 49, 42, 0.45));
}

.btn-9slice:active:not(:disabled) {
  transform: translateY(2px);
}

.btn-9slice:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.btn-9slice > span,
.cm-btn > span,
.cm-hud-btn > .cm-btn-label,
.cm-tab-btn > span,
.cm-mini-btn > span,
.cm-lift-btn > .cm-lift-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================================================= */
/* RED-DOT NOTIFICATION BADGE (NEVER CLIPPED!)                               */
/* ========================================================================= */

button {
  position: relative;
  overflow: visible !important;
  font-family: inherit;
}

.notify-badge {
  position: absolute;
  box-sizing: border-box;
  top: -4px;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--alert-coral);
  border: 2px solid #FFFDF7;
  z-index: 35;
  pointer-events: none;
  animation: cmBadgePulse 1.5s ease-in-out infinite;
}

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

/* ========================================================================= */
/* ICONS & TACTILE BUTTONS                                                   */
/* ========================================================================= */

.cm-icon-sm {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.cm-icon-md {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.cm-svg-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink-cocoa);
}

.cm-svg-icon.is-gold { color: #F2B63D; }
.cm-svg-icon.is-sage { color: #7EAB6E; }

.cm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--ink-cocoa);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-deep);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink-cocoa);
  transition: transform 0.1s ease, filter 0.1s ease;
}

.cm-btn:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.cm-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink-cocoa); }
.cm-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.cm-btn-sage {
  background: linear-gradient(180deg, #C0DAB2 0%, #9EC08D 100%);
  color: var(--ink-deep);
}

.cm-btn-gold {
  background: linear-gradient(180deg, #FFE08C 0%, #F0BE59 100%);
  color: var(--ink-deep);
}

.cm-btn-cream {
  background: var(--bg-warm);
  color: var(--ink-deep);
}

.cm-btn-coral-soft {
  background: #FFD8D2;
  border-color: #9E4238;
  color: #5C1F19;
}

.cm-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 9px;
  border-radius: 10px;
  border: 2px solid var(--outline-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cm-mini-btn:hover:not(:disabled) {
  background: #FFF6E8;
  border-color: var(--ink-cocoa);
}

.cm-full-btn {
  width: 100%;
}

/* ========================================================================= */
/* TITLE SCREEN OVERLAY                                                      */
/* ========================================================================= */

.cm-title-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 26px;
}

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

.cm-title-scrim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 48%, rgba(253, 246, 227, 0.15) 0%, rgba(74, 49, 42, 0.46) 100%);
  z-index: 1;
}

.cm-title-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cm-lang-select,
.cm-compact-select {
  padding: 6px 10px;
  border-radius: 12px;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-cream);
  color: var(--ink-deep);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cm-top-util-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 12px;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-cream);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink-cocoa);
}

.cm-title-center {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 42px);
}

.cm-title-Showcase {
  position: relative;
  width: clamp(230px, 26vw, 350px);
  height: clamp(250px, 42vh, 390px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
}

.cm-hero-portrait-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.cm-hero-nora img {
  height: clamp(230px, 40vh, 360px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(62, 39, 32, 0.35));
}

.cm-hero-biscuit {
  position: absolute;
  right: -14px;
  bottom: 0;
}

.cm-hero-biscuit img {
  height: clamp(115px, 19vh, 170px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(62, 39, 32, 0.32));
}

.cm-title-card {
  width: min(500px, 90vw);
  text-align: center;
  padding: 12px 18px;
}

.cm-brand-kicker {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.cm-brand-title {
  margin: 0 0 8px 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 46px);
  line-height: 1.08;
  color: #FFF9EE;
  paint-order: stroke fill;
  -webkit-text-stroke: 4px #5A3E36;
  text-shadow: 0 3px 0 #5A3E36;
}

.cm-brand-tagline {
  margin: 0 0 16px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-deep);
}

.cm-loading-box {
  margin: 0 auto 14px auto;
  max-width: 380px;
}

.cm-loading-track {
  height: 14px;
  border-radius: 999px;
  background: var(--wood-sand);
  border: 2px solid var(--ink-cocoa);
  overflow: hidden;
}

.cm-loading-fill {
  height: 100%;
  background: linear-gradient(90deg, #9EC08D 0%, #F0BE59 100%);
  transition: width 0.14s ease;
}

.cm-loading-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 5px;
}

.cm-play-cta {
  min-width: 210px;
  font-size: 20px;
}

.cm-play-cta.is-loading {
  opacity: 0.45;
  pointer-events: none;
}

/* ========================================================================= */
/* MAIN 16:9 3-COLUMN SHOP WORKBENCH                                         */
/* ========================================================================= */

.cm-workbench {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: var(--bg-linen);
  overflow: hidden;
}

/* TOP RIBBON */
.cm-top-ribbon {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg-cream);
  border-bottom: 3px solid var(--outline-cocoa);
  box-shadow: 0 2px 8px rgba(90, 62, 54, 0.12);
  z-index: 20;
}

.cm-ribbon-left,
.cm-ribbon-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cm-shop-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: var(--bg-warm);
  border: 2px solid var(--outline-cocoa);
  max-width: 200px;
}

.cm-shop-lv {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold-warm);
  border: 1.5px solid var(--ink-cocoa);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 11.5px;
  flex-shrink: 0;
}

.cm-shop-name-lbl {
  font-family: var(--font-display);
  font-size: 13.5px;
  color: var(--ink-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #FFFDF7;
  border: 2px solid var(--wood-tan);
  font-size: 12.5px;
  color: var(--ink-deep);
  white-space: nowrap;
}

.cm-currency-pill {
  border-color: var(--ink-cocoa);
  background: var(--bg-warm);
  font-size: 13.5px;
  font-weight: 800;
}

.cm-pill-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink-cocoa);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.cm-shutter-open {
  background: #B8D8A8;
  color: var(--ink-deep);
}

.cm-shutter-closed {
  background: #F4B6AC;
  color: var(--ink-deep);
}

.cm-hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  max-width: 175px;
  border-radius: 11px;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--wood-tan);
}

.cm-hud-shop-btn {
  background: linear-gradient(180deg, #FFE49E 0%, #F2C464 100%);
}

.cm-hud-seasons-btn {
  background: linear-gradient(180deg, #DDF0D2 0%, #AED49A 100%);
}

.cm-hud-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  cursor: pointer;
  flex-shrink: 0;
}

.cm-quit-btn:hover {
  background: #FFD8D2;
}

/* 3-COLUMN LAYOUT */
.cm-columns-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(230px, 22fr) minmax(420px, 52fr) minmax(270px, 26fr);
  gap: 8px;
  padding: 8px;
}

.cm-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-cream);
  border: 2.5px solid var(--outline-cocoa);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(90, 62, 54, 0.08);
}

.cm-rail-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 8px;
  background: var(--wood-sand);
  border-bottom: 2px solid var(--outline-cocoa);
  flex-shrink: 0;
}

.cm-tab-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 6px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: rgba(253, 246, 227, 0.65);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.cm-tab-btn.is-active {
  background: #FFFDF7;
  border-color: var(--ink-cocoa);
  box-shadow: 0 2px 0 var(--wood-tan);
}

.cm-help-pill {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.cm-rail-pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 7px;
  overflow: hidden;
}

.cm-scroll-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

/* LEFT RAIL: DECOR / BISCUIT / STAFF */
.cm-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cm-charm-tag,
.cm-tag-warm,
.cm-tag-sage {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
}

.cm-charm-tag, .cm-tag-warm {
  background: var(--bg-warm);
  border: 1.5px solid var(--wood-tan);
  color: var(--ink-deep);
}

.cm-tag-sage {
  background: #D6E9CC;
  border: 1.5px solid #6E9660;
  color: #284420;
}

.cm-pane-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.3;
}

.cm-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
  min-width: 0;
}

.cm-row-card.is-placed {
  border-color: #6E9660;
  background: #F4FAF0;
}

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

.cm-row-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#left-rail-panel .cm-scroll-list {
  padding-bottom: 38px;
}

.cm-row-sub {
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--ink-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

/* BISCUIT CARE CARD */
.cm-biscuit-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-biscuit-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-biscuit-avatar {
  width: 68px;
  height: 68px;
  object-fit: contain;
  border-radius: 14px;
  background: var(--bg-warm);
  border: 2px solid var(--wood-tan);
  flex-shrink: 0;
}

.cm-biscuit-name {
  margin: 0 0 5px 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-deep);
}

.cm-biscuit-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cm-meter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cm-meter-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-deep);
}

.cm-meter-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-linen);
  border: 1.5px solid var(--wood-tan);
  overflow: hidden;
}

.cm-meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.cm-meter-fill.is-pink { background: linear-gradient(90deg, #FF9BB0, #F06D88); }
.cm-meter-fill.is-gold { background: linear-gradient(90deg, #FFD670, #E8A63A); }

.cm-biscuit-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* STAFF CONTROLS */
.cm-staff-controls-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-staff-ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.cm-staff-bake-box {
  padding-top: 5px;
  border-top: 1.5px dashed var(--wood-oak);
}

.cm-slider {
  width: 100%;
  accent-color: #88AD77;
  cursor: pointer;
}

/* ========================================================================= */
/* CENTER STAGE: 4-FLOOR DIORAMA + SHOPLIFT + CARTON TRAY                    */
/* ========================================================================= */

.cm-center-stage {
  background: var(--bg-warm);
}

.cm-diorama-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  background: #EEDEC5;
  overflow: hidden;
}

#diorama-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.cm-shoplift-rail {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 8;
}

.cm-lift-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  max-width: 165px;
  border-radius: 11px;
  border: 2px solid var(--ink-cocoa);
  background: rgba(253, 246, 227, 0.94);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(90, 62, 54, 0.35);
}

.cm-lift-btn.is-active {
  background: var(--gold-warm);
}

.cm-lift-btn.is-locked {
  opacity: 0.76;
  background: var(--sage-soft);
}

.cm-lift-num {
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--ink-cocoa);
  color: #FFFDF7;
  font-size: 10.5px;
  flex-shrink: 0;
}

.cm-diorama-widgets {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 8;
}

.cm-widget-pill,
.cm-rush-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink-cocoa);
  background: rgba(255, 253, 247, 0.95);
  color: var(--ink-deep);
  font-family: var(--font-display);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(90, 62, 54, 0.3);
}

.cm-rush-pill {
  background: linear-gradient(90deg, #FFE48F, #F4B942);
  cursor: default;
}

.cm-toast-stack {
  position: absolute;
  left: 12px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  pointer-events: none;
  z-index: 12;
  max-width: 72%;
}

.cm-toast {
  padding: 6px 12px;
  border-radius: 11px;
  background: rgba(253, 246, 227, 0.96);
  border: 2px solid var(--ink-cocoa);
  color: var(--ink-deep);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(62, 39, 32, 0.22);
}

/* BOTTOM CARTON TRAY */
.cm-carton-tray {
  height: 118px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 10px 8px 10px;
  background: var(--wood-sand);
  border-top: 2.5px solid var(--outline-cocoa);
}

.cm-carton-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
}

.cm-carton-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cm-carton-hint {
  font-size: 11px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-carton-slots {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px;
}

.cm-carton-card {
  position: relative;
  flex-shrink: 0;
  width: 82px;
  height: 68px;
  border-radius: 12px;
  border: 2px solid var(--outline-cocoa);
  background: #FFFDF7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
}

.cm-carton-card.is-selected {
  border-color: var(--ink-cocoa);
  background: #FFF5D6;
  box-shadow: 0 0 0 2px var(--gold-warm);
}

.cm-carton-icons {
  position: relative;
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cm-carton-box-img {
  width: 38px;
  height: 36px;
  object-fit: contain;
}

.cm-carton-prod-img {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  object-fit: contain;
  background: #FFFDF7;
  border-radius: 6px;
  border: 1.5px solid var(--outline-cocoa);
}

.cm-carton-qty {
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-deep);
}

/* ========================================================================= */
/* RIGHT WORKBENCH: TACTILE CHECKOUT TILL & WHOLESALER                       */
/* ========================================================================= */

.cm-till-pane {
  gap: 6px;
}

.cm-till-customer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-till-cust-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.cm-cust-avatar {
  width: 42px;
  height: 48px;
  object-fit: contain;
  background: var(--bg-warm);
  border-radius: 10px;
  border: 1.5px solid var(--wood-tan);
  flex-shrink: 0;
}

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

.cm-cust-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.cm-pay-tag {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--gold-warm);
  border: 1.5px solid var(--ink-cocoa);
  color: var(--ink-deep);
  font-size: 10px;
  font-weight: 800;
}

.cm-cust-sub {
  display: block;
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--ink-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
}

.cm-order-total-pill {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 3px 9px;
  border-radius: 8px;
  background: #FFF6DC;
  border: 1.5px solid var(--wood-oak);
  color: var(--ink-deep);
  flex-shrink: 0;
  line-height: 1.2;
}

.cm-order-total-pill.is-idle {
  opacity: 0.82;
}

.cm-order-total-pill.is-active {
  background: linear-gradient(90deg, #FFF3C4 0%, #FFE49E 100%);
  border-color: #B97E24;
  box-shadow: 0 1px 4px rgba(185, 126, 36, 0.24);
}

.cm-order-pill-lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink-cocoa);
}

.cm-order-total-pill strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-deep);
}

.cm-piggy-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--bg-warm);
  border: 1.5px solid var(--wood-tan);
  font-size: 11px;
  flex-shrink: 0;
  line-height: 1.15;
}

.cm-piggy-top {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.cm-piggy-lbl {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}

/* CONVEYOR BELT */
.cm-conveyor-box {
  padding: 7px;
  border-radius: 12px;
  background: #EFE4D4;
  border: 2px solid var(--outline-cocoa);
}

.cm-conveyor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

.cm-belt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 76px;
}

.cm-belt-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 10px;
  border: 2px solid var(--ink-cocoa);
  background: #FFFDF7;
  color: var(--ink-deep);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.12s ease;
}

.cm-belt-item:hover:not(:disabled) {
  background: #FFF6DC;
  transform: translateY(-1px);
}

.cm-belt-item.is-scanned {
  opacity: 0.42;
  border-style: dashed;
  cursor: default;
}

.cm-belt-item .cm-row-title {
  font-size: 11.5px;
  white-space: normal;
  line-height: 1.15;
}

.cm-weight-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.cm-weight-heavy { background: #DCE4EC; color: #263849; }
.cm-weight-normal { background: #E4EFE0; color: #2B4A24; }
.cm-weight-fragile { background: #FFE2DC; color: #6E2219; }

/* KRAFT BAG STACK */
.cm-bag-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
  min-height: 56px;
}

.cm-bag-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 44px;
  flex-shrink: 0;
}

.cm-bag-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.cm-bag-stamp {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%) rotate(-5deg);
  padding: 1px 6px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 10px;
  white-space: nowrap;
  border: 1.5px solid #FFFDF7;
  color: #FFFDF7;
  background: #4A7C42;
}

.cm-bag-stamp.is-squashed {
  background: #C94438;
}

.cm-bag-stack {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.cm-bagged-chip {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--bg-warm);
  border: 1.5px solid var(--wood-tan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cm-bagged-chip img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

/* RETRO MONOSPACE LCD */
.cm-lcd-screen {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #D9E5D2;
  border: 2px solid var(--ink-cocoa);
  font-family: var(--font-lcd);
  color: #1F3322;
}

.cm-lcd-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cm-lcd-cell span {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  opacity: 0.78;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-lcd-cell strong {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.cm-lcd-cell.is-tray strong {
  color: #7A3E10;
}

/* INTEGER-CENT CASH DRAWER */
.cm-payment-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.cm-denom-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 6px;
}

.cm-denom-btn {
  padding: 6px 4px;
  border-radius: 9px;
  border: 2px solid var(--ink-cocoa);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-deep);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink-cocoa);
}

.cm-denom-btn.is-bill {
  background: #D5E8C8;
}

.cm-denom-btn.is-coin {
  background: #FFE59E;
  border-radius: 999px;
}

.cm-drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 6px;
}

.cm-drawer-actions.has-helper {
  grid-template-columns: 0.78fr 1.22fr;
}

.cm-drawer-actions.has-helper #btn-submit-change {
  grid-column: 1 / -1;
}

/* WHOLESALER TAB */
.cm-ws-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cm-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cm-search-input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 10px;
  border: 2px solid var(--outline-cocoa);
  background: #FFFDF7;
  color: var(--ink-deep);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
}

.cm-filter-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.cm-filter-pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--outline-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.cm-filter-pill.is-active {
  background: var(--gold-warm);
  border-color: var(--ink-cocoa);
}

.cm-ws-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-ws-top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.cm-ws-prod {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cm-ws-card .cm-row-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
}

.cm-ws-card .cm-order-btn {
  width: 100%;
  min-height: 30px;
  height: auto;
  font-size: 11.5px;
  white-space: normal;
}

.cm-ws-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 11.5px;
  padding-top: 4px;
  border-top: 1px dashed var(--wood-sand);
}

.cm-price-stepper {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.cm-clearance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 5px;
  border-top: 2px solid var(--wood-sand);
  font-size: 11.5px;
}

/* ========================================================================= */
/* MODALS (WARM SCRIM, ZERO BACKDROP-FILTER BLUR, ZERO OVERFLOW GRIDS)       */
/* ========================================================================= */

.cm-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(74, 49, 42, 0.54);
}

.cm-modal-card {
  position: relative;
  z-index: 6010;
  max-width: 94vw;
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-deep);
  overflow: hidden;
}

.cm-modal-sm { width: min(430px, 92vw); }
.cm-modal-md { width: min(540px, 92vw); }
.cm-modal-lg { width: min(780px, 94vw); }
.cm-modal-xl { width: min(940px, 95vw); }

.cm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cm-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 2vw, 24px);
  color: var(--ink-deep);
}

.cm-shop-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--ink-cocoa);
  background: var(--bg-warm);
  color: var(--ink-deep);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.cm-modal-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
}

.cm-cards-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 2px;
}

.cm-cards-grid > *,
.cm-shop-grid > *,
.cm-modal-foot-grid > * {
  min-width: 0;
  max-width: 100%;
}

.cm-grid-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-grid-card-top {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cm-grid-card-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

/* CLOSING LEDGER */
.cm-ledger-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 6px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, #FFF6DC 0%, #FFE6A3 50%, #FFF6DC 100%);
  border: 2px solid #D4A042;
}

.cm-ledger-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-ledger-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--wood-sand);
}

.cm-ledger-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.cm-ledger-row.is-highlight {
  color: #1F5B28;
  font-weight: 800;
}

.cm-ledger-bonus-row {
  position: relative;
  overflow: hidden;
  align-items: center;
  margin: 3px -6px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1.5px solid #C89B3C;
  border-bottom: 1.5px solid #C89B3C;
  background: linear-gradient(90deg, #FFF7D8 0%, #E7F7DB 52%, #FFF7D8 100%);
  box-shadow: 0 2px 6px rgba(191, 142, 42, 0.16);
}

.cm-bonus-label-wrap,
.cm-bonus-val-wrap {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cm-bonus-sparkle {
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(168, 114, 18, 0.35));
}

.cm-bonus-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: #2E7D32;
  color: #FFFDF5;
  border: 1px solid #1E5A22;
  line-height: 1.25;
}

.cm-ledger-bonus-row.is-bonus-credited {
  background: linear-gradient(90deg, #FFF2B8 0%, #D9F5C7 50%, #FFF2B8 100%);
  border-color: #D49B24;
  animation: cmLedgerBonusGlow 1.15s cubic-bezier(0.22, 1.25, 0.36, 1) 1, cmLedgerBonusHalo 2.2s ease-in-out 1.15s infinite;
}

.cm-ledger-bonus-row.is-bonus-credited::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, transparent 22%, rgba(255, 255, 255, 0.78) 48%, rgba(255, 232, 138, 0.55) 56%, transparent 78%);
  transform: translateX(-120%);
  animation: cmLedgerBonusSweep 1.1s ease-out 0.12s 2;
  pointer-events: none;
}

.cm-ledger-bonus-row.is-bonus-credited .cm-bonus-sparkle {
  animation: cmBonusSparkleTwinkle 1.3s ease-in-out infinite;
}

@keyframes cmLedgerBonusGlow {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(238, 185, 45, 0.0); }
  40% { transform: scale(1.03); box-shadow: 0 0 0 4px rgba(238, 185, 45, 0.38), 0 4px 14px rgba(46, 125, 50, 0.28); }
  100% { transform: scale(1); box-shadow: 0 2px 10px rgba(212, 155, 36, 0.28); }
}

@keyframes cmLedgerBonusHalo {
  0%, 100% { box-shadow: 0 2px 8px rgba(212, 155, 36, 0.24); }
  50% { box-shadow: 0 0 12px rgba(238, 185, 45, 0.48), 0 2px 8px rgba(46, 125, 50, 0.22); }
}

@keyframes cmLedgerBonusSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(130%); }
}

@keyframes cmBonusSparkleTwinkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.24) rotate(14deg); }
}

#hud-cash-pill.is-cash-credited {
  animation: cmHudCashCredit 0.9s cubic-bezier(0.22, 1.3, 0.36, 1) 1;
}

@keyframes cmHudCashCredit {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.12); filter: brightness(1.18) drop-shadow(0 0 10px rgba(242, 193, 78, 0.75)); }
  100% { transform: scale(1); filter: brightness(1); }
}

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

/* BOUTIQUE SHOP GRID */
.cm-shop-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 10px 6px;
}

.cm-shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  gap: 6px;
  padding: 24px 10px 10px 10px;
  border-radius: 16px;
  background: #FFFDF7;
  border: 2.5px solid var(--wood-oak);
}

.cm-shop-card.is-featured {
  background: linear-gradient(180deg, #FFFDF7 0%, #FFF3D6 100%);
  border-color: #D69830;
}

.cm-shop-badge {
  position: absolute;
  top: 5px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #5A3E36;
  color: #FFFDF7;
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.25;
  z-index: 4;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-staff-avatar {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 9px;
  background: var(--bg-warm);
  border: 1.5px solid var(--wood-tan);
  flex-shrink: 0;
}

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

.cm-shop-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-deep);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-shop-desc {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cm-shop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 2px solid var(--wood-sand);
  flex-wrap: wrap;
}

.cm-giftcode-box,
.cm-shop-util-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* SETTINGS */
.cm-settings-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 2px 2px 6px 2px;
}

.cm-setting-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-setting-row.cm-vault-status-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.cm-vol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cm-setting-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.cm-chk-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 10px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
  font-size: 12px;
  cursor: pointer;
  min-width: 0;
}

.cm-chk-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* GUIDE & CHEST REVEAL */
.cm-guide-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.cm-guide-art,
.cm-chest-hero-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.cm-guide-body {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.45;
  text-align: center;
  color: var(--ink-deep);
}

.cm-chest-modal {
  align-items: center;
  text-align: center;
}

.cm-chest-rewards-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cm-chest-reward-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--gold-warm);
  font-size: 12.5px;
}

.cm-chest-reward-item img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

/* TUTORIAL COACHMARK */
.cm-tut-overlay {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 4500;
  max-width: min(440px, 92vw);
  pointer-events: auto;
}

.cm-tut-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-tut-avatar {
  width: 64px;
  height: 86px;
  object-fit: contain;
  flex-shrink: 0;
}

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

.cm-tut-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-muted);
}

.cm-tut-body p {
  margin: 4px 0 8px 0;
  font-size: 12.5px;
  line-height: 1.35;
}

.cm-tut-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.cm-tut-focus {
  outline: 3px solid var(--gold-warm) !important;
  outline-offset: -2px;
}

/* FLYING BEZIER CURRENCY & CUT-IN OVERLAY */
.cm-fly-coin {
  position: fixed;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  object-fit: contain;
  pointer-events: none;
  z-index: 9200;
}

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

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

/* PREVIEW DEBUG PILL & PANEL (`!window.__MS_RELEASE__` ONLY) */
.cm-debug-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 6px;
  z-index: 9800;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--ink-cocoa);
  background: rgba(255, 244, 210, 0.92);
  color: var(--ink-deep);
  font-family: var(--font-lcd);
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}

.cm-debug-panel {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 34px;
  z-index: 9800;
  width: 270px;
  padding: 10px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2.5px solid var(--ink-cocoa);
  box-shadow: 0 8px 24px rgba(62, 39, 32, 0.3);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cm-debug-panel h4 {
  margin: 0 0 4px 0;
  font-size: 12px;
  font-family: var(--font-lcd);
}

/* COMPACT 1280x720 / 1366x768 DESKTOP FIT (0px OFFSCREEN & 0 OVERFLOW) */
@media (max-width: 1440px) {
  .cm-top-ribbon {
    padding: 0 8px;
    gap: 4px;
  }
  .cm-ribbon-left,
  .cm-ribbon-right {
    gap: 4px;
  }
  .cm-shop-badge-pill {
    max-width: 185px;
    padding: 3px 8px 3px 4px;
    gap: 4px;
  }
  .cm-shop-name-lbl {
    font-size: 12px;
  }
  .cm-pill {
    padding: 3px 6px;
    font-size: 11.5px;
    gap: 4px;
  }
  .cm-currency-pill {
    font-size: 12px;
  }
  .cm-pill-btn {
    padding: 4px 7px;
    font-size: 11px;
  }
  .cm-hud-btn {
    padding: 4px 6px;
    font-size: 11px;
    gap: 3px;
  }
  .cm-hud-btn .cm-icon-sm,
  .cm-hud-btn .cm-svg-icon {
    width: 16px;
    height: 16px;
  }
  .cm-hud-icon-btn {
    width: 30px;
    height: 30px;
  }
}

/* RESPONSIVE NARROW WINDOW STACK (`<= 900px`) */
@media (max-width: 900px) {
  html, body, .cm-workbench {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }
  .cm-top-ribbon {
    height: auto;
    flex-wrap: wrap;
    padding: 6px 10px;
  }
  .cm-columns-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cm-center-stage {
    order: -1;
    min-height: 400px;
  }
  .cm-shop-grid,
  .cm-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ========================================================================= */
/* SEASONS 2–4 UI, CLEAN PHOTO MODE & VILLAGE HUB (`v2.1 → v5.0`)            */
/* ========================================================================= */

.cm-theme-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.cm-tiny-select {
  min-width: 0;
  width: 100%;
  height: 26px;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 9px;
}

.cm-carton-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cm-stockout-pill {
  background: #FFE2DC;
  border-color: #9E4238;
  color: #5C1F19;
}

.cm-pilferer-pill {
  background: linear-gradient(180deg, #FF6B5B 0%, #E03D31 100%);
  border-color: #FFF9EE;
  color: #FFF9EE;
  font-weight: 800;
  animation: cmBadgePulse 0.9s ease-in-out infinite;
}

.cm-btn-confirm-warn {
  background: linear-gradient(180deg, #FFD666 0%, #F0A92E 100%) !important;
  border-color: #7A4310 !important;
  color: #3E2109 !important;
}

.cm-photo-bar {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(253, 246, 227, 0.94);
  border: 2px solid var(--ink-cocoa);
  box-shadow: 0 4px 14px rgba(62, 39, 32, 0.25);
}

body.is-photo-mode .cm-top-ribbon,
body.is-photo-mode #left-rail-panel,
body.is-photo-mode #right-workbench-panel,
body.is-photo-mode #carton-tray-wrap,
body.is-photo-mode #shoplift-rail,
body.is-photo-mode .cm-diorama-widgets,
body.is-photo-mode .cm-debug-pill,
body.is-photo-mode #tutorial-overlay {
  display: none !important;
}

body.is-photo-mode .cm-columns-grid {
  grid-template-columns: minmax(0, 1fr);
  padding: 0;
  gap: 0;
}

body.is-photo-mode #center-stage-panel {
  border: none;
  border-radius: 0;
}

.cm-seasons-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 4px 10px 4px;
}

.cm-seasons-body .cm-cards-grid {
  flex: 0 0 auto;
  overflow: visible;
  padding: 2px;
  gap: 7px;
}

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

.cm-modal-subfilter {
  flex-shrink: 0;
  gap: 5px;
}

.cm-season-banner {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #F8ECCF 0%, #F2DFB4 100%);
  border: 2px solid var(--wood-tan);
}

.cm-season-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cm-pass-tier-lbl {
  font-size: 12.5px;
  color: var(--ink-deep);
}

.cm-shard-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  background: #F4C35E;
  border: 1.5px solid var(--ink-cocoa);
  color: var(--ink-deep);
  font-size: 11.5px;
  font-weight: 800;
}

.cm-pass-progress {
  height: 10px;
  border-radius: 999px;
  background: #E5D4B3;
  border: 1.5px solid var(--ink-cocoa);
  overflow: hidden;
}

.cm-pass-fill {
  height: 100%;
  background: linear-gradient(90deg, #83B84E 0%, #F0BE59 100%);
  border-radius: 999px;
}

.cm-pass-tiers-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.cm-pass-finales-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.cm-pass-tier-card {
  gap: 5px;
  padding: 6px 7px;
}

.cm-pass-tier-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cm-pass-tier-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
}

.cm-pass-finale-card {
  gap: 5px;
  padding: 6px 8px;
}

.cm-pass-header-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFFDF7 0%, #FFF5DC 100%);
  border: 2px solid var(--wood-tan);
}

.cm-pass-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cm-pass-season-pills,
.cm-pass-token-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

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

.cm-seasons-grid > * {
  min-width: 0;
  max-width: 100%;
}

.cm-board-table {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #FFFDF7;
  border: 2px solid var(--wood-oak);
}

.cm-board-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 8px;
  background: var(--bg-linen);
  font-size: 12px;
}

.cm-board-entry.is-you {
  background: #FFEAB3;
  border: 1.5px solid #C88A28;
  font-weight: 800;
}

.cm-hearts-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #E85D75;
  font-size: 12px;
}

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