/* =========================================================
   《巷口小舖》 — Stardew-inspired Taiwanese Convenience Store
   Palette: Warm Wood, Cream White, Mint Green, Brick Red
   ========================================================= */

:root {
  --wood-dark: #5c3a21;
  --wood-mid: #8b5a2b;
  --wood-warm: #c88a4b;
  --wood-light: #e2b47a;
  --cream: #fff6e5;
  --cream-mid: #f3e6ce;
  --cream-dark: #dfd0b5;
  --mint: #5bb89a;
  --mint-dark: #3d8c73;
  --mint-light: #a8e2ca;
  --brick: #c65445;
  --brick-dark: #943629;
  --brick-light: #e67e70;
  --ink: #3a241a;
  --ink-soft: #6c4c3a;
  --gold: #e9b44c;
  --screen-bg: #1e2d28;
  --screen-fg: #b8f2d8;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--wood-dark);
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
}

#game-root {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.force-landscape #game-root {
  width: 100vh;
  width: 100dvh;
  height: 100vw;
  height: 100dvw;
  transform-origin: top left;
  transform: rotate(90deg) translateY(-100%);
}

#webgl-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}

#game-canvas.grabbing {
  cursor: grabbing;
}

#game-canvas.pointer {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ---------- Corner HUD ---------- */
.hud-corner {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 45;
  pointer-events: none;
}

.hud-corner > * {
  pointer-events: auto;
}

#hud-top-left {
  top: 12px;
  left: 12px;
  flex-wrap: wrap;
}

#hud-top-right {
  top: 12px;
  right: 12px;
}

#hud-bottom-left {
  bottom: 14px;
  left: 14px;
}

#hud-bottom-right {
  top: 56px;
  right: 12px;
  bottom: auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.back-store-floating {
  position: absolute;
  top: 58px;
  left: 12px;
  z-index: 50;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 246, 229, 0.94);
  border: 2px solid #8b5a2b;
  box-shadow: 0 3px 10px rgba(45, 24, 14, 0.22), inset 0 1px 0 #ffffff;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  backdrop-filter: blur(4px);
}

.hud-day-text {
  color: var(--ink);
  font-weight: 800;
}

.hud-sep {
  color: #bfa07a;
  font-weight: 400;
  margin: 0 1px;
}

.hud-badge {
  background: var(--brick);
  color: var(--cream);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  border: 1.5px solid var(--brick-dark);
}

.hud-phase-tag {
  background: #e6f2e8;
  color: #285a50;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1.5px solid #285a50;
}

.hud-phase-tag.open {
  background: #ffe39e;
  color: #5c3a21;
  border-color: #b97848;
}

.hud-mono {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 14px;
  font-weight: 800;
}

.hud-money-pill {
  background: rgba(255, 246, 229, 0.95);
}

.hud-menu-wrap {
  position: relative;
}

.hud-menu-toggle {
  border-radius: 999px !important;
  border-width: 2px !important;
  border-color: #8b5a2b !important;
  background: rgba(255, 246, 229, 0.94) !important;
  box-shadow: 0 3px 10px rgba(45, 24, 14, 0.22) !important;
  padding: 5px 12px !important;
  font-size: 13px !important;
}

.hud-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 158px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 246, 229, 0.97);
  border: 2.5px solid #5c3a21;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(42, 22, 12, 0.32);
  z-index: 80;
}

.hud-menu-dropdown .hud-btn {
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  font-size: 13px;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--wood-dark);
}

.hud-menu-row {
  display: flex;
  gap: 6px;
}

.hud-menu-row .hud-btn {
  text-align: center;
}

.hud-menu-row #btn-sound {
  width: 44px;
  flex: 0 0 44px;
}

.hud-menu-row #btn-pause {
  flex: 1;
}

.hud-held-pill {
  background: #f8e4c4;
  border-color: var(--wood-mid);
}

.hud-queue-pill {
  cursor: pointer;
  background: var(--cream);
  transition: transform 0.1s ease;
}

.hud-queue-pill:hover {
  transform: translateY(-1px);
  background: #fff9ee;
}

.hud-queue-pill.urgent {
  background: #ffd9d2;
  border-color: var(--brick-dark);
  animation: pulse-soft 1.1s infinite;
}

@keyframes pulse-soft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.hud-btn, .action-btn, .mini-btn, .close-btn {
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  border: 3px solid var(--wood-dark);
  border-radius: 6px;
  box-shadow: 0 3px 0 var(--wood-dark);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.1s;
}

.hud-btn:active, .action-btn:active, .mini-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--wood-dark);
}

.hud-btn {
  background: var(--cream);
  color: var(--ink);
  padding: 7px 12px;
  font-size: 13px;
}

.hud-btn:hover {
  background: #ffffff;
}

.hud-btn.icon-only {
  padding: 7px 10px;
}

.mini-btn {
  padding: 2px 7px;
  font-size: 12px;
  background: var(--wood-light);
  color: var(--ink);
  border-width: 2px;
  box-shadow: 0 2px 0 var(--wood-dark);
}

.action-btn {
  padding: 9px 16px;
  font-size: 14px;
  color: var(--cream);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.action-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
}

.action-btn.mint {
  background: var(--mint);
  border-color: var(--mint-dark);
  box-shadow: 0 3px 0 var(--mint-dark);
}

.action-btn.mint:hover:not(:disabled) {
  background: #67c5a6;
}

.action-btn.brick {
  background: var(--brick);
  border-color: var(--brick-dark);
  box-shadow: 0 3px 0 var(--brick-dark);
}

.action-btn.brick:hover:not(:disabled) {
  background: #d46050;
}

.action-btn.wood {
  background: var(--wood-warm);
  border-color: var(--wood-dark);
  color: #fffaf0;
}

.action-btn.wood:hover:not(:disabled) {
  background: #d59759;
}

.full-width {
  width: 100%;
}

.layout-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: 0 3px 0 var(--wood-dark);
}

/* Keep the notice lane separate from the action row and hosting badge. */
#game-root #toast-container {
  top: max(76px, calc(env(safe-area-inset-top) + 66px));
  bottom: auto;
  width: min(56%, 32rem);
  max-height: 4.25rem;
  overflow: hidden;
  text-align: center;
}

.layout-hint {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0 4px;
}

.hud-alert {
  background: #ffe082;
  color: var(--ink);
  border: 3px solid var(--brick-dark);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 3px 0 var(--brick-dark);
  cursor: pointer;
  animation: pulse-soft 1.1s infinite;
}

/* ---------- Toast ---------- */
#toast-container {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 90;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: var(--cream);
  border: 3px solid var(--wood-warm);
  border-radius: 6px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
  animation: toast-in 0.18s ease-out;
}

.toast.good {
  background: #235c49;
  border-color: var(--mint-light);
}

.toast.warn {
  background: var(--brick-dark);
  border-color: #ffb8ac;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Overlays & Pixel Cards ---------- */
.overlay-panel, .closeup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(42, 26, 16, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 18px;
}

.pixel-card {
  background: var(--cream);
  border: 4px solid var(--wood-dark);
  border-radius: 10px;
  box-shadow: 0 8px 0 var(--wood-dark), 0 14px 32px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--wood-warm);
  color: var(--cream);
  padding: 10px 16px;
  border-bottom: 4px solid var(--wood-dark);
}

.card-header h2 {
  margin: 0;
  font-size: 18px;
  text-shadow: 0 2px 0 var(--wood-dark);
}

.close-btn {
  background: var(--brick);
  color: var(--cream);
  width: 32px;
  height: 32px;
  font-size: 16px;
  border-color: var(--brick-dark);
  box-shadow: 0 2px 0 var(--brick-dark);
}

.card-body {
  padding: 16px;
  overflow-y: auto;
}

.card-footer {
  padding: 12px 16px;
  background: var(--cream-mid);
  border-top: 3px solid var(--cream-dark);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Inventory Drawer ---------- */
.drawer-card {
  width: min(720px, 94vw);
}

.inv-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--wood-dark);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 2px dashed var(--wood-light);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.inv-item-card {
  background: #fffdf8;
  border: 3px solid var(--wood-light);
  border-radius: 8px;
  padding: 10px;
}

.inv-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.inv-item-name {
  font-weight: 800;
  font-size: 14px;
}

.inv-badge-fresh {
  display: inline-block;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #ffe1dc;
  color: var(--brick-dark);
  border: 1px solid var(--brick);
  font-weight: 700;
}

.inv-stat-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 3px;
}

.inv-stat-line strong {
  color: var(--ink);
}

/* ---------- Ordering Kiosk Close-up ---------- */
.kiosk-shell {
  width: min(920px, 95vw);
  max-height: 90vh;
  background: #4f635d;
  border: 5px solid var(--ink);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 10px 0 var(--ink), 0 18px 36px rgba(0, 0, 0, 0.5);
  display: flex;
}

.kiosk-bezel {
  flex: 1;
  background: var(--cream);
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kiosk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--mint-dark);
  color: var(--cream);
  padding: 10px 16px;
  border-bottom: 4px solid var(--ink);
}

.kiosk-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
}

.kiosk-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #9effc7;
  border: 2px solid var(--ink);
}

.kiosk-funds {
  font-size: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 10px;
  border-radius: 5px;
}

.kiosk-main {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 14px;
  padding: 14px;
  overflow-y: auto;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.order-product-card {
  background: #fffdf8;
  border: 3px solid var(--wood-mid);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-prod-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-prod-icon {
  width: 44px;
  height: 44px;
  border: 2px solid var(--wood-light);
  border-radius: 6px;
  background: var(--cream-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.order-prod-icon canvas {
  image-rendering: pixelated;
  width: 36px;
  height: 36px;
}

.order-prod-meta h4 {
  margin: 0;
  font-size: 15px;
}

.order-prod-price {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.order-prod-stock {
  font-size: 12px;
  background: var(--cream-mid);
  padding: 4px 7px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
}

.order-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.qty-btn {
  width: 30px;
  height: 30px;
  font-size: 17px;
  font-weight: 900;
  border: 2px solid var(--wood-dark);
  border-radius: 5px;
  background: var(--wood-light);
  color: var(--ink);
  cursor: pointer;
}

.qty-btn:hover {
  background: var(--wood-warm);
  color: var(--cream);
}

.qty-val {
  min-width: 24px;
  text-align: center;
  font-family: "Consolas", monospace;
  font-size: 16px;
  font-weight: 800;
}

.order-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-summary-box, .order-incoming-box {
  background: #fffdf8;
  border: 3px solid var(--wood-mid);
  border-radius: 8px;
  padding: 12px;
}

.order-summary-box h3, .order-incoming-box h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.order-cart-lines {
  font-size: 13px;
  color: var(--ink-soft);
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-cart-line {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 700;
}

.order-divider {
  border-top: 2px dashed var(--cream-dark);
  margin: 8px 0;
}

.order-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}

.text-brick {
  color: var(--brick-dark);
}

.incoming-list {
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 110px;
  overflow-y: auto;
}

.incoming-item {
  display: flex;
  justify-content: space-between;
  background: var(--cream-mid);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--ink);
  font-weight: 700;
}

.kiosk-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--cream-mid);
  border-top: 3px solid var(--cream-dark);
  padding: 10px 14px;
  gap: 10px;
}

.kiosk-tip {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ---------- Warehouse Close-up ---------- */
.warehouse-card {
  width: min(760px, 94vw);
}

.warehouse-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f5e9d2;
  border-bottom: 2px solid var(--cream-dark);
  font-size: 13px;
  font-weight: 700;
}

.warehouse-held-badge {
  background: var(--mint-light);
  border: 2px solid var(--mint-dark);
  border-radius: 5px;
  padding: 3px 9px;
  white-space: nowrap;
}

.warehouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
}

.wh-box-card {
  background: #fffdf8;
  border: 3px solid var(--wood-mid);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.wh-box-card.empty {
  opacity: 0.55;
}

.wh-box-icon {
  width: 64px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wh-box-icon canvas {
  image-rendering: pixelated;
  width: 56px;
  height: 56px;
}

.wh-count-pill {
  font-size: 12px;
  font-weight: 800;
  background: var(--cream-mid);
  padding: 3px 8px;
  border-radius: 10px;
}

/* ---------- Daily Report ---------- */
.report-card {
  width: min(680px, 94vw);
}

.report-kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.report-kpi {
  background: #fffdf8;
  border: 3px solid var(--wood-light);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.report-kpi-label {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

.report-kpi-val {
  font-family: "Consolas", monospace;
  font-size: 20px;
  font-weight: 900;
  margin-top: 4px;
}

.report-kpi-val.pos { color: var(--mint-dark); }
.report-kpi-val.neg { color: var(--brick-dark); }

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.report-table th, .report-table td {
  padding: 7px 8px;
  border-bottom: 2px solid var(--cream-dark);
  text-align: left;
}

.report-table th {
  background: var(--cream-mid);
  font-weight: 800;
}

.report-loss-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.report-loss-box {
  background: #fff3ef;
  border: 2px solid var(--brick-light);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.report-loss-box strong {
  display: block;
  font-size: 16px;
  color: var(--brick-dark);
  margin-top: 2px;
}

.report-advice {
  background: #eaf7f1;
  border: 2px solid var(--mint-dark);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

/* ---------- Pause Overlay ---------- */
.pause-card {
  width: min(360px, 90vw);
  padding: 20px;
  text-align: center;
}

.pause-card h2 {
  margin: 0 0 6px;
}

.pause-sub {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Title Screen ---------- */
.title-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 240, 200, 0.2), rgba(45, 26, 15, 0.85)),
    repeating-linear-gradient(
      90deg,
      #7c4c29 0px,
      #7c4c29 36px,
      #6e4222 36px,
      #6e4222 72px
    );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}

.title-card {
  width: min(580px, 94vw);
  background: var(--cream);
  border: 5px solid var(--wood-dark);
  border-radius: 12px;
  box-shadow: 0 10px 0 var(--wood-dark), 0 22px 44px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  text-align: center;
}

.title-awning {
  height: 28px;
  background: repeating-linear-gradient(
    90deg,
    var(--mint) 0px,
    var(--mint) 32px,
    var(--cream) 32px,
    var(--cream) 64px,
    var(--brick) 64px,
    var(--brick) 96px
  );
  border-bottom: 4px solid var(--wood-dark);
}

.title-sign {
  padding: 22px 24px 12px;
}

.title-sub-tag {
  display: inline-block;
  background: var(--mint-light);
  border: 2px solid var(--mint-dark);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.title-sign h1 {
  margin: 4px 0 10px;
  font-size: 38px;
  color: var(--brick-dark);
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 var(--wood-light);
}

.title-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  font-weight: 600;
}

.title-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 20px 14px;
}

.title-features span {
  background: var(--cream-mid);
  border: 2px solid var(--wood-light);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.title-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 6px 24px 16px;
}

.title-buttons .action-btn {
  font-size: 16px;
  padding: 12px 24px;
}

.title-controls-hint {
  background: var(--cream-mid);
  border-top: 3px solid var(--cream-dark);
  padding: 9px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

@media (max-width: 780px) {
  .kiosk-main {
    grid-template-columns: 1fr;
  }
  .order-grid {
    grid-template-columns: 1fr;
  }
  .hud-pill {
    padding: 4px 8px;
    font-size: 12px;
  }
  .action-btn {
    padding: 7px 11px;
    font-size: 12px;
  }
}

/* ---------- Staff Wardrobe & Title Chibi Picker ---------- */
.wardrobe-card {
  width: min(740px, 94vw);
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
}

.skin-card {
  background: #fffdf8;
  border: 3px solid var(--wood-light);
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease, background 0.1s ease;
}

.skin-card:hover {
  transform: translateY(-2px);
  border-color: var(--wood-mid);
  background: #fff7e8;
}

.skin-card.selected {
  border-color: var(--brick);
  background: #fff1dc;
  box-shadow: 0 3px 0 var(--brick-dark);
}

.skin-card canvas {
  image-rendering: pixelated;
  width: 72px;
  height: 86px;
}

.skin-card-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--cream-mid);
  padding: 2px 10px;
  border-radius: 10px;
}

.skin-card.selected .skin-card-name {
  background: var(--brick);
  color: var(--cream);
}

.title-skin-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 0 12px;
}

.title-skin-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--cream-mid);
  border: 3px solid var(--wood-mid);
  border-radius: 10px;
  padding: 6px 18px 8px;
  min-width: 128px;
}

#title-skin-canvas {
  image-rendering: pixelated;
  width: 76px;
  height: 92px;
}

.title-skin-label {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 800;
  background: var(--wood-warm);
  color: var(--cream);
  padding: 2px 10px;
  border-radius: 10px;
}

@media (max-width: 680px) {
  .wardrobe-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Handheld PDA, Upgrades & Delivery App Packing ---------- */
.pda-btn {
  background: #dff7ee;
  border-color: var(--mint-dark);
}

.pda-btn:hover {
  background: #c5efe0;
}

.pda-shell {
  border-radius: 18px;
  background: #33453f;
  border-width: 6px;
}

.pda-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 14px 0;
  background: var(--cream-mid);
  border-bottom: 3px solid var(--cream-dark);
}

.pda-tab {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 7px 14px;
  border: 3px solid var(--wood-dark);
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: var(--cream-dark);
  color: var(--ink-soft);
  cursor: pointer;
}

.pda-tab.active {
  background: var(--cream);
  color: var(--ink);
  transform: translateY(3px);
}

.delivery-app-alert {
  background: #b9f0d9;
  border-color: var(--mint-dark);
  box-shadow: 0 3px 0 var(--mint-dark);
}

.upgrade-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px dashed var(--cream-dark);
}

.upgrade-tab {
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  padding: 6px 12px;
  border: 2.5px solid var(--wood-dark);
  border-radius: 8px;
  background: var(--cream-mid);
  color: var(--ink-soft);
  cursor: pointer;
}

.upgrade-tab.active {
  background: var(--brick);
  color: var(--cream);
  border-color: var(--brick-dark);
  box-shadow: 0 2px 0 var(--brick-dark);
}

.upgrade-list, .delivery-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upgrade-card, .delivery-order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fffdf8;
  border: 3px solid var(--wood-mid);
  border-radius: 8px;
  padding: 12px 14px;
}

.upgrade-card.owned {
  background: #eaf7f1;
  border-color: var(--mint-dark);
}

.upgrade-info {
  min-width: 0;
  flex: 1;
}

.upgrade-info h4, .delivery-order-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.upgrade-info p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.order-prod-meta, .order-product-card, .wh-box-card, .inv-item-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inv-badge-chill {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  background: #d8f4ee;
  color: #1f6b54;
  border: 1.5px solid #3d8c73;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ---------- Store Background & 3D Decor Customizer ---------- */
.decor-section {
  margin-bottom: 16px;
}

.decor-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--wood-dark);
  border-bottom: 2px dashed var(--cream-dark);
  padding-bottom: 4px;
}

.decor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.decor-card {
  background: #fffdf8;
  border: 3px solid var(--wood-light);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.decor-card:hover {
  transform: translateY(-2px);
  border-color: var(--wood-mid);
}

.decor-card.active {
  border-color: var(--mint-dark);
  background: #e6f7f0;
  box-shadow: 0 3px 0 var(--mint-dark);
}

.decor-swatch {
  width: 100%;
  height: 26px;
  border-radius: 5px;
  border: 2px solid var(--wood-dark);
}

/* ---------- Mobile Portrait Prompt & Landscape Fullscreen Optimization ---------- */
.portrait-hint {
  position: absolute;
  inset: 0;
  z-index: 95;
  background: rgba(45, 26, 15, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.portrait-hint-card {
  width: min(340px, 92%);
  background: var(--cream);
  border: 4px solid var(--wood-dark);
  border-radius: 12px;
  box-shadow: 0 8px 0 var(--wood-dark);
  padding: 20px 18px;
  text-align: center;
}

.portrait-hint-icon {
  font-size: 38px;
  margin-bottom: 6px;
}

.portrait-hint-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--brick-dark);
}

.portrait-hint-card p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 700;
}

.portrait-hint-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-buttons {
  flex-wrap: wrap;
}

@media (max-height: 520px), (max-width: 900px) {
  #hud-top-left {
    top: max(6px, env(safe-area-inset-top));
    left: max(6px, env(safe-area-inset-left));
    gap: 4px;
  }
  #hud-top-right {
    top: max(6px, env(safe-area-inset-top));
    right: max(6px, env(safe-area-inset-right));
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 60%;
  }
  #hud-bottom-left {
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    left: max(12px, calc(env(safe-area-inset-left) + 6px));
    gap: 6px;
  }
  #hud-bottom-right {
    bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
    right: max(14px, calc(env(safe-area-inset-right) + 8px));
    gap: 6px;
  }
  .back-store-floating {
    top: max(42px, calc(env(safe-area-inset-top) + 38px));
    left: max(8px, env(safe-area-inset-left));
    padding: 7px 14px;
    font-size: 13px;
  }
  .hud-pill { padding: 3px 6px; font-size: 11px; border-width: 2px; }
  .hud-mono { font-size: 11px; }
  .hud-badge, .hud-phase-tag { font-size: 10px; padding: 1px 5px; }
  .hud-btn { padding: 4px 6px; font-size: 11px; border-width: 2px; }
  .action-btn { padding: 6px 10px; font-size: 12px; border-width: 2px; }
  .title-overlay { padding: 8px; }
  .title-card { max-height: 94%; overflow-y: auto; }
  .title-awning { height: 14px; }
  .title-sign { padding: 8px 14px 4px; }
  .title-sub-tag { font-size: 10px; margin-bottom: 2px; }
  .title-sign h1 { font-size: 22px; margin: 2px 0 4px; }
  .title-skin-bar { margin: 4px 0 6px; }
  .title-skin-preview { padding: 3px 12px 4px; min-width: 102px; }
  #title-skin-canvas { width: 48px; height: 58px; }
  .title-desc { font-size: 12px; line-height: 1.4; }
  .title-features { padding: 4px 12px 6px; gap: 5px; }
  .title-features span { font-size: 11px; padding: 2px 7px; }
  .title-buttons { padding: 4px 12px 8px; gap: 8px; }
  .title-buttons .action-btn { font-size: 13px; padding: 7px 14px; }
  .title-controls-hint { padding: 5px 10px; font-size: 11px; }
}

body.force-landscape #hud-top-left { top: 8px; left: 10px; gap: 4px; }
body.force-landscape #hud-top-right { top: 8px; right: 14px; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
body.force-landscape #hud-bottom-left { bottom: 20px; left: 12px; gap: 6px; }
body.force-landscape #hud-bottom-right { bottom: 20px; right: 20px; gap: 6px; }
body.force-landscape .back-store-floating { top: 44px; left: 10px; padding: 7px 14px; font-size: 13px; }
body.force-landscape .hud-pill { padding: 3px 6px; font-size: 11px; border-width: 2px; }
body.force-landscape .hud-btn { padding: 4px 6px; font-size: 11px; border-width: 2px; }
body.force-landscape .title-card { max-height: 94%; overflow-y: auto; }
body.force-landscape .title-awning { height: 14px; }
body.force-landscape .title-sign { padding: 8px 14px 4px; }
body.force-landscape .title-sign h1 { font-size: 22px; margin: 2px 0 4px; }
body.force-landscape #title-skin-canvas { width: 48px; height: 58px; }
body.force-landscape .title-buttons .action-btn { font-size: 13px; padding: 7px 14px; }

/* ---------- Ops Center & Locker Grid (A-G Full Features) ---------- */
.ops-banner {
  background: #fff3d6;
  border: 2px solid #c88a4b;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
  color: #3a241a;
}

.ops-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}

.ops-card {
  background: #fffdf8;
  border: 2px solid #d4b48c;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.1s;
}

.ops-card:hover {
  border-color: #8b5a2b;
}

.ops-card.selected {
  background: #eaf8f2;
  border-color: #285A50;
  box-shadow: inset 0 0 0 1px #285A50;
}

.ops-card p {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6c4c3a;
}

.locker-grid {
  display: grid;
  grid-template-columns: repeat(var(--parcel-columns), minmax(0, 1fr));
  gap: 8px;
}

.locker-cell {
  background: #f4e3c3;
  border: 3px solid #285A50;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  min-height: 92px;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.locker-cell.occupied {
  background: #fff8e6;
  box-shadow: 0 3px 0 #1c423a;
}

.locker-cell.occupied:hover {
  transform: translateY(-2px);
  background: #ffe9b8;
}

.locker-cell.empty {
  opacity: 0.65;
  cursor: default;
}

.locker-num {
  font-size: 11px;
  font-weight: 800;
  color: #285A50;
}

.locker-code {
  font-family: Consolas, monospace;
  font-size: 20px;
  font-weight: 900;
  color: #c65445;
  margin: 3px 0;
}

/* ---------- Compact Mobile Landscape Title Screen (Zero Vertical Scrolling!) ---------- */
@media (max-height: 540px) {
  .title-card {
    max-width: min(760px, 94vw);
    max-height: 92vh;
    padding: 12px 18px !important;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 10px 18px;
    align-items: center;
    overflow: hidden;
  }
  .title-hero {
    margin: 0 !important;
  }
  .title-logo {
    font-size: 26px !important;
    margin-bottom: 4px !important;
  }
  .title-sub {
    font-size: 12px !important;
    margin-bottom: 6px !important;
  }
  .title-skin-picker {
    margin: 4px auto !important;
    padding: 4px 10px !important;
  }
  .title-skin-preview canvas {
    width: 60px !important;
    height: 72px !important;
  }
  .title-awning-bar,
  .title-desc,
  .title-features {
    display: none !important;
  }
  .title-buttons {
    grid-column: 2;
    grid-row: 1;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 10px !important;
  }
  .title-buttons .action-btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }
  .title-controls-hint {
    grid-column: 1 / -1;
    font-size: 11px !important;
    margin-top: 2px !important;
  }
}

body.force-landscape .title-card {
  max-width: min(760px, 94dvh);
  max-height: 92dvw;
  padding: 12px 18px !important;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 8px 16px;
  align-items: center;
  overflow: hidden;
}
body.force-landscape .title-desc {
  display: none !important;
}
body.force-landscape .title-skin-preview canvas {
  width: 60px !important;
  height: 72px !important;
}
body.force-landscape .title-buttons .action-btn {
  padding: 8px 14px !important;
  font-size: 13px !important;
}

/* ---------- Visual Icon-Tile Upgrade Shop Grid ---------- */
.upgrade-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
}

.upgrade-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 12px 8px;
  background: #fffdf8;
  border: 2.5px solid #8b5a2b;
  border-radius: 10px;
  box-shadow: 0 3px 0 #5c3a21;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease, background 0.1s;
}

.upgrade-tile:hover {
  transform: translateY(-2px);
  background: #fff4dd;
}

.upgrade-tile.owned {
  background: #eaf7f1;
  border-color: #285A50;
}

.upgrade-tile-icon {
  font-size: 34px;
  line-height: 1;
}

.upgrade-tile-name {
  font-size: 12px;
  font-weight: 800;
  color: #3a241a;
  text-align: center;
}

.upgrade-tile-price {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #c65445;
  color: #fff6e5;
}

.upgrade-tile-price.owned {
  background: #285A50;
}

.upgrade-detail-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #fffaf0;
  border: 3px solid #8b5a2b;
  border-radius: 12px;
  padding: 18px;
  flex-wrap: wrap;
}

.upgrade-detail-icon {
  font-size: 56px;
  width: 92px;
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4e3c3;
  border: 3px solid #5c3a21;
  border-radius: 14px;
  flex-shrink: 0;
}

.upgrade-detail-body {
  flex: 1;
  min-width: 220px;
}

.upgrade-detail-body h3 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #3a241a;
}

.upgrade-detail-body p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #5c3a21;
}

.upgrade-detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Airy Compact Mobile Landscape HUD (More Breathing Room!) ---------- */
@media (max-height: 520px), (max-width: 900px) {
  #hud-top-left { top: 6px; left: 8px; gap: 5px; }
  #hud-top-right { top: 6px; right: 8px; gap: 5px; }
  #hud-bottom-left { bottom: 8px; left: 8px; gap: 6px; }
  #hud-bottom-right { top: 42px; right: 8px; }
  .back-store-floating { top: 42px; left: 8px; padding: 5px 10px !important; font-size: 12px !important; }
  .hud-pill { padding: 3px 9px; font-size: 11px; gap: 4px; }
  .hud-mono { font-size: 12px; }
  .hud-phase-tag { font-size: 10px; padding: 1px 6px; }
  .hud-menu-toggle { padding: 3px 10px !important; font-size: 11px !important; }
  #hud-bottom-left .action-btn { padding: 6px 11px; font-size: 12px; }
}

/* ---------- Full-Bleed Illustrated Key-Art Start Screen ---------- */
.title-overlay.title-keyart-mode {
  background: #3b2418 url('assets/title-bg.jpg') center center / cover no-repeat !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.title-keyart-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.title-top-pill {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255, 246, 229, 0.92);
  color: #3a241a;
  border: 2.5px solid #5c3a21;
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(42, 20, 10, 0.35);
}

.title-skin-float {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 246, 229, 0.90);
  border: 2.5px solid #5c3a21;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(42, 20, 10, 0.38);
  backdrop-filter: blur(3px);
}

.title-skin-float .title-skin-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.title-skin-float .title-skin-label {
  font-size: 11px;
  font-weight: 800;
  color: #3a241a;
  background: #f0d7b0;
  padding: 1px 7px;
  border-radius: 999px;
}

.title-cta-bar {
  position: absolute;
  left: 50%;
  bottom: 2.2%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.title-wood-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 245px;
  padding: 13px 30px;
  font-family: inherit;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff8ea;
  background: linear-gradient(180deg, #8b5630 0%, #6d3f20 100%);
  border: 4px solid #fff5de;
  border-radius: 16px;
  box-shadow: 0 0 0 3px #4b2a16, 0 6px 16px rgba(34, 16, 8, 0.55);
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.12s ease;
}

.title-wood-btn:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.08);
}

.title-wood-btn:active {
  transform: translateY(2px) scale(0.99);
}

.title-wood-btn.continue {
  min-width: 175px;
  font-size: 18px;
  padding: 13px 22px;
  background: linear-gradient(180deg, #3c8a73 0%, #285A50 100%);
}

.title-wood-btn .cta-arrow {
  color: #f7c96e;
  font-size: 18px;
}

@media (max-height: 520px), (max-width: 900px) {
  .title-top-pill { top: 8px; right: 10px; padding: 4px 10px; font-size: 11px; }
  .title-skin-float { left: 10px; bottom: 10px; padding: 4px 7px; }
  .title-skin-float canvas { width: 48px !important; height: 58px !important; }
  .title-cta-bar { bottom: 1.5%; gap: 8px; }
  .title-wood-btn { min-width: 215px; padding: 9px 22px; font-size: 16px; gap: 10px; border-width: 3px; }
  .title-wood-btn.continue { min-width: 130px; padding: 8px 14px; font-size: 14px; }
}

/* Mobile usability and the hosting badge's bottom-right safe zone. */
#game-root #hud-bottom-left {
  left: max(8px, env(safe-area-inset-left));
  bottom: max(10px, env(safe-area-inset-bottom));
  max-width: calc(100% - 185px - env(safe-area-inset-left));
  flex-wrap: wrap;
}
#game-root #hud-bottom-right {
  top: max(55px, calc(env(safe-area-inset-top) + 48px));
  right: max(8px, env(safe-area-inset-right));
  bottom: auto;
}
#layout-toolbar { flex-wrap: wrap; max-width: 100%; }
#layout-selected-label { flex: 1 1 100%; min-width: 0; }
#game-root .overlay-panel, #game-root .closeup-overlay {
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(64px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  z-index: 55;
}
#game-root .pixel-card, #game-root .kiosk-shell { max-width: 100%; max-height: 100%; min-height: 0; }
#game-root .card-header, #game-root .card-footer, #game-root .kiosk-header,
#game-root .kiosk-footer, #game-root .pda-tabs { flex: 0 0 auto; }
#game-root .card-body, #game-root .kiosk-main, #game-root .wardrobe-grid {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
#game-root .kiosk-bezel { min-width: 0; min-height: 0; }
#game-root .kiosk-footer #btn-confirm-order, #game-root .kiosk-footer #btn-close-order {
  flex: 0 0 auto;
  white-space: nowrap;
}
#game-root .kiosk-main > *, #game-root .order-grid > * { min-width: 0; }
#game-root .hud-menu-dropdown {
  max-height: calc(100dvh - 118px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
body.force-landscape #game-root .hud-menu-dropdown { max-height: calc(100dvw - 118px); }
@media (max-height: 520px), (max-width: 900px) {
  #game-root .action-btn, #game-root .close-btn, #game-root .qty-btn,
  #game-root .pda-tab { min-height: 44px; }
  #game-root .close-btn, #game-root .qty-btn { min-width: 44px; }
  #game-root .kiosk-main { gap: 8px; padding: 8px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  #game-root .order-grid { grid-template-columns: minmax(0, 1fr); }
  #game-root .kiosk-header, #game-root .card-header, #game-root .card-footer { padding: 5px 9px; }
  #game-root .kiosk-footer { padding: 5px 9px; }
  #game-root .kiosk-footer { justify-content: flex-end; gap: 8px; }
  #game-root .kiosk-tip { display: none; }
}
@media (max-width: 560px) and (orientation: portrait) {
  body:not(.force-landscape) #game-root #hud-bottom-left {
    max-width: calc(100% - 24px);
    bottom: max(64px, calc(env(safe-area-inset-bottom) + 50px));
  }
  body:not(.force-landscape) #game-root .kiosk-main { grid-template-columns: minmax(0, 1fr); }
  body:not(.force-landscape) #game-root .kiosk-brand { font-size: 12px; }
  body:not(.force-landscape) #game-root .kiosk-funds { display: flex; align-items: center; gap: 4px; }
}

/* B art direction, first pass for folders and hands-on work surfaces. */
#btn-landscape[hidden], #btn-title-landscape[hidden] { display: none !important; }
#drawer-upgrades .pixel-card, #drawer-minigame .pixel-card, #drawer-delivery .pixel-card {
  background: #f5f1e8;
  border-color: #244a3d;
  color: #24312c;
  box-shadow: 0 8px #244a3d, 0 14px 34px #24312c56;
}
#drawer-upgrades .card-header, #drawer-minigame .card-header, #drawer-delivery .card-header {
  background: #244a3d; border-color: #a8b9a3; color: #f5f1e8;
}
#drawer-upgrades .upgrade-tabs {
  display: flex; align-items: end; flex-wrap: nowrap; overflow-x: auto;
  padding: 5px 2px 2px; margin-bottom: 12px; border-bottom: 2px solid #a8b9a3;
}
#drawer-upgrades .upgrade-folder {
  position: relative; flex: 0 0 auto; min-height: 44px; white-space: nowrap;
  background: #e6dbc6; border: 2px solid #829883; border-radius: 8px 8px 0 0;
  color: #244a3d; box-shadow: none;
}
#drawer-upgrades .upgrade-folder.active { background: #244a3d; color: #fff9ee; border-color: #244a3d; }
#drawer-upgrades .upgrade-tile { border-color: #9cae97; background: #fffaf1; box-shadow: 0 3px #a8b9a3; }
#drawer-upgrades .upgrade-tile.owned { background: #dce9dd; border-color: #6c9280; }
.packing-item, .packing-bag {
  position: relative; padding: 10px 12px; border: 2px solid #829883;
  border-radius: 8px; background: #f5f1e8; color: #24312c; font-weight: 700;
}
.packing-item { touch-action: none; cursor: grab; }
.packing-item:active { cursor: grabbing; }
.packing-bag { min-height: 48px; border: 2px dashed #6f8b75; background: #e6d7b8; }
.packing-bag[data-bin="bottle"] { background: #deebdc; }
.packing-bag[data-bin="box"] { background: #f3ddd2; }
.trash-piece { max-width: max-content; margin: 0 auto 10px; }

#hud-top-right .hud-store-shortcut { white-space: nowrap; min-height: 36px; }
#btn-handheld-pda { background: #244a3d; color: #fff9eb; border-color: #183b30; }
#btn-go-warehouse { background: #e6eadb; color: #244a3d; }
@media (max-height: 520px), (max-width: 900px) {
  #hud-top-right .hud-store-shortcut { min-height: 44px; padding-inline: 9px; }
}

/* Original monochrome controls and the B art palette. */
#game-root button[data-shop-icon]::before {
  content: ''; display: inline-block; width: 1em; height: 1em;
  margin-inline-end: .34em; vertical-align: -.12em;
  background: currentColor;
  -webkit-mask: var(--shop-icon) center / contain no-repeat;
  mask: var(--shop-icon) center / contain no-repeat;
}
#game-root button.close-btn[data-shop-icon]::before,
#btn-sound[data-shop-icon]::before,
#btn-title-skin-prev[data-shop-icon]::before,
#btn-title-skin-next[data-shop-icon]::before { margin-inline-end: 0; }
#game-root .upgrade-tile[data-shop-icon]::before { display: block; width: 27px; height: 27px; margin: 0 auto 8px; color: #244a3d; }
#game-root .upgrade-tile-icon:empty { display: none; }
#game-root .hud-pill, #game-root .hud-menu-toggle { background: #f5f1e8; color: #24312c; border-color: #829883; }
#game-root #btn-go-warehouse { background: #edf0e5; color: #244a3d; }
#game-root .hud-icon[aria-hidden=true] {
  display: inline-block; width: 1em; height: 1em; background: currentColor;
  -webkit-mask: var(--shop-icon) center / contain no-repeat;
  mask: var(--shop-icon) center / contain no-repeat;
}

/* Use one measured viewport for the two canvases and the DOM. */
#game-root, body.force-landscape #game-root {
  width: var(--game-width, 100dvw); height: var(--game-height, 100dvh);
}
body.ios-webkit #game-root { transform: none; }
#game-root .hud-pill, #game-root .title-skin-float {
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
#native-landscape-gate[hidden] { display:none; }
#native-landscape-gate {
  position:fixed; inset:0; z-index:200; display:grid; place-content:center; gap:.6rem;
  text-align:center; background:#244a3d; color:#f5f1e8;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#native-landscape-gate strong { font-size:1.6rem; }
body.ios-webkit #game-root #hud-top-left { left:max(8px,env(safe-area-inset-left)); top:max(8px,env(safe-area-inset-top)); }
body.ios-webkit #game-root #hud-top-right { right:max(8px,env(safe-area-inset-right)); top:max(8px,env(safe-area-inset-top)); }

#game-root #view-order .kiosk-header { padding:5px 12px; border-bottom-width:2px; }
#game-root #view-order .pda-tabs { padding-block:2px; }
#game-root #view-order .kiosk-main { flex:1; min-height:0; }
#game-root #view-order .kiosk-footer { display:flex; align-items:center; gap:8px; }
.order-footer-total { margin-right:auto; white-space:nowrap; }
.order-footer-total output { color:#244a3d; }
@media (orientation:landscape), (min-width:761px) {
  #game-root #view-order .kiosk-main { overflow:hidden; grid-template-rows:minmax(0,1fr); }
  #game-root #view-order .order-grid, #game-root #view-order .order-sidebar {
    min-height:0; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; align-content:start;
  }
}
body.force-landscape #game-root #view-order .kiosk-main { overflow:hidden; grid-template-rows:minmax(0,1fr); }
body.force-landscape #game-root #view-order .order-grid,
body.force-landscape #game-root #view-order .order-sidebar { min-height:0; overflow:auto; touch-action:pan-y; align-content:start; }

#game-root #drawer-minigame.coffee-view {
  background:#d9e1d5; padding:max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right))
  max(54px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
}
#drawer-minigame.coffee-view .pixel-card {
  width:min(820px,100%); border:1px solid #829883; box-shadow:0 9px 24px #24312c27;
}
#drawer-minigame.coffee-view .card-header { border:0; padding:4px 9px 4px 14px; }
#drawer-minigame.coffee-view .card-body {
  display:grid; grid-template-columns:minmax(180px,1fr) minmax(145px,.72fr);
  min-height:0; gap:10px; padding:8px;
}
.coffee-bench {
  display:grid; place-items:center; min-height:140px; height:clamp(140px,46dvh,290px);
  background:linear-gradient(#e8e8de 0 72%,#c9a783 72% 79%,#d7b58b 79%); border-radius:6px;
}
.coffee-step { align-self:center; min-width:0; color:#24312c; }
.coffee-step button { min-height:44px; touch-action:none; width:100%; }
.coffee-meter { position:relative; margin:6px 0; height:27px; border:1px solid #829883; background:linear-gradient(90deg,#e4dfd0 75%,#a8b9a3 75% 95%,#e4dfd0 95%); }
.coffee-meter[hidden] { display:none; }
.coffee-meter span { display:block; height:100%; background:#85634888; width:0; }
.coffee-meter output { position:absolute; inset:0; text-align:center; line-height:25px; font-weight:700; }
body.force-landscape .coffee-bench { height:clamp(140px,46dvw,290px); }
@media(max-height:390px) { .coffee-step p { margin:3px 0; font-size:13px; } }

#game-root .title-overlay.title-keyart-mode {
  background:#24312c !important;
}
.title-pack-backdrop { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:cover; pointer-events:none; }
.title-project-sign { position:absolute; left:max(16px,7%,env(safe-area-inset-left)); top:max(14px,14%,env(safe-area-inset-top)); color:#244a3d; background:#f5f1e8; padding:clamp(8px,2vmin,18px); border-radius:10px; }
.title-project-sign h1 { margin:0; font-size:clamp(32px,7vmin,71px); letter-spacing:.08em; }
.title-project-sign img { display:block; width:clamp(110px,19vw,250px); max-width:53vw; height:auto; }
.pack-icon, .pack-order-button::before, .pack-warehouse-button::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  vertical-align: middle;
  background: url('assets/art-b/brand/ui_icons_atlas_2x.png') no-repeat;
  background-size: 90px 90px;
  image-rendering: pixelated;
}
.pack-time { background-position: -18px 0; }
.pack-date { background-position: -36px 0; }
.pack-cashier { background-position: -36px -18px; }
.pack-order-button::before { margin-right: 3px; background-position: -18px -18px; }
.pack-warehouse-button::before { margin-right: 3px; background-position: 0 -18px; }
#game-root .title-wood-btn, #game-root .title-wood-btn.continue {
  min-width:0; padding:8px 15px; min-height:44px; gap:5px;
  background:#244a3d; border:1px solid #c2d0b7; box-shadow:0 4px 12px #24312c40;
  letter-spacing:0; font-size:clamp(14px,2.5vmin,19px);
}
#game-root .title-wood-btn.start {
  background:#a15b41;
  width:clamp(108px,16vw,205px);
  min-height:clamp(50px,9vmin,70px);
  justify-content:center;
  font-size:clamp(18px,3.3vmin,26px);
}
#game-root .title-wood-btn.continue {
  position:absolute;
  top:50%;
  right:calc(100% + clamp(6px,1.4vw,16px));
  transform:translateY(-50%);
  width:clamp(92px,14vw,176px);
  justify-content:center;
  font-size:clamp(14px,2.8vmin,22px);
  padding-inline:5px;
}
.title-wood-btn .cta-arrow { display:none; }
#game-root .title-cta-bar {
  left:50%;
  right:auto;
  bottom:max(44px,9%,calc(env(safe-area-inset-bottom) + 16px));
  transform:translateX(-50%);
}
#save-status {
  position: absolute;
  z-index: 120;
  left: 50%;
  bottom: max(8px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 6px 8px;
  border: 1px solid #c28361;
  border-radius: 8px;
  background: #fff3dc;
  color: #503123;
  font-size: 13px;
}
#save-status button {
  min-height: 44px;
  padding-inline: 10px;
  border: 1px solid #244a3d;
  border-radius: 6px;
  background: #244a3d;
  color: #fff8ea;
  font: inherit;
}
.report-cost-note { font-size: 13px; margin: 6px 0 10px; }
#btn-ask-carrier {
  position: absolute;
  z-index: 10;
  top: clamp(calc(env(safe-area-inset-top) + 74px), var(--pos-y, 42%), 85%);
  left: clamp(calc(env(safe-area-inset-left) + 100px), var(--pos-x, 68%), calc(100% - env(safe-area-inset-right) - 100px));
  transform: translate(-50%, -100%);
  display: grid;
  gap: 3px;
  min-height: 56px;
  padding: 7px 14px;
  border: 2px solid #733b19;
  border-radius: 12px;
  background: #ffdc8e;
  color: #392411;
  box-shadow: 0 4px 10px #38281146;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
#btn-ask-carrier::before { display: none; }
#btn-ask-carrier::after {
  content: "";
  position: absolute;
  left: calc(50% - 6px);
  bottom: -7px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: 2px solid #733b19;
  border-bottom: 2px solid #733b19;
  transform: rotate(45deg);
  pointer-events: none;
}
#btn-ask-carrier .carrier-step { color: #70421d; font-size: 11px; font-weight: 700; }
#btn-ask-carrier strong { font-size: clamp(15px, 2.8vmin, 20px); white-space: nowrap; }
#btn-undo-price {
  position: absolute;
  z-index: 9;
  right: max(10px, calc(env(safe-area-inset-right) + 8px));
  bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
  min-height: 44px;
}
.daily-mission-list { display:grid; gap:6px; margin-bottom:12px; }
.daily-mission-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:4px 8px;
  border:1px solid #a8b9a3;
  border-radius:8px;
  background:#f5f1e8;
  color:#244a3d;
}
.daily-mission-row button { min-height:44px; white-space:nowrap; }
#tutorial-tip {
  position:absolute;
  z-index:8;
  top:max(62px, calc(env(safe-area-inset-top) + 54px));
  left:50%;
  transform:translateX(-50%);
  display:flex;
  align-items:center;
  gap:8px;
  width:max-content;
  max-width:min(75%, 500px);
  padding:3px 4px 3px 12px;
  border:1px solid #b4c7b3;
  border-radius:8px;
  background:#f5f1e8;
  color:#244a3d;
  font-size:13px;
  pointer-events:none;
}
#btn-hide-tutorial {
  min-height:44px;
  min-width:44px;
  border:0;
  border-radius:5px;
  color:#244a3d;
  background:#e4e9dd;
  cursor:pointer;
  pointer-events:auto;
}
.trash-round { display:grid; justify-items:center; gap:6px; padding:4px; text-align:center; }
.trash-bags { width:min(100%, 420px); display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
.trash-round .trash-piece, .trash-round .trash-bag { display:grid; justify-items:center; gap:2px; font-size:12px; }
.trash-round canvas { width:clamp(38px,14vmin,82px); height:clamp(38px,14vmin,82px); pointer-events:none; }
.trash-round .trash-bag:nth-child(1) { border-color:#567c81; }
.trash-round .trash-bag:nth-child(2) { border-color:#93693d; }
.trash-round .trash-bag:nth-child(3) { border-color:#5c7362; }
.delivery-product, .delivery-paper-bag { display:flex; align-items:center; gap:7px; }
.delivery-product { min-height:44px; }
.delivery-product canvas, .delivery-paper-bag canvas { flex:none; pointer-events:none; }
.delivery-product canvas { width:38px; height:38px; }
.delivery-paper-bag canvas { width:52px; height:52px; }
.packing-bag.packing-hover { outline:3px solid #f1bb65; background:#fff1cd; }

.locker-cell canvas { display: block; width: 48px; height: 48px; margin-inline: auto; }
.parcel-counter:not([hidden]) { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.parcel-counter canvas { display: block; width: 48px; height: 48px; margin-inline: auto; }

.expansion-preview-map { display: flex; min-height: 28px; gap: 3px; margin-block: 6px; }
.expansion-preview-map span { border-radius: 4px; background: #b5c6b9; }
.expansion-preview-map .expansion-preview-added { background: #50785e; }
.decor-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }

.delivery-packing-stage { display: block; width: 100%; max-width: 700px; align-self: center; aspect-ratio: 780 / 298; border-radius: 8px; touch-action: none; cursor: grab; }
.delivery-packing-stage:active { cursor: grabbing; }
#delivery-body [hidden] { display: none; }

.toast-shop-icon { display: inline-block; width: 18px; height: 18px; margin-inline-end: 6px; vertical-align: middle; background: #f5f1e8; border-radius: 4px; }
.upgrade-detail-icon canvas { display: block; width: 36px; height: 36px; }

.hot-food-tools, .hot-food-supply { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

#game-root.compact-landscape :is(#view-order, #drawer-minigame, #drawer-delivery) {
  padding-block: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-bottom));
}

#game-root.compact-landscape :is(#drawer-delivery, #drawer-minigame) .card-body {
  padding: 8px 10px;
}
#game-root.compact-landscape #view-order .pda-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
#game-root.compact-landscape #view-order .pda-tab { flex: 0 1 auto; padding: 3px 9px; }
#game-root.compact-landscape #view-order .kiosk-main {
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
#game-root.compact-landscape #view-order .kiosk-footer { flex-wrap: wrap; }
#game-root.compact-landscape .delivery-packing-stage {
  max-width: min(100%, calc((var(--game-height) - 164px) * 2.617));
}
#game-root.compact-landscape .hot-food-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
}
#game-root.compact-landscape .hot-food-layout > :is([role="status"], .hot-food-supply, [data-finish-hot-food]) {
  grid-column: 1 / -1;
}
#game-root.compact-landscape .hot-food-layout .mini-btn { min-height: 44px; }
#game-root.compact-landscape .hot-food-layout canvas { width: 54px; height: 54px; }
#game-root.compact-landscape .coffee-bench { height: clamp(140px, calc(var(--game-height) - 145px), 235px); }

.coffee-machine-preview { display: block; width: auto; height: 100%; max-width: 100%; min-height: 0; object-fit: contain; }

#game-root button.source-shop-icon[data-shop-icon]::before,
#game-root .hud-icon.source-shop-icon[aria-hidden=true] {
  background: url("assets/art-b/brand/ui_icons_atlas_2x.png") var(--atlas-x) var(--atlas-y) / 500% 500% no-repeat;
  -webkit-mask: none;
  mask: none;
  image-rendering: pixelated;
}
