/* ═══════════════════════════════════════════════════════════
   DIRTY ICE CREAM SHOP — AAA QUALITY STYLESHEET
   Dark, gritty, photo-real aesthetic
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@400;600;700&family=Roboto:wght@300;400;700&display=swap');

:root {
  --bg-dark:      #0a0a0f;
  --bg-mid:       #12121a;
  --bg-panel:     #1a1a26;
  --bg-card:      #20202e;
  --border:       #2e2e44;
  --border-glow:  #4a3f6b;
  --accent:       #c8a400;
  --accent2:      #e05c00;
  --gross-green:  #4caf20;
  --gross-yellow: #d4c800;
  --gross-brown:  #7a4a00;
  --nausea-red:   #c00030;
  --text-primary: #f0eaff;
  --text-muted:   #7a7a9a;
  --text-accent:  #ffd700;
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.8);
  --shadow-glow:  0 0 24px rgba(200,164,0,0.3);
  --radius:       8px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-ui:      'Oswald', sans-serif;
  --font-body:    'Roboto', sans-serif;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  user-select: none;
}

/* ── SCREENS ── */
.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; }

/* ══════════════════════ MAIN MENU ══════════════════════ */
#main-menu {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(100,40,0,0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(40,0,100,0.4) 0%, transparent 60%),
    linear-gradient(160deg, #0a0a0f 0%, #12091a 50%, #0f0a05 100%);
  align-items: center; justify-content: center; flex-direction: column;
}

.menu-bg-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(255,255,255,0.01) 40px, rgba(255,255,255,0.01) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(255,255,255,0.01) 40px, rgba(255,255,255,0.01) 41px);
}

.menu-container {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 32px;
  padding: 40px 60px;
  background: rgba(10,10,20,0.75);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(120,60,200,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  min-width: 480px;
}

.game-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Logo image */
.logo-ice-cream-img {
  width: 160px;
  height: auto;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.7));
  margin-bottom: 4px;
}

.game-title {
  font-family: var(--font-display);
  font-size: 64px; line-height: 0.9;
  text-align: center;
  color: var(--text-primary);
  text-shadow: 0 0 30px rgba(200,164,0,0.5), 2px 2px 0 rgba(0,0,0,0.8);
  letter-spacing: 4px;
}
.title-accent {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(200,164,0,0.8), 2px 2px 0 rgba(0,0,0,0.8);
}
.game-subtitle {
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 2px;
  color: #c04040; text-transform: uppercase;
  border: 1px solid #c04040; padding: 4px 16px; border-radius: 4px;
  background: rgba(192,64,64,0.1);
}
.game-tagline {
  font-family: var(--font-body); font-size: 13px; font-style: italic;
  color: var(--text-muted);
}

/* MENU BUTTONS */
.main-nav { display: flex; flex-direction: column; gap: 12px; width: 100%; }

.menu-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 32px; border: none; border-radius: var(--radius);
  font-family: var(--font-display); font-size: 28px; letter-spacing: 3px;
  cursor: pointer; transition: all 0.15s ease;
  position: relative; overflow: hidden;
  text-align: left; width: 100%;
}
.menu-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  pointer-events: none;
}
.menu-btn:hover { transform: translateX(6px) scale(1.02); }
.menu-btn:active { transform: translateX(2px) scale(0.99); }

.btn-new-game {
  background: linear-gradient(135deg, #7a2000 0%, #c84000 50%, #e05c00 100%);
  color: #fff; box-shadow: 0 4px 20px rgba(224,92,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-new-game:hover { box-shadow: 0 6px 30px rgba(224,92,0,0.7), inset 0 1px 0 rgba(255,255,255,0.2); }

.btn-how-to-play {
  background: linear-gradient(135deg, #1a2a4a 0%, #1e3a7a 50%, #2040a0 100%);
  color: #a0c0ff; box-shadow: 0 4px 20px rgba(32,64,160,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-how-to-play:hover { box-shadow: 0 6px 30px rgba(32,64,160,0.6), inset 0 1px 0 rgba(255,255,255,0.15); }

.btn-exit {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #3a3a3a 100%);
  color: #888; box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}
.btn-exit:hover { color: #bbb; box-shadow: 0 6px 30px rgba(0,0,0,0.7); }

.btn-back {
  background: linear-gradient(135deg, #2a1a3a 0%, #3a2a5a 100%);
  color: #c0a0ff; font-size: 20px; justify-content: center;
  border: 1px solid #4a3a7a; margin-top: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.btn-icon { font-size: 28px; }

.menu-footer { text-align: center; color: var(--text-muted); font-size: 11px; line-height: 1.8; }

/* ══════════════════════ HOW TO PLAY MODAL ══════════════════════ */
#how-to-play-screen {
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: 100;
}
.modal-overlay { position: absolute; inset: 0; cursor: pointer; }
.modal-box {
  position: relative; z-index: 2;
  background: linear-gradient(160deg, #16161e 0%, #1e1e2e 100%);
  border: 1px solid var(--border-glow);
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(100,80,200,0.3);
  padding: 36px 40px;
  max-width: 680px; width: 90%; max-height: 88vh; overflow-y: auto;
}
.modal-title {
  font-family: var(--font-display); font-size: 44px; letter-spacing: 4px;
  color: var(--accent); text-align: center; margin-bottom: 24px;
  text-shadow: 0 0 20px rgba(200,164,0,0.5);
}
.htp-section { margin-bottom: 20px; }
.htp-section h3 {
  font-family: var(--font-ui); font-size: 16px; letter-spacing: 2px;
  color: var(--accent2); border-bottom: 1px solid var(--border);
  padding-bottom: 6px; margin-bottom: 10px;
}
.htp-section p, .htp-section li {
  color: #c0c0d8; font-size: 14px; line-height: 1.7;
}
.htp-section ul { padding-left: 20px; }
.htp-section li { margin-bottom: 6px; }

/* ══════════════════════ GAME HUD ══════════════════════ */
#game-screen {
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(40,20,60,0.6) 0%, transparent 70%),
    linear-gradient(180deg, #0d0d14 0%, #0a0a10 100%);
}

#game-hud {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; height: 64px;
  background: linear-gradient(180deg, rgba(20,16,30,0.98) 0%, rgba(16,12,24,0.95) 100%);
  border-bottom: 2px solid var(--border-glow);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  flex-shrink: 0; z-index: 10;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 20px; }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hud-stat { display: flex; flex-direction: column; align-items: center; }
.hud-label { font-family: var(--font-ui); font-size: 9px; letter-spacing: 2px; color: var(--text-muted); text-transform: uppercase; }
.hud-value { font-family: var(--font-display); font-size: 26px; color: var(--accent); line-height: 1; }
.shop-sign {
  font-family: var(--font-display); font-size: 18px; letter-spacing: 3px;
  color: var(--text-accent); text-shadow: 0 0 12px rgba(255,215,0,0.4);
}
.gross-meter-container { display: flex; align-items: center; gap: 8px; }
.gross-label { font-family: var(--font-ui); font-size: 9px; letter-spacing: 2px; color: var(--gross-green); text-transform: uppercase; }
.gross-meter-bar {
  width: 180px; height: 12px; border-radius: 6px;
  background: rgba(0,0,0,0.5); border: 1px solid #2a4a2a;
  position: relative; overflow: hidden;
}
.gross-meter-fill {
  height: 100%; width: 0%; border-radius: 6px;
  background: linear-gradient(90deg, #2a7a00 0%, #80c000 50%, #c8e000 80%, #ff4400 100%);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(128,192,0,0.5);
}
.gross-meter-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-family: var(--font-ui); letter-spacing: 1px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.hud-btn {
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border-glow);
  background: rgba(74,63,107,0.3); color: #c0a0ff;
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 1px;
  cursor: pointer; transition: all 0.15s;
}
.hud-btn:hover { background: rgba(74,63,107,0.6); color: #fff; }

/* ══════════════════════ GAME AREA ══════════════════════ */
#game-area {
  display: flex; flex: 1; overflow: hidden; gap: 0; min-height: 0;
}

/* ── LEFT PANEL: INGREDIENTS ── */
#ingredient-panel {
  width: 260px; flex-shrink: 0;
  background: linear-gradient(180deg, #13131e 0%, #111119 100%);
  border-right: 2px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; min-height: 0;
  /* do NOT set height:100% — let flexbox stretch it */
}
.panel-header {
  padding: 10px 14px;
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 2px;
  color: var(--accent); background: rgba(200,164,0,0.08);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; flex-shrink: 0;
}
.ingredient-search { padding: 8px 10px; flex-shrink: 0; }
.ingredient-search input {
  width: 100%; padding: 7px 12px; border-radius: 6px;
  background: rgba(0,0,0,0.4); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 12px; font-family: var(--font-body);
  outline: none;
}
.ingredient-search input:focus { border-color: var(--accent); }
.ingredient-search input::placeholder { color: var(--text-muted); }

.ingredient-categories {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px;
  flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.cat-btn {
  padding: 3px 9px; border-radius: 12px; font-size: 10px;
  font-family: var(--font-ui); letter-spacing: 1px;
  background: rgba(255,255,255,0.06); color: var(--text-muted);
  border: 1px solid var(--border); cursor: pointer; transition: all 0.15s;
  text-transform: uppercase;
}
.cat-btn.active, .cat-btn:hover { background: rgba(200,164,0,0.2); color: var(--accent); border-color: var(--accent); }

.ingredient-grid {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; align-content: start;
}
.ingredient-grid::-webkit-scrollbar { width: 4px; }
.ingredient-grid::-webkit-scrollbar-track { background: transparent; }
.ingredient-grid::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 2px; }

.ingredient-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 6px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  text-align: center; position: relative; overflow: hidden;
}
.ingredient-card::after {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.15) 0%, transparent 70%);
  transition: opacity 0.15s;
}
.ingredient-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.ingredient-card:hover::after { opacity: 1; }
.ingredient-card:active { transform: translateY(0) scale(0.97); }

.ingredient-card.category-bodily  { border-color: #4a2a00; }
.ingredient-card.category-chemical { border-color: #1a3a1a; }
.ingredient-card.category-garbage  { border-color: #3a3a1a; }
.ingredient-card.category-medical  { border-color: #1a2a4a; }
.ingredient-card.category-animal   { border-color: #3a1a3a; }
.ingredient-card.category-junk     { border-color: #2a2a2a; }
.ingredient-card.category-special  { border-color: #4a3a00; }

.ingredient-card.category-bodily:hover  { border-color: #c8640a; box-shadow: 0 0 12px rgba(200,100,10,0.3); }
.ingredient-card.category-chemical:hover { border-color: #40c840; box-shadow: 0 0 12px rgba(64,200,64,0.3); }
.ingredient-card.category-garbage:hover  { border-color: #c8c840; box-shadow: 0 0 12px rgba(200,200,64,0.3); }
.ingredient-card.category-medical:hover  { border-color: #4080c8; box-shadow: 0 0 12px rgba(64,128,200,0.3); }
.ingredient-card.category-animal:hover   { border-color: #c840c8; box-shadow: 0 0 12px rgba(200,64,200,0.3); }
.ingredient-card.category-special:hover  { border-color: #ffd700; box-shadow: 0 0 16px rgba(255,215,0,0.4); }

.ing-svg-wrap { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.ing-svg-wrap svg { width: 52px; height: 52px; }
.ing-name { font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.5px; color: var(--text-primary); line-height: 1.2; }
.ing-gross { font-size: 9px; color: var(--gross-green); font-family: var(--font-ui); }
.ing-count-badge {
  position: absolute; top: 4px; right: 4px; background: var(--accent2);
  color: #fff; font-size: 9px; font-family: var(--font-ui);
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── CENTER: CUSTOMER + ICE CREAM ── */
#game-center {
  flex: 1; min-width: 0; display: flex; gap: 0; overflow: hidden; min-height: 0;
}

/* Customer window */
#customer-window {
  width: 340px; flex-shrink: 0;
  background: linear-gradient(180deg, #0e0e18 0%, #111118 100%);
  border-right: 2px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
#customer-queue-display {
  padding: 8px 10px; display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); min-height: 52px;
  align-items: center;
  background: rgba(0,0,0,0.3);
}
.queue-thumb {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--border); overflow: hidden; cursor: default;
  transition: border-color 0.2s;
}
.queue-thumb img { width: 100%; height: 100%; object-fit: cover; }
.queue-thumb.active { border-color: var(--accent); box-shadow: 0 0 10px rgba(200,164,0,0.5); }

#customer-area { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 12px 12px; gap: 8px; overflow-y: auto; overflow-x: hidden; }
#current-customer { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }

#customer-portrait-wrap {
  position: relative; width: 170px; height: 170px;
  border-radius: 12px; overflow: hidden;
  border: 3px solid var(--border-glow);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7), 0 0 20px rgba(74,63,107,0.3);
  flex-shrink: 0;
}
.customer-face-img {
  width: 100%; height: 100%; object-fit: cover;
  display: block;
}
.customer-face-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a1a2e, #2a1a3e);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; color: rgba(255,255,255,0.15);
}
#customer-reaction-overlay {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 72px; opacity: 0; transition: opacity 0.3s;
  background: transparent;
}
#customer-reaction-overlay.show { opacity: 1; }
#customer-flies {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.fly {
  position: absolute; font-size: 14px;
  animation: flyAround 2s infinite linear;
}
@keyframes flyAround {
  0%   { transform: translate(0,0) rotate(0deg); }
  25%  { transform: translate(20px,-15px) rotate(90deg); }
  50%  { transform: translate(40px,0px) rotate(180deg); }
  75%  { transform: translate(20px,15px) rotate(270deg); }
  100% { transform: translate(0,0) rotate(360deg); }
}

#customer-info { width: 100%; }
.customer-name {
  font-family: var(--font-display); font-size: 28px;
  color: var(--text-primary); text-align: center; letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* Speech bubble */
.speech-bubble {
  position: relative; background: #fff; color: #111;
  padding: 10px 14px; border-radius: 12px;
  font-size: 13px; font-family: var(--font-body); line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  margin-top: 8px; max-width: 280px; text-align: center;
  animation: bubblePop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.speech-bubble::before {
  content: ''; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  border-left: 10px solid transparent; border-right: 10px solid transparent;
  border-bottom: 10px solid #fff;
}
.speech-bubble.hidden { display: none; }
@keyframes bubblePop {
  0%   { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#customer-status-bar { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.status-item { display: flex; align-items: center; gap: 8px; }
.status-item > span { font-family: var(--font-ui); font-size: 9px; letter-spacing: 1.5px; color: var(--text-muted); width: 68px; text-align: right; }
.status-bar-bg { flex: 1; height: 8px; background: rgba(0,0,0,0.5); border-radius: 4px; border: 1px solid var(--border); overflow: hidden; }
.status-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.tolerance-fill { background: linear-gradient(90deg, #2a8a2a, #60c840); width: 80%; }
.nausea-fill { background: linear-gradient(90deg, #8a2a2a, #c84040); width: 0%; }

/* ── ICE CREAM BUILDER ── */
/* ── ICE CREAM BUILDER: column layout, canvas fills flex space, controls pinned bottom ── */
#ice-cream-builder {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 0; gap: 0; overflow: hidden;
  background: linear-gradient(180deg, #0f0f18 0%, #0d0d14 100%);
  border-right: 2px solid var(--border);
}

.builder-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 14px;
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 2px;
  color: var(--accent); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.clear-btn {
  padding: 5px 12px; border-radius: 6px; border: 1px solid #3a1a1a;
  background: rgba(192,0,0,0.2); color: #c04040;
  font-family: var(--font-ui); font-size: 11px; cursor: pointer; transition: all 0.15s;
}
.clear-btn:hover { background: rgba(192,0,0,0.4); color: #ff6060; }

/* Canvas area: takes all remaining vertical space */
#ice-cream-display {
  position: relative; flex: 1; width: 100%; min-height: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 100%, #1a1010 0%, #0a080c 100%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
#ice-cream-canvas {
  display: block;
  /* scale canvas to fit the flex area while keeping aspect ratio */
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
}
#item-tags-overlay {
  position: absolute; top: 6px; left: 6px;
  display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 12px);
  pointer-events: none; z-index: 2;
}
.item-tag {
  padding: 2px 7px; border-radius: 10px; font-size: 9px;
  font-family: var(--font-ui); letter-spacing: 0.5px;
  background: rgba(0,0,0,0.7); border: 1px solid var(--border-glow);
  color: var(--accent); pointer-events: none;
}

/* Base selector — pinned, never overflows */
#base-selector {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px; flex-shrink: 0;
  border-bottom: 2px solid var(--border-glow);
  background: linear-gradient(180deg, rgba(30,20,10,0.9) 0%, rgba(14,12,20,0.95) 100%);
}
.base-label {
  font-family: var(--font-ui); font-size: 11px; letter-spacing: 2px;
  color: var(--accent); flex-shrink: 0; text-transform: uppercase;
  text-shadow: 0 0 10px rgba(200,164,0,0.5);
}
#base-options { display: flex; gap: 14px; justify-content: center; }

/* Flavor card — large image button */
.base-btn.flavor-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 12px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.04);
  cursor: pointer; transition: all 0.18s ease; flex-shrink: 0;
  min-width: 88px;
}
.base-btn.flavor-card:hover {
  border-color: var(--accent);
  background: rgba(200,164,0,0.12);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(200,164,0,0.25);
}
.base-btn.flavor-card.selected {
  border-color: var(--accent);
  background: rgba(200,164,0,0.18);
  box-shadow: 0 0 18px rgba(200,164,0,0.45), 0 4px 12px rgba(0,0,0,0.5);
  transform: translateY(-2px);
}
/* Pulse on the base-selector when no flavor chosen */
#base-selector.needs-selection {
  animation: selectorPulse 1.4s ease-in-out infinite;
}
@keyframes selectorPulse {
  0%, 100% { border-color: var(--border-glow); }
  50%       { border-color: var(--accent); box-shadow: 0 0 14px rgba(200,164,0,0.4); }
}
.flavor-thumb {
  width: 68px; height: 68px; object-fit: contain; display: block;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}
.flavor-name {
  font-family: var(--font-display); font-size: 16px; letter-spacing: 2px;
  color: var(--text-primary); text-align: center;
}
.base-btn.flavor-card.selected .flavor-name { color: var(--accent); }

/* Added ingredients list — pinned, scrollable if many items */
#added-ingredients-list {
  width: 100%; max-height: 56px; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 12px;
  flex-shrink: 0;
}
#added-ingredients-list::-webkit-scrollbar { height: 3px; }
#added-ingredients-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.added-tag {
  padding: 3px 9px 3px 7px; border-radius: 12px; font-size: 10px;
  font-family: var(--font-ui); background: rgba(255,255,255,0.08);
  color: var(--text-primary); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 4px;
}
.added-tag-remove { cursor: pointer; color: var(--text-muted); transition: color 0.1s; font-size: 10px; }
.added-tag-remove:hover { color: #ff6060; }

/* SERVE BUTTON — always pinned at bottom, never hidden */
.serve-section {
  width: 100%; display: flex; justify-content: center;
  padding: 10px 16px; flex-shrink: 0;
  background: rgba(0,0,0,0.4);
  border-top: 1px solid var(--border);
}
.serve-btn {
  width: 100%; padding: 14px 24px; border: none; border-radius: 10px;
  font-family: var(--font-display); font-size: 28px; letter-spacing: 3px;
  cursor: pointer; transition: all 0.15s;
  background: linear-gradient(135deg, #3a7a00, #60c000, #80e000);
  color: #fff; box-shadow: 0 6px 24px rgba(96,192,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
}
.serve-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(96,192,0,0.7), inset 0 1px 0 rgba(255,255,255,0.25); }
.serve-btn:active { transform: translateY(-1px); }
.serve-btn:disabled { background: linear-gradient(135deg, #2a2a2a, #3a3a3a); color: #666; box-shadow: none; cursor: not-allowed; }

/* ── RIGHT PANEL: REACTION LOG ── */
#reaction-log-panel {
  width: 240px; flex-shrink: 0;
  background: linear-gradient(180deg, #0e0e18 0%, #0c0c14 100%);
  border-left: 2px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
#reaction-log {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
#reaction-log::-webkit-scrollbar { width: 3px; }
#reaction-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.log-entry {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px;
  font-size: 11px; font-family: var(--font-body); color: #a0a0c0;
  line-height: 1.5; animation: logSlide 0.3s ease;
}
@keyframes logSlide {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.log-entry .log-name { font-family: var(--font-ui); font-size: 12px; color: var(--accent); letter-spacing: 1px; }
.log-entry .log-reaction { color: #ff8080; font-weight: bold; }
.log-entry .log-points { color: var(--gross-green); font-family: var(--font-ui); font-size: 11px; }
.log-entry.hospitalized { border-color: #c04040; background: rgba(192,64,64,0.1); }
.log-entry.tripping    { border-color: #8040c0; background: rgba(128,64,192,0.1); }
.log-entry.laxative    { border-color: #7a5000; background: rgba(122,80,0,0.1); }

/* ══════════════════════ REACTION POPUP ══════════════════════ */
.reaction-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  z-index: 200; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  opacity: 0;
}
.reaction-popup.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: auto;
}
.reaction-popup.hidden { display: none; }
#reaction-popup-inner {
  background: linear-gradient(135deg, #1a1a2e, #2e1a3e);
  border: 2px solid var(--accent); border-radius: 16px;
  padding: 24px 40px 20px; text-align: center;
  box-shadow: 0 16px 60px rgba(0,0,0,0.9), 0 0 40px rgba(200,164,0,0.4);
  min-width: 320px; max-width: 480px;
}
#reaction-title {
  font-family: var(--font-display); font-size: 48px; letter-spacing: 3px;
  color: var(--accent); text-shadow: 0 0 20px rgba(200,164,0,0.6);
  margin-bottom: 8px;
}
#reaction-desc { font-size: 15px; color: #c0c0e0; margin-bottom: 12px; line-height: 1.6; }
#reaction-score {
  font-family: var(--font-display); font-size: 36px;
  color: var(--gross-green); text-shadow: 0 0 14px rgba(76,175,32,0.5);
  margin-bottom: 18px;
}
.reaction-close-btn {
  display: block; width: 100%;
  padding: 12px 20px; border: none; border-radius: 8px;
  font-family: var(--font-display); font-size: 20px; letter-spacing: 2px;
  cursor: pointer;
  background: linear-gradient(135deg, #2a4a00, #4a8000, #60a000);
  color: #fff;
  box-shadow: 0 4px 16px rgba(80,160,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
  transition: all 0.15s ease;
}
.reaction-close-btn:hover {
  background: linear-gradient(135deg, #3a6000, #60a000, #80c000);
  box-shadow: 0 6px 22px rgba(80,160,0,0.7);
  transform: translateY(-1px);
}
.reaction-close-btn:active { transform: translateY(0); }

/* ══════════════════════ CHAOS OVERLAY ══════════════════════ */
.chaos-overlay {
  position: fixed; inset: 0; z-index: 300; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 120px;
}
.chaos-overlay.hidden { display: none; }
.chaos-overlay.vomit  { background: radial-gradient(ellipse, rgba(120,160,0,0.4), transparent); animation: chaosShake 0.5s infinite; }
.chaos-overlay.trip   { background: radial-gradient(ellipse, rgba(120,0,180,0.3), transparent); animation: chaosPulse 0.8s infinite; }
.chaos-overlay.ambulance { background: rgba(192,0,0,0.15); animation: ambulanceFlash 0.4s infinite; }
.chaos-overlay.poop   { background: radial-gradient(ellipse, rgba(80,40,0,0.3), transparent); animation: chaosShake 0.3s infinite; }

@keyframes chaosShake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-8px) rotate(-1deg); }
  75%     { transform: translateX(8px) rotate(1deg); }
}
@keyframes chaosPulse {
  0%,100% { opacity: 0.5; filter: hue-rotate(0deg); }
  50%     { opacity: 1;   filter: hue-rotate(180deg); }
}
@keyframes ambulanceFlash {
  0%,100% { background: rgba(192,0,0,0.2); }
  50%     { background: rgba(0,0,192,0.2); }
}

/* ══════════════════════ SCORE FLOATERS ══════════════════════ */
.score-float {
  position: fixed; pointer-events: none; z-index: 250;
  font-family: var(--font-display); font-size: 32px;
  color: var(--gross-green); text-shadow: 0 0 10px rgba(76,175,32,0.8), 2px 2px 0 rgba(0,0,0,0.8);
  animation: floatUp 2s ease-out forwards;
}
.score-float.negative { color: #ff4040; text-shadow: 0 0 10px rgba(255,64,64,0.8), 2px 2px 0 rgba(0,0,0,0.8); }
@keyframes floatUp {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  60%  { transform: translateY(-80px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-140px) scale(0.8); opacity: 0; }
}

/* ══════════════════════ SCROLLBAR GLOBAL ══════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════════════════ UTILITY ══════════════════════ */
.hidden { display: none !important; }
.shake { animation: chaosShake 0.4s ease; }
.glow-text { text-shadow: 0 0 12px currentColor; }

/* ══════════════════════ SPECIAL TINTING ON ICE CREAM ══════════════════════ */
.ic-tint-yellow { filter: sepia(1) saturate(4) hue-rotate(10deg); }
.ic-tint-brown  { filter: sepia(1) saturate(3) hue-rotate(-20deg) brightness(0.6); }
.ic-tint-green  { filter: sepia(1) saturate(4) hue-rotate(80deg); }
.ic-tint-purple { filter: sepia(1) saturate(4) hue-rotate(240deg); }
.ic-tint-red    { filter: sepia(1) saturate(4) hue-rotate(-30deg); }

/* Pulse animation for serve button when ice cream is ready */
.serve-btn.ready {
  animation: servePulse 1.5s ease-in-out infinite;
}
@keyframes servePulse {
  0%,100% { box-shadow: 0 6px 24px rgba(96,192,0,0.5); }
  50%     { box-shadow: 0 8px 40px rgba(96,192,0,0.9), 0 0 60px rgba(96,192,0,0.4); }
}
