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

:root {
  --void: #04030a;
  --deep: #0a0818;
  --nebula1: #1a0a2e;
  --nebula2: #0d1a3a;
  --accent: #c8a96e;
  --accent2: #7b5ea7;
  --accent3: #4ab8c4;
  --glow: #e8d5a3;
  --text: #e8e0d0;
  --muted: #7a7268;
  --border: rgba(200,169,110,0.2);
  --r: 8px;
  --success: #4ab8c4;
  --danger: #e05555;
  --tip: #f0c040;
}

html, body {
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  font-weight: 400;
  overflow: hidden;
  user-select: none;
}

/* STARFIELD */
#starfield {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 30% 20%, #1a0a2e 0%, #04030a 60%),
              radial-gradient(ellipse at 70% 80%, #0d1a3a 0%, transparent 50%);
}
.star {
  position: absolute;
  border-radius: 50%;
  background: white;
}

/* SCREENS */
.screen { position: fixed; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; }
.screen.active { display: flex; }

/* TITLE SCREEN */
#title-screen { flex-direction: column; gap: 0; }
.title-nebula {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(123,94,167,0.3) 0%, transparent 60%),
              radial-gradient(ellipse at 30% 70%, rgba(74,184,196,0.15) 0%, transparent 50%);
  pointer-events: none;
}
.title-main {
  text-align: center; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.title-eyebrow {
  font-family: 'Space Mono', monospace; font-size: 11px;
  letter-spacing: .35em; color: var(--accent3);
  text-transform: uppercase; opacity: 0;
}
.title-word {
  font-family: 'Cinzel', serif; font-weight: 900;
  font-size: clamp(52px, 8vw, 96px); line-height: 1;
  letter-spacing: .05em;
  background: linear-gradient(135deg, #e8d5a3 0%, #c8a96e 40%, #ffffff 60%, #7b5ea7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; opacity: 0;
}
.title-sub {
  font-family: 'Exo 2', sans-serif; font-weight: 200; font-size: 15px;
  letter-spacing: .15em; color: var(--muted); text-transform: uppercase; opacity: 0;
}
.title-divider {
  width: 120px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
}
.title-desc {
  max-width: 400px; text-align: center; font-size: 14px;
  line-height: 1.8; color: rgba(232,224,208,0.65); opacity: 0;
}
.btn-start {
  margin-top: 8px; padding: 14px 48px;
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: .25em; text-transform: uppercase;
  cursor: pointer; border-radius: 2px; position: relative;
  overflow: hidden; opacity: 0; transition: color .3s;
}
.btn-start::before {
  content: ''; position: absolute; inset: 0;
  background: var(--accent); transform: translateX(-100%);
  transition: transform .3s ease; z-index: -1;
}
.btn-start:hover { color: var(--void); }
.btn-start:hover::before { transform: translateX(0); }

/* TUTORIAL */
#tutorial-overlay { z-index: 400; background: rgba(4,3,10,0.92); }
.tutorial-box {
  background: rgba(20,14,36,0.95); border: 1px solid var(--accent);
  border-radius: var(--r); padding: 32px 40px; max-width: 480px;
  text-align: center; display: flex; flex-direction: column; gap: 16px;
}
.tutorial-step-indicator {
  display: flex; gap: 6px; justify-content: center;
}
.tutorial-step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(200,169,110,0.2); transition: background .3s;
}
.tutorial-step-dot.active { background: var(--accent); }
.tutorial-title {
  font-family: 'Cinzel', serif; font-size: 22px; font-weight: 600;
  color: var(--accent); letter-spacing: .05em;
}
.tutorial-text {
  font-size: 14px; line-height: 1.7; color: rgba(232,224,208,0.8);
}
.tutorial-visual {
  display: flex; gap: 12px; justify-content: center; align-items: center;
  min-height: 60px; flex-wrap: wrap;
}
.btn-tutorial-next {
  padding: 10px 32px; background: transparent;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: 'Space Mono', monospace; font-size: 11px;
  letter-spacing: .2em; text-transform: uppercase;
  cursor: pointer; border-radius: 2px; transition: all .2s;
  align-self: center;
}
.btn-tutorial-next:hover { background: var(--accent); color: var(--void); }

/* SHIFT INTRO */
#shift-intro { z-index: 350; background: rgba(4,3,10,0.95); flex-direction: column; }
.shift-intro-content {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 16px; max-width: 500px; padding: 20px;
}
.shift-eyebrow {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: .4em; color: var(--accent3); text-transform: uppercase; opacity: 0;
}
.shift-title {
  font-family: 'Cinzel', serif; font-size: clamp(28px, 5vw, 48px);
  font-weight: 900; color: var(--accent); letter-spacing: .05em; opacity: 0;
}
.shift-lore {
  font-size: 14px; line-height: 1.8; color: rgba(232,224,208,0.7);
  font-style: italic; opacity: 0;
}
.shift-continue {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: .25em; color: var(--muted); text-transform: uppercase;
  cursor: pointer; opacity: 0; transition: color .2s; margin-top: 8px;
}
.shift-continue:hover { color: var(--accent); }

/* GAME SCREEN */
#game-screen { flex-direction: column; padding: 0; background: var(--void); width: 100%; align-items: stretch; justify-content: stretch; }

.top-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  display: flex; align-items: center; padding: 0 24px;
  background: rgba(4,3,10,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); z-index: 50; gap: 24px;
}
.logo { font-family: 'Cinzel', serif; font-size: 14px; font-weight: 600; letter-spacing: .1em; color: var(--accent); }
.round-info { display: flex; align-items: center; gap: 12px; }
.streak-display {
  font-family: 'Space Mono', monospace; font-size: 11px;
  color: var(--tip); letter-spacing: .1em;
}
.score-wrap { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.stat-label { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.stat-value { font-family: 'Space Mono', monospace; font-size: 16px; color: var(--accent); line-height: 1; }
.tip-value { color: var(--tip); }
.lives { display: flex; gap: 4px; }
.heart { font-size: 14px; transition: all .3s; color: var(--danger); }
.heart.lost { opacity: .2; filter: grayscale(1); }

.game-layout { display: grid; grid-template-columns: 1fr 380px; height: 100vh; padding-top: 52px; gap: 0; }

.cafe-scene { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 100%, rgba(26,10,46,0.8) 0%, transparent 60%), linear-gradient(180deg, #04030a 0%, #0a0818 40%, #0d0d1a 100%); min-width: 0; }

.counter { position: absolute; bottom: 0; left: 0; right: 0; height: 120px; background: linear-gradient(180deg, #1a1025 0%, #0f0a1a 100%); border-top: 2px solid rgba(200,169,110,0.3); }
.counter::before { content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.counter-top { position: absolute; top: -20px; left: 0; right: 0; height: 22px; background: #251833; border-top: 1px solid rgba(200,169,110,0.4); border-bottom: 1px solid rgba(200,169,110,0.1); }

.ambient-light { position: absolute; top: 20%; left: 50%; transform: translateX(-50%); width: 600px; height: 300px; background: radial-gradient(ellipse, rgba(123,94,167,0.06) 0%, transparent 70%); pointer-events: none; }
.shelf { position: absolute; height: 6px; background: #2a1f3d; border-top: 1px solid rgba(200,169,110,0.3); }
.shelf-left { top: 30%; left: 20px; width: 90px; }
.shelf-right { top: 25%; right: 20px; width: 90px; }
.shelf-item { position: absolute; bottom: 8px; width: 12px; border-radius: 2px 2px 0 0; }

.customer-area {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; width: 320px; z-index: 20;
}
.customer-img {
  width: 100px; height: 120px; object-fit: contain;
  display: block; margin: 0 auto;
}
.customer-wrap { position: relative; opacity: 0; transform: translateY(30px); }
.customer-planet { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; text-align: center; margin-bottom: 8px; opacity: .6; }
.customer-svg { width: 100px; height: 120px; margin: 0 auto; display: block; }
.customer-name { text-align: center; font-family: 'Exo 2', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .08em; margin-top: 6px; }

.speech-bubble {
  position: relative; background: rgba(20,14,36,0.95);
  border: 1px solid var(--accent3);
  box-shadow: 0 4px 20px rgba(74,184,196,0.15);
  border-radius: var(--r); padding: 16px; width: 300px; opacity: 0;
}
.speech-bubble::before {
  content: ''; position: absolute; top: -8px; left: 50%;
  transform: translateX(-50%); width: 14px; height: 8px;
  background: rgba(20,14,36,0.95);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.bubble-label { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; }

.order-seq { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.order-orb {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  position: relative; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.order-orb:hover { transform: scale(1.1); }
.orb-icon { font-size: 14px; font-weight: bold; }
.orb-num { position: absolute; bottom: -14px; font-family: 'Space Mono', monospace; font-size: 8px; color: var(--muted); }

/* Glyph orbs */
.order-orb .glyph-symbol {
  font-size: 18px; font-weight: bold; color: var(--text);
  font-family: 'Space Mono', monospace;
}

/* Sound orbs */
.order-orb.sound-orb {
  cursor: pointer; background: rgba(74,184,196,0.15);
  border-color: var(--accent3);
}
.order-orb.sound-orb:hover { background: rgba(74,184,196,0.3); }
.sound-wave {
  width: 20px; height: 16px; display: flex; align-items: flex-end;
  gap: 2px; justify-content: center;
}
.sound-bar {
  width: 3px; background: var(--accent3); border-radius: 1px;
  animation: soundPulse 0.6s ease-in-out infinite alternate;
}
.sound-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.sound-bar:nth-child(2) { height: 70%; animation-delay: 0.15s; }
.sound-bar:nth-child(3) { height: 100%; animation-delay: 0.3s; }
.sound-bar:nth-child(4) { height: 50%; animation-delay: 0.45s; }

@keyframes soundBar {
  from { transform: scaleY(0.4); }
  to { transform: scaleY(1); }
}

.btn-replay-sound {
  margin-top: 8px; padding: 4px 12px;
  background: rgba(74,184,196,0.1); border: 1px solid rgba(74,184,196,0.3);
  color: var(--accent3); font-family: 'Space Mono', monospace;
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase;
  cursor: pointer; border-radius: 2px; transition: all .2s;
  display: block; margin-left: auto; margin-right: auto;
}
.btn-replay-sound:hover { background: rgba(74,184,196,0.2); }

.patience-bar { width: 100%; height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; margin-top: 14px; }
.patience-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #4ab8c4, #c8a96e, #e05555); transform-origin: left; border-radius: 2px; }

/* TV MONITOR */
.tv-monitor {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tv-body {
  width: 290px;
  background: linear-gradient(180deg, #1c1230 0%, #100c1e 100%);
  border-radius: 10px;
  border: 3px solid #2d2244;
  box-shadow:
    0 0 0 1px rgba(200,169,110,0.12),
    0 0 28px rgba(74,184,196,0.1),
    0 8px 32px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.05);
}
.tv-bezel {
  margin: 8px 8px 0;
  background: #04030a;
  border-radius: 4px;
  border: 2px solid #0a0810;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9), 0 0 0 1px rgba(74,184,196,0.07);
}
.tv-display-area {
  padding: 10px 12px 10px;
  position: relative;
  background: radial-gradient(ellipse at 50% -10%, rgba(74,184,196,0.07) 0%, transparent 60%);
  min-height: 80px;
}
.tv-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent 0px, transparent 1px,
    rgba(0,0,0,0.1) 1px, rgba(0,0,0,0.1) 2px
  );
  pointer-events: none; z-index: 10;
}
.tv-bezel::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,0.35) 100%);
  pointer-events: none; z-index: 11; border-radius: 2px;
}
.tv-patience-row {
  padding: 5px 12px 7px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(74,184,196,0.08);
}
.tv-controls-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 5px 12px 7px;
}
.tv-led {
  width: 5px; height: 5px; border-radius: 50%;
  background: #4ab8c4;
  box-shadow: 0 0 4px #4ab8c4, 0 0 8px rgba(74,184,196,0.4);
  animation: tvLed 3s ease-in-out infinite;
}
@keyframes tvLed {
  0%, 85%, 100% { opacity: 1; }
  90% { opacity: 0.2; }
}
.tv-brand {
  font-family: 'Space Mono', monospace; font-size: 6px;
  letter-spacing: .25em; color: rgba(200,169,110,0.2); text-transform: uppercase;
}
.tv-knobs { display: flex; gap: 5px; }
.tv-knob {
  width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a1f3d, #0d0a14);
  border: 1px solid rgba(200,169,110,0.12);
}
.tv-stand {
  width: 50px; height: 12px;
  background: linear-gradient(180deg, #150e20 0%, #0e0918 100%);
  border: 2px solid #1e1630; border-top: none;
  border-radius: 0 0 6px 6px;
}
.tv-stand::after {
  content: ''; display: block;
  width: 90px; height: 6px; margin: 0 auto;
  background: #0e0918; border: 2px solid #1e1630;
  border-radius: 0 0 4px 4px;
}
.tv-channel-label {
  font-family: 'Space Mono', monospace; font-size: 8px;
  letter-spacing: .2em; color: rgba(74,184,196,0.55);
  text-transform: uppercase; margin-bottom: 8px;
}

/* MIXING ANIMATION */
.mixing-area {
  position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 15; opacity: 0; pointer-events: none;
}
.mixing-glass-svg { width: 60px; height: 80px; }
.mixing-label {
  font-family: 'Space Mono', monospace; font-size: 9px;
  letter-spacing: .2em; color: var(--accent); text-transform: uppercase;
}

/* RIGHT PANEL */
.right-panel { display: flex; flex-direction: column; background: rgba(10,8,24,0.95); border-left: 1px solid var(--border); overflow-y: auto; }
.panel-section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-title { font-family: 'Space Mono', monospace; font-size: 9px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.panel-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.ingredient-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ing-btn {
  aspect-ratio: 1; border-radius: var(--r);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03); cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; transition: all .2s;
  position: relative; overflow: hidden;
}
.ing-btn:hover { border-color: rgba(200,169,110,0.4); background: rgba(200,169,110,0.06); transform: translateY(-1px); }
.ing-btn:active { transform: scale(0.95); }
.ing-dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--void); font-size: 10px; font-weight: bold;
}
.ing-name {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  letter-spacing: .03em;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  /* Allow wrapping to 2 lines so two-word names like "Midnight Mocha" fit */
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
  padding: 0 2px;
}
.ing-key {
  position: absolute; top: 2px; right: 4px;
  font-family: 'Space Mono', monospace; font-size: 7px;
  color: rgba(200,169,110,0.3);
}

.order-tray { display: flex; gap: 6px; min-height: 44px; align-items: center; flex-wrap: wrap; }
.tray-slot {
  width: 40px; height: 40px; border-radius: var(--r);
  border: 1px dashed rgba(200,169,110,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: rgba(255,255,255,0.02); transition: all .2s;
}
.tray-slot.filled { border-style: solid; border-color: rgba(200,169,110,0.3); background: rgba(200,169,110,0.06); }
.tray-slot.filled .ing-dot { width: 26px; height: 26px; font-size: 14px; }

.action-row { display: flex; gap: 8px; padding: 14px 20px; }
.btn-action {
  flex: 1; padding: 12px 8px; border-radius: var(--r);
  border: 1px solid var(--border); background: transparent;
  color: var(--text); font-family: 'Space Mono', monospace;
  font-size: 10px; letter-spacing: .15em; text-transform: uppercase;
  cursor: pointer; transition: all .2s;
}
.btn-action:hover { background: rgba(200,169,110,0.08); border-color: var(--accent); color: var(--accent); }
.btn-serve { flex: 2; background: rgba(200,169,110,0.1); border-color: var(--accent); color: var(--accent); }
.btn-serve:hover { background: var(--accent); color: var(--void); }

/* CODEX */
.codex-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.codex-entry {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 6px 4px; border-radius: var(--r);
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.04);
  opacity: 0.35; transition: opacity .3s; cursor: default;
  position: relative;
}
.codex-entry.known { opacity: 1; }
.codex-dot {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: var(--void); font-weight: bold;
}
.codex-label {
  font-family: 'Space Mono', monospace;
  font-size: 7px;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
}
.codex-shape { width: 12px; height: 12px; flex-shrink: 0; margin-top: 1px; opacity: 0.7; }
.codex-extra {
  display: flex; gap: 2px; flex-wrap: wrap; justify-content: center;
  margin-top: 1px;
}
.codex-tag {
  font-family: 'Space Mono', monospace; font-size: 6px;
  padding: 1px 3px; border-radius: 2px;
  background: rgba(74,184,196,0.1); color: var(--accent3);
}

/* RECIPE LIST */
.recipe-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; }
.recipe-item {
  font-size: 11px; color: var(--muted); padding: 4px 8px;
  border-radius: 4px; background: rgba(255,255,255,0.02);
  display: flex; align-items: center; gap: 8px; opacity: 0;
  cursor: default; transition: all .2s;
}
.recipe-item.discovered { color: var(--text); background: rgba(200,169,110,0.06); border: 1px solid rgba(200,169,110,0.15); }
.recipe-item.secret { border-color: rgba(123,94,167,0.3); background: rgba(123,94,167,0.06); }
.recipe-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.recipe-frag { font-family: 'Space Mono', monospace; font-size: 9px; color: var(--muted); margin-left: auto; }

/* FEEDBACK */
#feedback-overlay { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; }
.feedback-msg { font-family: 'Cinzel', serif; font-size: clamp(28px, 5vw, 56px); font-weight: 900; letter-spacing: .08em; opacity: 0; transform: scale(0.7); pointer-events: none; }
.feedback-msg.correct { color: var(--success); }
.feedback-msg.wrong { color: var(--danger); }
.feedback-tip {
  font-family: 'Space Mono', monospace; font-size: 14px;
  color: var(--tip); opacity: 0; letter-spacing: .1em;
}

/* UNLOCK OVERLAY */
#unlock-overlay { position: fixed; inset: 0; z-index: 300; background: rgba(4,3,10,0.92); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.unlock-eyebrow { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: .4em; color: var(--accent3); text-transform: uppercase; opacity: 0; }
.unlock-title { font-family: 'Cinzel', serif; font-size: clamp(24px, 4vw, 48px); font-weight: 900; color: var(--accent); letter-spacing: .05em; opacity: 0; text-align: center; }
.unlock-sub { font-family: 'Space Mono', monospace; font-size: 11px; color: var(--accent3); margin-top: 4px; opacity: 0; }
.unlock-lore { font-family: 'Exo 2', sans-serif; font-size: 14px; font-style: italic; line-height: 1.6; color: rgba(232,224,208,.8); text-align: center; max-width: 450px; opacity: 0; margin-top: 10px; padding: 0 20px; }
.unlock-particles { position: absolute; inset: 0; pointer-events: none; }
.unlock-continue { font-family: 'Space Mono', monospace; font-size: 10px; letter-spacing: .25em; color: var(--muted); text-transform: uppercase; cursor: pointer; opacity: 0; margin-top: 12px; transition: color .2s; }
.unlock-continue:hover { color: var(--accent); }

/* SHIFT COMPLETE */
#shift-complete { z-index: 310; background: rgba(4,3,10,0.95); flex-direction: column; }
.shift-complete-content {
  text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 16px; max-width: 500px; padding: 20px;
}
.shift-complete-eyebrow {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: .4em; color: var(--accent3); text-transform: uppercase;
}
.shift-complete-title {
  font-family: 'Cinzel', serif; font-size: 32px; font-weight: 900;
  color: var(--accent); letter-spacing: .05em;
}
.shift-complete-stats {
  font-family: 'Space Mono', monospace; font-size: 12px;
  color: var(--text); line-height: 2;
}
.shift-complete-lore {
  font-size: 14px; line-height: 1.8; color: rgba(232,224,208,0.7);
  font-style: italic; max-width: 450px;
}
.btn-next-shift {
  padding: 12px 36px; background: transparent;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: 'Space Mono', monospace; font-size: 11px;
  letter-spacing: .2em; text-transform: uppercase; cursor: pointer;
  border-radius: 2px; transition: all .2s; margin-top: 8px;
}
.btn-next-shift:hover { background: var(--accent); color: var(--void); }

/* GAME OVER */
#gameover-screen { flex-direction: column; gap: 16px; background: var(--void); }
.go-title { font-family: 'Cinzel', serif; font-size: 64px; font-weight: 900; color: var(--accent); opacity: 0; }
.go-score { font-family: 'Space Mono', monospace; font-size: 18px; color: var(--text); opacity: 0; }
.go-sub { font-family: 'Exo 2', sans-serif; font-weight: 200; font-size: 13px; letter-spacing: .1em; color: var(--muted); opacity: 0; }
.go-recipes-summary {
  font-family: 'Space Mono', monospace; font-size: 11px;
  color: var(--accent3); opacity: 0; margin-top: 8px;
}
.btn-restart { margin-top: 8px; padding: 12px 36px; background: transparent; border: 1px solid var(--accent); color: var(--accent); font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; cursor: pointer; border-radius: 2px; opacity: 0; transition: background .2s, color .2s; }
.btn-restart:hover { background: var(--accent); color: var(--void); }

/* ENDGAME */
#endgame-screen { z-index: 500; background: var(--void); flex-direction: column; }
#endgame-canvas { position: absolute; inset: 0; }
.endgame-content {
  z-index: 2; text-align: center; display: flex;
  flex-direction: column; align-items: center; gap: 20px;
}
.endgame-eyebrow {
  font-family: 'Space Mono', monospace; font-size: 10px;
  letter-spacing: .4em; color: var(--accent3); text-transform: uppercase;
}
.endgame-title {
  font-family: 'Cinzel', serif; font-size: clamp(32px, 6vw, 64px);
  font-weight: 900; color: var(--accent); letter-spacing: .05em;
}
.endgame-text {
  font-size: 15px; line-height: 1.8; color: rgba(232,224,208,0.8);
  max-width: 500px; padding: 0 20px;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(200,169,110,0.2); border-radius: 2px; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .right-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 45vh;
    overflow-y: auto;
  }
  .cafe-scene { min-height: 55vh; }
  .ingredient-grid { grid-template-columns: repeat(5, 1fr); }
  .codex-grid { grid-template-columns: repeat(5, 1fr); }
  .customer-area { top: 40px; width: 280px; }
  .tv-monitor { bottom: 76px; }
  .tv-body { width: 250px; }
}

@media (max-width: 600px) {
  .top-bar { padding: 0 12px; gap: 12px; height: 44px; }
  .logo { font-size: 11px; }
  .stat-value { font-size: 13px; }
  .ingredient-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .ing-btn { gap: 2px; }
  .ing-dot { width: 18px; height: 18px; font-size: 8px; }
  .ing-name { font-size: 7px; }
  .action-row { padding: 10px 12px; }
  .panel-section { padding: 10px 12px; }
  .game-layout { padding-top: 44px; }
}
/* ── COMPOUND SHAPE ORBS (Geometrix) ─────────────────────────── */
.order-orb.compound-orb {
  background: transparent !important;
  border: none !important;
  width: 56px; height: 56px;
}
.order-orb.compound-orb > div {
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.15));
}

/* ── GLYPH ORBS (Glyphara) ──────────────────────────────────── */
.order-orb.glyph-orb {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.order-orb.glyph-orb .orb-glyph {
  font-size: 26px;
  color: #a8ff78;
  text-shadow: 0 0 8px rgba(168,255,120,0.5), 0 0 14px rgba(168,255,120,0.25);
  font-family: 'Space Mono', monospace;
  line-height: 1;
  animation: glyphFlicker 3s ease-in-out infinite;
}
@keyframes glyphFlicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 1; }
  48% { opacity: 0.55; }
  49% { opacity: 1; }
  72% { opacity: 0.7; }
  73% { opacity: 1; }
}

/* ── CODEX: GLYPH DECODE INDICATOR ──────────────────────────── */
.codex-glyph {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #a8ff78;
  margin-top: 2px;
  text-shadow: 0 0 6px rgba(168,255,120,0.4);
}
.codex-glyph.locked {
  font-size: 7px;
  color: var(--muted);
  text-shadow: none;
  opacity: 0.6;
}

/* ── CODEX: PER-CUSTOMER CIPHER SWAPS ───────────────────────── */
.codex-swaps {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px; padding: 6px 4px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.codex-swaps:empty { display: none; }
.codex-swap-row {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Space Mono', monospace; font-size: 8px;
  color: var(--muted);
}
.codex-swap-name {
  min-width: 56px;
  color: var(--accent3);
  font-weight: 700;
}
.codex-swap-dot {
  width: 14px; height: 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px; color: var(--void); font-weight: bold;
  flex-shrink: 0;
}
.codex-swap-arrow {
  color: var(--text);
  font-size: 10px;
  opacity: 0.6;
}

/* ── MOOD HINT under customer name ──────────────────────────── */
.customer-mood-hint {
  font-family: 'Space Mono', monospace;
  font-style: italic;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  margin-top: 2px;
  opacity: 0;
  letter-spacing: 0.3px;
}

/* ── DRAG-DROP INTERACTION ──────────────────────────────────── */
.ing-btn {
  cursor: grab;
}
.ing-btn:active { cursor: grabbing; }
.ing-btn.dragging {
  opacity: 0.55;
  transform: scale(0.92);
  transition: transform 0.15s, opacity 0.15s;
}

.order-orb {
  cursor: copy;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  position: relative;
}
.order-orb.drag-over {
  transform: scale(1.12);
  box-shadow: 0 0 0 2px rgba(168,255,120,0.6), 0 0 18px rgba(168,255,120,0.3);
  outline: none;
}
.order-orb.confirmed {
  cursor: default;
  box-shadow: 0 0 0 2px rgba(168,255,120,0.55), 0 0 14px rgba(168,255,120,0.4) inset;
}
.order-orb.confirmed::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(168,255,120,0.06);
  pointer-events: none;
}
.order-orb.reject {
  box-shadow: 0 0 0 2px rgba(255,107,107,0.7), 0 0 14px rgba(255,107,107,0.4);
  animation: rejectPulse 0.4s ease-out;
}
@keyframes rejectPulse {
  0% { background-color: rgba(255,107,107,0.25); }
  100% { background-color: transparent; }
}

.orb-confirm-badge {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #a8ff78;
  color: #0a0a0a;
  font-size: 10px;
  font-weight: bold;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(168,255,120,0.6);
}
.orb-confirm-badge::before { content: '✓'; }

/* ── TRANSLATION TELL (Chromara hint flicker) ──────────────── */
.order-orb.translation-tell {
  animation: translationTell 1.2s ease-out;
}
@keyframes translationTell {
  0%   { background: var(--tell-true-color, currentColor); filter: brightness(1.2); }
  18%  { background: var(--tell-true-color, currentColor); filter: brightness(1.2); }
  22%  { background: inherit; filter: none; }
  35%  { background: var(--tell-true-color, currentColor); filter: brightness(1); opacity: 0.6; }
  42%  { background: inherit; opacity: 1; }
  100% { background: inherit; }
}

/* ── SERVE BUTTON READY STATE ──────────────────────────────── */
.btn-serve.ready {
  background: var(--accent3, #a8ff78);
  color: var(--void, #0a0a0a);
  box-shadow: 0 0 18px rgba(168,255,120,0.45);
  animation: serveReadyPulse 1.6s ease-in-out infinite;
}
@keyframes serveReadyPulse {
  0%, 100% { box-shadow: 0 0 18px rgba(168,255,120,0.4); }
  50%      { box-shadow: 0 0 28px rgba(168,255,120,0.7); }
}

/* ── SPECIES INTRO TUTORIAL OVERLAY ────────────────────────── */
#tutorial-overlay.species-intro-mode {
  background: rgba(4,3,10,0.78);
  backdrop-filter: blur(2px);
}
#tutorial-overlay.species-intro-mode .tutorial-box {
  max-width: 480px;
  border: 1px solid rgba(168,255,120,0.25);
  box-shadow: 0 0 40px rgba(168,255,120,0.12);
}

/* ── AMBER NEAR-MISS FEEDBACK (Option 1) ───────────────────── */
.order-orb.reject-amber {
  box-shadow: 0 0 0 2px rgba(255,193,79,0.85), 0 0 18px rgba(255,193,79,0.45);
  animation: rejectAmberPulse 0.7s ease-out;
}
@keyframes rejectAmberPulse {
  0%   { background-color: rgba(255,193,79,0.30); }
  60%  { background-color: rgba(255,193,79,0.10); }
  100% { background-color: transparent; }
}
.feedback-msg.amber {
  color: #ffc14f;
  text-shadow: 0 0 14px rgba(255,193,79,0.5);
}

/* ── ELIMINATION × MARKS PER ORB (Option 2) ────────────────── */
.orb-eliminations {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  padding: 2px;
  pointer-events: none;
  max-width: 90%;
  flex-wrap: wrap;
  justify-content: center;
}
.orb-elim-tag {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  opacity: 0.85;
  box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.orb-elim-tag .elim-x {
  position: absolute;
  font-size: 11px;
  color: #ff5555;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(0,0,0,0.9);
  line-height: 1;
}

/* ── GHOST ICON: KNOWN-CIPHER REVEAL ON ORB (Option 6) ─────── */
.orb-ghost-true {
  position: absolute;
  top: -6px;
  left: -6px;
  font-size: 13px;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  text-shadow: 0 0 4px currentColor;
  pointer-events: none;
  opacity: 0.9;
  z-index: 2;
}

/* ── GLYPH ORB AURAS (family hints for undecoded glyphs) ─────────── */
.order-orb.glyph-orb {
  /* Default — for DECODED glyphs (player knows them): green/known styling */
  background: rgba(168,255,120,0.08);
  border: 1px solid rgba(168,255,120,0.4);
}
.order-orb.glyph-orb .orb-glyph {
  /* Default text color; overridden per-family for unknowns */
  color: #a8ff78;
  text-shadow: 0 0 8px rgba(168,255,120,0.5), 0 0 14px rgba(168,255,120,0.25);
}

/* Unknown glyphs get a family-colored aura that hints at the ingredient's color family */
.order-orb.glyph-orb-unknown {
  background: var(--glyph-aura-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--glyph-aura-border, rgba(255,255,255,0.3));
  box-shadow: 0 0 12px var(--glyph-aura-glow, rgba(255,255,255,0.2));
  animation: glyphAuraPulse 2.4s ease-in-out infinite;
}
.order-orb.glyph-orb-unknown .orb-glyph {
  color: var(--glyph-aura-text, #fff);
  text-shadow: 0 0 8px var(--glyph-aura-glow, rgba(255,255,255,0.5));
}

@keyframes glyphAuraPulse {
  0%, 100% { box-shadow: 0 0 10px var(--glyph-aura-glow, rgba(255,255,255,0.18)); }
  50%      { box-shadow: 0 0 18px var(--glyph-aura-glow, rgba(255,255,255,0.36)); }
}

/* Family-specific aura colors */
.glyph-family-warm {
  --glyph-aura-bg: rgba(224,85,85,0.12);
  --glyph-aura-border: rgba(224,85,85,0.45);
  --glyph-aura-glow: rgba(255,140,66,0.5);
  --glyph-aura-text: #ff9a6e;
}
.glyph-family-cool {
  --glyph-aura-bg: rgba(74,184,196,0.12);
  --glyph-aura-border: rgba(74,184,196,0.45);
  --glyph-aura-glow: rgba(74,138,255,0.5);
  --glyph-aura-text: #6fc4d4;
}
.glyph-family-pale {
  --glyph-aura-bg: rgba(232,224,208,0.12);
  --glyph-aura-border: rgba(232,224,208,0.45);
  --glyph-aura-glow: rgba(232,224,208,0.45);
  --glyph-aura-text: #f0e8d8;
}
.glyph-family-vivid {
  --glyph-aura-bg: rgba(200,114,200,0.12);
  --glyph-aura-border: rgba(200,114,200,0.45);
  --glyph-aura-glow: rgba(255,110,180,0.55);
  --glyph-aura-text: #e898d8;
}