* { box-sizing: border-box; }
html { margin: 0; padding: 0; width: 100%; height: 100%; height: 100dvh; }
body { margin: 0; padding: 0; width: 100%; height: 100%; height: 100dvh; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: radial-gradient(circle at 20% 20%, #111827, #0b1021 40%, #05070f 75%); color: #eef; overflow: hidden; touch-action: manipulation; }
/* position:fixed prevents iOS Safari address-bar resize from pushing content */
#scene { position: fixed; top: 0; left: 0; width: 100%; height: 100%; height: 100dvh; display: block; z-index: 0; touch-action: none; }
#ui { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 10; }

/* ── Loading Screen ─────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 40%, #111827, #0b1021 50%, #05070f);
  opacity: 1; transition: opacity 0.5s ease;
  pointer-events: all;
}
#loading-screen.hidden { display: none; }
#loading-screen.fade-out { opacity: 0; pointer-events: none; }
#loading-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; width: 280px; text-align: center;
}
#loading-logo {
  font-size: 52px; line-height: 1;
  animation: loading-pulse 2s ease-in-out infinite;
}
@keyframes loading-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}
#loading-title {
  margin: 0; font-size: 22px; font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #6ee7ff 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  letter-spacing: 0.5px;
}
#loading-status {
  margin: 0; font-size: 13px; color: #9ca3af;
  min-height: 18px; transition: opacity 0.2s;
}
#loading-bar-track {
  width: 100%; height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px; overflow: hidden;
  margin-top: 4px;
}
#loading-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6366f1, #6ee7ff);
  border-radius: 2px;
  transition: width 0.3s ease;
}
#loading-pct {
  margin: 0; font-size: 11px; color: rgba(255,255,255,0.3);
  font-variant-numeric: tabular-nums;
}

/* ── 2D City Map ──────────────────────────────────────────────────────────── */
#map-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(5, 7, 15, 0.92);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#map-overlay.hidden { display: none; }
#map-panel {
  background: rgba(10, 14, 28, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  width: min(92vw, 880px);
  height: min(88vh, 620px);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
}
#map-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(99,102,241,0.2);
  flex-shrink: 0;
}
#map-title { font-size: 15px; font-weight: 700; color: #e0e7ff; letter-spacing: 0.4px; }
#map-close-btn {
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  color: #f87171; padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
#map-close-btn:hover { background: rgba(239,68,68,0.3); }
#map-body {
  flex: 1; display: flex; overflow: hidden;
}
#map-canvas {
  flex: 1; display: block; cursor: crosshair;
  background: #080b18;
}
#map-sidebar {
  width: 200px; flex-shrink: 0;
  border-left: 1px solid rgba(99,102,241,0.2);
  display: flex; flex-direction: column;
  overflow: hidden;
}
#map-sidebar-title {
  padding: 10px 14px 6px;
  font-size: 11px; font-weight: 700; color: rgba(165,180,252,0.7);
  text-transform: uppercase; letter-spacing: 1px;
  flex-shrink: 0;
}
#map-location-list {
  flex: 1; overflow-y: auto;
  padding: 4px 0;
}
#map-location-list::-webkit-scrollbar { width: 4px; }
#map-location-list::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.3); border-radius: 2px; }
.map-loc-item {
  padding: 6px 10px 6px 12px; font-size: 12px; color: #c7d2fe;
  cursor: pointer; transition: background 0.12s;
  border-left: 2px solid transparent;
  display: flex; align-items: center; gap: 7px;
}
.map-loc-item:hover { background: rgba(99,102,241,0.12); border-left-color: #6366f1; }
.map-loc-item.active { background: rgba(99,102,241,0.2); border-left-color: #818cf8; color: #e0e7ff; }
.map-loc-swatch {
  width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0;
  opacity: 0.85;
}
.map-loc-item .map-loc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-loc-item .map-loc-go {
  flex-shrink: 0; background: none; border: 1px solid rgba(99,102,241,0.3);
  color: #818cf8; border-radius: 4px; font-size: 11px; padding: 1px 6px; cursor: pointer;
  opacity: 0; transition: opacity 0.12s;
}
.map-loc-item:hover .map-loc-go,
.map-loc-item.active .map-loc-go { opacity: 1; }
#map-location-info {
  border-top: 1px solid rgba(99,102,241,0.2);
  padding: 12px 14px; flex-shrink: 0;
}
#map-location-info.hidden { display: none; }
#map-loc-name { font-size: 13px; font-weight: 700; color: #e0e7ff; margin-bottom: 4px; }
#map-loc-desc { font-size: 11px; color: #9ca3af; line-height: 1.4; margin-bottom: 10px; }
#map-goto-btn {
  width: 100%; padding: 7px; border-radius: 6px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; font-size: 12px; font-weight: 600;
}
#map-goto-btn:hover { filter: brightness(1.15); }
@media (max-width: 600px) {
  #map-sidebar { display: none; }
}

/* Onboarding Overlay */
#overlay {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(10, 15, 30, 0.98));
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 25px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05) inset;
  padding: 32px 36px;
  border-radius: 24px;
  width: 420px;
  max-width: 92vw;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.overlay-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.4));
}

#overlay h1 {
  margin: 0 0 6px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #6ee7ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  margin: 0;
  font-size: 14px;
  color: #9ca3af;
  letter-spacing: 0.3px;
}

#join-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.form-section label {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-row {
  display: flex;
  gap: 16px;
}

#join-form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #eef;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

#join-form input[type="text"]:focus {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#join-form input[type="text"]::placeholder {
  color: #6b7280;
}

.color-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

#avatar-color {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

#avatar-color::-webkit-color-swatch-wrapper {
  padding: 4px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}

#avatar-color::-webkit-color-swatch {
  border-radius: 8px;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#avatar-hat {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #eef;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

#avatar-hat:focus {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#avatar-hat option {
  background: #1a1a2e;
  padding: 8px;
}

/* Character Selector */
#character-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.char-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #9ca3af;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.char-nav-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.5);
  color: #fff;
}

#character-preview {
  width: 160px;
  height: 180px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

#char-preview-canvas {
  width: 160px;
  height: 130px;
  border-radius: 12px 12px 0 0;
}

#char-name {
  font-size: 13px;
  font-weight: 600;
  color: #eef;
  margin-top: 6px;
  text-align: center;
}

#char-desc {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  padding: 0 8px;
}

/* Hide color/hat for GLTF characters */
.form-section.hidden-option {
  display: none;
}

.join-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  margin-top: 8px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--city-primary, #6366f1) 0%, #8b5cf6 50%, #38bdf8 100%);
  background-size: 200% 200%;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1) inset;
  transition: all 0.3s ease;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.join-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(99,102,241,0.5), 0 0 0 1px rgba(255,255,255,0.15) inset;
}

.join-btn:active {
  transform: translateY(0);
}

.join-btn svg {
  transition: transform 0.2s ease;
}

.join-btn:hover svg {
  transform: translateX(4px);
}

.features-preview {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.feature {
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  font-size: 12px;
  color: #a5b4fc;
  white-space: nowrap;
}

#hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

#hint svg {
  flex-shrink: 0;
  color: #f59e0b;
}

@media (max-width: 520px) {
  #overlay {
    top: auto;
    bottom: 20px;
    transform: translate(-50%, 0);
    padding: 24px;
    border-radius: 20px 20px 24px 24px;
  }
  
  .logo-icon { font-size: 36px; }
  #overlay h1 { font-size: 26px; }
  
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .features-preview {
    gap: 8px;
  }
  
  .feature {
    padding: 5px 10px;
    font-size: 11px;
  }
}

.hidden { display: none !important; }

#scene { touch-action: none; }
#touch { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; touch-action: none; z-index: 10; }
#touch-row { display: flex; gap: 8px; justify-content: center; }
#touch,
#touch *,
#mobile-bottom-bar,
#mobile-bottom-bar *,
#mobile-overflow-menu,
#mobile-overflow-menu * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
#touch button,
.mbb-btn,
.mob-menu-item {
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}
#touch button {
  touch-action: none;
}
#touch button { width: 78px; height: 52px; padding: 0; border-radius: 14px; border: 1px solid rgba(255,255,255,0.18); background: rgba(17, 24, 39, 0.55); color: #eef; font-weight: 700; box-shadow: 0 10px 28px rgba(0,0,0,0.35); font-size: 18px; }
#touch button:active { transform: translateY(1px); }
#touch-interact { width: 100%; margin-top: 8px; background: rgba(99, 102, 241, 0.6); border-color: rgba(99, 102, 241, 0.4); }

#chat-container { position: absolute; bottom: 48px; right: 16px; width: 340px; max-width: 45vw; display: flex; flex-direction: column; pointer-events: auto; z-index: 10; }
#chat-messages { max-height: 180px; overflow-y: auto; padding: 8px 10px; background: rgba(17, 24, 39, 0.7); border-radius: 10px 10px 0 0; font-size: 13px; line-height: 1.4; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#chat-messages:empty { display: none; }
#chat-messages .msg { margin-bottom: 4px; word-break: break-word; }
#chat-messages .msg b { color: #6ee7ff; }
#chat-form { display: flex; }
#chat-input { flex: 1; padding: 10px 12px; border-radius: 0 0 10px 10px; border: 1px solid rgba(255,255,255,0.15); border-top: none; background: rgba(17, 24, 39, 0.85); color: #eef; outline: none; font-size: 13px; }
#chat-input::placeholder { color: #9ca3af; }

#name-labels { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.name-label { position: absolute; transform: translate(-50%, -100%); padding: 2px 8px; background: rgba(17, 24, 39, 0.75); border-radius: 6px; font-size: 11px; white-space: nowrap; color: #eef; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

.chat-bubble { 
  position: absolute; 
  transform: translate(-50%, -100%); 
  padding: 6px 12px; 
  background: rgba(255, 255, 255, 0.95); 
  color: #1a1a2e; 
  border-radius: 12px; 
  font-size: 13px; 
  max-width: 200px; 
  word-wrap: break-word;
  pointer-events: none; 
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: bubbleFade 5s ease-out forwards;
}
.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(255, 255, 255, 0.95);
}
@keyframes bubbleFade {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}

#chat-messages .msg { transition: opacity 0.3s; }

#scene:focus { outline: none; }

#hud { position: absolute; top: 16px; left: 16px; pointer-events: none; z-index: 10; display: flex; flex-direction: column; gap: 8px; }
#player-count { padding: 6px 12px; background: rgba(17, 24, 39, 0.75); border-radius: 8px; font-size: 13px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
#pointer-hint { padding: 6px 12px; background: rgba(17, 24, 39, 0.75); border-radius: 8px; font-size: 12px; color: #9ca3af; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: opacity 0.3s; }
#pointer-hint.locked { opacity: 0; }

#hud-buttons { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: auto; }
#hud-buttons button {
  padding: 6px 10px;
  background: rgba(17, 24, 39, 0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#hud-buttons button:hover { background: rgba(255,255,255,0.1); color: #eef; }
#hud-buttons button.active { background: rgba(99, 102, 241, 0.4); border-color: rgba(99, 102, 241, 0.6); color: #a5b4fc; }

/* City branding — dynamically overridden via --city-primary / --city-accent */
:root { --city-primary: #10b981; --city-accent: #ffffff; }
#hud-city-label {
  padding: 5px 12px;
  background: var(--city-primary, rgba(17,24,39,0.75));
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--city-accent, #ffffff);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#touch-look { position: absolute; top: 0; right: 0; width: 50%; height: 100%; pointer-events: auto; touch-action: none; z-index: 2; }

@media (max-width: 768px) {
  #chat-container { width: 280px; max-width: 60vw; bottom: 90px; }
  #hud { top: 8px; left: 8px; }
  #pointer-hint { display: none; }
}


/* Emote system */
#emote-hint { padding: 6px 12px; background: rgba(17, 24, 39, 0.75); border-radius: 8px; font-size: 12px; color: #9ca3af; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

#emote-menu {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  z-index: 20;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.emote-title {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.emote-btn {
  padding: 10px 20px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #eef;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.emote-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateX(4px);
}

.emote-indicator {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 28px;
  pointer-events: none;
  animation: emoteFloat 1.5s ease-out forwards;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@keyframes emoteFloat {
  0% { opacity: 1; transform: translate(-50%, -100%) scale(0.5); }
  20% { transform: translate(-50%, -120%) scale(1.2); }
  40% { transform: translate(-50%, -130%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(0.8); }
}

@media (max-width: 768px) {
  #emote-menu { bottom: 160px; }
  #emote-hint { display: none; }
}


/* Interaction prompt */
#interact-prompt {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 8px;
  color: #eef;
  font-size: 14px;
  pointer-events: none;
  z-index: 15;
  animation: promptPulse 2s ease-in-out infinite;
}

@keyframes promptPulse {
  0%, 100% { border-color: rgba(99, 102, 241, 0.5); }
  50% { border-color: rgba(99, 102, 241, 1); }
}

/* Vending popup */
.popup-message {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 16px 24px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.popup-message.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.popup-icon { font-size: 32px; }
.popup-text { font-size: 16px; color: #eef; }

/* Arcade game overlay */
#arcade-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#arcade-game {
  width: 400px;
  max-width: 90vw;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 3px solid #ffaa00;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(255, 170, 0, 0.3);
}

#arcade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(90deg, #ff6600, #ffaa00);
  color: #1a1a2e;
  font-weight: bold;
  font-size: 18px;
}

#arcade-close {
  background: rgba(0,0,0,0.3);
  border: none;
  color: #1a1a2e;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#arcade-stats {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: rgba(0,0,0,0.3);
  color: #eef;
  font-size: 14px;
}

#arcade-stats b { color: #ffaa00; font-size: 18px; }

#arcade-game-area {
  position: relative;
  height: 300px;
  background: radial-gradient(circle at center, #0a0f1d, #050810);
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.arcade-target {
  position: absolute;
  width: 50px;
  height: 50px;
  background: radial-gradient(circle at 30% 30%, #ff6666, #cc0000);
  border-radius: 50%;
  cursor: pointer;
  transform: translate(-50%, -50%) scale(0);
  animation: targetSpawn 0.2s ease-out forwards;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

.arcade-target:hover {
  filter: brightness(1.3);
}

@keyframes targetSpawn {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#arcade-instructions {
  padding: 12px;
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
}

/* System messages in chat */
#chat-messages .msg.system {
  color: #ffaa00;
  font-style: italic;
}

@media (max-width: 768px) {
  #interact-prompt { bottom: auto; top: 90px; font-size: 15px; pointer-events: auto; touch-action: manipulation; }
}


/* Time display */
#time-display {
  padding: 6px 12px;
  background: rgba(17, 24, 39, 0.75);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  letter-spacing: 0.5px;
}


/* BCC Building labels */
.bcc-building-label {
  background: rgba(5, 8, 20, 0.88);
  border: 1px solid var(--bcc-color, #10b981);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px var(--bcc-color, #10b981), 0 2px 8px rgba(0,0,0,0.6);
}
.bcc-label-name { color: #fff; }

/* Regular building sign labels */
.building-sign {
  background: rgba(10, 14, 28, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.building-sign-name { color: #d1d5db; }

/* Door entrance sign labels */
.door-sign {
  background: rgba(10, 14, 28, 0.85);
  border: 1px solid rgba(255, 200, 100, 0.35);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 0 8px rgba(255, 200, 100, 0.15), 0 2px 6px rgba(0,0,0,0.5);
}
.door-sign-name { color: #fde68a; }

/* NPC styles */
.npc-label {
  text-align: center;
  background: rgba(99, 102, 241, 0.85);
  border: 1px solid rgba(255,255,255,0.3);
}

.npc-role {
  font-size: 9px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.npc-activity {
  font-size: 9px;
  opacity: 0.7;
  font-style: italic;
  margin-top: 2px;
  color: #c7d2fe;
}

.npc-bubble {
  background: rgba(99, 102, 241, 0.95);
  color: #fff;
  max-width: 250px;
}

.npc-bubble::after {
  border-top-color: rgba(99, 102, 241, 0.95);
}

/* NPC chat overlay */
#npc-chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#npc-chat {
  width: 450px;
  max-width: 90vw;
  max-height: 80vh;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid rgba(99, 102, 241, 0.5);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.2);
}

#npc-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #fff;
}

#npc-chat-name {
  font-weight: bold;
  font-size: 16px;
  margin-right: 8px;
}

#npc-chat-role {
  font-size: 12px;
  opacity: 0.8;
}

#npc-chat-close {
  background: rgba(0,0,0,0.3);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

#npc-chat-messages {
  flex: 1;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.npc-msg {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.4;
}

.npc-msg-player {
  background: rgba(255,255,255,0.1);
  align-self: flex-end;
  color: #eef;
}

.npc-msg-npc {
  background: rgba(99, 102, 241, 0.3);
  align-self: flex-start;
  color: #eef;
}

.npc-msg b {
  color: #a5b4fc;
}

#npc-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.1);
}

#npc-chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #eef;
  font-size: 14px;
  outline: none;
}

#npc-chat-input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

#npc-chat-form button {
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

#npc-chat-form button:hover {
  filter: brightness(1.1);
}


/* Mini-map */
#minimap {
  position: absolute;
  top: 88px;
  left: 16px;
  right: auto;
  width: 150px;
  height: 150px;
  background: rgba(17, 24, 39, 0.85);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  overflow: hidden;
  z-index: 12;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#minimap-canvas {
  width: 100%;
  height: 100%;
}

@media (max-width: 768px) {
  #minimap { width: 100px; height: 100px; top: 82px; left: 8px; right: auto; }
  #minimap-canvas { width: 100px; height: 100px; }
}


/* Weather toast */
.weather-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 12px 24px;
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  color: #eef;
  font-size: 16px;
  z-index: 100;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.weather-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* Enter building prompt */
.enter-prompt {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 20px 30px;
  background: rgba(17, 24, 39, 0.95);
  border: 2px solid rgba(99, 102, 241, 0.5);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.enter-prompt.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.enter-prompt span {
  font-size: 18px;
  color: #eef;
}

.enter-prompt button {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.enter-prompt button:first-of-type {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.enter-prompt button:last-of-type {
  background: rgba(255,255,255,0.1);
  color: #9ca3af;
}


/* NPC chat voice controls */
#npc-mic-btn {
  padding: 10px 12px;
  background: rgba(34, 197, 94, 0.3);
  border: 1px solid rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
}

#npc-mic-btn.active {
  background: rgba(34, 197, 94, 0.6);
  animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#npc-chat-controls {
  display: flex;
  justify-content: center;
  padding: 8px;
  background: rgba(0,0,0,0.2);
}

#tts-toggle {
  padding: 6px 12px;
  background: rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 6px;
  color: #eef;
  font-size: 12px;
  cursor: pointer;
}

#tts-toggle.off {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: #9ca3af;
}


/* Voice chat button */
#voice-chat-btn {
  padding: 8px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#voice-chat-btn:hover {
  background: rgba(255,255,255,0.15);
}

#voice-chat-btn.active {
  background: rgba(34, 197, 94, 0.3);
  border-color: rgba(34, 197, 94, 0.5);
  color: #22c55e;
  animation: voicePulse 2s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}


/* Real-time display */
#real-time-display {
  padding: 6px 12px;
  background: rgba(17, 24, 39, 0.75);
  border-radius: 8px;
  font-size: 12px;
  color: #a5b4fc;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* HUD buttons */
#radio-btn, #news-btn {
  padding: 8px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #9ca3af;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#radio-btn:hover, #news-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #eef;
}

#radio-btn.active {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.5);
  color: #a5b4fc;
}

/* Radio Panel */
#radio-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  width: 380px;
  max-width: 90vw;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(30, 20, 50, 0.98));
  border: 2px solid rgba(99, 102, 241, 0.4);
  border-radius: 16px;
  padding: 0;
  z-index: 200;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(99, 102, 241, 0.2);
  overflow: hidden;
}

#radio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  font-weight: 600;
  font-size: 16px;
}

#radio-header button {
  background: rgba(0,0,0,0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
}

#radio-show {
  padding: 16px 20px 8px;
  font-size: 18px;
  font-weight: 600;
  color: #eef;
}

#radio-host {
  padding: 0 20px 12px;
  font-size: 13px;
  color: #a5b4fc;
}

#radio-message {
  padding: 16px 20px;
  background: rgba(0,0,0,0.2);
  margin: 0 16px 16px;
  border-radius: 12px;
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.5;
  font-style: italic;
  min-height: 60px;
}

#radio-controls {
  padding: 12px 20px 20px;
  display: flex;
  justify-content: center;
}

#radio-tts-btn {
  padding: 10px 24px;
  background: rgba(34, 197, 94, 0.3);
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 8px;
  color: #22c55e;
  font-size: 14px;
  cursor: pointer;
}

#radio-tts-btn.active {
  background: rgba(34, 197, 94, 0.5);
}

/* Newspaper Panel */
#newspaper-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  width: 500px;
  max-width: 92vw;
  max-height: 80vh;
  background: #f5f0e6;
  border: 1px solid #8b7355;
  border-radius: 4px;
  z-index: 200;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#newspaper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #1a1a2e;
  color: #f5f0e6;
  font-family: 'Georgia', serif;
  font-weight: bold;
  font-size: 16px;
}

#newspaper-header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #f5f0e6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

#newspaper-date {
  padding: 8px 16px;
  background: #e8e0d0;
  font-family: 'Georgia', serif;
  font-size: 12px;
  color: #5a5040;
  text-align: center;
  border-bottom: 1px solid #ccc5b5;
}

#newspaper-content {
  padding: 20px;
  font-family: 'Georgia', serif;
  font-size: 14px;
  color: #2a2a2a;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  flex: 1;
}

#newspaper-content h2 {
  font-size: 18px;
  margin: 16px 0 8px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;
}

/* Event Toast */
#event-toast {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 16px 28px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.95), rgba(139, 92, 246, 0.95));
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 16px;
  color: white;
  font-size: 15px;
  font-weight: 500;
  z-index: 150;
  opacity: 0;
  transition: all 0.4s ease;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
  text-align: center;
  max-width: 90vw;
}

#event-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#event-toast .event-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

#event-toast .event-desc {
  font-size: 13px;
  opacity: 0.9;
}

/* NPC activity indicator */
.npc-activity {
  font-size: 10px;
  color: #9ca3af;
  font-style: italic;
}

@media (max-width: 768px) {
  #radio-panel, #newspaper-panel {
    width: 95vw;
    max-height: 70vh;
  }
  
  #real-time-display {
    font-size: 11px;
  }
}


/* ============================================
   COMPANION ORB CHAT STYLES
   ============================================ */

#orb-chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#orb-chat {
  width: 400px;
  max-width: 90vw;
  max-height: 70vh;
  background: linear-gradient(135deg, #1a1a3e, #0f1628);
  border: 2px solid rgba(147, 197, 253, 0.4);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(147, 197, 253, 0.2), 0 0 20px rgba(147, 197, 253, 0.1) inset;
}

#orb-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(147, 197, 253, 0.2), rgba(196, 181, 253, 0.2));
  border-bottom: 1px solid rgba(147, 197, 253, 0.2);
}

.orb-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 170, 255, 0.5);
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.35);
  animation: orbPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes orbPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 170, 255, 0.35); }
  50% { box-shadow: 0 0 20px rgba(0, 170, 255, 0.65); }
}

#orb-chat-name {
  font-weight: 600;
  font-size: 15px;
  color: #c7d2fe;
  display: block;
}

#orb-chat-hint {
  font-size: 11px;
  color: #818cf8;
  display: block;
}

#orb-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #c7d2fe;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

#orb-chat-close:hover {
  background: rgba(255,255,255,0.2);
}

#orb-chat-messages {
  flex: 1;
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.orb-msg {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  font-size: 14px;
  line-height: 1.4;
}

.orb-msg-player {
  align-self: flex-end;
  background: rgba(99, 102, 241, 0.3);
  color: #e0e7ff;
  border-bottom-right-radius: 4px;
}

.orb-msg-orb {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.25), rgba(196, 181, 253, 0.25));
  color: #e0e7ff;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(147, 197, 253, 0.2);
}

#orb-typing {
  display: flex;
  gap: 4px;
  padding: 8px 14px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: rgba(147, 197, 253, 0.6);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

#orb-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(147, 197, 253, 0.1);
}

#orb-chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(147, 197, 253, 0.2);
  background: rgba(255,255,255,0.05);
  color: #e0e7ff;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

#orb-chat-input:focus {
  border-color: rgba(147, 197, 253, 0.5);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.1);
}

#orb-chat-input::placeholder {
  color: #6b7280;
}

#orb-chat-input:disabled {
  opacity: 0.5;
}

#orb-chat-form button {
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.3), rgba(196, 181, 253, 0.3));
  border: 1px solid rgba(147, 197, 253, 0.3);
  border-radius: 12px;
  color: #c7d2fe;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

#orb-chat-form button:hover {
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.4), rgba(196, 181, 253, 0.4));
  transform: scale(1.05);
}

/* Orb bubble style */
.orb-bubble {
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.9), rgba(196, 181, 253, 0.9)) !important;
  color: #1e1b4b !important;
  font-style: italic;
  border: 1px solid rgba(255,255,255,0.3);
}

.orb-bubble::after {
  border-top-color: rgba(147, 197, 253, 0.9) !important;
}


/* Orb button in HUD */
#orb-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.2), rgba(196, 181, 253, 0.2));
  border: 1px solid rgba(147, 197, 253, 0.3);
  border-radius: 8px;
  color: #c7d2fe;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#orb-btn:hover {
  background: linear-gradient(135deg, rgba(147, 197, 253, 0.3), rgba(196, 181, 253, 0.3));
  color: #e0e7ff;
  box-shadow: 0 0 12px rgba(147, 197, 253, 0.3);
}


/* ============================================
   GAME SYSTEMS UI STYLES
   ============================================ */

/* Inventory Panel */
#inventory-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  width: 320px;
  max-width: 90vw;
  max-height: 70vh;
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.95), rgba(10, 15, 30, 0.98));
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 16px;
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

#inventory-header span:first-child {
  font-weight: 600;
  color: #fbbf24;
}

#coins-display {
  background: rgba(0,0,0,0.3);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  color: #fcd34d;
}

#inventory-header button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fbbf24;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

#inventory-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inventory-empty {
  text-align: center;
  color: #6b7280;
  padding: 20px;
  font-style: italic;
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.inventory-item:hover {
  background: rgba(251, 191, 36, 0.15);
}

.item-icon {
  font-size: 24px;
}

.item-info {
  flex: 1;
}

.item-name {
  font-weight: 500;
  color: #f3f4f6;
}

.item-qty {
  font-size: 12px;
  color: #9ca3af;
}

/* Shop Modal */
#shop-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

.shop-content {
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border: 2px solid rgba(244, 114, 182, 0.4);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.shop-header {
  padding: 16px;
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.2), rgba(236, 72, 153, 0.2));
  border-bottom: 1px solid rgba(244, 114, 182, 0.2);
}

.shop-header h2 {
  margin: 0 0 4px;
  color: #f472b6;
}

.shop-header p {
  margin: 0 0 8px;
  font-size: 13px;
  color: #9ca3af;
}

.shop-coins {
  font-size: 14px;
  color: #fcd34d;
}

.shop-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
}

.shop-item-icon {
  font-size: 28px;
}

.shop-item-info {
  flex: 1;
}

.shop-item-name {
  font-weight: 500;
  color: #f3f4f6;
}

.shop-item-desc {
  font-size: 12px;
  color: #9ca3af;
  margin: 2px 0;
}

.shop-item-price {
  font-size: 13px;
  color: #fcd34d;
}

.shop-item button {
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.3), rgba(236, 72, 153, 0.3));
  border: 1px solid rgba(244, 114, 182, 0.4);
  border-radius: 8px;
  color: #f9a8d4;
  cursor: pointer;
  transition: all 0.2s;
}

.shop-item button:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.5), rgba(236, 72, 153, 0.5));
}

.shop-item button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.shop-close {
  margin: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #9ca3af;
  cursor: pointer;
}

/* Quest Modal */
#quest-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

.quest-content {
  width: 380px;
  max-width: 90vw;
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border: 2px solid rgba(167, 139, 250, 0.4);
  border-radius: 16px;
  padding: 20px;
}

.quest-header h2 {
  margin: 0 0 16px;
  color: #a78bfa;
}

.quest-dialogue {
  background: rgba(0,0,0,0.3);
  padding: 12px;
  border-radius: 8px;
  font-style: italic;
  color: #d1d5db;
  margin-bottom: 16px;
}

.quest-objective, .quest-reward {
  margin-bottom: 12px;
  color: #e5e7eb;
}

.quest-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.quest-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.quest-actions button:first-child {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #c4b5fd;
}

.quest-actions button:last-child {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #9ca3af;
}

/* Active Quest Display */
#active-quest {
  position: absolute;
  top: 120px;
  right: 16px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  max-width: 200px;
  z-index: 15;
}

.quest-name {
  font-weight: 500;
  color: #a78bfa;
  font-size: 13px;
}

.quest-obj {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Item Action Modal */
#item-action-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 260;
}

#item-action-modal .modal-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border: 2px solid rgba(251, 191, 36, 0.4);
  border-radius: 16px;
  padding: 20px;
  width: 300px;
  max-width: 90vw;
}

#item-action-modal h3 {
  margin: 0 0 8px;
  color: #fbbf24;
}

#item-action-modal p {
  color: #9ca3af;
  font-size: 13px;
  margin-bottom: 16px;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-actions button {
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s;
}

.item-actions button:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.4);
}

/* Guestbook Modal */
#guestbook-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
}

.guestbook-content {
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  background: linear-gradient(145deg, #f5f0e6, #ebe5d8);
  border: 2px solid #8b7355;
  border-radius: 8px;
  padding: 20px;
  color: #3d2817;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.guestbook-content h2 {
  margin: 0 0 16px;
  color: #5d4037;
  font-family: Georgia, serif;
}

.guestbook-entries {
  flex: 1;
  overflow-y: auto;
  max-height: 300px;
  margin-bottom: 16px;
}

.guestbook-entry {
  padding: 10px;
  border-bottom: 1px solid rgba(139, 115, 85, 0.3);
}

.entry-author {
  font-weight: 600;
  color: #5d4037;
}

.entry-message {
  margin: 4px 0;
  font-style: italic;
}

.entry-time {
  font-size: 11px;
  color: #8b7355;
}

.guestbook-content form {
  display: flex;
  gap: 8px;
}

.guestbook-content input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #8b7355;
  border-radius: 4px;
  background: #fff;
  color: #3d2817;
}

.guestbook-content button {
  padding: 8px 16px;
  background: #5d4037;
  border: none;
  border-radius: 4px;
  color: #f5f0e6;
  cursor: pointer;
}

/* Achievement Toast */
.achievement-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  -webkit-transform: translateX(-50%) translateY(-100px);
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 12px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 300;
  box-shadow: 0 10px 40px rgba(251, 191, 36, 0.4);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-toast.show {
  transform: translateX(-50%) translateY(0);
  -webkit-transform: translateX(-50%) translateY(0);
}

.achievement-icon {
  font-size: 36px;
}

.achievement-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(0,0,0,0.6);
}

.achievement-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

.achievement-desc {
  font-size: 12px;
  color: rgba(0,0,0,0.7);
}

.achievement-reward {
  font-size: 13px;
  color: #1a1a2e;
  font-weight: 600;
}

/* Game Notification */
.game-notification {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  -webkit-transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 10px 20px;
  color: #e5e7eb;
  font-size: 14px;
  z-index: 280;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.game-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  -webkit-transform: translateX(-50%) translateY(0);
}

/* Camera Flash Effect */
.camera-flash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  z-index: 500;
  animation: flashFade 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Inventory Button */
#inventory-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 8px;
  color: #fbbf24;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#inventory-btn:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(245, 158, 11, 0.3));
}

/* AI Mode Button */
#ai-mode-btn {
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  color: #a5b4fc;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

#ai-mode-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
}

#ai-mode-btn.webllm-active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(52, 211, 153, 0.2));
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

#ai-mode-btn.webllm-loading {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border-color: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
  animation: pulse 1.5s infinite;
}

/* WebLLM Status */
#webllm-status {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 16px 24px;
  min-width: 300px;
  text-align: center;
  pointer-events: auto;
  z-index: 1000;
}

#webllm-progress-text {
  font-size: 14px;
  color: #a5b4fc;
  margin-bottom: 10px;
}

#webllm-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}

#webllm-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 3px;
  transition: width 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================
   BLAKCLOUD BUILDING SYSTEM
   ============================================ */

#building-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.95);
}

#building-container.hidden {
  display: none;
}

.building-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.building-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(17, 24, 39, 0.9));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.building-exit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 10px;
  color: #a5b4fc;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.building-exit-btn:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
  color: #fff;
  transform: translateX(-2px);
}

.building-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex: 1;
}

.building-occupants {
  font-size: 13px;
  color: #6b7280;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
}

.building-frame-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#building-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #111827;
}

/* Building Loading State */
.building-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #9ca3af;
}

.building-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Building Entry Prompt */
.building-entry-prompt {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  pointer-events: auto;
}

.building-entry-icon {
  font-size: 32px;
}

.building-entry-info h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #fff;
}

.building-entry-info p {
  margin: 0;
  font-size: 13px;
  color: #9ca3af;
}

.building-entry-key {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 600;
}

.building-entry-key kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: inherit;
}

/* Device Tier Indicator */
.device-tier-badge {
  position: fixed;
  bottom: 10px;
  right: 10px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  font-size: 11px;
  color: #6b7280;
  z-index: 50;
}

.device-tier-badge.tier-low { color: #fbbf24; }
.device-tier-badge.tier-mid { color: #34d399; }

/* ── BCC Live Ticker ─────────────────────────────────────────────────────── */
#bcc-ticker {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2000;
  height: 28px;
  display: flex; align-items: center; gap: 0;
  background: rgba(5, 7, 15, 0.92);
  border-top: 1px solid rgba(16, 185, 129, 0.35);
  backdrop-filter: blur(8px);
  user-select: none;
  font-size: 11.5px;
  pointer-events: auto;
}
#bcc-ticker-label {
  flex-shrink: 0;
  padding: 0 10px 0 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: #10b981;
  border-right: 1px solid rgba(16,185,129,0.25);
  white-space: nowrap; height: 100%;
  display: flex; align-items: center;
}
#bcc-ticker-viewport {
  flex: 1; overflow: hidden; height: 100%;
  display: flex; align-items: center;
}
#bcc-ticker-track {
  display: flex; align-items: center; gap: 0;
  white-space: nowrap;
  will-change: transform;
}
#bcc-ticker-track.bt-scroll {
  animation: bt-scroll linear infinite;
}
@keyframes bt-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.bt-item { padding: 0 12px; color: rgba(255,255,255,0.72); font-size: 11.5px; }
.bt-item.bt-journal { color: #c7d2fe; }
.bt-item.bt-product { color: #fde68a; }
.bt-item.bt-city    { color: #6ee7b7; }
.bt-link { color: inherit; text-decoration: none; }
.bt-link:hover { text-decoration: underline; }
.bt-sep { color: rgba(255,255,255,0.2); padding: 0 4px; flex-shrink: 0; }
#bcc-ticker-toggle {
  flex-shrink: 0; width: 24px; height: 24px; margin: 0 4px;
  background: none; border: none; color: rgba(255,255,255,0.3);
  cursor: pointer; font-size: 10px; display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
#bcc-ticker-toggle:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); }

/* ── BCC Onboarding Overlay ──────────────────────────────────────────────── */
#bcc-onboarding {
  position: fixed; inset: 0; z-index: 8500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(6px);
  animation: onboard-fade-in 0.4s ease;
}
@keyframes onboard-fade-in { from { opacity:0 } to { opacity:1 } }
#bcc-onboarding.hidden { display: none; }
.onboard-card {
  background: linear-gradient(135deg, #0d1117 0%, #161b2e 100%);
  border: 1px solid rgba(99,102,241,0.4);
  border-radius: 16px;
  padding: 36px 40px;
  max-width: 520px; width: calc(100% - 40px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 40px rgba(99,102,241,0.12);
  text-align: center;
}
.onboard-logo { font-size: 48px; line-height: 1; margin-bottom: 12px; }
.onboard-title { font-size: 22px; font-weight: 800; color: #f1f5f9; margin-bottom: 6px; }
.onboard-sub { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 24px; }
.onboard-controls {
  background: rgba(255,255,255,0.04); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 22px; text-align: left;
}
.onboard-controls h4 { color: #10b981; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 10px; }
.onboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.onboard-row { display: flex; align-items: center; gap: 8px; }
.onboard-key { background: rgba(255,255,255,0.12); border-radius: 4px; padding: 2px 7px; font-size: 11px; font-family: monospace; color: #e2e8f0; }
.onboard-desc { font-size: 12px; color: rgba(255,255,255,0.55); }
.onboard-tips { font-size: 12px; color: rgba(255,255,255,0.45); margin-bottom: 24px; line-height: 1.6; }
.onboard-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff; border: none; border-radius: 10px;
  padding: 12px 36px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}
.onboard-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(99,102,241,0.5); }

/* ── Guestbook ───────────────────────────────────────────────────────────── */
#guestbook-modal {
  position: fixed; inset: 0; z-index: 7000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,7,15,0.8); backdrop-filter: blur(6px);
}
#guestbook-modal.hidden { display: none; }
.guestbook-content {
  background: #0d1117; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; padding: 28px 32px;
  width: min(540px, calc(100vw - 32px)); max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.gb-title { font-size: 18px; font-weight: 700; color: #f1f5f9; margin-bottom: 20px; }
.gb-entries { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; max-height: 300px; overflow-y: auto; }
.gb-entry { background: rgba(255,255,255,0.04); border-radius: 8px; padding: 10px 14px; }
.gb-entry-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.gb-entry-msg { font-size: 13px; color: rgba(255,255,255,0.7); }
.gb-entry-ts { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 4px; }
.gb-form { display: flex; flex-direction: column; gap: 10px; }
.gb-form textarea { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); color: #f1f5f9; border-radius: 8px; padding: 10px 12px; font-size: 13px; resize: none; font-family: inherit; outline: none; }
.gb-form textarea:focus { border-color: rgba(99,102,241,0.5); }
.gb-actions { display: flex; justify-content: space-between; align-items: center; }
.gb-submit { background: #6366f1; color: #fff; border: none; border-radius: 8px; padding: 8px 22px; font-size: 13px; font-weight: 600; cursor: pointer; }
.gb-submit:hover { background: #818cf8; }
.gb-close { background: none; border: 1px solid rgba(255,255,255,0.15); color: rgba(255,255,255,0.5); border-radius: 8px; padding: 8px 16px; font-size: 13px; cursor: pointer; }
.gb-close:hover { background: rgba(255,255,255,0.06); color: #fff; }

/* ── EVERA Radio Player ─────────────────────────────────────────────────── */
#evera-radio {
  --er-accent: #6366f1;
  --er-grad-a: #1a1a2e;
  --er-grad-b: #e94560;
  position: fixed;
  bottom: 48px;
  left: 20px;
  z-index: 500;
  font-family: inherit;
  pointer-events: auto;
}

#er-collapsed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: rgba(15, 15, 30, 0.92);
  border: 1px solid var(--er-accent);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 12px color-mix(in srgb, var(--er-accent) 30%, transparent);
}
#er-collapsed:hover { background: rgba(25, 25, 45, 0.95); transform: translateY(-1px); }

#er-mini-icon { font-size: 16px; animation: er-pulse 2s ease-in-out infinite; }
@keyframes er-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
#er-mini-label { font-size: 13px; font-weight: 600; color: #e2e8f0; }
#er-mini-freq { font-size: 11px; color: var(--er-accent); font-weight: 700; letter-spacing: 0.5px; }

#er-expanded {
  width: 320px;
  background: linear-gradient(160deg, rgba(12,12,24,0.97) 0%, rgba(20,14,34,0.97) 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-top: 2px solid var(--er-accent);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px color-mix(in srgb, var(--er-accent) 20%, transparent);
  backdrop-filter: blur(20px);
}

#er-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 10px;
  background: linear-gradient(90deg, var(--er-grad-a), var(--er-grad-b));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#er-station-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#er-freq-badge {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}
#er-close-btn {
  background: rgba(0,0,0,0.25);
  border: none;
  color: rgba(255,255,255,0.7);
  width: 24px; height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
#er-close-btn:hover { background: rgba(0,0,0,0.5); color: #fff; }

#er-station-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#er-station-tabs::-webkit-scrollbar { display: none; }
.er-tab {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.er-tab:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.8); }
.er-tab.active {
  background: color-mix(in srgb, var(--er-tab-color, #6366f1) 25%, transparent);
  border-color: var(--er-tab-color, #6366f1);
  color: #fff;
}

#er-now-playing {
  padding: 14px 16px 4px;
}
#er-track-title {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#er-track-artist {
  font-size: 12px;
  color: var(--er-accent);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#er-track-album {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#er-progress-wrap {
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin: 10px 0 4px;
  overflow: hidden;
}
#er-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--er-accent);
  border-radius: 2px;
  transition: width 0.5s linear;
}
#er-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 2px;
}

#er-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
}
#er-prev-btn, #er-next-btn {
  background: rgba(255,255,255,0.07);
  border: none;
  color: rgba(255,255,255,0.6);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
#er-prev-btn:hover, #er-next-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
#er-play-btn {
  background: var(--er-accent);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--er-accent) 50%, transparent);
}
#er-play-btn:hover { transform: scale(1.05); filter: brightness(1.15); }

#er-vol-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
#er-vol-icon { font-size: 12px; opacity: 0.6; }
#er-vol-slider {
  width: 60px;
  height: 3px;
  accent-color: var(--er-accent);
  cursor: pointer;
}

#er-tagline {
  padding: 0 16px 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  text-align: center;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-tier-badge.tier-high { color: #a78bfa; }

#city-editor-panel {
  position: fixed;
  top: 72px;
  left: 16px;
  width: 320px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  z-index: 1200;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(8, 11, 24, 0.94);
  color: #e5e7eb;
  box-shadow: 0 18px 46px rgba(0,0,0,0.38);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.ce-header,
.ce-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ce-actions {
  display: flex;
  gap: 6px;
}

.ce-header button,
.ce-tabs button,
.ce-library button {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  color: #e5e7eb;
  padding: 6px 9px;
  cursor: pointer;
}

.ce-tabs button {
  flex: 1;
}

.ce-tabs button.active,
#city-editor-btn.active {
  background: rgba(99, 102, 241, 0.62);
  border-color: rgba(165, 180, 252, 0.72);
}

.ce-empty,
.ce-note,
.ce-status {
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.35;
}

.ce-status {
  margin-top: 10px;
  min-height: 16px;
  color: #a7f3d0;
}

.ce-delete-btn {
  margin-top: 12px;
  width: 100%;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 6px;
  padding: 6px 0;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.ce-delete-btn:hover {
  background: rgba(239,68,68,0.3);
}

.ce-name {
  margin: 8px 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: #c7d2fe;
  word-break: break-all;
}

.ce-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.62);
  font-size: 12px;
  color: #cbd5e1;
}

.ce-tools input[type="number"] {
  width: 64px;
  margin-left: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  padding: 4px 6px;
}

.ce-selected label {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
  font-size: 12px;
  color: #cbd5e1;
}

.ce-selected input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  padding: 5px 7px;
}

.ce-library {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ce-library button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-size: 11px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE UI OVERHAUL  — BlakCloud City
   Targets: max-width 768px (phones / small tablets in portrait)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── 1. HUD: hide the old button strip, show nothing at top-left ── */
  #hud {
    top: 8px;
    left: 8px;
    gap: 4px;
  }

  /* Keep player count + time small and stacked */
  #player-count,
  #time-display,
  #real-time-display {
    font-size: 11px;
    padding: 4px 8px;
  }

  /* Hide hints that reference keyboard keys */
  #pointer-hint,
  #emote-hint,
  #webllm-status { display: none !important; }

  /* Hide the old HUD button row — replaced by mobile bottom bar */
  #hud-buttons { display: none !important; }

  /* ── 2. Minimap — top-right, below HUD bar on mobile ── */
  #minimap {
    top: 82px;
    left: 8px;
    right: auto;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid rgba(99,102,241,0.5);
    overflow: hidden;
  }
  #minimap-canvas { width: 90px; height: 90px; }

  /* ── 3. Interact prompt — moved to top-center, away from D-pad ── */
  #interact-prompt {
    bottom: auto;
    top: 90px;
    font-size: 15px;
    padding: 12px 28px;
    border-radius: 24px;
    letter-spacing: 0.2px;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
  }

  /* ── 4. Chat — sits just above the bottom bar ── */
  #chat-container {
    bottom: 130px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
  #chat-messages { max-height: 120px; font-size: 12px; }
  #chat-input { font-size: 13px; padding: 9px 12px; }

  /* ── 5. EVERA Radio pill — move above bottom bar ── */
  #evera-radio {
    bottom: 130px;
    left: 8px;
  }

  /* ── 6. Touch D-pad — proper 4-direction layout ── */
  #touch {
    position: fixed;
    left: 12px;
    bottom: 130px;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 0;
    pointer-events: auto;
    z-index: 50;
  }

  #touch-up,
  #touch-down {
    width: 56px;
    height: 48px;
    border-radius: 10px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #touch-row {
    display: flex;
    gap: 0;
    align-items: center;
  }

  #touch-left,
  #touch-right {
    width: 48px;
    height: 56px;
    border-radius: 10px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Down button acts as the centre piece of the D-pad row: ◀ ▼ ▶ */
  #touch-down {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    order: 1; /* sits between left (0) and right (2) */
  }
  #touch-left  { order: 0; }
  #touch-right { order: 2; }

  /* Hide the old "Talk / Use" button — replaced by bottom bar Interact btn */
  #touch-interact { display: none !important; }

  /* ── 7. Emote menu — higher so it clears the bottom bar ── */
  #emote-menu { bottom: 200px; }

  /* ── 8. NPC / Orb chat overlays — full-screen on mobile ── */
  #npc-chat-overlay,
  #orb-chat-overlay {
    align-items: flex-end;
    padding-bottom: 0;
  }

  #npc-chat,
  #orb-chat {
    width: 100%;
    max-width: 100%;
    max-height: 70vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  /* ── 9. Map panel — full-screen on mobile ── */
  #map-panel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  #map-header {
    padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  }
  #map-title {
    font-size: 18px;
    max-width: calc(100vw - 86px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #map-close-btn {
    min-width: 48px;
    min-height: 44px;
    font-size: 18px;
  }
  #map-body {
    flex-direction: column;
  }
  #map-canvas {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 260px);
  }
  #map-sidebar {
    display: flex;
    width: 100%;
    height: 190px;
    border-left: none;
    border-top: 1px solid rgba(99,102,241,0.24);
    background: rgba(8, 11, 24, 0.97);
  }
  #map-sidebar-title {
    padding: 10px 12px 4px;
  }
  #map-location-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 0 0 auto;
    padding: 6px 12px 10px;
    scroll-snap-type: x proximity;
  }
  .map-loc-item {
    flex: 0 0 auto;
    min-width: 120px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    max-width: 150px;
    padding: 10px 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255,255,255,0.055);
    font-size: 13px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .map-loc-item:hover,
  .map-loc-item.active {
    border-left-color: transparent;
    border-bottom-color: #818cf8;
  }
  #map-location-info {
    display: block;
    min-height: 72px;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(99,102,241,0.18);
  }
  #map-loc-name { font-size: 15px; }
  #map-loc-desc { font-size: 12px; margin-bottom: 8px; }
  #map-goto-btn {
    min-height: 40px;
    font-size: 13px;
  }

  /* ── 10. Active quest — move so it doesn't overlap minimap ── */
  #active-quest {
    top: auto;
    bottom: 200px;
    right: 8px;
    max-width: 160px;
  }

  /* Hide touch controls and bottom bar while join overlay is visible */
  #overlay:not(.hidden) ~ #touch,
  #overlay:not(.hidden) ~ #touch-look,
  #overlay:not(.hidden) ~ #mobile-bottom-bar,
  #overlay:not(.hidden) ~ #mobile-overflow-menu,
  #overlay:not(.hidden) ~ #mobile-chat-drawer { display: none !important; }

} /* end @media 768px */

@media (max-width: 768px) {
  input[type="color"] {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    padding: 4px;
    cursor: pointer;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE BOTTOM ACTION BAR
   Fixed bar at the very bottom — replaces the old HUD button strip
   ═══════════════════════════════════════════════════════════════════════════ */

#mobile-bottom-bar {
  display: none; /* shown only on mobile via JS / media query below */
}

@media (max-width: 768px) {

  #mobile-bottom-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(8, 11, 24, 0.96);
    border-top: 1px solid rgba(99,102,241,0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    align-items: center;
    justify-content: space-around;
    padding: 0 4px;
    z-index: 200;
    pointer-events: auto;
    /* safe area for notched phones */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mbb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 52px;
    height: 56px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: #9ca3af;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0 6px;
    letter-spacing: 0.2px;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
  }

  .mbb-btn .mbb-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mbb-btn:active {
    transform: scale(0.92);
    background: rgba(99,102,241,0.25);
    border-color: rgba(99,102,241,0.5);
    color: #a5b4fc;
  }

  .mbb-btn.active {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.45);
    color: #a5b4fc;
  }

  /* Interact button — accent colour */
  #mbb-interact {
    background: rgba(99,102,241,0.18);
    border-color: rgba(99,102,241,0.4);
    color: #a5b4fc;
    min-width: 60px;
  }
  #mbb-interact:active {
    background: rgba(99,102,241,0.45);
  }

  /* Chat button */
  #mbb-chat .mbb-icon { font-size: 18px; }

  /* More (⋯) button */
  #mbb-more .mbb-icon { font-size: 22px; letter-spacing: 2px; }

  /* ── Mobile overflow menu (shown when ⋯ is tapped) ── */
  #mobile-overflow-menu {
    position: fixed;
    bottom: 80px;
    right: 8px;
    width: 220px;
    background: rgba(8, 11, 24, 0.97);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 16px;
    padding: 8px;
    z-index: 300;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    gap: 4px;
    pointer-events: auto;
  }

  #mobile-overflow-menu.open {
    display: flex;
    animation: mobileMenuSlideUp 0.18s ease-out;
  }

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

  .mob-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #d1d5db;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
  }

  .mob-menu-item:active,
  .mob-menu-item:hover {
    background: rgba(99,102,241,0.18);
    color: #e0e7ff;
  }

  .mob-menu-item .mob-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
  }

  .mob-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 4px 0;
  }

  /* ── Mobile chat input drawer ── */
  #mobile-chat-drawer {
    position: fixed;
    bottom: 72px;
    left: 0;
    right: 0;
    background: rgba(8, 11, 24, 0.97);
    border-top: 1px solid rgba(99,102,241,0.25);
    padding: 10px 12px;
    display: none;
    align-items: center;
    gap: 8px;
    z-index: 250;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    pointer-events: auto;
  }

  #mobile-chat-drawer.open {
    display: flex;
    animation: mobileMenuSlideUp 0.15s ease-out;
  }

  #mobile-chat-drawer input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid rgba(99,102,241,0.35);
    background: rgba(255,255,255,0.07);
    color: #eef;
    font-size: 14px;
    outline: none;
  }

  #mobile-chat-drawer input::placeholder { color: #6b7280; }
  #mobile-chat-drawer input:focus {
    border-color: rgba(99,102,241,0.6);
    background: rgba(255,255,255,0.1);
  }

  #mobile-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* Hide the old floating chat container on mobile — use drawer instead */
  #chat-container { display: none !important; }

  /* Interact prompt — top-center on mobile (clear of D-pad) */
  #interact-prompt {
    bottom: auto;
    top: 90px;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
  }

} /* end mobile bottom bar media query */

/* Modern command HUD */
#hud {
  top: 14px;
  left: 14px;
  right: 14px;
  width: auto;
  max-width: none;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  z-index: 30;
}

#hud-status-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 210px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: rgba(8, 13, 28, 0.72);
  box-shadow: 0 14px 36px rgba(0,0,0,0.28);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

#hud-status-card #player-count {
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  color: #f8fafc;
}

#hud-status-card #time-display,
#hud-status-card #real-time-display {
  padding: 0;
  background: transparent;
  border-radius: 0;
  color: #c7d2fe;
  font-size: 12px;
  white-space: nowrap;
}

.hud-hidden-clock {
  display: none !important;
}

#hud-command-dock {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  background: rgba(8, 13, 28, 0.74);
  box-shadow: 0 14px 40px rgba(0,0,0,0.3);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

#hud-primary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

#hud-command-dock button {
  min-width: 68px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.11);
  background: rgba(255,255,255,0.055);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

#hud-command-dock button:hover,
#hud-command-dock button.active {
  transform: translateY(-1px);
  background: rgba(99,102,241,0.24);
  border-color: rgba(129,140,248,0.55);
  color: #ffffff;
}

#hud-more-btn {
  min-width: 58px;
  color: #93c5fd !important;
}

#hud-actions-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 220px;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(129,140,248,0.24);
  border-radius: 14px;
  background: rgba(7, 11, 24, 0.96);
  box-shadow: 0 18px 52px rgba(0,0,0,0.45);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

#hud-actions-menu.hidden { display: none; }
#hud-actions-menu button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
  height: 36px;
}

#pointer-hint,
#emote-hint {
  position: fixed;
  left: 18px;
  bottom: 50px;
  max-width: 320px;
}

#emote-hint { bottom: 86px; }

/* Responsive landing screen */
@media (max-width: 768px) {
  #overlay {
    top: 12px;
    bottom: auto;
    width: min(94vw, 390px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 18px;
    border-radius: 18px;
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
  }

  .overlay-header { margin-bottom: 14px; }
  .logo-icon { font-size: 34px; margin-bottom: 4px; }
  #overlay h1 { font-size: 25px; }
  .tagline { font-size: 12px; }
  #join-form { gap: 10px; }
  .form-section label { font-size: 10px; }
  #join-form input[type="text"],
  #avatar-hat {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 10px;
  }

  #character-preview {
    width: 132px;
    height: 118px;
  }

  #char-preview-canvas {
    width: 132px;
    height: 88px;
  }

  #char-name { font-size: 12px; margin-top: 4px; }
  #char-desc { display: none; }
  .char-nav-btn { width: 34px; height: 34px; }
  .form-row { gap: 10px; }
  #avatar-color { height: 38px; }
  .join-btn {
    padding: 13px 18px;
    margin-top: 2px;
    border-radius: 12px;
  }

  .features-preview { display: none; }

  #hint { display: none; }

  body:has(#overlay:not(.hidden)) #mobile-bottom-bar,
  body:has(#overlay:not(.hidden)) #mobile-overflow-menu,
  body:has(#overlay:not(.hidden)) #mobile-chat-drawer,
  body:has(#overlay:not(.hidden)) #touch,
  body:has(#overlay:not(.hidden)) #evera-radio,
  body:has(#overlay:not(.hidden)) .device-tier-badge {
    display: none !important;
  }

  #hud {
    top: 8px;
    left: 8px;
    right: 8px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  #hud-status-card {
    min-width: 0;
    width: min(190px, calc(100vw - 126px));
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  #hud-status-card #player-count,
  #hud-status-card #real-time-display {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #hud-command-dock {
    display: none;
  }

  #mobile-bottom-bar {
    height: 68px;
    padding-inline: 8px;
    gap: 6px;
    background: rgba(7, 11, 24, 0.94);
    border-top-color: rgba(129,140,248,0.28);
  }

  #evera-radio {
    display: none !important;
  }

  .mbb-btn {
    min-width: 0;
    flex: 1;
    height: 52px;
    border-radius: 14px;
    background: rgba(255,255,255,0.055);
  }

  #mobile-overflow-menu {
    left: 10px;
    right: 10px;
    bottom: 78px;
    width: auto;
    border-radius: 18px;
    display: none;
    grid-template-columns: 1fr 1fr;
  }

  #mobile-overflow-menu.open {
    display: grid;
  }

  .mob-menu-item {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .mob-menu-divider {
    grid-column: 1 / -1;
  }
}

@media (min-width: 769px) {
  #mobile-bottom-bar,
  #mobile-overflow-menu,
  #mobile-chat-drawer {
    display: none !important;
  }
}

/* ── Interior System (3D) ────────────────────────────────────────────────── */
@keyframes interiorFadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes interiorFadeOut { from { opacity: 1 } to { opacity: 0 } }

.interior-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: #000;
  display: flex; flex-direction: column;
  animation: interiorFadeIn 0.35s ease;
  overflow: hidden;
}

/* ── 3D Header bar ───────────────────────────────────────────────────────── */
.int3d-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: rgba(5, 7, 15, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0; z-index: 5;
}
.int3d-exit {
  background: rgba(255,255,255,0.08); color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-family: inherit;
  transition: background 0.15s; white-space: nowrap;
}
.int3d-exit:hover { background: rgba(255,255,255,0.16); }
/* ── Interior Live Panel ─────────────────────────────────────────────────── */
.int3d-live-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 240px;
  background: rgba(5, 8, 18, 0.92);
  border-left: 1px solid rgba(255,255,255,0.07);
  overflow-y: auto;
  z-index: 10;
  padding: 12px;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
.int3d-canvas-wrap { position: relative; }
.lp-loading { color: rgba(255,255,255,0.35); padding: 20px 8px; text-align: center; font-size: 12px; }
.lp-error   { color: #f87171; padding: 20px 8px; text-align: center; font-size: 12px; }
.lp-empty   { color: rgba(255,255,255,0.3); font-size: 11px; padding: 6px 0; }
.lp-section { margin-bottom: 16px; }
.lp-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(255,255,255,0.3); margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.lp-stat-row { display: flex; justify-content: space-between; padding: 3px 0; }
.lp-stat-row span:first-child { color: rgba(255,255,255,0.4); }
.lp-stat-row span:last-child  { color: rgba(255,255,255,0.85); font-weight: 600; }
.lp-agents { display: flex; flex-direction: column; gap: 4px; }
.lp-agent-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 5px; background: rgba(255,255,255,0.03); }
.lp-agent-icon { font-size: 13px; flex-shrink: 0; }
.lp-agent-info { flex: 1; min-width: 0; }
.lp-agent-name { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.85); display: block; }
.lp-agent-role { font-size: 10px; color: rgba(255,255,255,0.35); display: block; }
.lp-agent-status { color: #10b981; font-size: 10px; flex-shrink: 0; }
.lp-feed { display: flex; flex-direction: column; gap: 4px; }
.lp-feed-item { font-size: 11px; color: rgba(255,255,255,0.55); line-height: 1.4; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.lp-products { display: flex; flex-direction: column; gap: 6px; }
.lp-product-card { background: rgba(255,255,255,0.04); border-radius: 6px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lp-product-name { font-size: 11px; color: rgba(255,255,255,0.75); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-product-btn { font-size: 10px; font-weight: 700; color: #fde68a; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.lp-product-btn:hover { color: #fbbf24; }
.lp-cta-btn { display: block; background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.4); color: #c7d2fe; text-decoration: none; text-align: center; padding: 8px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; }
.lp-cta-btn:hover { background: rgba(99,102,241,0.35); color: #e0e7ff; }

.int3d-admin-btn {
  background: rgba(124,58,237,0.2); color: #c4b5fd;
  border: 1px solid rgba(124,58,237,0.5);
  padding: 6px 12px; border-radius: 6px;
  cursor: pointer; font-size: 12px; font-family: inherit;
  transition: background 0.15s; white-space: nowrap; margin-left: auto;
}
.int3d-admin-btn:hover { background: rgba(124,58,237,0.4); }
.int3d-title {
  flex: 1; font-size: 15px; font-weight: 700;
  color: rgba(255,255,255,0.9); letter-spacing: 0.4px;
  text-shadow: 0 0 12px var(--accent, #6366f1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.int3d-hint {
  font-size: 11px; color: rgba(255,255,255,0.3);
  white-space: nowrap;
}

/* ── 3D Canvas fill ──────────────────────────────────────────────────────── */
.int3d-canvas-wrap {
  flex: 1; position: relative; overflow: hidden;
}
.int3d-canvas-wrap canvas {
  display: block; width: 100% !important; height: 100% !important;
  touch-action: none; cursor: grab;
}
.int3d-canvas-wrap canvas:active { cursor: grabbing; }

/* ── Interior virtual joystick ───────────────────────────────────────────── */
.int-joystick {
  position: absolute; bottom: 28px; left: 28px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  touch-action: none; z-index: 20;
}
.int-joystick-knob {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  border: 2px solid rgba(255,255,255,0.5);
  pointer-events: none; transition: transform 0.05s;
}

/* ── Floating action buttons ─────────────────────────────────────────────── */
.int3d-minigame-btn,
.int3d-launch-btn {
  position: absolute; bottom: 20px; right: 20px; z-index: 10;
  background: var(--accent, #6366f1); color: #fff;
  border: none; border-radius: 24px;
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.int3d-minigame-btn:hover,
.int3d-launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}

/* ── Mini-game panel (slides in over 3D) ─────────────────────────────────── */
.int3d-minigame-panel {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(5, 7, 15, 0.96);
  overflow-y: auto; padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.int3d-minigame-panel::-webkit-scrollbar { width: 4px; }
.int3d-minigame-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* legacy interior classes — kept for safety, unused by 3D system */
.interior-room { display: none; }
.interior-ceiling, .interior-back-wall, .interior-floor,
.interior-content, .interior-exit-btn, .interior-building-name { display: none; }

/* BCC Office */
.int-office { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.int-office-monitors { display: flex; justify-content: center; gap: 16px; flex: 1; }
.int-monitor {
  background: #0a0f1a; border: 2px solid #10b981;
  border-radius: 8px; padding: 12px; min-width: 260px; max-width: 380px;
  flex: 1; display: flex; flex-direction: column;
  box-shadow: 0 0 20px rgba(16,185,129,0.15);
}
.int-monitor-screen { flex: 1; font-family: 'Courier New', monospace; font-size: 12px; }
.int-terminal-header {
  font-size: 14px; font-weight: 700; color: #10b981;
  border-bottom: 1px solid rgba(16,185,129,0.3); padding-bottom: 6px; margin-bottom: 8px;
}
.int-terminal-body { color: rgba(255,255,255,0.6); line-height: 1.8; }
.int-terminal-line { }
.int-status-ok { color: #10b981; }
.int-terminal-btn {
  margin-top: 12px; width: 100%; padding: 8px 12px;
  background: linear-gradient(135deg, #065f46, #10b981);
  border: none; border-radius: 6px; color: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.int-terminal-btn:hover { opacity: 0.85; }
.int-terminal-offline {
  margin-top: 12px; padding: 8px 12px; border-radius: 6px;
  background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.35);
  font-size: 12px; text-align: center;
}
.int-office-desk {
  display: flex; justify-content: center; gap: 20px;
  padding: 8px; font-size: 22px;
}
.int-desk-item { opacity: 0.7; }

/* Flower Shop */
.int-shop { display: flex; flex-direction: column; gap: 12px; }
.int-flower-display {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
}
.int-flower-pot {
  background: rgba(255,255,255,0.05); border-radius: 10px;
  padding: 12px 16px; text-align: center; font-size: 24px;
  min-width: 80px; border: 1px solid rgba(255,255,255,0.08);
}
.int-flower-label { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 4px; }
.int-arrangement-table {
  background: rgba(255,255,255,0.04); border-radius: 8px;
  padding: 12px; border: 1px solid rgba(255,255,255,0.08);
}
.int-table-label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.7); text-align: center; }

/* Arcade */
.int-arcade { display: flex; flex-direction: column; height: 100%; gap: 12px; }
.int-arcade-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px;
  flex: 1;
}
.int-arcade-machine {
  background: #0d0d2e; border: 2px solid #f43f5e;
  border-radius: 8px; padding: 10px; text-align: center;
  box-shadow: 0 0 10px rgba(244,63,94,0.2);
  cursor: pointer; transition: transform 0.15s;
}
.int-arcade-machine:hover { transform: scale(1.04); }
.int-arcade-screen { font-size: 26px; line-height: 1; }
.int-arcade-label { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 4px; }
.int-arcade-footer { text-align: center; font-size: 11px; color: rgba(255,255,255,0.25); font-family: monospace; }

/* Gallery */
.int-gallery { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.int-gallery-walls {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; flex: 1;
}
.int-art-frame {
  width: 120px; background: #0a0a0a;
  border: 3px solid rgba(255,255,255,0.15); border-radius: 4px;
  padding: 6px; text-align: center;
}
.int-art-canvas {
  height: 70px; background: linear-gradient(135deg, #1a1a2e, #4a2a6e, #2a1a4e);
  border-radius: 2px; margin-bottom: 6px;
  animation: artShimmer 4s ease-in-out infinite alternate;
}
@keyframes artShimmer {
  from { filter: hue-rotate(0deg) brightness(0.9); }
  to   { filter: hue-rotate(45deg) brightness(1.1); }
}
.int-art-title { font-size: 10px; color: rgba(255,255,255,0.7); font-weight: 600; }
.int-art-artist { font-size: 9px; color: rgba(255,255,255,0.35); }
.int-gallery-footer { text-align: center; font-size: 10px; color: rgba(255,255,255,0.2); }

/* City Hall */
.int-civic { display: flex; flex-direction: column; gap: 16px; height: 100%; }
.int-conf-table {
  background: rgba(59,130,246,0.07); border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px; padding: 14px; text-align: center; flex: 1;
}
.int-conf-seats { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.int-conf-seat { font-size: 18px; }
.int-conf-center { font-size: 13px; color: rgba(59,130,246,0.7); font-weight: 600; }
.int-announcements {
  background: rgba(255,255,255,0.04); border-radius: 8px; padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}
.int-ann-title { font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.7); margin-bottom: 8px; }
.int-ann-item { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.8; }

/* Library */
.int-library { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.int-bookshelf {
  display: flex; flex-wrap: wrap; gap: 3px; align-items: flex-end;
  background: rgba(255,255,255,0.03); border-radius: 6px; padding: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.int-bookshelf-large { flex: 1; }
.int-book {
  width: 16px; height: calc(32px + var(--hue, 0) * 0.1px);
  min-height: 28px; max-height: 52px;
  background: hsl(var(--hue, 220), 60%, 35%);
  border-radius: 2px; flex-shrink: 0;
}
.int-reading-nook {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px; font-size: 22px;
  background: rgba(255,255,255,0.03); border-radius: 8px;
}
.int-nook-text { font-size: 13px; color: rgba(255,255,255,0.4); }

/* EVERA Music Hall */
.int-evera { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.int-stage {
  flex: 1; background: rgba(168,85,247,0.07); border: 1px solid rgba(168,85,247,0.2);
  border-radius: 10px; padding: 14px; display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.int-stage-lights { display: flex; gap: 20px; }
.int-spotlight {
  width: 10px; height: 30px;
  background: linear-gradient(to bottom, rgba(255,220,50,0.8), transparent);
  border-radius: 5px 5px 40px 40px;
  transform: rotate(calc((var(--i) - 2) * 12deg));
}
.int-stage-floor { display: flex; gap: 16px; font-size: 24px; align-items: center; }
.int-stage-label { font-size: 12px; color: rgba(168,85,247,0.6); font-weight: 600; }
.int-seating {
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: center;
  font-size: 14px; padding: 6px;
  background: rgba(255,255,255,0.02); border-radius: 6px;
}

/* Residences Lobby */
.int-lobby { display: flex; gap: 12px; height: 100%; align-items: flex-start; }
.int-lobby-board {
  flex: 1; background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.2);
  border-radius: 10px; padding: 14px;
}
.int-lobby-title { font-size: 14px; font-weight: 700; color: rgba(16,185,129,0.8); margin-bottom: 8px; }
.int-lobby-unit { font-size: 12px; color: rgba(255,255,255,0.5); padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.int-lobby-decor { display: flex; flex-direction: column; gap: 8px; font-size: 22px; align-self: center; }

/* Filler interiors */
.int-filler { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.int-filler-shelf {
  display: flex; gap: 16px; justify-content: center; font-size: 28px;
  background: rgba(255,255,255,0.04); border-radius: 8px; padding: 12px;
}
.int-filler-counter {
  background: rgba(255,255,255,0.03); border-radius: 8px; padding: 12px;
}
.int-filler-label { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.6); text-align: center; }
.int-filler-items { display: flex; justify-content: center; gap: 16px; margin-top: 8px; font-size: 12px; color: rgba(255,255,255,0.4); }

/* ── Café Mini-Game ──────────────────────────────────────────────────────── */
.cafe-game { width: 100%; height: 100%; display: flex; align-items: flex-start; justify-content: center; }
.cafe-step { width: 100%; max-width: 520px; }
.cafe-step-hidden { display: none !important; }

.cafe-step-title {
  font-size: 16px; font-weight: 700; color: #f59e0b;
  margin-bottom: 12px; text-align: center;
}

.cafe-drink-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px;
}
.cafe-drink-btn {
  padding: 10px 8px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8); font-size: 12px; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.cafe-drink-btn:hover { background: rgba(245,158,11,0.15); border-color: #f59e0b; }
.cafe-drink-btn.selected { background: rgba(245,158,11,0.2); border-color: #f59e0b; color: #fde68a; }

.cafe-size-row { display: flex; gap: 10px; justify-content: center; }
.cafe-size-btn {
  flex: 1; max-width: 130px; padding: 14px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8); font-size: 22px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all 0.15s; font-family: inherit;
}
.cafe-size-btn small { font-size: 10px; color: rgba(255,255,255,0.4); }
.cafe-size-btn:hover { background: rgba(245,158,11,0.15); border-color: #f59e0b; }
.cafe-size-btn.selected { background: rgba(245,158,11,0.2); border-color: #f59e0b; }

.cafe-custom-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px;
  margin-bottom: 12px;
}
.cafe-custom-btn {
  padding: 8px 6px; border-radius: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7); font-size: 11px; cursor: pointer;
  transition: all 0.15s; font-family: inherit;
}
.cafe-custom-btn:hover { background: rgba(99,102,241,0.15); border-color: #6366f1; }
.cafe-custom-btn.selected { background: rgba(99,102,241,0.25); border-color: #6366f1; color: #a5b4fc; }

.cafe-order-btn {
  width: 100%; padding: 12px; border-radius: 10px;
  background: linear-gradient(135deg, #92400e, #f59e0b);
  border: none; color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: opacity 0.15s;
}
.cafe-order-btn:hover { opacity: 0.9; }

/* Brewing animation */
.cafe-brew-animation { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px; }
.cafe-brew-cup { font-size: 52px; animation: cafeCupPulse 0.6s ease-in-out infinite alternate; }
@keyframes cafeCupPulse { from { transform: scale(1); } to { transform: scale(1.1); } }
.cafe-brew-steam { display: flex; gap: 8px; }
.cafe-brew-steam span {
  display: block; width: 6px; height: 24px;
  background: rgba(255,255,255,0.3); border-radius: 3px;
  animation: cafeSteam 1s ease-in-out infinite;
}
.cafe-brew-steam span:nth-child(2) { animation-delay: 0.2s; }
.cafe-brew-steam span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cafeSteam {
  0%   { transform: translateY(0) scaleX(1); opacity: 0.8; }
  50%  { transform: translateY(-10px) scaleX(1.3); opacity: 0.4; }
  100% { transform: translateY(-20px) scaleX(0.8); opacity: 0; }
}
.cafe-brew-label { font-size: 14px; color: rgba(255,255,255,0.5); }

/* Enjoy screen */
.cafe-enjoy { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; }
.cafe-enjoy-drink { font-size: 56px; animation: cafeCupPulse 2s ease-in-out infinite alternate; }
.cafe-enjoy-name { font-size: 18px; font-weight: 700; color: #fde68a; text-align: center; }
.cafe-enjoy-msg { font-size: 14px; color: rgba(255,255,255,0.5); }

@media (max-width: 480px) {
  .int3d-hint { display: none; }
  .int3d-title { font-size: 13px; }
  .int3d-minigame-btn, .int3d-launch-btn { bottom: 12px; right: 12px; font-size: 13px; padding: 9px 16px; }
  .cafe-drink-grid { grid-template-columns: repeat(2, 1fr); }
  .cafe-size-row { gap: 6px; }
}

/* ── Panels (Profile / Settings) ─────────────────────────────────────────── */
.panel-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.panel-sheet {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1001; width: min(420px, 94vw);
  background: rgba(8, 12, 26, 0.97);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  overflow: hidden;
  max-height: 90dvh; overflow-y: auto;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  background: rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 2;
}
.panel-title { font-size: 16px; font-weight: 700; color: #e0e7ff; }
.panel-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.panel-close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.panel-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.panel-label { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.6px; }
.panel-input {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: #fff; font-size: 15px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
  box-sizing: border-box;
}
.panel-input:focus { border-color: rgba(99,102,241,0.6); }
.panel-color-input {
  margin-top: 6px; width: 48px; height: 36px; border: none; border-radius: 8px;
  cursor: pointer; background: none; padding: 0;
}
.panel-save-btn {
  width: 100%; padding: 11px; border: none; border-radius: 10px;
  background: #6366f1; color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: background 0.15s;
}
.panel-save-btn:hover { background: #4f46e5; }

/* Profile specifics */
.profile-avatar-row { display: flex; gap: 16px; align-items: flex-start; }
.profile-avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  background: #6ee7ff; border: 3px solid rgba(255,255,255,0.15);
  margin-top: 4px;
}
.profile-avatar-inputs { flex: 1; }
.profile-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.07);
}
.profile-stat {
  background: rgba(255,255,255,0.04); border-radius: 10px;
  padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.stat-label { font-size: 10px; color: rgba(255,255,255,0.35); text-align: center; }
.stat-val { font-size: 18px; font-weight: 700; color: #a5b4fc; }

/* Settings specifics */
.settings-section { display: flex; flex-direction: column; gap: 10px; }
.settings-section-title {
  font-size: 12px; font-weight: 700; color: rgba(99,102,241,0.8);
  text-transform: uppercase; letter-spacing: 0.8px; padding-bottom: 4px;
  border-bottom: 1px solid rgba(99,102,241,0.15);
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 2px 0;
}
.settings-label { font-size: 13px; color: rgba(255,255,255,0.65); }
.settings-quality-btns { display: flex; gap: 6px; }
.sq-btn {
  padding: 5px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.sq-btn.active { background: rgba(99,102,241,0.3); border-color: #6366f1; color: #c7d2fe; }
.settings-slider {
  width: 140px; accent-color: #6366f1;
}
.settings-select {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px; color: #fff; padding: 4px 8px; font-size: 13px;
  font-family: inherit; outline: none;
}
.settings-toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0; border-radius: 22px;
  background: rgba(255,255,255,0.12); cursor: pointer; transition: background 0.2s;
}
.toggle-track::before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.settings-toggle input:checked + .toggle-track { background: #6366f1; }
.settings-toggle input:checked + .toggle-track::before { transform: translateX(18px); }

/* Map location go button — styles consolidated into .map-loc-item above */

/* HUD Profile/Settings icon buttons */
#hud-profile-btn, #hud-settings-btn {
  min-width: 38px !important; padding: 0 !important; font-size: 16px;
}

/* ── Zombie Survivor Game ─────────────────────────────────────────────────── */
#zs-overlay {
  position: fixed; inset: 0; z-index: 950;
  background: #000;
  font-family: 'Courier New', monospace;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
  height: 100dvh;
}
#zs-overlay *,
#zs-overlay button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
#zs-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD Top */
#zs-hud-top {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 20px; align-items: center;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 20px; border-radius: 20px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
#zs-wave-badge {
  font-size: 13px; font-weight: 700; color: #f59e0b; letter-spacing: 1px;
}
#zs-score, #zs-best, #zs-kills {
  font-size: 12px; color: rgba(255,255,255,0.7); letter-spacing: 0.5px;
}
#zs-score span, #zs-best span, #zs-kills span { color: #a5b4fc; font-weight: 700; }

/* Health bars */
#zs-bars {
  position: absolute; bottom: 80px; left: 16px;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.zs-bar-row { display: flex; align-items: center; gap: 8px; }
.zs-bar-label {
  width: 46px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px; text-align: right;
}
.zs-bar-track {
  width: 130px; height: 10px; border-radius: 5px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}
.zs-bar-fill {
  height: 100%; border-radius: 5px; width: 100%;
  transition: width 0.2s ease;
}
.zs-bar-val { font-size: 10px; color: rgba(255,255,255,0.45); min-width: 28px; }

/* Onyx commands */
#zs-commands {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
#zs-onyx-state-label {
  font-size: 10px; color: rgba(0,255,204,0.55); letter-spacing: 0.5px;
}
#zs-onyx-state { color: #00ffcc; font-weight: 700; }
#zs-cmd-row { display: flex; gap: 6px; }
.zs-cmd {
  padding: 6px 11px; border-radius: 8px; font-size: 12px; font-weight: 700;
  border: 1px solid rgba(0,255,204,0.25); background: rgba(0,255,204,0.08);
  color: rgba(0,255,204,0.7); cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.zs-cmd:hover { background: rgba(0,255,204,0.18); color: #00ffcc; }
.zs-cmd.active { background: rgba(0,255,204,0.28); border-color: #00ffcc; color: #fff; }
#zs-heal-cd { font-size: 10px; color: rgba(255,255,255,0.4); text-align: right; }

/* Name labels */
.zs-name-label {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  text-shadow: 0 0 6px currentColor, 0 1px 3px #000;
  pointer-events: none; white-space: nowrap;
}

/* Banner */
#zs-banner {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(5,5,20,0.92); border: 1px solid rgba(99,102,241,0.4);
  border-radius: 16px; padding: 24px 40px; text-align: center;
  font-size: 22px; font-weight: 700; color: #e0e7ff;
  letter-spacing: 1px; text-transform: uppercase;
  box-shadow: 0 0 60px rgba(99,102,241,0.2);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.zs-go-title { font-size: 36px; color: #f43f5e; margin-bottom: 8px; }
.zs-go-sub   { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 16px; font-weight: 400; text-transform: none; }
.zs-go-stat  { font-size: 14px; color: rgba(255,255,255,0.6); margin: 4px 0; }
.zs-go-stat strong { color: #a5b4fc; }
.zs-go-btns  { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.zs-go-btn {
  padding: 10px 24px; border-radius: 10px; border: none;
  background: #6366f1; color: #fff; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer; transition: background 0.15s;
  pointer-events: all;
}
.zs-go-btn:hover { background: #4f46e5; }
.zs-go-exit { background: rgba(244,63,94,0.3); border: 1px solid #f43f5e; }
.zs-go-exit:hover { background: rgba(244,63,94,0.5); }
#zs-banner.hidden { display: none; }

/* Exit button */
#zs-exit-btn, #zs-pause-btn {
  position: absolute; top: 14px; left: 14px;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6); padding: 7px 14px; border-radius: 8px;
  font-size: 13px; cursor: pointer; font-family: inherit;
  transition: all 0.15s; backdrop-filter: blur(4px);
}
#zs-exit-btn:hover { background: rgba(244,63,94,0.25); border-color: #f43f5e; color: #fff; }
#zs-pause-btn { left: auto; right: 14px; }
#zs-pause-btn:hover { background: rgba(99,102,241,0.25); border-color: #6366f1; color: #fff; }

/* Mobile joystick */
#zs-joystick-zone {
  position: absolute; bottom: 90px; left: 24px;
  width: 100px; height: 100px;
  display: none;
  touch-action: none;
}
#zs-joystick-base {
  width: 100%; height: 100%; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 2px solid rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
}
#zs-joystick-thumb {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(99,102,241,0.6); border: 2px solid #6366f1;
  transition: transform 0.05s;
}
#zs-aim-zone {
  position: absolute; bottom: 0; right: 0;
  width: 50%; height: 100%;
  display: none;
  touch-action: none;
  z-index: 2;
}
#zs-action-stack {
  position: absolute; bottom: 90px; right: 130px;
  display: none; flex-direction: column; align-items: center; gap: 10px;
  touch-action: none;
}
.zs-action-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(244,63,94,0.3); border: 2px solid #f43f5e;
  color: #fff; font-size: 12px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  touch-action: none;
}
#zs-dodge-btn {
  width: 58px; height: 58px;
  background: rgba(99,102,241,0.28); border-color: #818cf8;
}
#zs-heal-btn {
  width: 52px; height: 52px;
  background: rgba(0,255,204,0.18); border-color: rgba(0,255,204,0.75);
}
@media (max-width: 768px) {
  #zs-hud-top {
    top: calc(max(10px, env(safe-area-inset-top)) + 44px);
    left: 50%;
    width: min(340px, calc(100vw - 28px));
    justify-content: center;
    flex-wrap: wrap;
    row-gap: 4px;
    column-gap: 12px;
    padding: 8px 12px;
    border-radius: 14px;
  }
  #zs-wave-badge { width: 100%; text-align: center; font-size: 12px; }
  #zs-score, #zs-best, #zs-kills { font-size: 10px; }
  #zs-exit-btn, #zs-pause-btn {
    top: max(10px, env(safe-area-inset-top));
    padding: 9px 10px;
    font-size: 11px;
  }
  #zs-joystick-zone {
    display: block;
    width: 112px;
    height: 112px;
    left: max(18px, env(safe-area-inset-left));
    bottom: calc(28px + env(safe-area-inset-bottom));
  }
  #zs-aim-zone { display: block; }
  #zs-action-stack {
    display: flex;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
  #zs-commands {
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(218px + env(safe-area-inset-bottom));
    align-items: stretch;
  }
  #zs-onyx-state-label { text-align: center; }
  #zs-cmd-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .zs-cmd {
    min-height: 38px;
    padding: 6px 4px;
    font-size: 10px;
    border-radius: 10px;
  }
  #zs-bars {
    top: calc(max(10px, env(safe-area-inset-top)) + 108px);
    left: max(12px, env(safe-area-inset-left));
    bottom: auto;
    gap: 5px;
  }
  .zs-bar-label { width: 38px; font-size: 9px; }
  .zs-bar-track { width: 96px; height: 8px; }
  .zs-bar-val { font-size: 9px; min-width: 22px; }
  #zs-banner {
    width: min(320px, calc(100vw - 36px));
    padding: 20px 18px;
    font-size: 17px;
    border-radius: 14px;
  }
  .zs-go-title { font-size: 28px; }
  .zs-go-btns { flex-direction: column; }
}

/* ── Story Journal Panel ──────────────────────────────────────────────────── */
#story-journal-panel {
  position: fixed;
  top: 0; right: 0;
  width: min(520px, 100vw);
  height: 100%;
  background: rgba(5, 8, 20, 0.97);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 3500;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
#story-journal-panel.sj-panel-hidden {
  transform: translateX(100%);
}

/* Header */
#sj-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
#sj-header-left { display: flex; align-items: center; gap: 10px; }
#sj-header-icon { font-size: 22px; }
.sj-header-title {
  font-size: 16px; font-weight: 700; color: #f1f5f9; letter-spacing: 0.3px;
}
#sj-progress-summary {
  font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px;
}
#sj-close-btn {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.55); width: 30px; height: 30px;
  border-radius: 50%; cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#sj-close-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Body: two-pane layout */
#sj-body {
  display: flex; flex: 1; overflow: hidden;
}

/* Left pane — story list */
#sj-story-list {
  width: 180px; flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  padding: 8px 0;
}
#sj-story-list::-webkit-scrollbar { width: 3px; }
#sj-story-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sj-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  position: relative;
}
.sj-item:hover { background: rgba(255,255,255,0.04); }
.sj-item-sel { background: rgba(255,255,255,0.07) !important; }
.sj-item-unread { border-left-color: rgba(99,102,241,0.6); }
.sj-item-icon { font-size: 18px; line-height: 1; margin-top: 1px; flex-shrink: 0; }
.sj-item-body { flex: 1; min-width: 0; }
.sj-item-title {
  font-size: 11px; font-weight: 600; color: #e2e8f0;
  line-height: 1.3; word-break: break-word;
}
.sj-item-locked .sj-item-title { color: rgba(255,255,255,0.25); }
.sj-item-genre { font-size: 9px; margin-top: 2px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.sj-item-bar {
  height: 2px; background: rgba(255,255,255,0.08);
  border-radius: 1px; margin-top: 5px; overflow: hidden;
}
.sj-item-bar-fill { height: 100%; border-radius: 1px; transition: width 0.4s; }
.sj-item-prog { font-size: 9px; color: rgba(255,255,255,0.3); margin-top: 3px; }
.sj-dot {
  position: absolute; top: 10px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #6366f1;
}

/* Right pane — detail */
#sj-story-detail {
  flex: 1; overflow-y: auto; padding: 18px 16px;
}
#sj-story-detail::-webkit-scrollbar { width: 3px; }
#sj-story-detail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Empty state */
.sj-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; text-align: center; }
.sj-empty-icon { font-size: 42px; opacity: 0.4; }
.sj-empty-text { font-size: 14px; color: rgba(255,255,255,0.35); }
.sj-empty-hint { font-size: 11px; color: rgba(255,255,255,0.2); }

/* Locked detail */
.sj-locked-detail { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 10px; text-align: center; }
.sj-locked-icon { font-size: 36px; opacity: 0.4; }
.sj-locked-title { font-size: 14px; color: rgba(255,255,255,0.3); font-weight: 600; }
.sj-locked-hint { font-size: 12px; color: rgba(255,255,255,0.18); }

/* Story detail content */
.sj-detail-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid;
}
.sj-detail-icon { font-size: 32px; line-height: 1; flex-shrink: 0; }
.sj-detail-title { font-size: 16px; font-weight: 700; color: #f1f5f9; line-height: 1.3; }
.sj-detail-genre { font-size: 11px; font-weight: 500; margin-top: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.sj-detail-desc {
  font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.6;
  margin-bottom: 16px;
}
.sj-detail-prog-wrap { margin-bottom: 16px; }
.sj-detail-prog-label { font-size: 11px; color: rgba(255,255,255,0.4); margin-bottom: 6px; }
.sj-detail-prog-bar {
  height: 4px; background: rgba(255,255,255,0.08);
  border-radius: 2px; overflow: hidden;
}
.sj-detail-prog-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.sj-detail-citizens-title { font-size: 11px; color: rgba(255,255,255,0.35); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.sj-detail-citizens { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.sj-contrib { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255,255,255,0.35); }
.sj-contrib-met { color: rgba(255,255,255,0.75); }
.sj-contrib-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sj-contrib-name { flex: 1; }
.sj-contrib-check { font-size: 11px; font-weight: 700; }
.sj-hint-box {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 14px;
}
.sj-hint-label { font-size: 10px; color: rgba(255,255,255,0.3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.sj-hint-text { font-size: 12px; color: rgba(255,255,255,0.5); line-height: 1.5; }
.sj-complete {
  text-align: center; font-size: 13px; font-weight: 700;
  border: 1px solid; border-radius: 8px; padding: 8px;
  letter-spacing: 0.5px;
}

/* Stories HUD button badge */
#stories-btn { position: relative; }
.stories-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 999px;
  min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}
.stories-badge.hidden { display: none; }

/* Discovery toast */
#story-discovery-toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 14, 28, 0.96);
  border: 1px solid rgba(99,102,241,0.5);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  z-index: 4000;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.2);
  opacity: 0; transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  white-space: nowrap;
}
#story-discovery-toast.sdt-show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}
#story-discovery-toast.sdt-hide {
  opacity: 0;
  transform: translateX(-50%) translateY(0px);
}
.sdt-icon { font-size: 24px; line-height: 1; }
.sdt-label { font-size: 9px; color: #818cf8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.sdt-title { font-size: 13px; font-weight: 700; color: #e2e8f0; margin-top: 2px; }

/* Mobile: full-screen panel */
@media (max-width: 768px) {
  #story-journal-panel {
    width: 100vw;
    border-left: none;
  }
  #sj-body { flex-direction: column; }
  #sj-story-list {
    width: 100%; height: 140px; border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    padding: 6px;
  }
  .sj-item { flex-direction: column; align-items: center; width: 90px; flex-shrink: 0; text-align: center; border-left: none; border-bottom: 3px solid transparent; gap: 4px; }
  .sj-item-unread { border-left: none; border-bottom-color: rgba(99,102,241,0.6); }
  .sj-item-bar, .sj-item-prog { display: none; }
  .sj-dot { top: 5px; right: 5px; }
  #story-discovery-toast { bottom: 130px; max-width: calc(100vw - 32px); white-space: normal; }
}
