/* GoldenAroma - pastel tema: lobi, oyun HUD'u, popuplar ve etiketler */

:root {
  --cream: #fff7ee;
  --latte: #e7c8a0;
  --mocha: #8c6a4f;
  --espresso: #5b4232;
  --pink: #ffb5c9;
  --mint: #bfe8d4;
  --sky: #bfe0f8;
  --card-bg: rgba(255, 247, 238, 0.94);
  --shadow: 0 6px 18px rgba(91, 66, 50, 0.18);
  --shadow-lg: 0 18px 50px rgba(91, 66, 50, 0.32);
  --good: #6bbf74;
  --bad: #e07a5f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Fredoka', 'Segoe UI', sans-serif;
  overflow: hidden;
  background: #f0dcc6;
  color: var(--espresso);
}

#game-canvas { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

/* ---------- Butonlar ---------- */
.btn {
  border: 2px solid var(--latte);
  background: var(--cream);
  color: var(--espresso);
  border-radius: 14px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, #ffd9a8, #ffb5c9); border-color: #f0a9b8; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { padding: 8px 14px; font-size: 13px; }
.btn.tiny { padding: 6px 11px; font-size: 12px; border-radius: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- LOBI ---------- */
#lobby {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(120% 120% at 50% 0%, #fff2e0 0%, #f3d9bd 55%, #e7c39c 100%);
  z-index: 40;
  padding: 16px;
  overflow: hidden;
}

.lobby-bg-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.deco-bean { position: absolute; font-size: 42px; opacity: 0.18; animation: float 8s ease-in-out infinite; filter: saturate(0.6); }
.deco-bean.b1 { top: 8%; left: 8%; font-size: 54px; animation-delay: 0s; }
.deco-bean.b2 { top: 68%; left: 12%; animation-delay: 1.2s; }
.deco-bean.b3 { top: 14%; right: 10%; animation-delay: 2.1s; }
.deco-bean.b4 { top: 72%; right: 14%; font-size: 48px; animation-delay: 0.6s; }
.deco-bean.b5 { top: 42%; right: 5%; font-size: 36px; animation-delay: 1.8s; }

.lobby-card {
  position: relative;
  z-index: 1;
  width: min(460px, 96vw);
  background: var(--card-bg);
  border: 3px solid var(--latte);
  border-radius: 26px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-lg);
  max-height: 94vh;
  overflow-y: auto;
  animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.brand {
  font-family: 'Baloo 2', cursive;
  font-size: 34px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
  color: var(--mocha);
}
.brand-logo {
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.08));
  display: inline-block;
  animation: wiggle 3.5s ease-in-out infinite;
}
.brand-tagline {
  text-align: center;
  font-size: 12.5px;
  opacity: 0.65;
  margin-bottom: 18px;
  font-weight: 500;
}

.lobby-screen { display: none; animation: fade 0.25s ease; }
.lobby-screen.active { display: block; }

.field-label { display: block; font-size: 13px; font-weight: 600; margin: 10px 2px 6px; opacity: 0.85; }
.text-input {
  width: 100%;
  border: 2px solid var(--latte);
  background: #fffdfa;
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--espresso);
  outline: none;
}
.text-input:focus { border-color: var(--pink); }
.code-input { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; text-align: center; }

.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn-row .btn { flex: 1; }

.lobby-hint { font-size: 12.5px; opacity: 0.7; margin-top: 14px; line-height: 1.5; text-align: center; }
.lobby-error { color: var(--bad); font-size: 13px; font-weight: 600; margin-top: 10px; text-align: center; min-height: 16px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 12px; opacity: 0.85; }

.welcome-line { text-align: center; font-size: 15px; margin: 6px 0 4px; }
.welcome-line b { color: var(--mocha); font-family: 'Baloo 2'; }
#logout-btn { display: block; margin: 14px auto 0; }

.ad-slot {
  margin-top: 14px; min-height: 50px; border-radius: 12px; border: 1.5px dashed var(--latte);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ad-placeholder { font-size: 12px; opacity: 0.5; }

.referral-box {
  margin-top: 14px; padding: 10px 12px; border-radius: 12px; background: rgba(212,160,16,0.12);
  border: 1.5px solid rgba(212,160,16,0.35); font-size: 12.5px; line-height: 1.5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.referral-box b { color: #a87d0a; }
#auth-referral-row.hidden { display: none; }

/* ---------- Onay penceresi (window.confirm yerine) ---------- */
.confirm-dialog-overlay {
  position: fixed; inset: 0; background: rgba(91,66,50,0.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.confirm-dialog-card {
  background: var(--cream); border: 3px solid var(--latte); border-radius: 20px;
  padding: 22px 24px; box-shadow: var(--shadow-lg); max-width: 320px; text-align: center; animation: pop 0.2s ease;
}
.confirm-dialog-msg { font-size: 14px; margin-bottom: 18px; line-height: 1.5; }
.confirm-dialog-actions { display: flex; gap: 10px; justify-content: center; }

.mode-row { display: flex; gap: 10px; margin-top: 16px; }
.mode-btn {
  flex: 1;
  border: 2px solid var(--latte);
  background: var(--cream);
  border-radius: 13px;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--espresso);
}
.mode-btn.active { background: var(--mint); border-color: var(--good); }

.saves-list, .rooms-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 190px; overflow-y: auto; }
.save-row, .room-row {
  display: flex; justify-content: space-between; align-items: center;
  border: 2px solid var(--latte); border-radius: 12px; padding: 10px 13px;
  background: #fffdfa; cursor: pointer; font-size: 14px; transition: background 0.12s ease;
}
.save-row:hover, .room-row:hover { background: var(--cream); }
.save-row.selected { border-color: var(--good); background: var(--mint); }
.save-row .meta, .room-row .meta { font-size: 12px; opacity: 0.65; }
.save-row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.save-delete-btn {
  border: none; background: transparent; font-size: 16px; opacity: 0.55; cursor: pointer;
  padding: 4px 6px; border-radius: 8px; flex-shrink: 0;
}
.save-delete-btn:hover { opacity: 1; background: rgba(224,122,95,0.15); }
.list-empty { font-size: 13px; opacity: 0.6; text-align: center; padding: 14px; }

.divider { text-align: center; font-size: 12px; opacity: 0.55; margin: 16px 0 4px; }

/* Bekleme odasi */
.room-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.room-name { font-size: 22px; font-weight: 700; font-family: 'Baloo 2'; }
.room-code-line { font-size: 13px; opacity: 0.8; margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.room-code { font-family: 'Baloo 2'; font-weight: 700; letter-spacing: 3px; font-size: 18px; color: var(--mocha); }
.save-badge { background: var(--mint); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; }
.players-title { font-size: 13px; font-weight: 600; opacity: 0.7; margin: 16px 0 8px; }
.waiting-players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.player-row { display: flex; align-items: center; gap: 10px; border: 2px solid var(--latte); border-radius: 12px; padding: 9px 13px; background: #fffdfa; }
.player-swatch { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08); }
.player-name { font-weight: 600; }
.host-tag { margin-left: auto; font-size: 11px; background: #ffe1a8; border-radius: 999px; padding: 3px 8px; font-weight: 600; }

/* ---------- OYUN HUD ---------- */
#ui-overlay { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui-overlay .btn, #ui-overlay button, #ingredient-menu, #shop-modal { pointer-events: auto; }

#orders-panel { position: absolute; top: 14px; left: 14px; width: 280px; }
#orders-panel h2 { font-size: 19px; font-weight: 700; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.15); }
#orders-list { display: flex; flex-direction: column; gap: 9px; }
.orders-empty { font-size: 14px; opacity: 0.8; background: var(--card-bg); border: 2px dashed var(--latte); border-radius: 12px; padding: 12px; text-align: center; }

.ticket {
  display: flex; align-items: center; gap: 11px;
  background: #ffffff; border: 3px solid var(--latte); border-radius: 16px;
  padding: 11px 14px; box-shadow: var(--shadow); animation: pops 0.3s ease;
  color: var(--espresso);
}
.ticket-icon { font-size: 28px; }
.ticket-body { flex: 1; min-width: 0; }
.ticket-top { display: flex; justify-content: space-between; align-items: center; }
.ticket-name { font-weight: 700; font-size: 16px; color: var(--espresso); }
.ticket-price { font-size: 15px; color: #c04040; font-weight: 700; }
.ticket-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.chip { font-size: 12px; background: rgba(140, 106, 79, 0.12); border-radius: 8px; padding: 3px 8px; color: var(--espresso); font-weight: 600; border: 1.5px solid rgba(140, 106, 79, 0.2); }
.ticket-bar-wrap { margin-top: 6px; height: 7px; border-radius: 5px; background: rgba(140,106,79,0.18); overflow: hidden; }
.ticket-bar { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--mint), var(--pink)); }
.ticket-bar.urgent { background: var(--bad); }

#hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
#status-panel {
  position: absolute; top: 14px; right: 14px; display: flex; align-items: center; gap: 7px;
  background: var(--card-bg); border: 2px solid var(--latte); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
}
#room-code-chip { font-family: 'Baloo 2'; letter-spacing: 2px; color: var(--mocha); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.dot.online { background: var(--good); box-shadow: 0 0 8px rgba(107,191,116,0.9); }

.pill {
  background: var(--card-bg); border: 2px solid var(--latte); border-radius: 999px;
  padding: 8px 15px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); white-space: nowrap;
}
.pill.money { background: linear-gradient(135deg,#fff1cf,#ffe0a8); border-color: #f0cf8f; }
.pill.hint { font-size: 12.5px; opacity: 0.9; font-weight: 500; }
.pill.hint.active { border-color: var(--good); background: rgba(191,232,212,0.96); }

#inventory-panel {
  position: absolute; right: 14px; top: 58px; display: flex; flex-direction: column; gap: 5px;
  background: var(--card-bg); border: 2px solid var(--latte); border-radius: 14px; padding: 9px 11px;
  box-shadow: var(--shadow); font-size: 13px; min-width: 118px;
}
.inv-title { font-size: 11px; font-weight: 600; opacity: 0.6; margin-bottom: 2px; }
.inv-row { display: flex; justify-content: space-between; gap: 10px; }
.inv-row.low { color: var(--bad); font-weight: 700; }

#bottom-bar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.corner-buttons { position: absolute; bottom: 16px; right: 14px; display: flex; gap: 8px; }

/* ---------- Combo pill ---------- */
.combo-pill { background: linear-gradient(135deg,#ff6b6b,#ffd166); border-color: #e86060; color: #5b1a1a; animation: comboPulse 0.5s ease; }
@keyframes comboPulse { 0%{transform:scale(1.4)} 100%{transform:scale(1)} }

/* ---------- Acil sipariş banner ---------- */
.urgent-banner {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg,#ff4757,#c0392b); color: #fff;
  border-radius: 14px; padding: 10px 20px; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 18px rgba(192,57,43,0.5);
  animation: urgentIn 0.3s ease; z-index: 900;
}
.urgent-banner.hidden { display: none; }
.urgent-countdown { background: rgba(0,0,0,0.25); border-radius: 8px; padding: 2px 9px; font-size: 13px; font-variant-numeric: tabular-nums; }
@keyframes urgentIn { from{opacity:0;transform:translateX(-50%) translateY(-12px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ---------- Spectator badge ---------- */
.spectator-badge {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(60,60,60,0.85); color: #fff; border-radius: 999px;
  padding: 6px 18px; font-size: 13px; font-weight: 600; pointer-events: none;
}

/* ---------- Başarım popup ---------- */
.achievement-popup {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg,#fff1cf,#ffe0a8); border: 3px solid #f0cf8f;
  border-radius: 16px; padding: 12px 22px; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-lg);
  animation: achIn 0.35s ease; z-index: 950; white-space: nowrap;
}
.achievement-popup.hidden { display: none; }
@keyframes achIn { from{opacity:0;transform:translateX(-50%) scale(0.7)} to{opacity:1;transform:translateX(-50%) scale(1)} }

/* ---------- Gün sonu yorumlar ---------- */
.summary-reviews { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 7px; }
.review-item { background: #fffdfa; border: 1.5px solid var(--latte); border-radius: 11px; padding: 8px 12px; font-size: 12.5px; text-align: left; color: var(--espresso); }

/* ---------- Başarımlar ekranı ---------- */
.screen-head { font-family: 'Baloo 2'; font-size: 18px; margin-bottom: 12px; }
.achievements-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; max-height: 320px; overflow-y: auto; }
.ach-card {
  display: flex; align-items: center; gap: 9px;
  background: #fffdfa; border: 2px solid var(--latte); border-radius: 13px;
  padding: 9px 11px; font-size: 12px; opacity: 0.45; transition: opacity 0.2s;
}
.ach-card.unlocked { opacity: 1; border-color: #f0cf8f; background: linear-gradient(135deg,#fffaee,#fff3d0); }
.ach-icon { font-size: 22px; }
.ach-info b { display: block; font-size: 12px; }
.ach-info span { font-size: 10.5px; opacity: 0.7; }

/* ---------- Liderboard ---------- */
.leaderboard-list { display: flex; flex-direction: column; gap: 7px; max-height: 300px; overflow-y: auto; margin-bottom: 10px; }
.lb-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px;
  background: #fffdfa; border: 2px solid var(--latte); border-radius: 12px; font-size: 13px;
}
.lb-rank { font-size: 18px; width: 28px; text-align: center; }
.lb-name { flex: 1; font-weight: 600; }
.lb-money { font-weight: 700; color: var(--mocha); }
.lb-row.me { border-color: #f0cf8f; background: linear-gradient(135deg,#fffaee,#fff3d0); }

#toast {
  position: absolute; bottom: 74px; left: 0; right: 0; margin: 0 auto; width: fit-content; max-width: 82vw;
  background: var(--card-bg); border: 2px solid var(--latte); border-radius: 13px;
  padding: 10px 20px; font-size: 15px; font-weight: 600; box-shadow: var(--shadow); animation: pops 0.22s ease;
}
#toast.success { border-color: var(--good); background: rgba(191,232,212,0.96); }
#toast.error { border-color: var(--bad); background: rgba(240,200,190,0.96); }

/* ---------- Popup: malzeme menusu ---------- */
.popup {
  position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%);
  background: var(--card-bg); border: 3px solid var(--latte); border-radius: 20px;
  padding: 16px 18px; box-shadow: var(--shadow-lg); animation: popc 0.2s ease; text-align: center;
}
.popup-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.menu-items { display: flex; gap: 10px; justify-content: center; }
.menu-item {
  width: 92px; border: 2px solid var(--latte); background: #fffdfa; border-radius: 14px;
  padding: 12px 6px; text-align: center; cursor: pointer; transition: transform 0.08s ease, background 0.12s ease;
}
.menu-item:hover { transform: translateY(-2px); background: var(--cream); }
.menu-item.disabled { opacity: 0.4; cursor: not-allowed; }
.menu-item .mi-icon { font-size: 28px; }
.menu-item .mi-label { font-size: 13px; font-weight: 600; margin-top: 4px; }
.menu-item .mi-stock { font-size: 11px; opacity: 0.7; }
.menu-item .mi-key { font-size: 10px; opacity: 0.55; }
.popup-hint { font-size: 11px; opacity: 0.6; margin-top: 10px; }

/* ---------- Modal: magaza / yukleme ---------- */
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(91,66,50,0.4); backdrop-filter: blur(3px); z-index: 30; }
.modal-card { background: var(--cream); border: 3px solid var(--latte); border-radius: 24px; padding: 22px 24px; box-shadow: var(--shadow-lg); width: min(680px, 96vw); max-height: 90vh; display: flex; flex-direction: column; animation: pop 0.28s ease; }
.modal-card.center { text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-head h1 { font-size: 20px; font-family: 'Baloo 2'; }
.modal-money { font-size: 17px; font-weight: 700; }
.modal-sub { font-size: 13px; opacity: 0.75; margin: 6px 0 12px; flex-shrink: 0; }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 14px; overflow-y: auto; flex: 1; padding-right: 4px; }
.shop-items::-webkit-scrollbar { width: 5px; }
.shop-items::-webkit-scrollbar-track { background: transparent; }
.shop-items::-webkit-scrollbar-thumb { background: var(--latte); border-radius: 4px; }
.shop-item { display: flex; align-items: center; gap: 8px; border: 2px solid var(--latte); border-radius: 14px; padding: 8px 10px; background: #fffdfa; }
.shop-item .si-icon { font-size: 24px; flex-shrink: 0; }
.shop-item .si-body { flex: 1; min-width: 0; }
.shop-item .si-name { font-weight: 600; font-size: 12px; }
.shop-item .si-meta { font-size: 10px; opacity: 0.65; }
.shop-item .si-buy { border: 2px solid var(--good); background: var(--mint); border-radius: 10px; padding: 5px 8px; font-size: 11px; font-weight: 700; color: var(--espresso); white-space: nowrap; flex-shrink: 0; }
.shop-item .si-buy:disabled { border-color: var(--latte); background: var(--cream); }

/* ---------- Projelenen etiketler (nickname + baloncuk) ---------- */
#labels-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.name-label {
  position: absolute; transform: translate(-50%, -100%);
  font-family: 'Baloo 2', cursive; font-weight: 700; font-size: 14px;
  color: #fff; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35); box-shadow: var(--shadow);
  border: 2px solid rgba(255,255,255,0.65);
}
.bubble {
  position: absolute; transform: translate(-50%, -100%);
  background: #fff; border: 2px solid var(--latte); border-radius: 14px;
  padding: 4px 9px; box-shadow: var(--shadow); white-space: nowrap; font-size: 13px; font-weight: 600;
}
.bubble .bub-icon { font-size: 17px; }
.bubble::after {
  content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid #fff;
}
.bubble.want { border-color: var(--pink); }
.bubble.tap { border-color: var(--good); animation: nudge 1s ease-in-out infinite; }
.bubble .mini-bar { height: 4px; border-radius: 3px; background: rgba(140,106,79,0.2); margin-top: 3px; overflow: hidden; }
.bubble .mini-bar > div { height: 100%; background: var(--good); }
.bubble .mini-bar.urgent > div { background: var(--bad); }

.customer-bubble {
  position: absolute; transform: translate(-50%, -100%);
  background: #fff; border: 2px solid var(--latte); border-radius: 14px;
  padding: 8px 11px; box-shadow: var(--shadow); white-space: nowrap; font-size: 13px; font-weight: 600;
  text-align: center;
  pointer-events: none;
}
.customer-bubble::after {
  content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid #fff;
}
.customer-bubble.waiting { border-color: var(--good); animation: nudge 1s ease-in-out infinite; }
.customer-bubble.seated { border-color: var(--pink); }
.customer-bubble .bubble-icon { font-size: 18px; display: block; margin-bottom: 2px; }
.customer-bubble .bubble-name { font-weight: 600; display: block; }
.customer-bubble .bubble-take { font-size: 10px; opacity: 0.7; display: block; color: var(--good); }
.customer-bubble .bubble-patience { height: 4px; border-radius: 3px; background: rgba(140,106,79,0.2); margin-top: 4px; overflow: hidden; display: block; width: 100%; }
.customer-bubble .bubble-patience > span { height: 100%; display: block; transition: width 0.1s linear; }
.customer-bubble .bubble-emote { font-size: 20px; }

/* ---------- Tam ekran FAB ---------- */
#fullscreen-fab {
  position: fixed; bottom: 14px; left: 14px; z-index: 8000;
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--latte); background: var(--card-bg);
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow); display: none; align-items: center; justify-content: center;
  transition: background 0.15s ease;
}
#fullscreen-fab:active { background: var(--mint); }
#fullscreen-fab.fs-active { background: var(--mint); border-color: var(--good); }

/* Yalnizca dokunmatik/dar ekranlarda goster */
@media (pointer: coarse), (max-width: 820px) {
  #fullscreen-fab { display: flex; }
  /* In-game tam ekran butonu zaten corner-buttons icinde, FAB'i orada gizle */
  #ui-overlay:not(.hidden) ~ #fullscreen-fab { display: none; }
}

/* ---------- Mobil HUD: ekrana sigdirmak icin kucult ---------- */
/* max-width: 1024px — hem dar pencereler hem mobil landscape telefon (örn. 932px) */
@media (max-width: 1024px) and (pointer: coarse), (max-width: 820px) {
  /* Pilleri küçült — TEK SIRA kalmalı, asla wrap etmemeli */
  .pill { padding: 4px 7px; font-size: 10px; }
  #hud-top {
    gap: 3px; top: 6px;
    /* flex-wrap YOK — tüm pill'ler tek satırda kalır */
    flex-wrap: nowrap;
    /* sağ taraftaki status/inventory ile çakışmasın */
    max-width: calc(100vw - 140px);
    overflow: hidden;
    justify-content: flex-start;
    left: 6px; transform: none; /* ortalamayi kaldır, sola yasla */
  }
  /* Fame pill mobilde küçültülmüş tek harfle göster */
  #fame-pill { padding: 4px 6px; }
  #combo-pill { padding: 4px 7px; }

  #status-panel { top: 6px; right: 6px; font-size: 10px; padding: 4px 8px; gap: 4px; }
  /* Inventory panel mobilde gizle — depo bilgisi zaten yeterince küçük alanda sığmıyor */
  #inventory-panel { display: none; }

  /* Köşe butonları: status panelin altına dikey, aksiyon butonlarıyla çakışmasın */
  .corner-buttons {
    bottom: auto; top: 36px; right: 6px; gap: 4px;
    flex-direction: column; align-items: flex-end;
  }
  .corner-buttons .btn.tiny { padding: 4px 8px; font-size: 10px; }
  .joystick-toggle-btn.tiny { padding: 4px 7px; font-size: 13px; }

  #bottom-bar { bottom: 6px; gap: 5px; }
  #orders-panel { max-width: 44vw; font-size: 11px; top: 80px; }
  .ticket-title { font-size: 11px; }
  .ticket-price { font-size: 11px; }
  .chip { font-size: 9px; padding: 2px 5px; }

  /* Acil sipariş banner daha küçük */
  .urgent-banner { font-size: 13px; padding: 7px 14px; top: 38px; }

  /* iOS notch/safe-area dolgu */
  #ui-overlay, #lobby { padding-top: env(safe-area-inset-top); }
}

/* ---------- Mobil kontroller (joystick toggle ile acilir/kapanir) ---------- */
.mobile-controls { display: none; }

body[data-joystick="on"] .mobile-controls {
  display: block;
  position: absolute; inset: 0; pointer-events: none;
}

@media (pointer: coarse), (max-width: 820px) {
  body[data-joystick="on"] #bottom-bar { display: none; }
}

/* ---------- Yatay mod zorunluluğu (portrede döndür mesajı) ---------- */
#rotate-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 9999;
  background: #2c1a0e;
  color: #fff5e4;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  font-family: 'Fredoka', sans-serif; text-align: center; padding: 32px;
}
#rotate-overlay .rotate-icon { font-size: 64px; animation: rotatePing 1.2s ease-in-out infinite; }
#rotate-overlay p { font-size: 20px; font-weight: 500; opacity: 0.9; max-width: 280px; }

@keyframes rotatePing {
  0%,100% { transform: rotate(0deg); }
  50%      { transform: rotate(90deg); }
}

@media (max-width: 820px) and (orientation: portrait) {
  #rotate-overlay { display: flex; }
}

/* ---------- Joystick toggle butonu (lobi + bekleme + HUD corner) ---------- */
.joystick-toggle-btn {
  display: none;
  align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 10px; border: 2px solid var(--latte);
  background: var(--card-bg); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.1s ease, border-color 0.1s ease;
}
.joystick-toggle-btn.tiny { padding: 6px 10px; font-size: 16px; }
.joystick-toggle-btn.on { border-color: var(--good); background: var(--mint); }
@media (pointer: coarse), (max-width: 820px) {
  .joystick-toggle-btn { display: flex; }
}

.joystick-base {
  position: absolute; left: 26px; bottom: 26px; width: 118px; height: 118px;
  border-radius: 50%; background: rgba(255,247,238,0.55); border: 3px solid rgba(140,106,79,0.35);
  pointer-events: auto; touch-action: none;
}
.joystick-thumb {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: var(--card-bg); border: 3px solid var(--pink); box-shadow: var(--shadow);
  transition: transform 0.05s linear;
}

.mobile-action-buttons {
  position: absolute; right: 22px; bottom: 26px; display: flex; flex-direction: column; gap: 14px;
  pointer-events: auto;
}
.mobile-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--latte);
  background: var(--card-bg); font-size: 26px; box-shadow: var(--shadow); touch-action: none;
}
.mobile-btn.interact { border-color: var(--good); background: var(--mint); }
.mobile-btn.attack { width: 54px; height: 54px; font-size: 22px; align-self: flex-end; }
.mobile-btn.attack.armed { border-color: var(--bad); background: rgba(224,122,95,0.35); animation: pulse 0.6s ease-in-out infinite; }

.table-lock-bubble {
  position: absolute; transform: translate(-50%, -100%);
  background: rgba(140,106,79,0.85); color: #fff; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
  pointer-events: none;
}

/* ---------- Gün zamanlayıcı ---------- */
.day-timer { font-variant-numeric: tabular-nums; }
.day-timer.closing { border-color: var(--bad); background: rgba(240,200,190,0.96); animation: pulse 1s ease-in-out infinite; }
.day-timer.prep { opacity: 0.6; }

/* ---------- Hedef & Ün pilleri ---------- */
.target-pill { background: linear-gradient(135deg,#e0f5ea,#c9ecd8); border-color: var(--good); }
.target-pill.hit { background: linear-gradient(135deg,#c9ecd8,#a8e6cf); animation: pulse 1.4s ease-in-out infinite; }
.fame-pill { background: linear-gradient(135deg,#fff1cf,#ffe9a8); border-color: #e8c766; }

/* ---------- Zorluk secimi (lobi) ---------- */
.difficulty-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.difficulty-item {
  display: flex; align-items: center; gap: 10px; border: 2px solid var(--latte); border-radius: 13px;
  padding: 10px 13px; background: #fffdfa; cursor: pointer; transition: transform 0.08s ease, background 0.12s ease;
}
.difficulty-item:hover { transform: translateY(-1px); }
.difficulty-item.selected { border-color: var(--good); background: var(--mint); }
.difficulty-item .di-icon { font-size: 20px; }
.difficulty-item .di-label { font-weight: 700; flex: 1; }
.difficulty-item .di-desc { font-size: 11px; opacity: 0.65; }

/* ---------- Unlu misafir ---------- */
.customer-bubble.celebrity { border-color: #e8c766; box-shadow: 0 0 0 3px rgba(232,199,102,0.35), var(--shadow); }
.bubble-celebrity-tag { font-size: 10px; font-weight: 700; color: #b8860b; display: block; }

/* ---------- Dükkan aç/kapa butonu ---------- */
#toggle-shop-btn.shop-open { background: linear-gradient(135deg, var(--mint), #a8e6cf); border-color: var(--good); }
#toggle-shop-btn.shop-closed { background: linear-gradient(135deg, #ffd9a8, #ffb5c9); border-color: #f0a9b8; }

/* ---------- Gün sonu özeti ---------- */
.summary-card { max-width: 360px; }
.summary-card h1 { font-family: 'Baloo 2', cursive; font-size: 26px; margin-bottom: 16px; }
.summary-stats { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #fffdfa; border: 2px solid var(--latte); border-radius: 12px;
  padding: 10px 14px; font-size: 15px;
}
.summary-row.total { border-color: var(--good); background: var(--mint); font-size: 17px; }
.summary-row.bonus { border-color: #e8c766; background: rgba(255,233,168,0.6); }
.summary-row b { font-size: 18px; }
.summary-hint { font-size: 13px; opacity: 0.65; text-align: center; animation: pulse 2s ease-in-out infinite; }

@keyframes popc { from { transform: translateX(-50%) scale(0.86); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes pops { from { transform: scale(0.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nudge { 0%,100% { transform: translate(-50%,-100%); } 50% { transform: translate(-50%,-112%); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(6deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(8deg); }
}


/* ---------- Vardiya pill ---------- */
.shift-pill { background: linear-gradient(135deg,#dff2ff,#c5e8ff); border-color: #7fc8f8; font-size: 12px; }

/* ---------- Sipariş: adım göstergesi + modifier ---------- */
.ticket-steps { display: flex; align-items: center; gap: 3px; margin-top: 5px; flex-wrap: wrap; }
.step-chip { display: inline-flex; align-items: center; gap: 3px; background: rgba(255,255,255,0.75); border: 1px solid var(--latte); border-radius: 6px; padding: 2px 6px; font-size: 11px; white-space: nowrap; }
.step-name { font-size: 10px; color: #7c5c3a; font-weight: 600; }
.step-arrow { font-size: 10px; color: #b39070; line-height: 1; }
.order-modifier { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; background: rgba(255,230,160,0.7); border: 1px solid #e8c766; border-radius: 7px; padding: 1px 6px; margin-top: 4px; }
.mod-bonus { font-weight: 700; color: #b8860b; }
.customer-type-badge { font-size: 13px; margin-right: 3px; }

/* ===================== CHAT SİSTEMİ ===================== */
.chat-panel {
  position: fixed;
  bottom: 100px;
  left: 20px;
  width: 300px;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 15;
  font-family: 'Fredoka', sans-serif;
  display: none; /* GEÇİCİ OLARAK GİZLE */
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-title {
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.chat-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chat-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.chat-messages {
  height: 200px;
  overflow-y: auto;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  word-wrap: break-word;
  animation: fadeInUp 0.3s ease;
}

.chat-message.system {
  background: rgba(100, 150, 255, 0.2);
  color: #a0c4ff;
  font-style: italic;
  text-align: center;
  padding: 5px 10px;
}

.chat-message.own {
  background: rgba(76, 175, 80, 0.2);
  color: #a5d6a7;
  align-self: flex-end;
  max-width: 80%;
}

.chat-message.other {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
  align-self: flex-start;
  max-width: 80%;
}

.chat-player-name {
  color: #ffcc80;
  font-weight: 600;
  margin-right: 5px;
}

.chat-input-area {
  display: flex;
  padding: 10px 15px;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-area.hidden {
  display: none;
}

#chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

#chat-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

#chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.chat-send-btn {
  background: rgba(76, 175, 80, 0.3);
  border: 1px solid rgba(76, 175, 80, 0.5);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chat-send-btn:hover {
  background: rgba(76, 175, 80, 0.5);
  transform: scale(1.05);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobil düzenlemeler */
@media (max-width: 768px) {
  .chat-panel {
    width: 280px;
    bottom: 120px;
    left: 10px;
  }
  
  .chat-messages {
    height: 150px;
  }
}

/* Shop tabs için CSS ekleyelim */
.shop-tabs {
  display: flex;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 15px;
}

.shop-tab {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.shop-tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-bottom: 3px solid #4caf50;
}

.shop-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.shop-content.hidden {
  display: none;
}

/* Menu management styles */
.menu-management {
  padding: 10px 0;
}

.menu-header h3 {
  color: white;
  margin: 0 0 5px 0;
}

.menu-header p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 15px 0;
  font-size: 14px;
}

.menu-recipes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-recipe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-recipe.locked {
  opacity: 0.5;
}

.menu-recipe.disabled {
  background: rgba(255, 0, 0, 0.1);
  border-color: rgba(255, 0, 0, 0.2);
}

.recipe-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.recipe-icon {
  font-size: 20px;
}

.recipe-details {
  display: flex;
  flex-direction: column;
}

.recipe-name {
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.recipe-price {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.recipe-toggle {
  display: flex;
  align-items: center;
}

.toggle-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.enabled {
  background: rgba(76, 175, 80, 0.3);
  color: #a5d6a7;
  border: 1px solid rgba(76, 175, 80, 0.5);
}

.toggle-btn.disabled {
  background: rgba(244, 67, 54, 0.3);
  color: #ffab91;
  border: 1px solid rgba(244, 67, 54, 0.5);
}

.toggle-btn:hover {
  transform: scale(1.05);
}

.lock-badge {
  background: rgba(255, 193, 7, 0.2);
  color: #ffcc02;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* Oturma süresi timer'ı */
.bubble-order.seated .sitting-timer {
  font-size: 11px;
  color: #8b9dc3;
  margin-top: 2px;
  font-family: 'Courier New', monospace;
}

.bubble-order.seated {
  background: rgba(139, 157, 195, 0.15);
  border-color: rgba(139, 157, 195, 0.4);
}
/* ── Gardırop Modal ─────────────────────────────────────── */
.wardrobe-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.wardrobe-backdrop.hidden { display: none; }

.wardrobe-box {
  background: #1e1610;
  border: 2px solid #8b6343;
  border-radius: 14px;
  padding: 0;
  width: min(520px, 96vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.7);
}

.wardrobe-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px 10px;
  background: #2c1e14;
  border-bottom: 1px solid #8b6343;
  font-weight: 700; font-size: 16px; color: #f5d98a;
}
.wardrobe-header button {
  background: none; border: none; color: #aaa; font-size: 18px; cursor: pointer;
}
.wardrobe-header button:hover { color: #fff; }

.wardrobe-tabs {
  display: flex; gap: 0;
  background: #2c1e14;
  border-bottom: 1px solid #5a3d28;
}
.wardrobe-tab {
  flex: 1; padding: 8px 4px; font-size: 12px; font-weight: 600;
  background: none; border: none; border-bottom: 3px solid transparent;
  color: #a08060; cursor: pointer; transition: all .18s;
}
.wardrobe-tab:hover { color: #f5d98a; }
.wardrobe-tab.active { color: #f5d98a; border-bottom-color: #d4a010; }

.wardrobe-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px; padding: 14px; overflow-y: auto; flex: 1;
}

.wardrobe-card {
  background: #2a1c10; border: 2px solid #4a3228; border-radius: 10px;
  padding: 10px 8px; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 5px;
  transition: border-color .18s;
}
.wardrobe-card:hover { border-color: #8b6343; }
.wardrobe-card.owned { border-color: #5c8a44; }
.wardrobe-card.equipped { border-color: #d4a010; background: #2e2208; }

.w-icon { font-size: 26px; }
.w-swatch {
  width: 38px; height: 38px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2); display: block;
}
.w-name { font-size: 11px; color: #c8a87a; font-weight: 600; line-height: 1.2; }
.w-price { font-size: 11px; color: #a0c070; }

.w-action {
  margin-top: 4px; padding: 5px 10px; border-radius: 6px; border: none;
  font-size: 11px; font-weight: 700; cursor: pointer; transition: background .15s;
}
.btn-buy { background: #d4a010; color: #1a0e00; }
.btn-buy:hover { background: #f0bc20; }
.btn-equip { background: #3d6e30; color: #d0f0b0; }
.btn-equip:hover { background: #50903e; }

.wardrobe-equipped {
  padding: 10px 16px; font-size: 12px; color: #a08060;
  background: #1a1008; border-top: 1px solid #4a3228;
}

/* ── Elmas Mağazası Modal ───────────────────────────────── */
.coinstore-box { width: min(560px, 96vw); }
.coinstore-body { overflow-y: auto; flex: 1; }
.coinstore-hint { padding: 20px; font-size: 13px; color: #c8a87a; text-align: center; }
.coinstore-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px; padding: 14px;
}
.coinstore-card .w-action:disabled { opacity: 0.4; cursor: not-allowed; }

.pill.coin-pill { color: #7fe0ff; }
.pill.boost-pill { color: #ffb84d; animation: pulseBoost 1.4s ease-in-out infinite; }
@keyframes pulseBoost { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
.pill.premium-pill { color: #ffe0a0; }

/* ── FPS / Ping HUD ─────────────────────────────────────── */
#perf-hud {
  position: fixed;
  top: 52px;
  left: 8px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
#perf-hud span {
  background: rgba(0,0,0,.45);
  color: #a0ffb0;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .04em;
}
#perf-ping { color: #ffe080; }
#perf-hud.hidden { display: none; }
