/* OMAKASE OVERDRIVE — Warm Late-Night Tokyo Izakaya Lacquered Cedar UI
 * Strict Invariants:
 *  - ZERO pill radii anywhere (max 3px beveled corners + chamfered clip-paths)
 *  - >= 12px rendered text floor everywhere
 *  - >= 44x44px touch targets for all interactive controls
 *  - Zero external CDN URLs or remote fonts
 *  - Strict Frame Law: zero floating HUD over the 1280x860 counter stage
 */

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

:root {
  --bg: #0f0a08;
  --panel: #1c130e;
  --panel-raised: #291c14;
  --cedar-deep: #140d0a;
  --border: #4a3525;
  --border-gold: #a67a38;
  --gold: #e8b95b;
  --gold-bright: #ffe6a3;
  --lacquer: #ff5e4d;
  --lacquer-deep: #a8251a;
  --wasabi: #4fe39c;
  --cryo: #5fe4ff;
  --ink: #fbf4e6;
  --ink-dim: #cab9a2;
  --font-display: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --font-ui: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

body.high-contrast {
  --bg: #000000;
  --panel: #120c09;
  --panel-raised: #211710;
  --border: #94a3b8;
  --border-gold: #fde047;
  --gold: #fde047;
  --gold-bright: #ffffff;
  --lacquer: #ff7b54;
  --wasabi: #6effb8;
  --cryo: #6cf0ff;
  --ink: #ffffff;
  --ink-dim: #f1e8dc;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

.accent-wasabi {
  color: var(--wasabi) !important;
}

.accent-gold {
  color: var(--gold-bright) !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #241710 0%, #0f0a08 78%);
}

/* ================================================================
   COMPACT TOP LACQUER SIGNBOARD BAR (46px desktop, >= 44px targets)
   ================================================================ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 1px 10px;
  background: linear-gradient(180deg, #2b1a12 0%, #160e0a 100%);
  border-bottom: 2px solid var(--border-gold);
  box-shadow: inset 0 -1px 0 rgba(255, 230, 163, 0.22), 0 4px 16px rgba(0, 0, 0, 0.55);
  flex-shrink: 0;
  z-index: 30;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-crest-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
}

.brand-crest-logo {
  display: block;
  height: 28px;
  width: auto;
  max-width: 112px;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.78));
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

/* Rectangular Chamfered SHIFT | DAILY Switch */
.mode-switch {
  display: inline-flex;
  border: 1.5px solid var(--border-gold);
  background: #120b08;
  border-radius: 2px;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
}

.mode-btn {
  border: 0;
  min-height: 44px;
  min-width: 48px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.mode-btn:hover {
  color: var(--gold-bright);
}

.mode-btn.active {
  background: linear-gradient(180deg, #ff6c59 0%, #bf3124 100%);
  color: #fffaf0;
  box-shadow: inset 0 1px 0 rgba(255, 230, 163, 0.45);
}

/* Service Quota Signboard Bar */
.quota-lockplate {
  flex: 1;
  max-width: 470px;
  min-width: 150px;
  padding: 2px 10px 4px;
  background: linear-gradient(180deg, #241610 0%, #140d09 100%);
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}

.quota-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.shift-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quota-numbers {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex-shrink: 0;
}

.quota-text {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.timer-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-bright);
  padding: 0 5px;
  background: #120b08;
  border: 1px solid var(--border-gold);
  border-radius: 2px;
}

.timer-tag.is-urgent {
  color: #fff6f0;
  background: var(--lacquer-deep);
  border-color: var(--lacquer);
}

.quota-bar-track {
  position: relative;
  width: 100%;
  height: 11px;
  border-radius: 2px;
  background: #0d0806;
  border: 1px solid var(--border-gold);
  overflow: hidden;
}

.quota-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff5e4d 0%, #e8b95b 55%, #4fe39c 100%);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.quota-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(15, 10, 8, 0.82);
  box-shadow: 1px 0 0 rgba(255, 230, 163, 0.38);
  pointer-events: none;
}

.tick-50 { left: 50%; }

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

.tips-plaque {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 4px 10px;
  background: linear-gradient(180deg, #2d1c10 0%, #170e09 100%);
  border: 1.5px solid var(--gold);
  border-radius: 2px;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-bright);
}

.tips-icon {
  color: var(--lacquer);
  font-weight: 900;
}

.tips-label {
  font-size: 12px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.06em;
}

.cedar-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 9px;
  border-radius: 2px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, #2f2017 0%, #18100c 100%);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
  transition: border-color 110ms ease, background 110ms ease, transform 90ms ease;
}

.cedar-tool-btn:hover,
.cedar-tool-btn:focus-visible {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, #3e2a1d 0%, #231710 100%);
  outline: none;
}

.cedar-tool-btn:active {
  transform: scale(0.96);
}

.tool-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ================================================================
   WORKSPACE GRID — SLIM 178px RAILS + MASSIVE 1280x860 COUNTER
   ================================================================ */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr) 178px;
  gap: 8px;
  padding: 6px 8px;
  overflow: hidden;
}

.side-rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-gold) transparent;
}

/* Roasted Cedar & Antique-Brass 9-Slice Plaque Card */
.cedar-card {
  position: relative;
  background-color: #19110d;
  background-clip: padding-box;
  border-style: solid;
  border-width: 7px;
  border-color: var(--border-gold);
  border-image-source: url("./assets/ui/plaque-cedar.png");
  border-image-slice: 48 fill;
  border-image-width: 14px;
  border-image-repeat: stretch;
  border-radius: 2px;
  padding: 6px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.plaque-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(166, 122, 56, 0.35);
}

.plaque-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}

.rail-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

/* ---------- LEFT RAIL: RUSH HEAT DIAL & LEDGER ---------- */
.dial-card.fever-active {
  border-color: var(--lacquer);
  box-shadow: inset 0 0 22px rgba(255, 94, 77, 0.36), 0 0 18px rgba(255, 94, 77, 0.45);
}

.dial-card.fever-active .rush-dial-svg {
  filter: drop-shadow(0 0 8px rgba(255, 94, 77, 0.6));
}

.fever-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #fffaf0;
  background: linear-gradient(90deg, #ff5e4d, #d97706);
  padding: 1px 5px;
  border-radius: 2px;
}

.dial-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.rush-dial-svg {
  width: 100%;
  max-width: 152px;
  height: auto;
  display: block;
}

.dial-needle {
  transform-origin: 80px 88px;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.dial-needle-tremor {
  transform-origin: 80px 88px;
}

.dial-card.fever-active .dial-needle-tremor {
  animation: rushNeedleTremor 560ms ease-in-out infinite;
}

@keyframes rushNeedleTremor {
  0%, 100% { transform: rotate(-1.8deg); }
  50% { transform: rotate(1.8deg); }
}

.dial-readout {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding-top: 2px;
}

.combo-big {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold-bright);
  line-height: 1;
}

.dial-card.fever-active .combo-big {
  color: var(--lacquer);
}

.mult-tag {
  font-size: 12px;
  font-weight: 800;
  color: var(--wasabi);
}

.revenue-plaque {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(166, 122, 56, 0.32);
}

.micro-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.revenue-big {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

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

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

.stat-row strong {
  color: var(--ink);
}

/* Chef Relic Rack */
.relic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.relic-slot {
  min-height: 50px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: #120b08;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 3px;
  text-align: center;
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
}

.relic-slot.filled {
  border-color: var(--gold);
  background: linear-gradient(160deg, #331e14 0%, #170f0b 100%);
}

.relic-sym {
  font-size: 16px;
  line-height: 1.1;
}

.relic-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- CENTER PROTECTED IZAKAYA STAGE (1280 x 860) ---------- */
.board-stage {
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background: #0c0705;
  border-radius: 3px;
  border: 2px solid var(--border-gold);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.85), 0 0 24px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  position: relative;
}

#gameCanvas {
  display: block;
  width: min(100cqw, calc(100cqh * 1280 / 860));
  height: min(100cqh, calc(100cqw * 860 / 1280));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1280 / 860;
  cursor: pointer;
  touch-action: none;
  outline: none;
}

/* ---------- RIGHT RAIL: APPLIANCE BAYS & SERVE BUTTON ---------- */
.appliance-rack {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}

.bay-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 5px 7px;
  border-radius: 2px;
  border: 1.5px solid var(--border);
  background: linear-gradient(180deg, #251912 0%, #140d09 100%);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  transition: border-color 110ms ease, filter 110ms ease, transform 90ms ease;
}

.bay-btn.is-installed {
  border-color: var(--border-gold);
}

.bay-btn.is-ready:hover:not(:disabled) {
  border-color: var(--gold-bright);
  filter: brightness(1.12);
}

.bay-btn.is-firing {
  border-color: var(--lacquer);
  box-shadow: inset 0 0 12px rgba(255, 94, 77, 0.35);
}

.bay-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.bay-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.bay-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.bay-key {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-bright);
  min-width: 14px;
}

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

.bay-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bay-lvl {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--wasabi);
}

.bay-cd-track {
  width: 100%;
  height: 4px;
  background: #0d0806;
  border-radius: 1px;
  overflow: hidden;
}

.bay-cd-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff5e4d 0%, #e8b95b 60%, #4fe39c 100%);
  transform-origin: left center;
  transform: scaleX(1);
}

/* Painted Vermilion Lacquer Primary Button */
.lacquer-plaque-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 10px 22px;
  border: 0;
  border-radius: 2px;
  background: transparent url("./assets/ui/btn-lacquer.png") center / 100% 100% no-repeat;
  color: #fff9ec;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 3px rgba(18, 6, 4, 0.95);
  cursor: pointer;
  transition: filter 120ms ease, transform 90ms ease;
}

.lacquer-plaque-btn:hover:not(:disabled) {
  filter: brightness(1.14);
  transform: translateY(-1px);
}

.lacquer-plaque-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.lacquer-plaque-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

/* Status & Retention Surface */
.status-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: var(--wasabi);
}

.status-tag.is-hot {
  color: var(--lacquer);
}

.service-hint {
  font-size: 12px;
  line-height: 1.38;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.retention-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.retention-cell {
  background: #120b08;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.retention-label {
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 700;
}

.retention-val {
  font-size: 14px;
  color: var(--gold-bright);
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 2px;
  border: 1.5px solid var(--border-gold);
  background: linear-gradient(180deg, #322117 0%, #18100b 100%);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  clip-path: polygon(7px 0, calc(100% - 7px) 0, 100% 7px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 7px);
  transition: border-color 110ms ease, filter 110ms ease;
}

.secondary-btn:hover:not(:disabled) {
  border-color: var(--gold-bright);
  filter: brightness(1.1);
}

.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ================================================================
   IZAKAYA BLUEPRINT MODALS (WORKSHOP, CODEX, PAUSE, SUMMARY — COMPOSITOR-SAFE)
   ================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 6, 4, 0.87);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 18px 14px;
  isolation: isolate;
  z-index: 90;
}

.modal-panel {
  position: relative;
  margin: auto;
  width: 100%;
  max-width: 1040px;
  border-radius: 4px;
  padding: 15px 20px;
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.84);
}

.cedar-modal-panel {
  background-color: #18100c;
  background-image:
    linear-gradient(rgba(232, 185, 91, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 185, 91, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(36, 23, 16, 0.98) 0%, rgba(16, 10, 8, 0.99) 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  border: 2px solid var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(255, 230, 163, 0.22),
    inset 0 0 36px rgba(0, 0, 0, 0.56),
    0 28px 68px rgba(0, 0, 0, 0.86);
}

.modal-panel .lacquer-plaque-btn:hover:not(:disabled),
.modal-panel .lacquer-plaque-btn:active:not(:disabled),
.modal-panel .secondary-btn:hover:not(:disabled),
.modal-panel .secondary-btn:active:not(:disabled),
.modal-panel .style-card:hover:not(:disabled),
.modal-panel .style-card:active:not(:disabled) {
  filter: none;
  transform: none;
}

.modal-panel .lacquer-plaque-btn:hover:not(:disabled) {
  color: #ffffff;
  text-shadow: 0 2px 3px rgba(18, 6, 4, 0.98), 0 0 14px rgba(255, 230, 163, 0.8);
  box-shadow: 0 0 0 1.5px var(--gold-bright);
}

.modal-panel .secondary-btn:hover:not(:disabled) {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, #432b1d 0%, #22150e 100%);
  color: #ffffff;
}

.compact-panel {
  max-width: 500px;
  text-align: center;
}

.summary-modal-panel {
  max-width: 640px;
  text-align: center;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--lacquer);
}

.modal-title {
  margin: 3px 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
}

.modal-sub {
  margin: 0;
  font-size: 14px;
  color: #eadbc6;
  line-height: 1.4;
}

.large-tips {
  padding: 8px 16px;
  font-size: 16px;
}

.shop-sections {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.shop-section h3 {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}

.sec-note {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: #d6c2a8;
}

.shop-split {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.offer-grid {
  display: grid;
  gap: 9px;
}

.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#shopAppliances { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.offer-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 7px;
  min-height: 0;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1.5px solid rgba(232, 185, 91, 0.5);
  border-top: 3px solid var(--card-accent, var(--gold));
  background: linear-gradient(180deg, rgba(44, 28, 19, 0.96) 0%, rgba(20, 13, 9, 0.99) 100%);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 110ms ease, background 110ms ease, box-shadow 120ms ease;
}

.offer-card:hover:not(:disabled) {
  border-color: var(--card-accent, var(--gold-bright));
  background: linear-gradient(180deg, rgba(64, 39, 25, 0.98) 0%, rgba(28, 17, 11, 0.99) 100%);
  box-shadow: inset 0 0 0 1px var(--card-accent, var(--gold-bright)), 0 10px 24px rgba(0, 0, 0, 0.54);
  filter: none;
  transform: none;
}

.offer-card.purchased {
  opacity: 0.56;
  cursor: default;
  border-color: rgba(166, 122, 56, 0.35);
}

.offer-card:disabled:not(.purchased) {
  opacity: 0.78;
  border-color: rgba(166, 122, 56, 0.32);
  cursor: not-allowed;
}

.offer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.offer-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.offer-emblem,
.offer-sprite-box {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 235, 190, 0.16), rgba(16, 10, 8, 0.95));
  border: 1.5px solid var(--card-accent, var(--gold));
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.55);
}

.offer-emblem {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--card-accent, var(--gold-bright));
}

.offer-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.offer-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.offer-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--card-accent, var(--gold-bright));
  background: rgba(14, 9, 6, 0.92);
  border: 1px solid var(--card-accent, var(--gold));
  white-space: nowrap;
}

.offer-name {
  font-size: 15.5px;
  font-weight: 800;
  line-height: 1.18;
  color: #ffffff;
}

.offer-cost {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #1c1005;
  background: var(--gold-bright);
  border: 1px solid #fff7d6;
  white-space: nowrap;
  flex-shrink: 0;
}

.offer-cost.is-short {
  color: #fecdd3;
  background: rgba(127, 29, 29, 0.62);
  border-color: rgba(255, 94, 77, 0.65);
}

.offer-cost.is-owned {
  color: #c2b29f;
  background: rgba(24, 15, 11, 0.92);
  border-color: rgba(166, 122, 56, 0.42);
}

.offer-hero-stat {
  width: 100%;
  padding: 6px 9px;
  background: rgba(12, 8, 6, 0.9);
  border: 1px solid rgba(255, 230, 163, 0.12);
  border-left: 3.5px solid var(--card-accent, var(--gold-bright));
  font-family: var(--font-mono);
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.18;
  color: var(--card-accent, var(--gold-bright));
}

.offer-desc {
  font-size: 13.5px;
  line-height: 1.3;
  color: #f0e4d2;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(166, 122, 56, 0.35);
}

.modal-footer .lacquer-plaque-btn {
  width: auto;
  min-width: 210px;
}

.end-footer {
  flex-wrap: wrap;
  justify-content: center;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.end-stat {
  background: #140d0a;
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  padding: 9px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}

.end-stat-primary {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, #2d1a10 0%, #140d0a 100%);
}

.end-stat span {
  font-size: 12px;
  color: var(--ink-dim);
  font-weight: 700;
}

.end-stat strong {
  font-size: 18px;
  color: var(--gold-bright);
}

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

.codex-item {
  border: 1px solid var(--border-gold);
  background: #140d0a;
  border-radius: 2px;
  padding: 10px;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}

.codex-item.locked {
  opacity: 0.55;
}

/* Michelin Star Crest, Unlock Banner & Kitchen Style Picker (v0.2.0) */
.star-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px auto 8px;
  padding: 6px 16px;
  background: linear-gradient(180deg, #3c1910 0%, #1d0d08 100%);
  border: 1.5px solid var(--gold-bright);
  border-radius: 2px;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}

.star-glyphs {
  font-size: 20px;
  letter-spacing: 0.14em;
  color: #fde047;
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.55);
}

.star-rank-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
}

.unlock-banner {
  margin: 6px auto 8px;
  padding: 7px 14px;
  background: linear-gradient(90deg, rgba(79, 227, 156, 0.16) 0%, rgba(253, 224, 71, 0.2) 100%);
  border: 1.5px solid var(--wasabi);
  border-radius: 2px;
  color: #fef08a;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.style-picker-section {
  margin: 12px 0 4px;
  text-align: left;
}

.codex-style-section {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(166, 122, 56, 0.35);
}

.style-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.style-picker-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--gold);
}

.style-launch-btn {
  min-height: 44px;
  padding: 6px 12px;
  font-size: 12px;
}

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

.style-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  min-height: 76px;
  padding: 9px 10px;
  border-radius: 2px;
  border: 1.5px solid var(--border);
  background: linear-gradient(180deg, rgba(35, 23, 16, 0.94) 0%, rgba(18, 12, 9, 0.98) 100%);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
  transition: border-color 110ms ease, filter 110ms ease;
}

.style-card:hover:not(:disabled) {
  border-color: var(--gold-bright);
  filter: brightness(1.08);
}

.style-card.selected {
  border-color: #fde047;
  background: linear-gradient(180deg, rgba(64, 34, 20, 0.96) 0%, rgba(24, 14, 10, 0.98) 100%);
  box-shadow: inset 0 0 14px rgba(253, 224, 71, 0.22);
}

.style-card.locked {
  opacity: 0.56;
  cursor: not-allowed;
}

.style-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.style-card-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-bright);
}

.style-card-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 800;
  color: var(--wasabi);
}

.style-card-loadout {
  padding: 5px 8px;
  background: rgba(12, 8, 6, 0.85);
  border-left: 3px solid var(--gold);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 800;
  color: #ffffff;
}

.style-card-hint {
  font-size: 13px;
  color: #eadbc6;
  line-height: 1.35;
}

/* ================================================================
   RESPONSIVE BREAKPOINTS (360x640, 390x844, 844x390, 800x450 -> 1920x1080)
   ================================================================ */
@media (max-width: 1080px) and (min-width: 901px) {
  .workspace {
    grid-template-columns: 162px minmax(0, 1fr) 162px;
    gap: 6px;
    padding: 5px 6px;
  }
}

/* Compact top-bar rules from day 1 — guarantees ZERO overflow on 844x390 phone-landscape */
@media (max-width: 980px) {
  .top-bar {
    gap: 6px;
    padding: 1px 6px;
  }

  .brand-cluster {
    gap: 6px;
  }

  .brand-crest-logo {
    height: 22px;
    max-width: 68px;
  }

  .brand-name {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .mode-btn {
    min-width: 44px;
    padding: 0 7px;
  }

  .quota-lockplate {
    min-width: 0;
    padding: 3px 8px;
  }

  .top-actions {
    gap: 4px;
  }

  .tips-label,
  #codexBtn .tool-text,
  #muteBtn .tool-text,
  #pauseBtn .tool-text {
    display: none;
  }

  .cedar-tool-btn {
    padding: 0 6px;
  }
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 6px;
    padding: 6px;
    overflow-y: auto;
  }

  .board-stage {
    container-type: normal;
    aspect-ratio: 1280 / 860;
    width: min(100%, calc((100dvh - 196px) * 1280 / 860));
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0 auto;
  }

  #gameCanvas {
    width: 100%;
    height: 100%;
  }

  .left-rail {
    display: none;
  }

  .right-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 172px;
    gap: 6px;
    overflow: visible;
  }

  .bays-card {
    padding: 7px 8px;
  }

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

  .bay-btn {
    padding: 4px 5px;
    min-height: 44px;
  }

  .serve-btn {
    min-height: 44px;
    padding: 8px 10px;
  }

  .status-card {
    padding: 7px 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .service-hint {
    display: none;
  }

  .retention-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .three-col,
  .two-col,
  #shopAppliances,
  .shop-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .top-bar {
    flex-wrap: wrap;
    padding: 4px 6px;
    gap: 4px;
  }

  .brand-crest-logo {
    height: 22px;
    max-width: 60px;
  }

  .brand-name {
    font-size: 13px;
    letter-spacing: 0.06em;
  }

  .quota-lockplate {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    padding: 3px 8px;
  }

  #codexBtn,
  #contrastBtn,
  .tool-text {
    display: none;
  }

  .right-rail {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .status-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .status-card .plaque-head {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
    flex-direction: column;
    align-items: flex-start;
  }

  .retention-grid {
    grid-template-columns: 1fr 1fr;
    flex: 1;
  }

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

  .style-picker-grid {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .lacquer-plaque-btn,
  .modal-footer .secondary-btn {
    width: 100%;
  }
}

@media (max-height: 540px) and (min-width: 901px) {
  .top-bar {
    min-height: 44px;
  }

  .workspace {
    padding: 4px 6px;
    gap: 6px;
  }

  .cedar-card {
    padding: 6px 8px;
  }

  .relic-slot {
    min-height: 40px;
  }

  .service-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quota-bar-fill,
  .dial-needle,
  .offer-card,
  .lacquer-plaque-btn,
  .cedar-tool-btn,
  .bay-btn {
    transition: none !important;
  }

  .dial-card.fever-active .dial-needle-tremor {
    animation: none !important;
  }
}
