* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #20242e; touch-action: none; overscroll-behavior: none; }
body { font-family: "Segoe UI", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
:root {
  --glass: linear-gradient(180deg, rgba(32,38,54,0.92), rgba(20,24,34,0.92));
  --edge: rgba(255,255,255,0.14);
  --accent: #6ee787; --gold: #ffd75e;
}
/* one vertical stack top-center: stats, store controls, carry, orders —
   flex layout means the chips can never overlap */
#hud-stack {
  position: absolute; top: max(0px, env(safe-area-inset-top)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  pointer-events: none;
}
#hud-stack > * { pointer-events: auto; }
#hud-top {
  display: flex; align-items: stretch; pointer-events: none;
  background: var(--glass); border: 1px solid var(--edge); 
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(10px); overflow: hidden; width:100vw; justify-content: flex-end;
}
#store-dock {
  display: flex; gap: 8px; align-items: center;
}
/* ERP-style KPI chips: tiny caption over a bold value */
.hud-pill {
  color: #eef1f8; padding: 6px 13px 7px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  position: relative; min-width: 58px;
}
.hud-pill small {
  font-size: 8px; letter-spacing: 0.22em; font-weight: 800;
  color: #7a879f; text-transform: uppercase;
}
.hud-pill span {
  font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  display: flex; align-items: center; gap: 4px; line-height: 1.1;
}
.hud-pill + .hud-pill { border-left: 1px solid rgba(255,255,255,0.09); }
#hud-money span { color: var(--accent); }
#hud-rep span { color: var(--gold); }
#hud-clock span { color: #c6d2e8; }
.hud-brand {
  justify-content: center; align-items: center; min-width: 0;
  font-size: 15px; font-weight: 900; letter-spacing: 0.02em; color: var(--accent);
  background: rgba(110,231,135,0.08);
}
.hud-brand span { font-size: 9px; color: #7a879f; letter-spacing: 0.18em; display: block; }

#hud-carry {
  background: var(--glass); color: #fff; padding: 5px 14px; border-radius: 16px;
  font-size: 13px; font-weight: 700; pointer-events: none !important; border: 1px solid var(--edge);
  display: flex; align-items: center; gap: 5px; backdrop-filter: blur(8px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

#hud-orders {
  display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center;
  gap: 4px; pointer-events: none !important; max-width: 90vw;
}
.order-chip {
  background: rgba(20,24,34,0.8); color: #9fd0ff; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 12px; border: 1px solid rgba(120,180,255,0.25);
}

/* ---------- floating world labels ---------- */
#fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fx-text {
  position: absolute; transform: translate(-50%, -50%); font-weight: 800; font-size: 16px;
  color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.6); will-change: transform, opacity;
}
.fx-coin { color: #7dff9a; }
.fx-bad { color: #ff7d7d; }
.fx-emote { font-size: 22px; }

/* ---------- controls ---------- */
#joystick-zone {
  position: absolute; left: 0; bottom: 0; width: 62%;
  height: 240px; touch-action: none;
}
#joystick-base {
  position: absolute; left: 84px; bottom: calc(64px + env(safe-area-inset-bottom));
  width: 116px; height: 116px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.18);
  transform: translate(-50%, 50%);
  left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%);
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.35); border: 2px solid rgba(255,255,255,0.4);
  transform: translate(-50%, -50%); transition: transform 0.05s linear;
}
#btn-action {
  position: absolute; right: 18px; bottom: calc(56px + env(safe-area-inset-bottom));
  width: 108px; height: 108px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.35);
  background: linear-gradient(180deg, #ffb545, #f08a1d); color: #3a2404;
  font-size: 17px; font-weight: 800; font-family: inherit;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45); touch-action: manipulation;
}
#btn-action:active { transform: scale(0.93); }
#btn-action.scan { background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f; }
#btn-shop {
  position: absolute; right: 14px; top: max(76px, calc(env(safe-area-inset-top) + 70px));
  width: 46px; height: 46px; font-size: 22px;
  background: rgba(20,24,34,0.85); border: 1px solid rgba(255,255,255,0.2);
}
#btn-build {
  position: absolute; right: 14px; top: max(130px, calc(env(safe-area-inset-top) + 124px));
  width: 46px; height: 46px; font-size: 20px;
  background: rgba(20,24,34,0.85); border: 1px solid rgba(255,255,255,0.2);
}
#btn-settings {
  position: absolute; right: 14px; top: max(184px, calc(env(safe-area-inset-top) + 178px));
  width: 46px; height: 46px; font-size: 20px;
  background: rgba(20,24,34,0.85); border: 1px solid rgba(255,255,255,0.2);
}
#btn-shop, #btn-build, #btn-settings {
  color: #dfe6f2; display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--edge);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.09);
  backdrop-filter: blur(8px); transition: transform 0.08s;
}
#btn-shop:active, #btn-build:active, #btn-settings:active { transform: scale(0.92); }
#btn-shop .icn svg, #btn-build .icn svg, #btn-settings .icn svg { width: 22px; height: 22px; }

/* ---------- world stock labels ---------- */
#label-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wlabel {
  position: absolute; transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(16,20,29,0.82); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px; padding: 3px 8px; font-size: 10.5px; font-weight: 700;
  color: #dfe6f2; will-change: left, top;
}
.wlabel b { color: #7dff9a; margin-left: 1px; }
.wlabel .wl-low { color: #ff7d7d; }
.wl-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.wl-img { width: 16px; height: 16px; flex-shrink: 0; }

/* rendered 3D product thumbnails */
.prod-icon { width: 100%; height: 100%; object-fit: contain; }
.shop-swatch-3d { background: rgba(255,255,255,0.07); }
.ic-swatch img { width: 90%; height: 90%; object-fit: contain; }
.cg-item-img { width: 22px; height: 22px; flex-shrink: 0; }
#btn-build.active { background: #f08a1d; border-color: #ffd18a; }
#btn-open {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 22px; border: 2px solid rgba(255,255,255,0.3);
  background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f;
  font-size: 14px; font-weight: 800; font-family: inherit;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  animation: breathe 2.2s ease-in-out infinite;
}
#btn-open.is-open {
  background: linear-gradient(180deg, #ff8a7a, #d64533); color: #3a0a04;
  animation: none; padding: 8px 16px; font-size: 13px;
}
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
#btn-endday {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 20px; border: 2px solid rgba(214,69,51,0.6);
  background: rgba(40,18,16,0.9); color: #ff9d8f;
  font-size: 12.5px; font-weight: 800; font-family: inherit; letter-spacing: 0.05em;
  backdrop-filter: blur(6px);
}
#btn-open:active, #btn-endday:active { transform: scale(0.94); }
.late { color: #ff9d8f; margin-left: 3px; }
.cold-tag { color: #74b8e8; }
#build-bar { max-width: 94vw; overflow-x: auto; }


/* ---------- build toolbar ---------- */
#build-bar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 10px; border-radius: 18px;
  background: rgba(20,24,34,0.88); border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(6px); z-index: 12;
}
.build-tool {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 72px; padding: 8px 4px; border-radius: 12px;
  background: #313a4e; border: 2px solid transparent; color: #dfe6f2;
  font-family: inherit;
}
.build-tool.active { border-color: #ffb545; background: #45507a; }
.build-tool .bt-emoji { font-size: 22px; }
.build-tool .bt-name { font-size: 11px; font-weight: 700; }
.build-tool .bt-cost { font-size: 10.5px; color: #7dff9a; font-weight: 700; }
.build-done { background: #2c5c3a; }

/* ---------- banner ---------- */
#banner {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%) scale(0.7);
  font-size: 26px; font-weight: 900; color: #fff; text-align: center;
  text-shadow: 0 3px 10px rgba(0,0,0,0.7); pointer-events: none; z-index: 18;
  opacity: 0; white-space: nowrap;
}
#banner.show { animation: bannerIn 2.4s ease forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* money pulse */
.hud-pill.pulse { animation: moneyPulse 0.45s ease; }
@keyframes moneyPulse {
  0% { transform: scale(1); } 35% { transform: scale(1.18); background: rgba(45,90,50,0.9); } 100% { transform: scale(1); }
}

/* action button pop-in */
#btn-action.pop { animation: popIn 0.22s ease; }
@keyframes popIn { 0% { transform: scale(0.5); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* ---------- panels ---------- */
.panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92vw, 380px); max-height: 82vh; overflow-y: auto;
  background: #232838; color: #eef1f8; border-radius: 18px; padding: 16px;
  border: 1px solid rgba(255,255,255,0.14); box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  z-index: 20;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h2 { font-size: 18px; }

/* fake window chrome for the BackOffice ERP */
.erp-titlebar {
  gap: 10px; padding: 8px 10px; margin: -6px -6px 12px;
  background: rgba(0,0,0,0.28); border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px 10px 0 0;
}
.erp-titlebar h2 {
  flex: 1; font-size: 13.5px !important; letter-spacing: 0.08em; text-transform: uppercase;
  color: #b8c4da; font-weight: 800;
}
.erp-dots {
  width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; flex-shrink: 0;
  box-shadow: 15px 0 0 #febc2e, 30px 0 0 #28c840;
  margin-right: 30px;
}
#shop-status {
  position: sticky; bottom: -16px; margin: 14px -16px calc(-1 * max(16px, env(safe-area-inset-bottom)));
  padding: 8px 14px calc(max(10px, env(safe-area-inset-bottom)));
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  background: rgba(0,0,0,0.4); border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 10.5px; letter-spacing: 0.12em; color: #7a879f; font-weight: 800;
}
#shop-status b { color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.btn-close { background: none; border: none; color: #aab; font-size: 20px; padding: 4px 8px; }
.tabs { display: flex; gap: 2px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.tab {
  flex: 1; padding: 9px 4px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: #7a879f; font-weight: 800; font-family: inherit;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(110,231,135,0.06); }
.shop-row {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; margin-bottom: 8px;
}
.price-row {
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; margin-bottom: 8px; padding: 10px !important; border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}
.shop-swatch { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; border: 2px solid rgba(255,255,255,0.25); }
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-weight: 700; font-size: 14px; }
.shop-sub { font-size: 11.5px; color: #9aa3b8; }
.shop-buy {
  padding: 8px 12px; border-radius: 10px; border: none; font-weight: 800; font-family: inherit;
  background: #2ea84c; color: #fff; font-size: 13px; min-width: 74px;
}
.shop-buy:disabled { background: #3a4258; color: #778; }
.shop-buy.owned { background: transparent; border: 1px solid #4a5; color: #7dff9a; }
.shop-locked { opacity: 0.45; }
#btn-reset {
  margin-top: 14px; width: 100%; padding: 9px; border-radius: 10px; border: 1px solid #a33;
  background: transparent; color: #f88; font-weight: 700; font-family: inherit;
}
.btn-big {
  width: 100%; margin-top: 14px; padding: 14px; border-radius: 14px; border: none;
  background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f;
  font-size: 17px; font-weight: 800; font-family: inherit;
}
#summary-body { font-size: 14px; line-height: 1.9; }
#summary-body .sum-row { display: flex; justify-content: space-between; }
#summary-body .good { color: #7dff9a; } #summary-body .bad { color: #ff8d8d; }
.help-body p { margin: 8px 0; font-size: 14.5px; line-height: 1.5; }

#toast {
  position: absolute; bottom: calc(190px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); background: rgba(20,24,34,0.92); color: #fff;
  padding: 9px 18px; border-radius: 20px; font-size: 14px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2); white-space: nowrap; z-index: 15;
}
#toast.show { animation: toastIn 0.28s ease; }
@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 14px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}

/* panels pop in */
.panel { animation: panelIn 0.24s ease; }
@keyframes panelIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- inline SVG icons ---------- */
.icn { display: inline-flex; vertical-align: -0.15em; }
.icn svg { width: 1.05em; height: 1.05em; }
.hud-pill .icn { margin-right: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot-open { background: #5eff8a; box-shadow: 0 0 6px #5eff8a; }
.dot-closed { background: #ff5e5e; }

/* XP bar + quest chip in the HUD stack */
#xp-bar {
  width: 210px; height: 4px; border-radius: 2px; background: rgba(0,0,0,0.45);
  overflow: hidden; margin-top: -3px; pointer-events: none !important;
  border: 1px solid rgba(255,255,255,0.1);
}
#xp-fill { display: block; height: 100%; background: linear-gradient(90deg, #34e07d, #6ee787); transition: width 0.4s; }
#hud-quest {
  display: flex; align-items: center; gap: 6px;
  background: var(--glass); border: 1px solid rgba(255,215,94,0.35); border-radius: 14px;
  padding: 5px 12px; font-size: 12px; font-weight: 700; color: #e8ecf4;
  pointer-events: none !important; backdrop-filter: blur(8px);
}
#hud-quest small { font-size: 8px; letter-spacing: 0.2em; color: var(--gold); font-weight: 900; }
#hud-quest b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- inspect card ---------- */
#info-card {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(196px + env(safe-area-inset-bottom));
  width: min(88vw, 320px); z-index: 11;
  background: rgba(24,29,41,0.94); border: 1px solid rgba(255,215,94,0.35);
  border-radius: 16px; padding: 12px; color: #eef1f8;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: panelPop 0.18s ease;
}
@keyframes panelPop { 0% { opacity: 0; transform: translate(-50%, 8px); } 100% { opacity: 1; transform: translate(-50%, 0); } }
.ic-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ic-swatch {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px;
}
.ic-titles { flex: 1; min-width: 0; }
#ic-title { font-weight: 800; font-size: 15.5px; }
#ic-sub { font-size: 11.5px; color: #ffd75e; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
#ic-close { background: none; border: none; color: #aab; font-size: 16px; padding: 6px; }
.ic-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 13px; padding: 4px 0; border-top: 1px solid rgba(255,255,255,0.07);
}
.ic-row > span:first-child { color: #9aa3b8; flex-shrink: 0; }
.ic-val { text-align: right; font-weight: 600; }
.ic-bar {
  flex: 1; max-width: 150px; height: 9px; border-radius: 5px;
  background: rgba(255,255,255,0.12); overflow: hidden;
}
.ic-bar-fill { display: block; height: 100%; border-radius: 5px; background: #7dff9a; transition: width 0.3s; }
.bar-good { background: #7dff9a; } .bar-mid { background: #ffd75e; } .bar-bad { background: #ff7d7d; }

/* ---------- build placement confirm ---------- */
#build-confirm {
  position: absolute; transform: translate(-50%, -100%);
  display: flex; gap: 8px; z-index: 13; pointer-events: auto;
}
.bc-btn {
  display: flex; align-items: center; gap: 5px; padding: 10px 14px;
  border-radius: 14px; border: none; font-family: inherit; font-size: 14px; font-weight: 900;
  box-shadow: 0 6px 16px rgba(0,0,0,0.5);
}
.bc-ok { background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f; }
.bc-cancel { background: linear-gradient(180deg, #ff8a7a, #d64533); color: #3a0a04; padding: 10px 12px; }
.bc-btn:active { transform: scale(0.93); }

/* ---------- fullscreen management panel: truly edgeless window ---------- */
.panel-full {
  inset: 0; left: 0; top: 0; transform: none; width: 100%; max-height: 100%;
  border-radius: 0; border: none; padding: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(155deg, #171c28 0%, #1e2536 60%, #241f30 100%);
  animation: fullIn 0.22s ease;
}
@keyframes fullIn { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }
.panel-full .erp-titlebar {
  margin: 0; border-radius: 0;
  padding: calc(max(10px, env(safe-area-inset-top)) ) 14px 10px;
}
.panel-full .tabs { margin: 0; padding: 0 6px; overflow-x: auto; flex-shrink: 0; }
.panel-full .tab { min-width: 64px; }
.panel-full .tab-body {
  flex: 1; overflow-y: auto; width: 100%;
  padding: 14px 16px 30px;
  max-width: 480px; margin: 0 auto;
}
.panel-full #shop-status {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  padding: 9px 14px max(10px, env(safe-area-inset-bottom));
}
.panel-full .tab-body.hidden { display: none !important; }

/* dashboard */
.dash-level {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 12px;
}
.dash-level-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
.dash-level-top b { color: var(--accent); }
.dash-xp-num { color: #7a879f; font-size: 12px; }
.dash-xpbar { height: 8px; border-radius: 4px; background: rgba(0,0,0,0.35); margin-top: 8px; overflow: hidden; }
.dash-xpbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #34e07d, #6ee787); transition: width 0.4s; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dash-card {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.dash-card small { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #7a879f; font-weight: 800; }
.dash-card b { font-size: 16px; font-variant-numeric: tabular-nums; }
.bad-val { color: #ff8d8d; }

/* qty stepper + cart footer */
.qty-step { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.2);
  background: #313a4e; color: #eef1f8; font-size: 18px; font-weight: 900; font-family: inherit;
}
.qty-btn:disabled { opacity: 0.35; }
.qty-n { min-width: 22px; text-align: center; font-weight: 900; font-size: 15px; color: #667; }
.qty-n.has { color: #7dff9a; }
.cart-foot {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 4px; margin-top: 6px;
  background: linear-gradient(0deg, #1d2330 70%, transparent);
}
.cart-sum { font-size: 14px; font-weight: 600; }
.cart-sum b { color: #7dff9a; }
.cart-sum.dim { color: #78829a; }
#cart-confirm { min-width: 140px; padding: 12px 16px; font-size: 14px; }

/* ---------- price editor & market trends ---------- */
.trend-up { color: #7dff9a; } .trend-down { color: #ff7d7d; } .trend-flat { color: #9aa3b8; }
.ic-price {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 0 4px; border-top: 1px solid rgba(255,255,255,0.07); margin-top: 4px;
}
.ic-mine {
  min-width: 74px; text-align: center; font-size: 19px; font-weight: 900;
  display: flex; flex-direction: column; line-height: 1.1;
}
.ic-mine small { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #9aa3b8; }
.ic-mine.good small { color: #7dff9a; } .ic-mine.bad small { color: #ff7d7d; }
.pbtn {
  padding: 9px 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.2);
  background: #313a4e; color: #eef1f8; font-family: inherit; font-size: 12.5px; font-weight: 800;
}
.pbtn:active { background: #45507a; }
.pbtn-market { width: 100%; margin-top: 8px; }
.pbtn-market.active { border-color: #7dff9a; color: #7dff9a; background: transparent; }
.pbtn-mkt.active { border-color: #7dff9a; color: #7dff9a; background: transparent; }

/* staff tab */
.staff-head {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: #ffd75e; font-weight: 800; padding: 6px 4px;
}
.staff-stars { color: #ffd75e; font-size: 12px; margin-left: 4px; }
.fire-btn { background: rgba(214,69,51,0.2); color: #ff9d8f; border: 1px solid rgba(214,69,51,0.45); }

/* pricing tab */
.price-row { padding: 10px 4px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.price-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.spark { flex-shrink: 0; }
.spark-none { font-size: 11px; color: #78829a; }
#cg-combo {
  font-size: 14px; font-weight: 900; color: #ffd75e; min-width: 34px; text-align: center;
}
#cg-combo.pop { animation: popIn 0.22s ease; }

/* ---------- checkout minigame ---------- */
#checkout-game {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(94vw, 400px); z-index: 14;
  background: rgba(24,29,41,0.96); border: 1px solid rgba(110,231,135,0.4);
  border-radius: 18px; padding: 12px; color: #eef1f8;
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  animation: panelPop 0.2s ease;
}
.cg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#cg-name { font-weight: 800; font-size: 15px; flex: 1; }
#cg-count { font-size: 12px; color: #9aa3b8; font-weight: 700; }
#cg-total { font-size: 18px; font-weight: 900; color: #7dff9a; }
#cg-cancel { background: none; border: none; color: #aab; padding: 4px 6px; }
.cg-scan-area {
  position: relative; display: flex; align-items: center; height: 138px;
  background: #1a1f2b; border-radius: 12px; overflow: hidden;
}
#cg-pile { flex: 1; position: relative; align-self: stretch; }
#cg-scanner {
  width: 54px; align-self: stretch; position: relative; flex-shrink: 0;
  background: #262c3a; border-left: 2px dashed #3a4258; border-right: 2px dashed #3a4258;
}
.cg-laser {
  position: absolute; left: 50%; top: 10%; bottom: 10%; width: 3px;
  background: #ff4545; box-shadow: 0 0 10px #ff4545; transform: translateX(-50%);
  animation: laser 1.1s ease-in-out infinite;
}
@keyframes laser { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
#cg-bag {
  width: 76px; align-self: stretch; display: flex; flex-wrap: wrap; gap: 4px;
  align-content: flex-start; padding: 8px; background: #232a38;
}
.cg-bag-dot { width: 12px; height: 12px; border-radius: 4px; }
.cg-block {
  position: absolute; display: flex; align-items: center; justify-content: center; gap: 4px;
  box-sizing: border-box; padding: 2px;
  background: #313a4e; border: 1px solid rgba(255,255,255,0.25); border-radius: 7px;
  font-size: 10.5px; font-weight: 800; touch-action: none; user-select: none;
  transition: transform 0.15s ease, top 0.2s ease, left 0.2s ease;
  white-space: nowrap; z-index: 1;
}
.cg-block.h { width: 56px; height: 26px; }
.cg-block.v { width: 26px; height: 56px; flex-direction: column; gap: 3px; }
.cg-block.v b { writing-mode: initial; font-size: 9.5px; }
.cg-block.free { cursor: grab; border-color: rgba(110,231,135,0.55); }
.cg-block.blocked { opacity: 0.55; filter: brightness(0.75); }
.cg-block.grabbed { transition: none; cursor: grabbing; z-index: 2; }
.cg-block.scanned { transition: transform 0.24s ease, opacity 0.24s; opacity: 0; z-index: 2; }
.cg-block b { color: #7dff9a; }
.cg-block.wiggle { animation: shake 0.3s; }
.cg-item-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
#cg-pay { margin-top: 10px; }
.cg-pos {
  width: 100%; padding: 13px; border-radius: 12px; border: none;
  background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f;
  font-family: inherit; font-size: 15px; font-weight: 900;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cg-pos:disabled { background: #3a4258; color: #99a; }
.cg-change-row { text-align: center; font-size: 14px; margin-bottom: 8px; }
.cg-change-row b { color: #ffd75e; }
.cg-denoms { display: flex; gap: 6px; justify-content: center; }
.cg-denom {
  flex: 1; padding: 12px 4px; border-radius: 10px; border: 1px solid rgba(255,215,94,0.4);
  background: #33301f; color: #ffd75e; font-family: inherit; font-size: 14px; font-weight: 900;
}
.cg-denom:active { background: #4a4225; }
.cg-denom-clear { border-color: rgba(255,255,255,0.25); background: #313a4e; color: #ccd; }
.cg-hint { text-align: center; font-size: 11.5px; color: #9aa3b8; margin-top: 8px; letter-spacing: 0.04em; }
#cg-pay.shake { animation: shake 0.3s; }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- menu system ---------- */
#menu-root { position: absolute; inset: 0; z-index: 50; }
#menu-root.hidden { display: none; }
.menu-screen { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; }
.menu-bg {
  position: fixed; inset: 0;
  background: linear-gradient(155deg, #1a2030 0%, #232d4a 40%, #3a2d4a 75%, #4a2d3a 100%);
  background-size: 200% 200%;
  animation: bgShift 14s ease-in-out infinite;
}
@keyframes bgShift { 0%,100% { background-position: 0% 0%; } 50% { background-position: 100% 100%; } }
.menu-cubes { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.mcube {
  position: absolute; width: 26px; height: 26px; border-radius: 5px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.09);
  animation: cubeFloat 11s linear infinite;
  bottom: -40px;
}
.mcube:nth-child(1) { left: 8%; animation-delay: 0s; width: 20px; height: 20px; }
.mcube:nth-child(2) { left: 20%; animation-delay: 1.5s; }
.mcube:nth-child(3) { left: 32%; animation-delay: 3s; width: 34px; height: 34px; }
.mcube:nth-child(4) { left: 44%; animation-delay: 4.5s; }
.mcube:nth-child(5) { left: 56%; animation-delay: 0.8s; width: 18px; height: 18px; }
.mcube:nth-child(6) { left: 68%; animation-delay: 2.2s; }
.mcube:nth-child(7) { left: 80%; animation-delay: 5.5s; width: 30px; height: 30px; }
.mcube:nth-child(8) { left: 90%; animation-delay: 3.8s; }
.mcube:nth-child(9) { left: 14%; animation-delay: 7s; width: 22px; height: 22px; }
.mcube:nth-child(10) { left: 74%; animation-delay: 8.5s; width: 16px; height: 16px; }
@keyframes cubeFloat {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(-110vh) rotate(200deg); opacity: 0; }
}
.menu-content {
  position: relative; min-height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  color: #eef1f8;
}

/* splash logo */
.logo { text-align: center; animation: logoIn 0.7s ease; }
@keyframes logoIn { 0% { opacity: 0; transform: translateY(16px) scale(0.94); } 100% { opacity: 1; transform: none; } }
.logo-cubes { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.lc { width: 34px; height: 34px; border-radius: 8px; animation: lcBob 1.8s ease-in-out infinite; }
.lc1 { background: linear-gradient(160deg, #ff9d5c, #e4574f); }
.lc2 { background: linear-gradient(160deg, #6ee787, #2ea84c); animation-delay: 0.2s; }
.lc3 { background: linear-gradient(160deg, #6db7ff, #3a6ea5); animation-delay: 0.4s; }
@keyframes lcBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.logo-title, .menu-title {
  font-size: 52px; font-weight: 900; letter-spacing: 0.04em; line-height: 0.95;
  color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 10px 30px rgba(0,0,0,0.5);
}
.logo-title span, .menu-title span {
  display: block; color: #ffd75e;
  text-shadow: 0 4px 0 rgba(120,80,0,0.45), 0 10px 30px rgba(0,0,0,0.5);
}
.menu-title { font-size: 40px; text-align: center; }
.menu-title.small { font-size: 28px; }
.logo-sub {
  margin-top: 12px; font-size: 14px; letter-spacing: 0.28em; text-transform: uppercase;
  color: rgba(255,255,255,0.65);
}
.tap-hint {
  position: absolute; bottom: max(48px, env(safe-area-inset-bottom));
  font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.55);
  animation: tapPulse 1.6s ease-in-out infinite;
}
@keyframes tapPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 0.9; } }

/* menu buttons */
.menu-btns { display: flex; flex-direction: column; gap: 12px; width: min(78vw, 300px); margin-top: 8px; }
.mbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: 16px; font-family: inherit;
  font-size: 16px; font-weight: 800; letter-spacing: 0.05em;
  background: rgba(255,255,255,0.08); color: #eef1f8;
  border: 1px solid rgba(255,255,255,0.18);
  transition: transform 0.08s;
}
.mbtn:active { transform: scale(0.96); }
.mbtn small { font-weight: 600; opacity: 0.75; font-size: 12px; }
.mbtn-primary {
  background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f;
  border: none; box-shadow: 0 6px 18px rgba(46,168,76,0.35);
}
.mbtn-danger { background: rgba(214,69,51,0.18); border-color: rgba(214,69,51,0.5); color: #ff9d8f; }
.mbtn-back { background: rgba(255,255,255,0.06); }
.mbtn-sm {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
  border-radius: 12px; border: none; font-family: inherit; font-size: 13px; font-weight: 800;
  background: rgba(255,255,255,0.1); color: #eef1f8;
}
.mbtn-sm.mbtn-primary { background: linear-gradient(180deg, #6ee787, #2ea84c); color: #05300f; }
.mbtn-sm.mbtn-danger { background: rgba(214,69,51,0.2); color: #ff9d8f; border: 1px solid rgba(214,69,51,0.45); }
.menu-h2 { font-size: 22px; font-weight: 900; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; }

/* slots */
.slot-list { display: flex; flex-direction: column; gap: 12px; width: min(88vw, 360px); }
.slot-card {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
}
.slot-empty { opacity: 0.75; }
.slot-info { flex: 1; min-width: 0; }
.slot-name { font-weight: 900; font-size: 15px; letter-spacing: 0.04em; }
.slot-meta { font-size: 12.5px; color: #c3cbdc; margin-top: 3px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.slot-date { font-size: 11px; color: #8892a8; margin-top: 2px; }
.slot-actions { display: flex; gap: 8px; align-items: center; }

/* settings */
.set-section {
  width: min(88vw, 360px); background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 12px 14px;
}
.set-section h3 {
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #ffd75e; margin-bottom: 6px;
}
.set-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.07); font-size: 14px;
}
.set-row:first-of-type { border-top: none; }
.set-label { color: #d7dceb; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.set-dim { color: #778; }
.seg { display: flex; gap: 4px; background: rgba(0,0,0,0.25); padding: 3px; border-radius: 10px; }
.seg-btn {
  padding: 6px 11px; border-radius: 8px; border: none; font-family: inherit;
  font-size: 12.5px; font-weight: 700; background: transparent; color: #9aa3b8;
}
.seg-btn.active { background: #46527a; color: #fff; }
input[type="range"] { width: 130px; accent-color: #6ee787; }

/* about */
.about-body { width: min(84vw, 340px); text-align: center; font-size: 14.5px; line-height: 1.6; }
.about-body p { margin: 12px 0; }
.about-dim { color: #97a0b5; font-size: 12.5px; }
.hidden { display: none !important; }
