* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a0f08;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: #fff;
  user-select: none;
}
#game-root {
  position: fixed;
  inset: 0;
}
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#ui-layer,
#overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#ui-layer > *,
#overlay-layer > * {
  pointer-events: auto;
}

/* ---------- LOADING ---------- */
#loading-screen {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #2a1408, #4a1f0a 50%, #1a0f08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.6s;
}
.brand-logo {
  display: block;
  width: min(360px, 76vw);
  height: auto;
  max-height: 24vh;
  object-fit: contain;
}
.loading-logo {
  animation: titlePulse 2s ease-in-out infinite;
}
#loading-screen .tag {
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  color: #ffe9b0;
  margin-top: 8px;
  font-style: italic;
}
@keyframes titlePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}
.loading-bar-wrap {
  width: min(420px, 80vw);
  height: 22px;
  background: #1a0f08;
  border: 3px solid #ffcb47;
  border-radius: 12px;
  margin-top: 40px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 203, 71, 0.4);
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff8a00, #ffcb47);
  transition: width 0.25s;
}
.loading-msg {
  margin-top: 18px;
  color: #ffe9b0;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  min-height: 1.4em;
  text-align: center;
}

/* ---------- MAIN MENU ---------- */
#main-menu {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    ellipse at center,
    rgba(74, 31, 10, 0.5),
    rgba(26, 15, 8, 0.92)
  );
  z-index: 50;
}
.menu-brand-logo {
  width: min(320px, 68vw);
  max-height: 22vh;
}
#main-menu .menu-sub {
  font-size: clamp(0.9rem, 3vw, 1.4rem);
  color: #ffe9b0;
  font-style: italic;
  margin: 10px 0 30px;
}
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(340px, 82vw);
}
.menu-btn {
  background: linear-gradient(180deg, #ff8a00, #d95b00);
  color: #fff;
  border: 3px solid #ffcb47;
  border-radius: 14px;
  padding: 14px 20px;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 800;
  cursor: pointer;
  box-shadow:
    0 5px 0 #7a2e00,
    0 8px 16px rgba(0, 0, 0, 0.5);
  transition:
    transform 0.08s,
    box-shadow 0.08s;
  letter-spacing: 1px;
}
.menu-btn:hover {
  filter: brightness(1.1);
}
.menu-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #7a2e00;
}
.menu-btn.secondary {
  background: linear-gradient(180deg, #4a6fa5, #2a4a7a);
  border-color: #7fa8d8;
  box-shadow:
    0 5px 0 #1a2a4a,
    0 8px 16px rgba(0, 0, 0, 0.5);
}
.menu-btn.secondary:active {
  box-shadow: 0 1px 0 #1a2a4a;
}
.menu-btn.danger {
  background: linear-gradient(180deg, #d9534f, #a33b38);
  border-color: #ff8a85;
  box-shadow: 0 5px 0 #6a1f1c;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}
.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 14px;
  gap: 10px;
}
.hud-panel {
  background: rgba(26, 15, 8, 0.85);
  border: 2px solid #ffcb47;
  border-radius: 10px;
  padding: 6px 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}
.hud-day {
  font-size: clamp(0.7rem, 2.5vw, 0.95rem);
  color: #ffcb47;
  font-weight: 800;
  letter-spacing: 1px;
}
.hud-time {
  font-size: clamp(0.85rem, 3vw, 1.15rem);
  color: #fff;
  font-weight: 700;
}
.hud-score-val {
  font-size: clamp(1rem, 4vw, 1.6rem);
  color: #fff;
  font-weight: 900;
}
.hud-score-label {
  font-size: clamp(0.6rem, 2vw, 0.75rem);
  color: #ffcb47;
  letter-spacing: 2px;
}
.hud-money-val {
  font-size: clamp(1rem, 4vw, 1.6rem);
  color: #7fff7f;
  font-weight: 900;
}
.hud-money-label {
  font-size: clamp(0.6rem, 2vw, 0.75rem);
  color: #ffcb47;
  letter-spacing: 2px;
}
.hud-rep {
  font-size: clamp(0.65rem, 2vw, 0.85rem);
  color: #ffe9b0;
}
#pause-button {
  position: absolute;
  top: 82px;
  right: 12px;
  z-index: 32;
  width: 42px;
  height: 42px;
  border: 2px solid #ffe9b0;
  border-radius: 6px;
  color: #fff;
  background: #9d3e20;
  box-shadow: 0 3px 0 #552313;
  font: 900 1.2rem/1 sans-serif;
  cursor: pointer;
}
#pause-button:hover {
  background: #bd522a;
}
#pause-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #552313;
}
/* Food inventory bar */
#inventory-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  background: linear-gradient(
    0deg,
    rgba(26, 15, 8, 0.95),
    rgba(26, 15, 8, 0.6)
  );
  border-top: 3px solid #ffcb47;
  pointer-events: auto;
}
.food-chip {
  flex: 0 0 auto;
  min-width: 76px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #6a4a20;
  border-radius: 10px;
  padding: 6px 8px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.1s,
    border-color 0.2s;
  position: relative;
}
.food-chip:hover {
  border-color: #ffcb47;
  transform: translateY(-2px);
}
.food-chip:active {
  transform: scale(0.95);
}
.food-chip.low {
  border-color: #ff8a00;
  animation: lowPulse 1s infinite;
}
.food-chip.empty {
  opacity: 0.4;
  border-color: #555;
  cursor: not-allowed;
}
.food-chip .fc-icon {
  font-size: 1.4rem;
  line-height: 1.1;
}
.food-chip .fc-name {
  font-size: 0.65rem;
  color: #ffe9b0;
  letter-spacing: 0.5px;
}
.food-chip .fc-qty {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
}
.food-chip.low .fc-qty {
  color: #ff8a00;
}
.food-chip.empty .fc-qty {
  color: #ff5555;
}
@keyframes lowPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 138, 0, 0);
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 138, 0, 0.8);
  }
}

/* ---------- CUSTOMER AREA ---------- */
#customer-area {
  position: absolute;
  top: 90px;
  left: 0;
  right: 0;
  bottom: 100px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  padding: 10px 14px;
  pointer-events: none;
  overflow-y: auto;
  transition: top 0.15s ease-out;
}
#change-queue {
  position: absolute;
  top: 82px;
  left: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  max-height: 32vh;
  overflow: hidden;
  pointer-events: auto;
  color: #fff;
  background: rgba(18, 24, 22, 0.96);
  border: 2px solid #7fff7f;
  border-radius: 10px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.65);
}
#change-queue:empty {
  display: none;
}
.change-queue-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
  padding: 5px 9px;
  color: #7fff7f;
  font-size: 0.75rem;
  font-weight: 900;
}
.change-queue-title span {
  color: #fff;
}
.change-queue-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 6px;
  padding: 0 6px 6px;
  overflow-y: auto;
}
.change-customer {
  min-width: 0;
  padding: 7px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(127, 255, 127, 0.4);
  border-radius: 6px;
}
.change-customer-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #ffe9b0;
}
.change-food {
  overflow: hidden;
  margin: 3px 0;
  color: #e2dfd3;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.change-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.65rem;
}
.change-amounts b {
  color: #7fff7f;
}
.change-options {
  display: flex;
  gap: 5px;
  margin-top: 6px;
}
.change-option,
.change-later {
  min-width: 0;
  padding: 5px 7px;
  color: #fff;
  background: #315e48;
  border: 1px solid #7fff7f;
  border-radius: 5px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
}
.change-option {
  flex: 1;
}
.change-option small {
  display: block;
  margin-top: 2px;
  color: #d5e8d8;
  font-size: 0.55rem;
  font-weight: 400;
}
.change-option:hover,
.change-later:hover {
  filter: brightness(1.2);
}
.change-later {
  margin-top: 5px;
  padding: 3px 7px;
  color: #ffe9b0;
  background: #51432b;
  border-color: #c9a870;
}
.plate-empty {
  color: #888;
  font-size: 0.85rem;
}
.customer-card {
  pointer-events: auto;
  width: clamp(150px, 22vw, 210px);
  background: rgba(26, 15, 8, 0.92);
  border: 3px solid #ffcb47;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.2s,
    box-shadow 0.2s;
  position: relative;
  animation: custIn 0.35s ease-out;
}
@keyframes custIn {
  from {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.customer-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(255, 203, 71, 0.4);
}
.customer-card.selected {
  border-color: #7fff7f;
  box-shadow: 0 0 22px rgba(127, 255, 127, 0.8);
}
.customer-card.impatient {
  border-color: #ff8a00;
}
.customer-card.angry {
  border-color: #ff4444;
  animation: angryShake 0.4s infinite;
}
@keyframes angryShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}
.customer-card.leaving {
  animation: custOut 0.5s forwards;
}
@keyframes custOut {
  to {
    transform: translateY(30px) scale(0.8);
    opacity: 0;
  }
}
.cc-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cc-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4a2a10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 2px solid #ffcb47;
}
.cc-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffe9b0;
}
.cc-type {
  font-size: 0.6rem;
  color: #c9a870;
  letter-spacing: 0.5px;
}
.cc-dialogue {
  font-size: 0.68rem;
  color: #ffd980;
  font-style: italic;
  margin: 4px 0;
  min-height: 1.8em;
  line-height: 1.3;
}
.cc-order {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 4px 6px;
  margin: 4px 0;
}
.cc-order-item {
  font-size: 0.68rem;
  color: #fff;
  display: flex;
  justify-content: space-between;
}
.cc-price {
  font-size: 0.8rem;
  font-weight: 800;
  color: #7fff7f;
  text-align: right;
  margin-top: 2px;
}
.patience-bar {
  height: 8px;
  background: #2a1a0a;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid #000;
}
.patience-fill {
  height: 100%;
  transition:
    width 0.3s linear,
    background 0.3s;
  border-radius: 4px;
}
.patience-fill.happy {
  background: linear-gradient(90deg, #2ecc71, #7fff7f);
}
.patience-fill.waiting {
  background: linear-gradient(90deg, #f1c40f, #ffeb3b);
}
.patience-fill.impatient {
  background: linear-gradient(90deg, #e67e22, #ff8a00);
}
.patience-fill.angry {
  background: linear-gradient(90deg, #c0392b, #ff4444);
}
.cc-mood {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
}

/* ---------- SERVE PANEL ---------- */
#serve-panel {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  padding: 12px;
}
.serve-inner {
  width: min(560px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #3a1f0a, #1a0f08);
  border: 4px solid #ffcb47;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  animation: serveIn 0.3s ease-out;
}
@keyframes serveIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.serve-title {
  font-size: 1.2rem;
  color: #ffcb47;
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
}
.serve-sub {
  font-size: 0.8rem;
  color: #ffe9b0;
  text-align: center;
  margin-bottom: 10px;
}
.plate-area {
  background: #fff;
  border-radius: 50%;
  width: 170px;
  height: 170px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.15),
    0 6px 20px rgba(0, 0, 0, 0.5);
  border: 6px solid #e0d8c8;
}
.plate-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 12px;
  overflow: hidden;
}
.plate-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.6rem;
  animation: placeItem 0.3s ease-out;
}
.plate-item:hover {
  transform: scale(1.15);
}
@keyframes placeItem {
  from {
    transform: scale(2) rotate(20deg);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.serve-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.serve-item {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #6a4a20;
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.1s,
    border-color 0.2s,
    background 0.2s;
  position: relative;
}
.serve-item:hover {
  border-color: #ffcb47;
  transform: translateY(-2px);
}
.serve-item:active {
  transform: scale(0.94);
}
.serve-item.selected {
  border-color: #7fff7f;
  background: rgba(127, 255, 127, 0.15);
  box-shadow: 0 0 12px rgba(127, 255, 127, 0.5);
}
.serve-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.serve-item .si-icon {
  font-size: 1.5rem;
}
.serve-item .si-name {
  font-size: 0.65rem;
  color: #ffe9b0;
}
.serve-item .si-qty {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
}
.serve-item .si-have {
  font-size: 0.6rem;
  color: #7fff7f;
}
.serve-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.serve-actions .menu-btn {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
}

/* ---------- NOTIFICATIONS ---------- */
#notifications {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(360px, 90vw);
}
.notif {
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 800;
  font-size: clamp(0.8rem, 3vw, 1rem);
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  animation: notifIn 0.35s ease-out;
  border: 3px solid;
  min-width: 180px;
}
@keyframes notifIn {
  from {
    transform: translateY(-30px) scale(0.85);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.notif.out {
  animation: notifOut 0.4s forwards;
}
@keyframes notifOut {
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}
.notif.success {
  background: rgba(46, 204, 113, 0.95);
  border-color: #7fff7f;
  color: #fff;
}
.notif.warning {
  background: rgba(230, 126, 34, 0.95);
  border-color: #ff8a00;
  color: #fff;
}
.notif.error {
  background: rgba(192, 57, 43, 0.95);
  border-color: #ff4444;
  color: #fff;
}
.notif.event {
  background: rgba(155, 89, 182, 0.95);
  border-color: #d7a8ff;
  color: #fff;
}
.notif.info {
  background: rgba(52, 152, 219, 0.95);
  border-color: #7fc4ff;
  color: #fff;
}
.notif small {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.9;
}

/* ---------- OVERLAY (menus, results) ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
  overflow-y: auto;
}
.overlay-inner {
  width: min(560px, 94vw);
  background: linear-gradient(160deg, #3a1f0a, #1a0f08);
  border: 4px solid #ffcb47;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
  text-align: center;
}
.overlay-title {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 900;
  color: #ffcb47;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #a33b00;
}
.overlay-sub {
  font-size: clamp(0.8rem, 3vw, 1rem);
  color: #ffe9b0;
  font-style: italic;
  margin-bottom: 16px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
  text-align: left;
}
.stat-row {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid #ffcb47;
}
.stat-row .s-label {
  font-size: 0.75rem;
  color: #ffe9b0;
}
.stat-row .s-val {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
}
.stat-row.good .s-val {
  color: #7fff7f;
}
.stat-row.bad .s-val {
  color: #ff6666;
}
.stars {
  font-size: 2rem;
  letter-spacing: 4px;
  margin: 10px 0;
}
.overlay-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

/* Settings */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 203, 71, 0.2);
}
.settings-row label {
  font-size: 0.85rem;
  color: #ffe9b0;
}
.settings-row input[type="range"] {
  width: 140px;
  accent-color: #ffcb47;
}
.settings-row.settings-file-row {
  align-items: stretch;
  flex-direction: column;
  gap: 6px;
}
.settings-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.settings-control input[type="url"],
.settings-control input[type="file"] {
  width: 100%;
  min-width: 0;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
}
.settings-control input[type="url"] {
  padding: 7px;
  border: 1px solid #c9a870;
  border-radius: 4px;
  background: #201a16;
}
.settings-control small {
  color: #c9a870;
  font-size: 0.7rem;
  text-align: left;
}
.settings-control .menu-btn {
  padding: 7px 10px;
  font-size: 0.75rem;
}
.settings-row select {
  background: #1a0f08;
  color: #fff;
  border: 2px solid #ffcb47;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
}
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: #4a2a10;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
  border: 2px solid #6a4a20;
}
.toggle.on {
  background: #2ecc71;
  border-color: #7fff7f;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle.on::after {
  transform: translateX(22px);
}

/* Tutorial */
.tutorial-box {
  text-align: left;
}
.tutorial-box h3 {
  color: #ffcb47;
  margin-bottom: 8px;
}
.tutorial-box p {
  font-size: 0.9rem;
  color: #ffe9b0;
  margin-bottom: 8px;
  line-height: 1.4;
}
.tutorial-box ul {
  padding-left: 20px;
  font-size: 0.85rem;
  color: #fff;
  line-height: 1.6;
}
.tutorial-progress {
  font-size: 0.75rem;
  color: #c9a870;
  margin-top: 10px;
}

/* Leaderboard / Profile */
.lb-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.8rem;
}
.lb-table th {
  color: #ffcb47;
  padding: 6px;
  border-bottom: 2px solid #ffcb47;
  text-align: left;
}
.lb-table td {
  padding: 6px;
  border-bottom: 1px solid rgba(255, 203, 71, 0.15);
  color: #fff;
}
.lb-table tr.me td {
  color: #7fff7f;
  font-weight: 800;
}
.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.ach {
  background: rgba(0, 0, 0, 0.4);
  border: 2px solid #6a4a20;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}
.ach.unlocked {
  border-color: #ffcb47;
  box-shadow: 0 0 10px rgba(255, 203, 71, 0.3);
}
.ach.locked {
  opacity: 0.4;
}
.ach .a-icon {
  font-size: 1.6rem;
}
.ach .a-name {
  font-size: 0.7rem;
  font-weight: 800;
  color: #ffe9b0;
}
.ach .a-desc {
  font-size: 0.6rem;
  color: #c9a870;
}

/* Combo popup */
#combo-popup {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 45;
  pointer-events: none;
  font-size: clamp(2rem, 10vw, 4rem);
  font-weight: 900;
  color: #ffcb47;
  text-shadow:
    4px 4px 0 #a33b00,
    0 0 30px rgba(255, 203, 71, 0.8);
  opacity: 0;
}
#combo-popup.show {
  animation: comboPop 1s ease-out;
}
@keyframes comboPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1) translateY(-30px);
  }
}

/* Floating money */
.float-money {
  position: absolute;
  font-weight: 900;
  color: #7fff7f;
  font-size: 1.2rem;
  pointer-events: none;
  text-shadow: 2px 2px 0 #000;
  animation: floatUp 1.2s ease-out forwards;
  z-index: 42;
}
@keyframes floatUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-60px);
  }
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .hud-top {
    padding: 6px 8px;
  }
  #customer-area {
    top: 78px;
    bottom: 92px;
    gap: 8px;
    padding: 8px;
  }
  #pause-button {
    top: 78px;
    right: 8px;
    width: 38px;
    height: 38px;
  }
  .customer-card {
    width: calc(50% - 4px);
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .serve-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 400px) {
  .customer-card {
    width: 100%;
  }
}

/* Customer cards — stable, no blinking */
.customer-card {
  pointer-events: auto;
  width: clamp(160px, 23vw, 220px);
  background: rgba(26, 15, 8, 0.95);
  border: 3px solid #ffcb47;
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.3s,
    box-shadow 0.3s;
  position: relative;
  animation: custIn 0.35s ease-out;
}
@keyframes custIn {
  from {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
.customer-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(255, 203, 71, 0.4);
}
.customer-card.selected {
  border-color: #7fff7f;
  box-shadow: 0 0 22px rgba(127, 255, 127, 0.8);
}
.customer-card.impatient {
  border-color: #ff8a00;
}
.customer-card.angry {
  border-color: #ff4444;
}
.customer-card.leaving {
  animation: custOut 0.5s forwards;
}
@keyframes custOut {
  to {
    transform: translateY(30px) scale(0.8);
    opacity: 0;
  }
}

.cc-talk {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 6px;
}
.talk-btn {
  flex: 1;
  background: rgba(74, 31, 10, 0.9);
  border: 2px solid #6a4a20;
  border-radius: 8px;
  padding: 4px 2px;
  font-size: 0.9rem;
  cursor: pointer;
  transition:
    transform 0.1s,
    background 0.15s,
    border-color 0.15s;
}
.talk-btn:hover {
  background: rgba(120, 60, 20, 0.95);
  border-color: #ffcb47;
}
.talk-btn:active {
  transform: scale(0.9);
}

/* Speech bubble on customer card */
.speech-bubble {
  position: absolute;
  top: -34px;
  left: 8px;
  right: 8px;
  background: #fff;
  color: #222;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  z-index: 5;
  transition:
    opacity 0.3s,
    transform 0.3s;
  pointer-events: none;
}
.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}
.speech-bubble.player {
  background: #ffcb47;
  color: #3a1f0a;
  font-style: italic;
}
.speech-bubble.player::after {
  border-top-color: #ffcb47;
}
.speech-bubble.fade {
  opacity: 0;
  transform: translateY(-10px);
}
