* { margin:0; padding:0; box-sizing:border-box; }
html { overscroll-behavior: none; touch-action: none; }
:root {
  --fire: #ff6b00;
  --deep: #070409;
  --card: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  /* iPhone notch / safe areas */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  /* ── z-index Token System (#28) ── */
  /* Layer 0 — Game Scene (0-49) */
  --z-scene-bg: 0;
  --z-fire-canvas: 5;
  --z-particle-canvas: 8;
  --z-fire-orbits: 10;
  --z-scene-deco: 43;
  --z-scene-deco-btn: 44;
  --z-night-sky: 11;
  --z-emoji-ring: 12;
  --z-deco-emoji: 15;
  --z-duo-avatar: 26;
  --z-duo-name: 27;
  --z-sparkle-layer: 35;
  --z-sky-canvas: 41;
  --z-sky-overlay: 42;
  --z-fire-tag: 38;
  /* Layer 1 — Game UI (50-99) */
  --z-screen: 50;
  --z-ignis: 51;
  --z-bubble: 55;
  --z-reaction: 56;
  --z-dock: 60;
  --z-ignis-bubble: 61;
  --z-sleep-overlay: 62;
  --z-dock-panel: 65;
  --z-audio-dim: 74;
  --z-audio-prompt: 75;
  /* Layer 2 — Feed & Content (100-199) */
  --z-dock-bar: 140;
  --z-feed: 150;
  /* Layer 3 — Overlays (200-299) */
  --z-overlay: 200;
  --z-stream-controls: 205;
  --z-stream-reject: 206;
  --z-stream-toast: 210;
  --z-deco-tooltip: 250;
  /* Layer 4 — Modals & Friend Fire (300-399) */
  --z-modal-base: 300;
  --z-journal: 310;
  --z-friend-sparkle: 299;
  --z-friend-overlay: 300;
  /* Layer 5 — Plugin (500-599) */
  --z-plugin-overlay: 500;
  --z-plugin-hype: 510;
  /* Layer 6 — System Critical (700-899) */
  --z-sms-pop: 690;
  --z-sparkle-rain: 700;
  --z-toast: 750;
  --z-stream-banner: 800;
  --z-update-banner: 810;
  --z-pwa-banner: 820;
  --z-onboarding: 830;
  --z-buglog: 835;
  --z-school: 840;
  --z-friend-popup: 850;
  /* Layer 7 — Terminal (900) */
  --z-terminal: 900;
}
body {
  background: var(--deep);
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  font-family: 'Nunito', sans-serif;
  color: white;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  -webkit-touch-callout: none;
}
html { min-height: -webkit-fill-available; }

/* =====================
   SCREENS SYSTEM
   ===================== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s, transform 0.4s;
  z-index: var(--z-screen);
}
.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
}

/* =====================
   SCREEN: WELCOME
   ===================== */
#screenWelcome {
  background: radial-gradient(ellipse at 50% 80%, #2a0d02 0%, #0e0510 60%, var(--deep) 100%);
  gap: 0;
  padding: max(40px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
}
.welcome-flame {
  font-size: 72px;
  animation: welcomePulse 2s ease-in-out infinite;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 30px #ff6b00);
}
@keyframes welcomePulse { 0%,100%{transform:scale(1) rotate(-2deg)} 50%{transform:scale(1.08) rotate(2deg)} }

.welcome-title {
  font-family: 'Cinzel', serif;
  font-size: 42px;
  letter-spacing: 8px;
  color: #ff8c42;
  text-shadow: 0 0 40px rgba(255,100,0,0.8), 0 0 80px rgba(255,60,0,0.3);
  margin-bottom: 8px;
}
.welcome-sub {
  font-size: 13px;
  color: rgba(255,200,120,0.7);
  letter-spacing: 2px;
  margin-bottom: 24px;
  text-align: center;
}
.lang-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
  justify-content: center;
}
.lang-flag-btn {
  background: rgba(255,255,255,0.06);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.lang-flag-btn:hover { background: rgba(255,255,255,0.12); }
.lang-flag-btn.active {
  border-color: var(--fire);
  background: rgba(255,107,0,0.15);
  box-shadow: 0 0 12px rgba(255,107,0,0.3);
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b00, #ff3300);
  border: none;
  border-radius: 18px;
  padding: 16px 48px;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 900;
  color: white;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(255,100,0,0.4);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 16px;
}
.btn-primary:active { transform: scale(0.95); box-shadow: 0 4px 16px rgba(255,100,0,0.3); }

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 12px 32px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 1px;
}
.btn-secondary:active { background: rgba(255,255,255,0.05); }

/* =====================
   SCREEN: TAM TAM SPLASH
   ===================== */
#screenTamTam {
  background: transparent;
  gap: 0;
  padding: max(60px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.tamtam-bg {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 100%, #2a0f05 0%, #120508 40%, #060208 100%);
  z-index: 0;
}
.tamtam-title {
  font-size: 64px;
  text-shadow: 0 0 30px #ff6b00, 0 0 60px rgba(255,107,0,0.4);
  animation: welcomePulse 2s ease-in-out infinite;
  will-change: transform;
  position: relative; z-index: 1;
  margin-bottom: 8px;
}
.tamtam-sub {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255,200,120,0.8);
  letter-spacing: 1px;
  text-align: center;
  position: relative; z-index: 1;
  margin-bottom: 6px;
  padding: 0 16px;
}
.tamtam-hint {
  font-size: 13px;
  color: rgba(255,200,120,0.4);
  text-align: center;
  position: relative; z-index: 1;
  margin-bottom: 28px;
  padding: 0 16px;
}
/* Ghost hand — bouncing pointer that guides the user */
.tamtam-ghost {
  font-size: 36px;
  position: relative; z-index: 2;
  margin-top: 18px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.tamtam-ghost.visible {
  opacity: 0.6;
  animation: tamtamGhostBounce 1.2s ease-in-out infinite;
}
.tamtam-ghost.hidden {
  opacity: 0;
}
@keyframes tamtamGhostBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.tamtam-keys {
  display: flex;
  gap: 12px;
  justify-content: center;
  position: relative; z-index: 1;
  contain: layout style;
}
.tamtam-key {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 3px solid var(--key-color);
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--key-color) 40%, transparent), rgba(0,0,0,0.4));
  box-shadow: 0 0 20px var(--key-glow), inset 0 0 12px rgba(0,0,0,0.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
  will-change: transform;
  contain: layout style paint;
}
.tamtam-key:active {
  transform: scale(0.9);
  box-shadow: 0 0 40px var(--key-glow), 0 0 60px var(--key-glow), inset 0 0 12px rgba(0,0,0,0.2);
}
.tamtam-key.lit {
  background: radial-gradient(circle at 40% 35%, var(--key-color), color-mix(in srgb, var(--key-color) 60%, #000));
  box-shadow: 0 0 30px var(--key-glow), 0 0 60px var(--key-glow);
  animation: tamtamGlow 0.8s ease-in-out infinite alternate;
}
@keyframes tamtamGlow {
  from { opacity: 0.85; }
  to   { opacity: 1; }
}
.tamtam-progress {
  display: flex; gap: 10px; margin-top: 24px;
  position: relative; z-index: 1;
}
.tamtam-dot {
  font-size: 14px;
  opacity: 0.2;
  transition: opacity 0.3s, transform 0.3s;
  filter: grayscale(1);
}
.tamtam-dot.lit {
  opacity: 1;
  filter: grayscale(0);
  transform: scale(1.3);
}
/* Replay flash on keys */
.tamtam-key.replay {
  background: radial-gradient(circle at 40% 35%, var(--key-color), color-mix(in srgb, var(--key-color) 60%, #000));
  box-shadow: 0 0 40px var(--key-glow), 0 0 80px var(--key-glow);
  transform: scale(1.15);
}
#screenTamTam.igniting .tamtam-title {
  animation: tamtamIgnite 0.8s ease-in forwards;
}
@keyframes tamtamIgnite {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}
#screenTamTam.igniting .tamtam-sub,
#screenTamTam.igniting .tamtam-keys,
#screenTamTam.igniting .tamtam-progress {
  animation: fadeOut 0.5s ease-out forwards;
}
@keyframes fadeOut { to { opacity: 0; transform: translateY(20px); } }

/* =====================
   SCREEN: CREATE PROFILE
   ===================== */
#screenCreateProfile {
  background: radial-gradient(ellipse at 50% 0%, #1a0808 0%, #0a0412 60%, var(--deep) 100%);
  padding: max(40px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
  gap: 0;
  justify-content: flex-start;
  overflow-y: auto;
}
.profile-header {
  width: 100%;
  text-align: center;
  margin-bottom: 32px;
  margin-top: 20px;
}
.profile-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  color: #ff8c42;
  letter-spacing: 4px;
  margin-bottom: 6px;
}
.profile-header p {
  font-size: 14px;
  color: rgba(255,200,120,0.7);
  letter-spacing: 1px;
}

/* Avatar picker */
.avatar-section {
  width: 100%;
  margin-bottom: 28px;
}
.section-label {
  font-size: 14px;
  color: rgba(255,180,100,0.85);
  letter-spacing: 1px;
  font-weight: 800;
  margin-bottom: 12px;
  text-align: center;
}
.avatar-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,100,0,0.1);
  border: 2px solid rgba(255,100,0,0.4);
  font-size: 40px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 0 20px rgba(255,100,0,0.2);
  transition: all 0.2s;
}
.avatar-tabs {
  display: flex; justify-content: center; gap: 0; margin-bottom: 12px;
  background: rgba(0,0,0,0.25); border-radius: 14px; padding: 3px;
  width: 100%; max-width: 300px; margin-left: auto; margin-right: auto;
}
.avatar-tab {
  flex: 1; height: 38px; border-radius: 11px;
  background: transparent; border: none;
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; -webkit-tap-highlight-color: transparent;
  opacity: 0.5;
}
.avatar-tab:active { transform: scale(0.92); }
.avatar-tab.active {
  background: rgba(255,100,0,0.2); opacity: 1;
  box-shadow: 0 2px 8px rgba(255,80,0,0.25);
}
.avatar-grid-scroll {
  max-height: 200px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 14px; padding: 4px 0;
}
.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.avatar-option {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--border);
  font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.avatar-option:active { transform: scale(0.9); }
.avatar-option.selected {
  border-color: #ff8c42;
  background: rgba(255,100,0,0.15);
  box-shadow: 0 0 12px rgba(255,100,0,0.3);
}

/* Name input */
.name-section {
  width: 100%;
  margin-bottom: 28px;
}
.name-input {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.name-input:focus {
  border-color: rgba(255,100,0,0.6);
  box-shadow: 0 0 16px rgba(255,100,0,0.15);
}
.name-input::placeholder { color: rgba(255,255,255,0.4); letter-spacing: 1px; }

/* Flame color picker */
.color-section { width: 100%; margin-bottom: 32px; }
.color-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.color-option {
  width: 44px; height: 44px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.color-option:active { transform: scale(0.85); }
.color-option.selected {
  border-color: white;
  box-shadow: 0 0 14px rgba(255,255,255,0.4);
  transform: scale(1.15);
}

/* =====================
   SCREEN: LOGIN
   ===================== */
#screenLogin {
  background: radial-gradient(ellipse at 50% 80%, #2a0d02 0%, #0e0510 60%, var(--deep) 100%);
  padding: max(40px, env(safe-area-inset-top)) 24px max(40px, env(safe-area-inset-bottom));
  gap: 16px;
}
#screenLogin h2 {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  color: #ff8c42;
  letter-spacing: 3px;
  margin-bottom: 8px;
}
.profile-list {
  width: 100%;
  max-width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.profile-card:active { background: rgba(255,100,0,0.1); border-color: rgba(255,100,0,0.4); }
.profile-card-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,100,0,0.1);
  border: 2px solid rgba(255,100,0,0.3);
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-card-info { flex: 1; }
.profile-card-name {
  font-size: 16px;
  font-weight: 800;
  color: white;
  letter-spacing: 1px;
}
.profile-card-meta {
  font-size: 11px;
  color: rgba(255,200,120,0.4);
  margin-top: 2px;
}
.profile-card-fire-status {
  font-size: 12px;
  color: rgba(255,180,80,0.6);
  margin-top: 3px;
  font-weight: 600;
}
.profile-card-flame { font-size: 22px; }
.profile-card-delete {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(255,50,50,0.1);
  border: 1px solid rgba(255,50,50,0.2);
  color: rgba(255,80,80,0.6);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.profile-card-delete:active { background: rgba(255,50,50,0.3); }

/* =====================
   SCREEN: GAME
   ===================== */
#screenGame {
  background: radial-gradient(ellipse at 50% 100%, #2a0f05 0%, #120508 40%, #060208 100%);
  z-index: 1;
}
/* NIGHT SKY */
.night-sky {
  position:fixed; top:0; left:0; right:0; bottom:0;
  z-index:var(--z-sky-canvas); pointer-events:none; overflow:hidden;
  /* Sky fades to transparent in bottom 40% — fire zone emerges naturally */
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 85%);
  mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 85%);
}
.night-sky canvas { width:100%; height:100%; }
.sky-moon {
  width:36px; height:36px; border-radius:50%;
  background:#f0e6c0;
  box-shadow:0 0 14px 4px rgba(240,230,180,0.25);
  overflow:hidden;
  position:relative;
}
.sky-moon-shadow {
  position:absolute; border-radius:50%;
  background:#060208;
  width:36px; height:36px;
}

/* TOP BAR */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 14px 16px 10px;
  padding-top: max(14px, env(safe-area-inset-top, 14px));
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  z-index: var(--z-sky-overlay);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.top-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 12px 6px 8px;
  backdrop-filter: blur(10px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.top-avatar-wrap { position:relative; flex-shrink:0; }
.top-avatar { font-size: 20px; line-height: 1; }
.top-avatar-dot {
  position:absolute; top:-2px; right:-3px;
  width:8px; height:8px; border-radius:50%;
  background:#555; border:1.5px solid rgba(0,0,0,0.6);
  transition:background 0.3s, box-shadow 0.3s;
}
.top-avatar-dot.findable { background:#4cff88; box-shadow:0 0 6px rgba(76,255,136,0.6); animation:topNetPulse 2s ease-in-out infinite; }
.top-avatar-dot.connecting { background:#ffc107; animation:mpNetBlink 0.8s ease-in-out infinite; }
.top-avatar-dot.connected { background:#4cff88; box-shadow:0 0 6px rgba(76,255,136,0.6); }
.top-avatar-dot.offline { background:#ff4444; animation:mpNetBlink 1.2s ease-in-out infinite; }
.top-profile-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.top-name {
  font-size: 14px;
  font-weight: 800;
  color: rgba(255,200,120,0.9);
  letter-spacing: 1px;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}
.top-level-inline {
  font-size: 11px;
  color: #ff8c42;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 3px;
}
.top-level-inline #levelNum {
  font-family: 'Cinzel', serif;
  font-weight: 700;
}
.top-level-lbl {
  font-size: 10px;
  color: rgba(255,160,80,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 800;
}
.top-playtime {
  font-size: 12px;
  color: rgba(255,200,150,0.45);
  line-height: 1;
  font-weight: 600;
}
.top-net-status {
  display:none; align-items:center; gap:3px;
  font-size:12px; line-height:1; font-weight:700;
  color:rgba(120,255,160,0.7);
}
.top-net-status.visible { display:flex; }
.top-net-status .net-dot {
  width:5px; height:5px; border-radius:50%; flex-shrink:0;
}
.top-net-status.findable .net-dot { background:#4cff88; animation:topNetPulse 2s ease-in-out infinite; }
.top-net-status.findable { color:rgba(120,255,160,0.7); }
.top-net-status.connecting .net-dot { background:#ffc107; animation:mpNetBlink 0.8s ease-in-out infinite; }
.top-net-status.connecting { color:rgba(255,200,80,0.7); }
.top-net-status.connected .net-dot { background:#4cff88; }
.top-net-status.connected { color:rgba(120,255,160,0.7); }
.top-net-status.offline .net-dot { background:#ff4444; animation:mpNetBlink 1.2s ease-in-out infinite; }
.top-net-status.offline { color:rgba(255,100,100,0.8); }
@keyframes topNetPulse {
  0%,100% { box-shadow:0 0 0 0 rgba(76,255,136,0.4); }
  50% { box-shadow:0 0 0 3px rgba(76,255,136,0); }
}
.top-moon-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  pointer-events: none;
  z-index: -1;
}
/* Dock badge (notification-style counter) */
.dock-icon { position:relative; }
.dock-badge {
  position:absolute; top:-4px; right:-4px;
  min-width:18px;
  border-radius:10px; padding:3px 5px;
  background:linear-gradient(135deg,#8B4513,#D2691E);
  border:2px solid rgba(0,0,0,0.6);
  font-family:'Nunito',sans-serif; font-size:11px; font-weight:900;
  color:#fff; line-height:1; text-align:center;
  pointer-events:none; transition:transform 0.2s, opacity 0.3s;
}
.dock-badge.low { background:linear-gradient(135deg,#cc3300,#ff4400); animation:badgePulse 1s ease-in-out infinite; }
.dock-badge.tribe-badge { background:linear-gradient(135deg,#1a8a3a,#2ecc71); }
.dock-badge.hearth-badge { background:linear-gradient(135deg,#cc8800,#ffaa00); color:#1a0500; }
.dock-badge.community-badge, .dock-badge.chat-badge { background:linear-gradient(135deg,#1a8a3a,#2ecc71); }
.dock-badge.empty { opacity:0.4; background:#555; }
@keyframes badgePulse {
  0%,100% { transform:scale(1); }
  50% { transform:scale(1.15); }
}
/* ---- Challenge system ---- */
.challenge-picker-overlay {
  position:fixed; inset:0; z-index:var(--z-top, 900); display:flex; align-items:center; justify-content:center;
  background:rgba(0,0,0,0.6); backdrop-filter:blur(6px); opacity:0; pointer-events:none;
  transition:opacity 0.25s;
}
.challenge-picker-overlay.visible { opacity:1; pointer-events:all; }
.challenge-picker-panel {
  background:linear-gradient(180deg,#1a0a2e,#0d0518); border-radius:20px;
  padding:20px; width:85%; max-width:340px; max-height:70vh; overflow-y:auto;
  border:1px solid rgba(255,140,0,0.3); box-shadow:0 8px 40px rgba(0,0,0,0.6);
}
.challenge-picker-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.challenge-picker-title { font-family:'Cinzel',serif; font-size:18px; font-weight:700; color:#FFD700; }
.challenge-picker-close { background:none; border:none; color:#fff; font-size:20px; cursor:pointer; padding:4px 8px; }
.challenge-picker-list { display:flex; flex-direction:column; gap:10px; }
.challenge-picker-card {
  display:flex; align-items:center; gap:12px; padding:12px 16px;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,140,0,0.2);
  border-radius:14px; cursor:pointer; transition:background 0.15s;
}
.challenge-picker-card:active { background:rgba(255,140,0,0.15); }
.challenge-picker-avatar { font-size:28px; }
.challenge-picker-name { font-size:15px; font-weight:600; color:#fff; flex:1; text-align:left; }
.challenge-picker-online {
  width:10px; height:10px; border-radius:50%; background:#2ecc71;
  box-shadow:0 0 6px #2ecc71; flex-shrink:0;
}
.challenge-picker-check { font-size:18px; flex-shrink:0; width:24px; text-align:center; }
.challenge-picker-card.selected {
  background:rgba(255,140,0,0.18); border-color:rgba(255,160,40,0.5);
}
.challenge-picker-send {
  margin-top:8px; width:100%; font-size:16px; font-weight:700;
  padding:12px; border-radius:14px;
}
.challenge-picker-send:disabled { opacity:0.4; }
/* Challenge target HUD */
.challenge-target {
  position:fixed;
  top:max(80px, calc(env(safe-area-inset-top, 0px) + 60px));
  left:50%; transform:translateX(-50%);
  z-index:var(--z-toast); padding:10px 22px; border-radius:16px;
  background:linear-gradient(135deg,rgba(255,100,0,0.35),rgba(200,60,0,0.4));
  border:2px solid rgba(255,140,0,0.6); color:#FFD700;
  font-family:'Cinzel',serif; font-size:15px; font-weight:700;
  backdrop-filter:blur(10px); pointer-events:none;
  opacity:0; transition:opacity 0.3s;
  text-align:center; max-width:90vw;
  box-shadow:0 4px 20px rgba(255,100,0,0.3);
}
.challenge-target.visible { opacity:1; }
.challenge-target-name { display:block; font-size:13px; color:rgba(255,220,160,0.8); margin-bottom:2px; }
.challenge-target-score { display:block; font-size:18px; color:#FFD700; }
/* Duel result overlay in result screens */
.duel-result-box {
  margin:10px auto; padding:14px 16px; border-radius:16px;
  background:linear-gradient(135deg,rgba(255,100,0,0.15),rgba(200,60,0,0.2));
  border:1px solid rgba(255,140,0,0.4); max-width:320px; text-align:center;
}
.duel-vs-header { font-family:'Cinzel',serif; font-size:14px; color:rgba(255,220,160,0.7); margin-bottom:6px; }
.duel-vs-row { display:flex; align-items:center; justify-content:center; gap:12px; }
.duel-vs-player { display:flex; flex-direction:column; align-items:center; gap:2px; min-width:80px; }
.duel-vs-avatar { font-size:32px; }
.duel-vs-name { font-size:13px; font-weight:700; color:rgba(255,255,255,0.9); }
.duel-vs-score-val { font-size:20px; font-weight:900; color:#FFD700; font-family:'Cinzel',serif; }
.duel-vs-player.winner .duel-vs-name { color:#FFD700; }
.duel-vs-player.winner .duel-vs-score-val { color:#FFD700; text-shadow:0 0 10px rgba(255,200,0,0.5); }
.duel-vs-player.loser .duel-vs-score-val { color:rgba(255,255,255,0.5); }
.duel-vs-separator { font-size:20px; font-weight:900; color:rgba(255,140,0,0.7); }
.duel-verdict { font-family:'Cinzel',serif; font-size:16px; font-weight:900; margin-top:8px; }
.duel-verdict.won { color:#FFD700; }
.duel-verdict.lost { color:#ff6b6b; }
.duel-verdict.tie { color:#4FC3F7; }
/* ── Standardized Plugin Result Screen ── */
.plug-result {
  position:absolute; inset:0; z-index:10;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; overflow-y:auto;
  padding:env(safe-area-inset-top,0) 16px env(safe-area-inset-bottom,0);
  background:#050310;
  pointer-events:none; opacity:0; transition:opacity 0.5s;
}
.plug-result.visible { opacity:1; pointer-events:auto; }
.plug-result-avatar { font-size:clamp(48px,12vw,72px); }
.plug-result-bravo {
  font-size:clamp(20px,5vw,30px); font-weight:800; color:#fff;
  text-shadow:0 0 12px rgba(255,255,255,0.3); text-align:center;
}
.plug-result-rank {
  font-size:clamp(32px,9vw,52px); font-weight:900;
  font-family:Nunito,sans-serif; text-align:center;
}
.plug-result-stats {
  display:grid; grid-template-columns:1fr 1fr; gap:8px;
  width:100%; max-width:340px;
}
.plug-stat {
  display:flex; align-items:center; justify-content:space-between;
  background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.06);
  border-radius:14px; padding:10px 16px;
}
.plug-stat-lbl { font-size:clamp(12px,3vw,15px); color:rgba(255,255,255,0.7); font-weight:600; }
.plug-stat-val { font-size:clamp(16px,4vw,22px); font-weight:900; color:#fff; }
/* Duel VS result */
.plug-duel-vs {
  width:100%; max-width:340px; margin:4px 0 8px;
}
.plug-duel-verdict {
  text-align:center; font-size:clamp(18px,5vw,26px); font-weight:900;
  margin-bottom:10px; letter-spacing:0.5px;
}
.plug-duel-verdict.won { color:#ffd700; text-shadow:0 0 20px rgba(255,215,0,0.5); }
.plug-duel-verdict.lost { color:#ff5555; }
.plug-duel-verdict.draw { color:#aaa; }
.plug-duel-row {
  display:flex; align-items:center; justify-content:center; gap:12px;
}
.plug-duel-player {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:4px;
  padding:12px 8px; border-radius:16px;
  background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.06);
  transition:all 0.3s;
}
.plug-duel-player.winner {
  background:rgba(255,215,0,0.1); border-color:rgba(255,215,0,0.25);
  box-shadow:0 0 20px rgba(255,215,0,0.1);
}
.plug-duel-av { font-size:clamp(32px,8vw,48px); }
.plug-duel-name {
  font-size:clamp(12px,3vw,15px); font-weight:700; color:#fff;
  max-width:100px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.plug-duel-score {
  font-size:clamp(20px,5vw,28px); font-weight:900;
  color:#ffe44d; letter-spacing:0.5px;
}
.plug-duel-player.winner .plug-duel-score { color:#ffd700; }
.plug-duel-sep {
  font-size:clamp(14px,3.5vw,18px); font-weight:900; color:rgba(255,255,255,0.25);
  flex-shrink:0; padding:0 4px;
}

.plug-xp-wrap { width:60%; max-width:260px; }
.plug-xp-bar { height:6px; border-radius:3px; background:rgba(255,255,255,0.1); overflow:hidden; }
.plug-xp-fill { height:100%; border-radius:3px; background:linear-gradient(90deg,#ff6b00,#ffcc00); transition: width 1s ease-out 0.3s; }
.plug-xp-label { font-size:clamp(11px,2.8vw,14px); color:rgba(255,255,255,0.6); text-align:center; margin-top:4px; }
.plug-result-btns {
  display:flex; flex-direction:column; gap:10px;
  width:100%; max-width:320px; margin-top:4px;
}
.plug-result-row {
  display:flex; gap:10px; width:100%;
}
.plug-btn-flex { flex:1; min-width:0; }
.plug-btn {
  padding:14px; border:none; border-radius:16px;
  font-size:clamp(15px,3.8vw,19px); font-weight:800;
  font-family:Nunito,sans-serif; cursor:pointer;
  -webkit-tap-highlight-color:transparent; color:#fff;
}
.plug-btn:active { transform:scale(0.96); }
.plug-btn-primary { background:linear-gradient(135deg,#ff5500,#ff8800); box-shadow:0 4px 20px rgba(255,85,0,0.4); }
.plug-btn-challenge { background:linear-gradient(135deg,#22c55e,#16a34a); box-shadow:0 4px 16px rgba(34,197,94,0.3); }
.plug-btn-secondary { background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15); }
.plug-credits { font-size:11px; color:rgba(255,255,255,0.35); text-align:center; margin-top:8px; }

/* Challenge inbox */
.challenge-inbox { display:flex; flex-direction:column; gap:0; padding:0; }
.challenge-inbox-empty { text-align:center; color:rgba(255,255,255,0.4); padding:24px 0; font-size:14px; }
.challenge-date-sep {
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.5); padding:10px 4px 4px; margin-top:2px;
}
.challenge-row {
  display:flex; align-items:center; gap:8px; padding:8px 6px;
  border-bottom:1px solid rgba(255,255,255,0.06); min-height:52px;
  transition:background 0.12s;
}
.challenge-row:active { background:rgba(255,255,255,0.05); }
.challenge-row:last-child { border-bottom:none; }
.challenge-row-avatar { font-size:24px; flex-shrink:0; width:32px; text-align:center; }
.challenge-row-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.challenge-row-name { font-size:13px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.challenge-row-sub { font-size:11px; color:rgba(255,255,255,0.4); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.challenge-row-game { font-size:16px; flex-shrink:0; }
.challenge-row-result { font-size:16px; flex-shrink:0; width:24px; text-align:center; }
.challenge-row-scores {
  display:flex; flex-direction:column; align-items:flex-end; flex-shrink:0; gap:0;
}
.challenge-row-myscore { font-size:14px; font-weight:900; color:#FFD700; font-family:'Cinzel',serif; line-height:1.1; }
.challenge-row-oppscore { font-size:11px; color:rgba(255,255,255,0.35); line-height:1.1; }
.challenge-row-date { font-size:10px; color:rgba(255,255,255,0.25); flex-shrink:0; min-width:28px; text-align:right; }
.challenge-row.won .challenge-row-myscore { color:#2ecc71; }
.challenge-row.lost .challenge-row-myscore { color:#ff6b6b; }
.challenge-row.pending { background:rgba(255,200,0,0.06); }
.challenge-row.sent { opacity:0.7; }
.challenge-row.expired { opacity:0.35; }
.challenge-row-go {
  flex-shrink:0; padding:6px 14px; border:none; border-radius:10px;
  background:linear-gradient(135deg,#2ecc71,#27ae60); color:#fff;
  font-size:13px; font-weight:900; letter-spacing:1px; cursor:pointer;
  text-transform:uppercase; animation:goPulse 1.5s ease-in-out infinite;
}
.challenge-row-go:active { transform:scale(0.93); }
@keyframes goPulse { 0%,100%{ box-shadow:0 0 0 0 rgba(46,204,113,0.4); } 50%{ box-shadow:0 0 12px 3px rgba(46,204,113,0.3); } }
.challenge-row-wait { font-size:14px; flex-shrink:0; animation:waitPulse 2s ease-in-out infinite; }
@keyframes waitPulse { 0%,100%{ opacity:0.5; } 50%{ opacity:1; } }
/* Challenge button in result screens */
.challenge-result-btn {
  background:linear-gradient(135deg,#cc6600,#ff8800) !important;
  border:none !important; color:#fff !important;
}

/* ---- Activity Feed ---- */
.village-away-banner {
  background:rgba(255,180,60,0.08); border:1px solid rgba(255,180,60,0.15);
  border-radius:14px; padding:14px 16px; margin-bottom:8px;
}
.village-away-title {
  font-family:'Cinzel',serif; font-size:14px; font-weight:700; color:#ffd700;
  margin-bottom:8px;
}
.village-away-items { display:flex; flex-direction:column; gap:5px; }
.village-away-item { font-size:13px; color:rgba(255,255,255,0.85); padding-left:4px; }
.village-away-item-dim { color:rgba(255,255,255,0.4); font-size:12px; }
.village-away-time { font-size:11px; color:rgba(255,200,120,0.35); margin-top:6px; text-align:right; }
.feed-list { display:flex; flex-direction:column; gap:0; }
.feed-empty { text-align:center; color:rgba(255,255,255,0.35); padding:18px 0; font-size:13px; }
.feed-section-sep {
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.5); padding:14px 4px 6px; margin-top:4px;
  border-top:1px solid rgba(255,255,255,0.06);
}
.feed-item {
  display:flex; align-items:center; gap:8px; padding:8px 6px;
  border-bottom:1px solid rgba(255,255,255,0.05); min-height:44px;
  transition:background 0.12s; cursor:pointer;
}
.feed-item:active { background:rgba(255,255,255,0.04); }
.feed-item:last-child { border-bottom:none; }
.feed-item.unread { background:rgba(255,140,40,0.08); }
.feed-item-icon { font-size:18px; flex-shrink:0; width:28px; text-align:center; }
.feed-item-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.feed-item-text { font-size:13px; color:rgba(255,255,255,0.9); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.feed-item.unread .feed-item-text { font-weight:700; color:#fff; }
.feed-item-score { font-size:11px; color:rgba(255,200,100,0.5); }
.feed-item-time { font-size:10px; color:rgba(255,255,255,0.25); flex-shrink:0; min-width:28px; text-align:right; }
.feed-item-cta {
  flex-shrink:0; padding:4px 10px; border:none; border-radius:8px;
  background:linear-gradient(135deg,#cc6600,#ff8800); color:#fff;
  font-size:11px; font-weight:800; cursor:pointer; letter-spacing:0.5px;
}
.feed-item-cta:active { transform:scale(0.93); }

/* Game card badges */
.game-card-badge {
  position:absolute; top:-4px; right:-4px;
  min-width:16px; height:16px; border-radius:8px; padding:0 3px;
  background:linear-gradient(135deg,#cc3300,#ff4400);
  border:1.5px solid rgba(0,0,0,0.5);
  font-family:'Nunito',sans-serif; font-size:10px; font-weight:900;
  color:#fff; line-height:16px; text-align:center;
  pointer-events:none; animation:badgePulse 1.5s ease-in-out infinite;
}

/* Feed badge in dock */
.dock-badge#feedBadge { background:linear-gradient(135deg,#2d7a3a,#4caf50); }

/* While You Were Away modal — transparent overlay */
.while-away-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:transparent;
  display:flex; align-items:flex-start; justify-content:center;
  padding-top:max(12vh, env(safe-area-inset-top));
  animation:fadeIn 0.4s ease-out;
  pointer-events:none;
}
.while-away-card {
  background:rgba(10,4,18,0.75); backdrop-filter:blur(12px);
  border:1px solid rgba(255,180,60,0.15); border-radius:20px;
  padding:24px 20px 18px; max-width:300px; width:90%;
  text-align:center; display:flex; flex-direction:column; gap:12px;
  pointer-events:all;
  animation:slideDown 0.5s ease-out;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
.while-away-title { font-family:'Cinzel',serif; font-size:15px; font-weight:700; color:#ffd700; }
.while-away-subtitle { font-size:12px; color:rgba(255,220,160,0.5); margin-top:-6px; }
.while-away-items { display:flex; flex-direction:column; gap:7px; }
.while-away-item { font-size:14px; color:rgba(255,255,255,0.85); text-align:left; padding-left:8px; }
.while-away-item-dim { color:rgba(255,255,255,0.45); font-size:13px; }
.while-away-live { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; }
.while-away-live-stat { display:flex; flex-direction:column; align-items:center; gap:2px; }
.while-away-live-num { font-size:22px; font-weight:900; color:#ffd700; font-family:'Cinzel',serif; }
.while-away-live-label { font-size:11px; color:rgba(255,220,160,0.6); }
.while-away-btn {
  padding:10px 20px; border:none; border-radius:12px;
  background:linear-gradient(135deg,#2d7a3a,#4caf50); color:#fff;
  font-size:14px; font-weight:800; cursor:pointer; margin-top:4px;
}
.while-away-btn:active { transform:scale(0.95); }

/* ---- Metrics Dashboard ---- */
/* Observatory */
.obs-section { margin-bottom:16px; }
.obs-section-title { font-family:'Cinzel',serif; font-size:13px; font-weight:700; color:#ffd700; letter-spacing:1px; margin-bottom:8px; text-transform:uppercase; }
.obs-live-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.obs-live-card { text-align:center; background:rgba(255,180,80,0.06); border-radius:10px; padding:10px 4px; border:1px solid rgba(255,180,80,0.1); }
.obs-live-emoji { font-size:18px; margin-bottom:2px; }
.obs-live-value { font-size:22px; font-weight:800; color:#fff; line-height:1; }
.obs-live-label { font-size:10px; color:rgba(255,220,160,0.5); margin-top:2px; }
.obs-row { display:flex; justify-content:space-between; align-items:center; padding:4px 0; font-size:13px; }
.obs-label { color:rgba(255,220,160,0.7); }
.obs-value { color:#fff; font-weight:700; font-size:14px; }
.obs-personal { font-weight:400; font-size:11px; color:rgba(255,200,120,0.5); }
.obs-delta { font-size:11px; font-weight:700; margin-left:4px; }
.obs-note { font-size:10px; color:rgba(255,200,120,0.3); text-align:center; font-style:italic; padding-top:8px; border-top:1px solid rgba(255,255,255,0.05); }
.metrics-bars { display:flex; flex-direction:column; gap:6px; margin:4px 0; }
.metrics-bar-row { display:flex; align-items:center; gap:8px; font-size:13px; }
.metrics-bar-emoji { min-width:52px; text-align:left; white-space:nowrap; font-size:12px; font-weight:700; font-family:'Nunito',sans-serif; }
.metrics-bar-track { flex:1; height:10px; background:rgba(255,255,255,0.06); border-radius:5px; overflow:hidden; }
.metrics-bar-fill { height:100%; background:linear-gradient(90deg,#ff8c00,#ffd700); border-radius:5px; transition:width 0.3s; }
.metrics-bar-num { min-width:24px; text-align:right; color:rgba(255,255,255,0.5); font-size:12px; font-weight:700; }
.metrics-sparkline { margin:8px 0; }
.metrics-sparkline svg { width:100%; height:60px; display:block; }
.metrics-sparkline-labels { display:flex; justify-content:space-between; font-size:10px; color:rgba(255,200,120,0.4); margin-top:2px; }
.metrics-founder { border-top:1px solid rgba(255,180,80,0.15); padding-top:12px; margin-top:4px; }
.metrics-founder-ok { color:#2ecc71; }
.metrics-founder-btn { width:100%; padding:10px; font-size:13px; font-weight:700; border:1px solid rgba(255,180,80,0.3); border-radius:10px; background:rgba(255,180,80,0.08); color:#ffd700; cursor:pointer; margin-top:8px; -webkit-tap-highlight-color:transparent; }
.metrics-founder-btn:active { background:rgba(255,180,80,0.15); transform:scale(0.97); }

.top-points {
  display:flex; align-items:center; gap:3px;
  background:rgba(0,0,0,0.4); border:1px solid var(--border);
  border-radius:14px; padding:4px 10px; font-size:14px;
  font-family:'Nunito',sans-serif; font-weight:700;
  color:#ffcc00; backdrop-filter:blur(10px);
}
.top-points-icon { font-size:16px; }
/* Terminal toggle inherits mp-ctrl-btn styles when inside top-mp-controls */

/* MIC PANEL */
/* CANVASES */
#fireCanvas {
  position:fixed;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 60px);
  left:50%; transform:translateX(-50%);
  z-index:var(--z-fire-canvas); pointer-events:none;
  transition:transform 0.6s ease, left 0.6s ease, box-shadow 0.3s ease;
  width:min(400px, 95vw);
  height:min(625px, calc(100dvh - 200px));
  max-height:min(625px, calc(100vh - 200px));
  image-rendering:pixelated; will-change:transform;
  /* Soft edges — top + sides fade, bottom stays crisp (hearth is below) */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 100%),
                      linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-composite: destination-in;
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 100%),
              linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  mask-composite: intersect;
}
#particleCanvas { position:fixed; inset:0; z-index:var(--z-particle-canvas); pointer-events:none; will-change:transform; }

/* ============================================================
   FAMILY EMOJI RING — floating emojis around fire
   ============================================================ */
.family-emoji-ring {
  position:fixed;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 60px);
  left:50%; transform:translateX(-50%);
  width:min(280px, 75vw); height:min(280px, 75vw);
  z-index:var(--z-emoji-ring); pointer-events:none;
}
.family-emoji-ring.hidden { display:none; }
.family-emoji { pointer-events:auto; cursor:pointer; }
.family-emoji {
  position:absolute;
  font-size:32px;
  /* Fixed position on circle, set via --pos-x / --pos-y */
  left:var(--pos-x, 50%); top:var(--pos-y, 50%);
  transform:translate(-50%,-50%);
  animation: familyFloat 3s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  transition: filter 0.5s, opacity 0.5s;
  filter: drop-shadow(0 0 6px rgba(255,200,100,0.6));
  display:flex; flex-direction:column; align-items:center; gap:2px;
}
.family-emoji.connected {
  opacity:1;
  filter: drop-shadow(0 0 10px rgba(255,180,50,1)) drop-shadow(0 0 20px rgba(255,120,0,0.6));
}
.family-emoji.offline {
  opacity:0.35;
  filter: grayscale(100%) brightness(0.5);
}
.family-emoji.pending {
  opacity:0.7;
  filter: drop-shadow(0 0 8px rgba(255,215,0,0.8));
  animation: pendingPulse 1.5s ease-in-out infinite;
}
@keyframes pendingPulse {
  0%,100% { opacity:0.5; filter: drop-shadow(0 0 6px rgba(255,215,0,0.5)); }
  50% { opacity:0.9; filter: drop-shadow(0 0 16px rgba(255,215,0,1)); }
}
.family-emoji.leaving {
  opacity:0;
  transition: opacity 0.6s;
}
.family-emoji-me {
  pointer-events:none; cursor:default;
  border:2px solid rgba(100,200,255,0.5);
  border-radius:50%;
  padding:2px;
  filter: drop-shadow(0 0 8px rgba(100,200,255,0.6)) drop-shadow(0 0 16px rgba(100,200,255,0.3));
}
.family-emoji-name {
  font-family:'Nunito',sans-serif; font-size:11px; font-weight:700;
  color:#fff; background:rgba(0,0,0,0.5); backdrop-filter:blur(6px);
  padding:1px 6px; border-radius:8px; white-space:nowrap;
  max-width:60px; overflow:hidden; text-overflow:ellipsis;
  line-height:1.3;
}
@keyframes familyFloat {
  0%,100% { transform:translate(-50%,-50%) translateY(0); }
  50% { transform:translate(-50%,-50%) translateY(-6px); }
}

/* ── Friend Wall (scrollable grid between horizon and fire) ── */
.friend-wall {
  display:none; /* Removed from sky — friends accessible via dock chat/tribu */
  position:fixed;
  top:45%; transform:translateY(-50%);
  left:0; right:max(90px, calc(env(safe-area-inset-right, 0px) + 90px));
  height:auto; max-height:clamp(100px, 20vh, 180px);
  z-index:var(--z-emoji-ring, 10);
  pointer-events:none;
  overflow:hidden;
  display:flex; align-items:center;
}
.friend-wall-scroll {
  display:flex;
  flex-wrap:wrap;
  gap:4px 6px;
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  width:100%; padding:4px 12px;
  box-sizing:border-box;
  pointer-events:auto;
  touch-action:pan-x;
  overscroll-behavior-x:contain;
  scrollbar-width:none;
  justify-content:center;
  mask-image:linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
  -webkit-mask-image:linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}
.friend-wall-scroll::-webkit-scrollbar { display:none; }
.friend-wall-scroll::after { content:''; min-width:16px; grid-row:1 / -1; }

.fw-cell {
  display:flex; flex-direction:column; align-items:center; gap:1px;
  min-width:52px; max-width:60px; padding:4px 2px 3px;
  border-radius:10px;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  pointer-events:auto;
  scroll-snap-align:start;
  transition:transform 0.12s, background 0.15s;
  position:relative;
}
.fw-cell:active { transform:scale(0.88); }
.fw-cell.online { background:rgba(255,200,100,0.06); }
.fw-cell.offline { opacity:0.35; }

/* Avatar emoji */
.fw-avatar { font-size:28px; line-height:1; position:relative; }

/* Online dot */
.fw-dot {
  position:absolute; bottom:-1px; right:-3px;
  width:8px; height:8px; border-radius:50%;
  border:1.5px solid rgba(10,5,20,0.9);
}
.fw-dot.on { background:#4cff88; box-shadow:0 0 6px rgba(76,255,136,0.6); animation:fwDotPulse 2s ease-in-out infinite; }
.fw-dot.off { background:#555; }
.fw-medal {
  position:absolute; bottom:-2px; right:-4px;
  font-size:12px; line-height:1;
  text-shadow:0 1px 3px rgba(0,0,0,0.6);
  pointer-events:none;
}
.fw-avatar { position:relative; }
@keyframes fwDotPulse {
  0%,100% { box-shadow:0 0 4px rgba(76,255,136,0.4); }
  50% { box-shadow:0 0 10px rgba(76,255,136,0.8); }
}

/* Name truncated */
.fw-name {
  font-family:'Nunito',sans-serif; font-size:10px; font-weight:700;
  color:rgba(255,220,160,0.85); text-align:center;
  max-width:58px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  line-height:1.2;
}
.fw-cell.offline .fw-name { color:rgba(255,220,160,0.4); }

/* Empty state */
.fw-empty {
  grid-row:1 / -1; display:flex; align-items:center; justify-content:center;
  padding:16px 24px; font-size:13px; color:rgba(255,200,100,0.4);
  font-family:'Nunito',sans-serif; white-space:nowrap;
}

/* ── Friend Wall — invite button (no friends) ── */
.fw-invite-btn {
  border:1.5px dashed rgba(255,200,100,0.35); background:rgba(255,200,100,0.06);
  border-radius:14px; padding:14px 24px;
  font-size:15px; font-weight:700; color:rgba(255,220,160,0.9);
  font-family:'Nunito',sans-serif;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  pointer-events:auto;
  animation:fwInvitePulse 2.5s ease-in-out infinite;
  transition:transform 0.12s;
  margin:auto;
}
.fw-invite-btn:active { transform:scale(0.92); }
@keyframes fwInvitePulse {
  0%,100% { border-color:rgba(255,200,100,0.25); box-shadow:none; }
  50% { border-color:rgba(255,200,100,0.5); box-shadow:0 0 16px rgba(255,160,0,0.15); }
}

/* ── Friend Wall — Mini-fiche popover ── */
.fw-fiche {
  position:fixed; z-index:var(--z-modal-base, 300);
  background:rgba(12,6,24,0.96); backdrop-filter:blur(20px);
  border:1px solid rgba(255,200,100,0.2); border-radius:18px;
  padding:16px 18px; min-width:220px; max-width:280px;
  box-shadow:0 8px 40px rgba(0,0,0,0.7);
  animation:fwFicheIn 0.2s ease-out;
  display:flex; flex-direction:column; gap:8px;
  pointer-events:auto;
}
@keyframes fwFicheIn {
  from { opacity:0; transform:translateY(10px) scale(0.95); }
  to { opacity:1; transform:translateY(0) scale(1); }
}

/* Fiche header */
.fw-fiche-header {
  display:flex; align-items:center; gap:10px;
}
.fw-fiche-avatar { font-size:42px; line-height:1; }
.fw-fiche-info { flex:1; min-width:0; }
.fw-fiche-name {
  font-size:16px; font-weight:800; color:rgba(255,220,160,0.95);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.fw-fiche-code {
  font-size:13px; letter-spacing:1px; color:rgba(255,200,100,0.5);
}
.fw-fiche-status {
  font-size:11px; font-weight:600; display:flex; align-items:center; gap:5px;
}
.fw-fiche-status.on { color:#4cff88; }
.fw-fiche-status.off { color:rgba(255,255,255,0.35); }
.fw-fiche-dot {
  display:inline-block; width:8px; height:8px; border-radius:50%; flex-shrink:0;
}
.fw-fiche-dot.on {
  background:#4cff88; box-shadow:0 0 6px rgba(76,255,136,0.7);
}
.fw-fiche-dot.off {
  background:rgba(255,255,255,0.3);
}

/* Fiche detail rows */
.fw-fiche-sep {
  border:none; border-top:1px solid rgba(255,200,100,0.1); margin:2px 0;
}
.fw-fiche-row {
  display:flex; align-items:center; gap:6px;
  font-size:12px; color:rgba(255,220,160,0.7);
}
.fw-fiche-row .emoji { font-size:14px; flex-shrink:0; }
.fw-fiche-level-bar {
  flex:1; height:6px; background:rgba(255,255,255,0.08); border-radius:3px; overflow:hidden;
}
.fw-fiche-level-fill {
  height:100%; border-radius:3px;
  background:linear-gradient(90deg, #ff8c00, #ffd700);
}

/* Fiche action buttons */
.fw-fiche-actions {
  display:flex; gap:6px; justify-content:center; flex-wrap:wrap;
}
.fw-fiche-btn {
  flex:1; min-width:60px; max-width:90px;
  border:1px solid rgba(255,200,100,0.2); background:rgba(255,200,100,0.06);
  border-radius:10px; padding:8px 4px;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:background 0.15s, transform 0.1s;
}
.fw-fiche-btn:active { transform:scale(0.9); background:rgba(255,200,100,0.15); }
.fw-fiche-btn .btn-icon { font-size:20px; line-height:1; }
.fw-fiche-btn .btn-label {
  font-size:11px; font-weight:700; color:rgba(255,220,160,0.7);
  font-family:'Nunito',sans-serif; white-space:nowrap;
}

/* ── Friend Wall — Fiche inline emoji picker ── */
.fw-fiche-emoji-picker {
  display:flex; flex-wrap:wrap; gap:6px; justify-content:center;
  padding:4px 0;
  animation:fwFicheIn 0.15s ease-out;
}
.fw-fiche-emoji-btn {
  border:none; background:rgba(255,255,255,0.06); border-radius:10px;
  font-size:24px; padding:6px 8px; cursor:pointer;
  transition:transform 0.1s, background 0.15s;
  -webkit-tap-highlight-color:transparent;
}
.fw-fiche-emoji-btn:active { background:rgba(255,200,100,0.2); }

/* Friend invite popup (tap offline emoji) */
.friend-invite-popup {
  position:fixed; z-index:var(--z-overlay);
  background:rgba(12,6,24,0.95); backdrop-filter:blur(16px);
  border:1px solid rgba(255,200,100,0.25); border-radius:16px;
  padding:14px 18px; min-width:200px;
  display:flex; flex-direction:column; align-items:center; gap:10px;
  transform:translate(-50%,-100%) translateY(-12px);
  animation:popupFadeIn 0.25s ease-out;
  box-shadow:0 4px 24px rgba(0,0,0,0.5), 0 0 20px rgba(255,160,60,0.1);
}
@keyframes popupFadeIn {
  0% { opacity:0; transform:translate(-50%,-100%) translateY(-4px) scale(0.9); }
  100% { opacity:1; transform:translate(-50%,-100%) translateY(-12px) scale(1); }
}
.friend-invite-popup::after {
  content:''; position:absolute; bottom:-6px; left:50%; transform:translateX(-50%) rotate(45deg);
  width:12px; height:12px; background:rgba(12,6,24,0.95);
  border-right:1px solid rgba(255,200,100,0.25);
  border-bottom:1px solid rgba(255,200,100,0.25);
}
.friend-invite-popup .invite-avatar { font-size:32px; }
.friend-invite-popup .invite-name {
  font-family:'Nunito',sans-serif; font-size:15px; font-weight:800;
  color:rgba(255,255,255,0.9); text-align:center;
}
.friend-invite-popup .invite-status {
  font-size:12px; color:rgba(255,255,255,0.4);
}
.friend-invite-popup .invite-wa-btn {
  display:flex; align-items:center; gap:8px;
  background:#25D366; color:#fff; border:none; border-radius:12px;
  padding:10px 18px; font-family:'Nunito',sans-serif;
  font-size:14px; font-weight:700; cursor:pointer;
  transition:all 0.15s; -webkit-tap-highlight-color:transparent;
}
.friend-invite-popup .invite-wa-btn:active { background:#1da851; transform:scale(0.95); }
.friend-invite-popup .invite-wa-btn svg { width:18px; height:18px; fill:#fff; }
/* Emoji reaction bar */
.friend-invite-popup .invite-react-label {
  font-size:11px; color:rgba(255,200,120,0.5); font-weight:800;
  letter-spacing:1px; text-transform:uppercase; align-self:flex-start;
}
.friend-invite-popup .invite-react-bar {
  display:flex; gap:6px; flex-wrap:wrap; justify-content:center;
}
.friend-invite-popup .invite-react-emoji {
  font-size:26px; width:44px; height:44px; border:none; border-radius:12px;
  background:rgba(255,255,255,0.08); cursor:pointer; display:flex;
  align-items:center; justify-content:center; transition:transform 0.15s;
  -webkit-tap-highlight-color:transparent;
}
.friend-invite-popup .invite-react-emoji:active { transform:scale(1.3) !important; }
.friend-invite-popup .invite-react-kb {
  font-size:20px; color:rgba(255,255,255,0.5); background:rgba(255,255,255,0.05);
  border:1px dashed rgba(255,255,255,0.15);
}

/* Fire Surge — friend joins animation */
.fire-surge-flash {
  position:fixed; inset:0; z-index:var(--z-screen); pointer-events:none;
  background:radial-gradient(ellipse at 50% 85%, rgba(255,200,50,0.4) 0%, rgba(255,150,0,0.15) 40%, transparent 70%);
  opacity:0; transition:opacity 0.3s ease-out;
}
.fire-surge-flash.active { opacity:1; }
.fire-surge-emoji {
  position:fixed;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 94px);
  left:50%; z-index:var(--z-ignis);
  font-size:48px; pointer-events:none;
  transform:translateX(-50%) translateY(0) scale(0.3);
  opacity:0;
  transition:all 1.8s cubic-bezier(0.23, 1, 0.32, 1);
  filter:drop-shadow(0 0 16px rgba(255,200,50,1)) drop-shadow(0 0 40px rgba(255,150,0,0.8));
}
.fire-surge-emoji.rise {
  transform:translateX(-50%) translateY(-180px) scale(1.2);
  opacity:1;
}
.fire-surge-emoji.fade {
  opacity:0; transition:opacity 0.6s ease-out;
}
@keyframes sparkFall {
  0%   { top:-60px; opacity:1; transform:translateX(-50%) scale(1.5); }
  70%  { top:50%; opacity:1; transform:translateX(-50%) scale(1); }
  85%  { top:50%; opacity:1; transform:translateX(-50%) scale(1.8); filter: drop-shadow(0 0 30px rgba(255,215,0,1)); }
  100% { top:50%; opacity:0; transform:translateX(-50%) scale(0.3); }
}

/* ============================================================
   SPARKLE RAIN — dopamine rush overlay + floating text
   ============================================================ */
.sparkle-flash {
  position:fixed; inset:0; z-index:var(--z-screen); pointer-events:none;
  background: radial-gradient(ellipse at 50% 80%, rgba(255,200,50,0.25) 0%, rgba(255,150,0,0.08) 40%, transparent 70%);
  opacity:0; transition: opacity 0.3s ease-out;
}
.sparkle-flash.active { opacity:1; }

.sparkle-congrats {
  position:fixed; z-index:var(--z-reaction); pointer-events:none;
  left:50%; top:28%;
  transform:translateX(-50%) scale(0);
  font-family:'Nunito',sans-serif; font-weight:900; font-size:36px;
  color:#fff; white-space:nowrap;
  text-shadow: 0 0 24px rgba(255,200,0,0.9), 0 0 48px rgba(255,150,0,0.5), 0 3px 6px rgba(0,0,0,0.6);
  opacity:0; transition: transform 0.5s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.3s;
}
.sparkle-congrats.pop { opacity:1; transform:translateX(-50%) scale(1); }
.sparkle-congrats.fade { opacity:0; transition: opacity 0.5s; }
.sparkle-congrats-epic  { font-size:44px; color:#ffd700; }
.sparkle-congrats-great { font-size:40px; }

.sparkle-points-text {
  position:fixed; z-index:var(--z-bubble); pointer-events:none;
  left:50%; top:36%;
  transform:translateX(-50%) translateY(0) scale(0.5);
  font-family:'Nunito',sans-serif; font-weight:900; font-size:42px;
  color:#fff; text-shadow: 0 0 20px rgba(255,200,0,0.9), 0 0 40px rgba(255,150,0,0.6), 0 2px 4px rgba(0,0,0,0.5);
  opacity:0; transition: all 1.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sparkle-points-text.rise {
  opacity:1; transform:translateX(-50%) translateY(-30px) scale(1.15);
}

/* IGNIS CARD (carousel) — quote is the hero, buttons are secondary */
.ignis-quote-card .tip-card-thumb {
  background:linear-gradient(135deg, rgba(255,120,0,0.2), rgba(255,60,0,0.15));
  border:1px solid rgba(255,150,50,0.25);
}
.ignis-quote-text {
  font-size:17px; font-weight:700; line-height:1.5;
  color:rgba(255,230,180,0.95);
  text-shadow:0 1px 8px rgba(255,140,0,0.25);
  padding:6px 0 2px;
}
.ignis-card-actions {
  display:flex; gap:10px; width:100%; justify-content:center; margin-top:6px;
}
.ignis-send-btn, .ignis-next-btn {
  background:transparent !important;
  border:none !important;
  font-size:13px !important; font-weight:600 !important;
  padding:8px 14px !important;
  color:rgba(255,255,255,0.5) !important;
  letter-spacing:0.3px;
}
.ignis-send-btn:active, .ignis-next-btn:active {
  color:rgba(255,255,255,0.8) !important;
}
@keyframes ignisPulse { 0%{transform:scale(1)} 50%{transform:scale(1.02)} 100%{transform:scale(1)} }
.ignis-pulse { animation:ignisPulse 0.3s ease-out; }

/* =====================
   SCENE CAROUSELS (messages + tips, above fire)
   ===================== */
.scene-carousel-zone {
  position:fixed;
  left:50%; transform:translateX(-50%);
  top:calc(max(110px, env(safe-area-inset-top, 0px) + 100px));
  z-index:var(--z-game-ui, 100);
  width:min(90vw, 380px);
  display:flex; flex-direction:column; gap:8px;
  pointer-events:none;
}
.scene-carousel {
  position:relative;
  overflow:hidden;
  border-radius:16px;
  background:rgba(10,5,20,0.7);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  border:1px solid rgba(255,180,80,0.15);
  pointer-events:all;
  contain:layout style paint;
  will-change:transform;
}
.scene-carousel-track {
  display:flex;
  transition:transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
  touch-action:pan-y;
}
.scene-carousel-track > * {
  min-width:100%; box-sizing:border-box;
}
.scene-carousel-dots {
  display:flex; justify-content:center; gap:5px;
  padding:6px 0;
}
.scene-carousel-dot {
  width:6px; height:6px; border-radius:50%;
  background:rgba(255,255,255,0.3);
  transition:background 0.2s, transform 0.2s;
}
.scene-carousel-dot.active {
  background:rgba(255,220,150,0.9);
  transform:scale(1.3);
}

/* Message card */
.msg-card {
  display:flex; align-items:center; gap:10px;
  padding:10px 14px;
  cursor:pointer;
}
.msg-card-avatar { font-size:28px; flex-shrink:0; }
.msg-card-body { flex:1; min-width:0; }
.msg-card-name { font-family:'Nunito',sans-serif; font-size:13px; font-weight:700; color:rgba(255,220,160,0.95); }
.msg-card-preview { font-size:12px; color:rgba(255,255,255,0.6); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.msg-card-time { font-size:11px; color:rgba(255,255,255,0.35); flex-shrink:0; }

/* =====================
   ANNOUNCE ZONE (bottom, just above fire)
   ===================== */
.announce-zone {
  position:fixed;
  left:max(10px, env(safe-area-inset-left, 0px));
  right:max(90px, calc(env(safe-area-inset-right, 0px) + 90px)); /* leave room for scene-rail icons */
  bottom:calc(max(160px, env(safe-area-inset-bottom, 0px) + 160px));
  z-index:var(--z-game-ui, 100);
  pointer-events:none;
  display:flex; flex-direction:column; align-items:center; gap:0;
  transition:opacity 0.4s ease-out, transform 0.4s ease-out;
}
.announce-zone.announce-clearing {
  opacity:0; transform:scale(0.92) translateY(12px);
  pointer-events:none;
}
.announce-carousel {
  position:relative;
  overflow:hidden;
  border-radius:20px;
  background:rgba(8,4,18,0.75);
  backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  border:1px solid rgba(255,180,80,0.12);
  pointer-events:all;
  contain:layout style paint;
  will-change:transform;
  width:100%;
}
.announce-track {
  display:flex;
  transition:transform 0.35s cubic-bezier(0.25,0.46,0.45,0.94);
  touch-action:pan-y;
}
.announce-track > * { min-width:100%; box-sizing:border-box; }
/* Dots OUTSIDE the card */
.announce-dots {
  display:flex; justify-content:center; gap:6px;
  padding:8px 0 0;
  pointer-events:all;
}
.announce-dots .scene-carousel-dot { width:7px; height:7px; }
.announce-dismiss-all {
  position:absolute; top:8px; right:8px;
  background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15);
  color:rgba(255,255,255,0.5); font-size:16px;
  width:32px; height:32px; border-radius:50%;
  cursor:pointer; pointer-events:all; z-index:5;
  display:flex; align-items:center; justify-content:center;
  transition:background 0.15s, color 0.15s;
}
.announce-dismiss-all:active { background:rgba(255,255,255,0.2); color:#fff; }

/* Announce card — vertical layout, big CTA */
.tip-card {
  display:flex; flex-direction:column; align-items:center; gap:8px;
  padding:16px 20px 14px;
  text-align:center;
  cursor:pointer;
}
.tip-card-thumb {
  width:56px; height:56px; border-radius:14px;
  background:rgba(255,140,40,0.12);
  display:flex; align-items:center; justify-content:center;
  font-size:32px; flex-shrink:0;
  overflow:hidden;
}
.tip-card-thumb img { width:100%; height:100%; object-fit:cover; border-radius:14px; }
.tip-card-body { width:100%; }
.tip-card-title {
  font-family:'Nunito',sans-serif; font-size:15px; font-weight:800;
  color:rgba(255,220,150,0.95); margin-bottom:2px;
}
.tip-card-desc { font-size:13px; color:rgba(255,255,255,0.55); line-height:1.3; }
.tip-card-cta {
  font-family:'Nunito',sans-serif; font-size:15px; font-weight:800;
  color:#fff; background:linear-gradient(135deg, #ff8c00, #ff5500);
  border:none; border-radius:14px;
  padding:10px 0; width:100%; cursor:pointer;
  margin-top:6px;
  box-shadow:0 4px 16px rgba(255,100,0,0.35);
  transition:transform 0.15s, box-shadow 0.15s;
  letter-spacing:0.5px;
}
.tip-card-cta:active { transform:scale(0.96); box-shadow:0 2px 8px rgba(255,100,0,0.2); }
.tip-card { position:relative; }
/* Custom CTA color via inline style */
.tip-card-cta[style*="background"] { box-shadow:0 4px 16px rgba(0,0,0,0.3); }

/* MAILBOX button (under Ignis) */
.mailbox-btn {
  position:fixed;
  top:max(168px, calc(env(safe-area-inset-top, 0px) + 148px));
  right:max(22px, env(safe-area-inset-right, 22px));
  z-index:var(--z-fire-tag);
  width:40px; height:40px; border-radius:50%;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12);
  font-size:20px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  animation:ignisFloat 3s ease-in-out infinite;
  backdrop-filter:blur(6px);
}
.mailbox-btn:active { transform:scale(0.88); }
.mailbox-badge {
  position:absolute; top:-2px; right:-2px;
  width:14px; height:14px; border-radius:50%;
  background:#ff6b00; font-size:8px; font-weight:900;
  color:#fff; display:flex; align-items:center; justify-content:center;
}

/* DIAGNOSTIC PANEL */
.mp-diag-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay); background:rgba(0,0,0,0.7);
  display:none; align-items:flex-end; justify-content:center;
  backdrop-filter:blur(4px);
}
.mp-diag-overlay.visible { display:flex; }
.mp-diag-panel {
  background:linear-gradient(180deg, #1a1008 0%, #0d0804 100%);
  border:1px solid rgba(255,150,50,0.3); border-radius:20px 20px 0 0;
  width:100%; max-width:420px; max-height:75vh; overflow-y:auto;
  padding:20px 18px max(30px, env(safe-area-inset-bottom, 30px)); font-family:'Nunito',sans-serif;
  -webkit-overflow-scrolling:touch;
}
.mp-diag-header {
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:14px;
}
.mp-diag-title { font-size:16px; font-weight:800; color:#ffc864; }
.mp-diag-close {
  background:none; border:none; color:rgba(255,200,120,0.5);
  font-size:22px; cursor:pointer; padding:4px;
}
.mp-diag-section { margin-bottom:14px; }
.mp-diag-section-title {
  font-size:11px; font-weight:700; color:rgba(255,200,120,0.5);
  text-transform:uppercase; letter-spacing:1px; margin-bottom:6px;
}
.mp-diag-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:5px 0; font-size:13px; color:rgba(255,255,255,0.7);
  border-bottom:1px solid rgba(255,255,255,0.05);
}
.mp-diag-row:last-child { border-bottom:none; }
.mp-diag-val { font-weight:700; color:#fff; }
.mp-diag-val.good { color:#4cff88; }
.mp-diag-val.warn { color:#ffc107; }
.mp-diag-val.bad { color:#ff4444; }
.mp-diag-friend {
  background:rgba(255,255,255,0.04); border-radius:10px;
  padding:8px 10px; margin-bottom:6px;
}
.mp-diag-friend-header {
  display:flex; align-items:center; gap:8px; margin-bottom:4px;
  font-size:13px; font-weight:700; color:rgba(255,200,120,0.9);
}
/* MP controls — inline in top-bar */
.top-mp-controls {
  display:flex; gap:6px; align-items:center; margin-left:auto;
}
/* Voice + broadcast buttons always visible — dimmed when no friends online */
.top-mp-controls .voice-badge,
.top-mp-controls #btnMpBroadcast { display:flex; opacity:0.3; transition:opacity 0.3s; }
.top-mp-controls .mp-signal { display:none; }
.top-mp-controls.visible .voice-badge,
.top-mp-controls.visible #btnMpBroadcast { opacity:1; }
.top-mp-controls.visible .mp-signal { display:flex; }
.mp-ctrl-btn {
  width:44px; height:44px; border-radius:50%;
  border:1.5px solid rgba(255,200,100,0.45);
  background:rgba(30,25,50,0.7); backdrop-filter:blur(10px);
  box-shadow:0 0 8px rgba(255,180,80,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
  font-size:22px; cursor:pointer; -webkit-tap-highlight-color:transparent;
  display:flex; align-items:center; justify-content:center;
  transition:background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.mp-ctrl-btn:active { transform:scale(0.9); }
.mp-ctrl-btn.active {
  background:rgba(255,100,0,0.25); border-color:rgba(255,150,50,0.6);
}
.mp-ctrl-btn.muted {
  background:rgba(255,50,50,0.2); border-color:rgba(255,80,80,0.5);
}
.mp-ctrl-btn.live {
  background:rgba(0,200,100,0.2); border-color:rgba(0,255,120,0.5);
  animation:mpLivePulse 2s ease-in-out infinite;
}
@keyframes mpLivePulse {
  0%,100% { box-shadow:0 0 8px rgba(0,255,120,0.2); }
  50% { box-shadow:0 0 20px rgba(0,255,120,0.5); }
}

/* VOICE BADGE (compact, above satellite) */
.voice-badge {
  position:relative; display:flex; align-items:center; justify-content:center;
}
.voice-badge-count {
  position:absolute; top:-4px; right:-6px; min-width:16px; height:16px;
  border-radius:8px; background:#4cff88; color:#000;
  font-size:10px; font-weight:900; font-family:'Nunito',sans-serif;
  display:none; align-items:center; justify-content:center;
  padding:0 4px; line-height:1; pointer-events:none;
  box-shadow:0 0 6px rgba(76,255,136,0.5);
}
.voice-badge-count.visible { display:flex; }
.voice-badge .mp-ctrl-btn.in-room {
  background:rgba(0,200,100,0.2); border-color:rgba(0,255,120,0.5);
  animation:voiceBadgePulse 3s ease-in-out infinite;
}
.voice-badge .mp-ctrl-btn.muted {
  background:rgba(255,50,50,0.2); border-color:rgba(255,80,80,0.5);
}
.voice-badge .mp-ctrl-btn.suspended {
  background:rgba(255,180,0,0.15); border-color:rgba(255,200,50,0.4);
  animation:voiceBadgePulse 3s ease-in-out infinite;
}
.voice-badge .mp-ctrl-btn.available {
  background:rgba(100,180,255,0.15); border-color:rgba(120,200,255,0.4);
  animation:voiceBadgePulse 3s ease-in-out infinite;
}
@keyframes voiceBadgePulse {
  0%,100% { box-shadow:0 0 6px rgba(0,255,120,0.15); }
  50% { box-shadow:0 0 14px rgba(0,255,120,0.4); }
}

/* VOICE DROPDOWN (opens from badge) */
.voice-dropdown {
  position:fixed; z-index:var(--z-stream-controls); display:none;
  min-width:200px; max-width:260px;
  background:rgba(10,6,8,0.92); backdrop-filter:blur(16px);
  border:1px solid rgba(255,200,100,0.3); border-radius:16px;
  padding:10px 0; font-family:'Nunito',sans-serif; color:#fff;
  box-shadow:0 8px 32px rgba(0,0,0,0.6);
  animation:voiceDdIn 0.2s ease-out;
}
.voice-dropdown.visible { display:block; }
@keyframes voiceDdIn {
  from { opacity:0; transform:translateY(-8px) scale(0.95); }
  to { opacity:1; transform:translateY(0) scale(1); }
}
.voice-dd-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:2px 14px 8px; cursor:pointer;
  border-bottom:1px solid rgba(255,255,255,0.08);
  -webkit-tap-highlight-color:transparent;
}
.voice-dd-room-name {
  font-size:14px; font-weight:800; max-width:180px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.voice-dd-chevron {
  font-size:10px; color:rgba(255,200,100,0.5); transition:transform 0.2s;
}
.voice-dd-header.picker-open .voice-dd-chevron { transform:rotate(180deg); }
.voice-dd-picker {
  display:none; padding:4px 6px;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.voice-dd-picker.visible { display:block; }
.voice-dd-picker-item {
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:10px; cursor:pointer;
  font-size:13px; font-weight:600; color:#fff;
  transition:background 0.15s; -webkit-tap-highlight-color:transparent;
}
.voice-dd-picker-item:active { background:rgba(255,200,100,0.2); }
.voice-dd-picker-item.current { color:rgba(255,200,100,0.9); }
.voice-dd-members {
  padding:6px 14px; max-height:180px; overflow-y:auto;
}
.voice-dd-member {
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 0; font-size:13px; font-weight:600;
}
.voice-dd-member + .voice-dd-member {
  border-top:1px solid rgba(255,255,255,0.05);
}
.voice-dd-member-name { display:flex; align-items:center; gap:6px; }
.voice-dd-member-actions { display:flex; align-items:center; gap:4px; font-size:14px; }
.voice-dd-kick { background:none; border:none; cursor:pointer; font-size:14px; padding:2px 4px; border-radius:6px; -webkit-tap-highlight-color:transparent; opacity:0.5; transition:opacity 0.2s; }
.voice-dd-kick:hover, .voice-dd-kick:active { opacity:1; background:rgba(255,80,80,0.15); }
.voice-dd-member.speaking .voice-dd-member-name {
  color:#4cff88;
}
.voice-dd-actions {
  display:flex; justify-content:center; gap:12px;
  padding:8px 14px 2px;
  border-top:1px solid rgba(255,255,255,0.08);
}
.voice-dd-btn {
  width:44px; height:44px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.1); font-size:18px;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  -webkit-tap-highlight-color:transparent; transition:background 0.2s;
}
.voice-dd-btn:active { transform:scale(0.9); }
.voice-dd-btn.muted { background:rgba(255,50,50,0.3); }
.voice-dd-leave { background:rgba(255,50,50,0.2); }
.voice-dd-leave:active { background:rgba(255,50,50,0.4); }

/* HOST INDICATOR on family emoji */
.family-emoji .voice-host-dot {
  position:absolute; bottom:-2px; right:-2px;
  width:10px; height:10px; border-radius:50%;
  background:#4cff88; border:2px solid rgba(0,0,0,0.5);
  animation:voiceHostPulse 2s ease-in-out infinite;
}
@keyframes voiceHostPulse {
  0%,100% { box-shadow:0 0 4px rgba(76,255,136,0.3); }
  50% { box-shadow:0 0 10px rgba(76,255,136,0.6); }
}

/* SIGNAL QUALITY INDICATOR */
.mp-signal {
  display:flex; align-items:flex-end; justify-content:center; gap:2px;
  height:20px; padding:2px 0;
}
.mp-signal-bar {
  width:4px; border-radius:1px;
  background:rgba(255,255,255,0.25);
  transition:background 0.4s;
}
.mp-signal-bar:nth-child(1) { height:5px; }
.mp-signal-bar:nth-child(2) { height:9px; }
.mp-signal-bar:nth-child(3) { height:13px; }
.mp-signal-bar:nth-child(4) { height:17px; }
.mp-signal[data-quality="good"] .mp-signal-bar { background:#4cff88; }
.mp-signal[data-quality="ok"] .mp-signal-bar:nth-child(1),
.mp-signal[data-quality="ok"] .mp-signal-bar:nth-child(2),
.mp-signal[data-quality="ok"] .mp-signal-bar:nth-child(3) { background:#ffc107; }
.mp-signal[data-quality="poor"] .mp-signal-bar:nth-child(1),
.mp-signal[data-quality="poor"] .mp-signal-bar:nth-child(2) { background:#ff6b00; }
.mp-signal[data-quality="bad"] .mp-signal-bar:nth-child(1) { background:#ff3333; }
.mp-signal[data-quality="bad"] { animation:mp-signal-blink 1s ease-in-out infinite; }
@keyframes mp-signal-blink {
  0%,100% { opacity:1; }
  50% { opacity:0.4; }
}

/* STREAM VIEWING BANNER */
.mp-stream-banner {
  position:fixed; top:0; left:0; right:0; z-index:var(--z-update-banner);
  padding-top:env(safe-area-inset-top);
  min-height:36px; display:none; align-items:center; justify-content:center;
  background:rgba(30,100,220,0.85); backdrop-filter:blur(8px);
  font-family:'Nunito',sans-serif; font-size:13px; font-weight:700; color:#fff;
  gap:10px;
}
.mp-stream-banner.visible { display:flex; }
.mp-stream-banner-name { max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mp-stream-exit {
  width:28px; height:28px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.2); color:#fff; font-size:14px; font-weight:900;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.mp-stream-exit:active { background:rgba(255,255,255,0.4); }
/* Stream/spectator border — always visible above everything */
#streamBorder {
  position:fixed; inset:0; z-index:var(--z-onboarding); pointer-events:none;
  display:none;
}
#streamBorder.live { display:block; box-shadow:inset 0 0 0 3px rgba(220,30,30,0.9); }
#streamBorder.spectate { display:block; box-shadow:inset 0 0 0 3px rgba(30,100,220,0.9); }
/* Spectator banner enrichment */
.mp-stream-banner-avatar { font-size:20px; line-height:1; }
.mp-stream-banner-code { font-size:11px; opacity:0.75; letter-spacing:1px; }

/* BROADCASTER LIVE BANNER (shown to broadcaster) */
.mp-live-banner {
  position:fixed; top:0; left:0; right:0; z-index:var(--z-update-banner);
  padding-top:env(safe-area-inset-top);
  min-height:32px; display:none; align-items:center; justify-content:center;
  background:rgba(220,30,30,0.85); backdrop-filter:blur(8px);
  font-family:'Nunito',sans-serif; font-size:13px; font-weight:800; color:#fff;
  gap:8px;
}
.mp-live-banner.visible { display:flex; }
.mp-live-dot {
  width:8px; height:8px; border-radius:50%; background:#fff;
  animation: mp-live-pulse 1.2s ease-in-out infinite;
}
@keyframes mp-live-pulse {
  0%,100% { opacity:1; }
  50% { opacity:0.3; }
}
.mp-live-viewers {
  font-size:11px; font-weight:600; opacity:0.85;
}
/* SPECTATOR CLICK SHIELD — blocks game interactions while spectating */
.mp-spectator-shield {
  position:fixed; inset:0; z-index:var(--z-stream-reject);
  display:none; pointer-events:all;
}
.mp-spectator-shield.visible { display:block; }
.mp-stream-signal {
  font-size:11px; font-weight:700; opacity:0.9; margin-left:auto; padding-right:4px;
}
/* STREAM TERMINAL — slides down from banner */
#streamTerminal {
  position:fixed; top:0; left:0; right:0; z-index:var(--z-stream-banner);
  max-height:0; overflow:hidden;
  transition:max-height 0.3s cubic-bezier(.4,0,.2,1);
  pointer-events:none;
}
#streamTerminal.open {
  max-height:40vh;
  pointer-events:all;
}
#streamTermLines {
  margin:0; padding:4px 8px 8px; list-style:none;
  background:rgba(0,0,0,0.75); backdrop-filter:blur(10px);
  border-bottom:1px solid rgba(255,255,255,0.1);
  overflow-y:auto; max-height:40vh;
  font-family:'Courier New',monospace; font-size:11px; line-height:1.5;
  color:#ccc;
  /* leave room for banner above */
  padding-top:calc(env(safe-area-inset-top) + 38px);
}
#streamTermLines li {
  display:flex; gap:6px; white-space:nowrap; overflow:hidden;
}
#streamTermLines .st-dir { color:#888; min-width:12px; }
#streamTermLines .st-type { min-width:48px; font-weight:700; }
#streamTermLines .st-msg { color:#aaa; overflow:hidden; text-overflow:ellipsis; }
.mp-stream-signal[data-q="good"] { color:#4f4; }
.mp-stream-signal[data-q="ok"] { color:#ff0; }
.mp-stream-signal[data-q="poor"] { color:#fa0; }
.mp-stream-signal[data-q="bad"] { color:#f44; }

/* SPECTATOR EMOJI BAR */
.mp-emoji-bar {
  position:fixed;
  bottom:calc(28px + env(safe-area-inset-bottom, 0px));
  left:50%; transform:translateX(-50%);
  z-index:var(--z-stream-toast); display:none; gap:6px; align-items:center;
  background:rgba(0,0,0,0.5); backdrop-filter:blur(10px);
  border-radius:28px; padding:6px 12px;
  border:1px solid rgba(255,200,100,0.2);
}
.mp-emoji-bar.visible { display:flex; }
.mp-emoji-bar button {
  width:40px; height:40px; border:none; border-radius:50%;
  background:transparent; font-size:22px; cursor:pointer;
  transition:transform 0.15s;
  -webkit-tap-highlight-color:transparent;
}
.mp-emoji-bar button:active { transform:scale(1.3); }

/* SPEAKING INDICATOR (emoji ring) */
.family-emoji.speaking {
  z-index:2;
  filter: drop-shadow(0 0 10px rgba(100,255,100,0.9)) drop-shadow(0 0 24px rgba(100,255,100,0.5));
}
.family-emoji.speaking::after {
  content:'';
  position:absolute; inset:-6px; border-radius:50%;
  border:2.5px solid rgba(100,255,100,0.7);
  animation: speakingRing 0.8s ease-in-out infinite;
}
@keyframes speakingRing {
  0%,100% { transform:scale(1); opacity:0.7; border-color:rgba(100,255,100,0.7); }
  50% { transform:scale(1.15); opacity:1; border-color:rgba(100,255,100,1); }
}

/* REMOTE STREAM VIDEO */
.mp-remote-video {
  position:fixed; inset:0; z-index:var(--z-screen); display:none;
  background:#000;
}
.mp-remote-video.visible { display:block; }
.mp-remote-video video {
  width:100%; height:100%; object-fit:contain;
}

/* EMOJI BROADCAST INDICATOR on family emoji */
.family-emoji .broadcast-dot {
  position:absolute; top:-2px; right:-2px;
  width:10px; height:10px; border-radius:50%;
  background:#00ff88; border:2px solid rgba(0,0,0,0.5);
  animation:mpLivePulse 2s ease-in-out infinite;
}



/* FRIEND EMOJI — avatar + gift emoji rising from fire */
.friend-emoji-pop {
  position:absolute; left:50%; bottom:35%; z-index:var(--z-dock); pointer-events:none;
  display:flex; align-items:center; gap:4px;
  animation:friendEmojiRise 2s ease-out forwards;
}
.friend-emoji-sender { font-size:28px; }
.friend-emoji-gift { font-size:34px; }
@keyframes friendEmojiRise {
  0% { opacity:0; transform:translateX(-50%) translateY(20px) scale(0.5); }
  15% { opacity:1; transform:translateX(-50%) translateY(0) scale(1.15); }
  30% { transform:translateX(-50%) translateY(-10px) scale(1); }
  75% { opacity:1; }
  100% { opacity:0; transform:translateX(-50%) translateY(-60px) scale(0.9); }
}

/* SMS BUBBLE — fixed position, visible even during mini-games */
.friend-sms-pop {
  position:fixed; left:50%; top:12vh; z-index:var(--z-sms-pop); pointer-events:none;
  display:flex; align-items:flex-end; gap:6px; max-width:80%;
  transform:translateX(-50%);
  animation:friendSmsFloat 5s ease-out forwards;
}
.friend-sms-avatar { font-size:28px; flex-shrink:0; }
.friend-sms-bubble {
  background:rgba(0,0,0,0.8); border:1px solid rgba(255,200,0,0.5);
  border-radius:14px 14px 14px 4px; padding:8px 14px;
  backdrop-filter:blur(12px);
  box-shadow:0 4px 20px rgba(255,180,0,0.15);
}
.friend-sms-name {
  display:block; font-size:11px; color:#ffc800; font-weight:700;
  font-family:'Nunito',sans-serif;
}
.friend-sms-text {
  display:block; font-size:15px; color:#fff; font-family:'Nunito',sans-serif;
  line-height:1.3; word-break:break-word;
}
@keyframes friendSmsFloat {
  0% { opacity:0; transform:translateX(-50%) translateY(-20px) scale(0.7); }
  8% { opacity:1; transform:translateX(-50%) translateY(0) scale(1.05); }
  15% { transform:translateX(-50%) translateY(5px) scale(1); }
  80% { opacity:1; transform:translateX(-50%) translateY(5px) scale(1); }
  100% { opacity:0; transform:translateX(-50%) translateY(-15px) scale(0.95); }
}

/* GRATITUDE OVERLAY */
.gratitude-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:rgba(6,2,8,0.97);
  display:none; flex-direction:column;
  overflow:hidden;
}
.gratitude-overlay.visible { display:flex; }
.gratitude-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px 8px; padding-top:calc(16px + env(safe-area-inset-top, 0px));
  padding-left:calc(20px + env(safe-area-inset-left, 0px));
  padding-right:calc(20px + env(safe-area-inset-right, 0px));
  flex-shrink:0;
}
.gratitude-close {
  width:40px; height:40px; border-radius:50%;
  background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15);
  font-size:18px; color:#fff; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
/* Tablets area */
.gratitude-tablets {
  flex:1; overflow-y:auto; padding:0 16px 16px;
  display:flex; flex-direction:column; gap:20px;
}
.gratitude-tablet {
  display:none;
  background:
    linear-gradient(175deg, #b8a07a 0%, #a08965 40%, #8d7650 100%);
  border:1px solid rgba(160,130,80,0.5);
  border-radius:40% 40% 4px 4px / 28px 28px 4px 4px;
  padding:28px 22px 24px;
  position:relative;
  box-shadow:
    inset 0 2px 6px rgba(255,240,200,0.15),
    inset 0 -3px 12px rgba(0,0,0,0.3),
    inset 0 0 50px rgba(80,50,20,0.2),
    0 4px 24px rgba(0,0,0,0.6);
}
.gratitude-tablet.active { display:block; }
.gratitude-tablet::before {
  content:''; position:absolute;
  top:6px; left:6px; right:6px; bottom:6px;
  border:1px solid rgba(200,170,110,0.2);
  border-radius:38% 38% 2px 2px / 22px 22px 2px 2px;
  pointer-events:none;
}
.gratitude-tablet-title {
  font-family:'Cinzel',serif; font-size:14px;
  letter-spacing:5px;
  text-transform:uppercase; text-align:center;
  margin-bottom:18px; font-weight:900;
  color:rgba(50,30,10,0.8);
  text-shadow:
    0 1px 0 rgba(210,190,140,0.5),
    0 -1px 1px rgba(0,0,0,0.25);
}
.gratitude-tablet-body {
  font-family:'Cinzel',serif; font-size:14px;
  line-height:2.2; letter-spacing:0.8px;
  text-transform:uppercase;
  text-align:center; word-break:break-word;
  min-height:60px;
  color:rgba(40,25,10,0.85);
  text-shadow:
    0 1px 0 rgba(210,190,140,0.45),
    0 -1px 1px rgba(0,0,0,0.2);
}
.gratitude-tablet-body .sep {
  color:rgba(70,45,15,0.5); margin:0 4px;
  font-weight:900; font-size:18px;
  text-shadow:none; vertical-align:middle;
}
.gratitude-tablet-empty {
  font-family:'Nunito',sans-serif; font-size:13px;
  color:rgba(60,40,15,0.45); text-transform:none;
  letter-spacing:0; font-style:italic;
  text-shadow:none;
}
/* Write form */
.gratitude-write {
  flex-shrink:0; padding:10px 16px 18px;
  padding-bottom:calc(18px + env(safe-area-inset-bottom, 0px));
  padding-left:calc(16px + env(safe-area-inset-left, 0px));
  padding-right:calc(16px + env(safe-area-inset-right, 0px));
  border-top:1px solid rgba(180,140,80,0.1);
}
.gratitude-type-pick {
  display:flex; gap:8px; margin-bottom:8px;
}
.gratitude-type-btn {
  flex:1; padding:8px 6px; border-radius:6px;
  background:rgba(60,40,20,0.25); border:1px solid rgba(180,140,80,0.15);
  font-family:'Cinzel',serif; font-size:12px; font-weight:700;
  color:rgba(220,180,100,0.4); letter-spacing:1px;
  cursor:pointer; text-align:center; text-transform:uppercase;
}
.gratitude-type-btn.active {
  background:rgba(60,40,20,0.5); border-color:rgba(220,180,100,0.4);
  color:rgba(240,210,140,0.9);
}
.gratitude-textarea {
  width:100%; min-height:50px; max-height:80px;
  background:rgba(60,40,20,0.2); border:1px solid rgba(180,140,80,0.15);
  border-radius:6px; padding:10px 14px; resize:none;
  font-family:'Cinzel',serif; font-size:13px;
  text-transform:uppercase; letter-spacing:0.5px;
  color:rgba(240,220,170,0.85); outline:none;
}
.gratitude-textarea::placeholder {
  color:rgba(220,180,100,0.25); text-transform:none;
  font-family:'Nunito',sans-serif; letter-spacing:0;
}
.gratitude-textarea:focus { border-color:rgba(220,180,100,0.4); }
.gratitude-write-row {
  display:flex; align-items:center; justify-content:space-between;
  margin-top:8px; gap:8px;
}
.gratitude-send-btn {
  padding:9px 22px; border-radius:6px;
  background:linear-gradient(135deg, rgba(180,140,60,0.5), rgba(140,100,40,0.5));
  border:1px solid rgba(220,180,100,0.3);
  font-family:'Cinzel',serif; font-weight:700; font-size:12px;
  color:rgba(240,220,170,0.9); cursor:pointer;
  letter-spacing:1px; text-transform:uppercase;
}
.gratitude-send-btn:active { transform:scale(0.95); }
.gratitude-send-btn:disabled { opacity:0.25; }
/* Glow flash on save */
@keyframes tabletGlow {
  0% { box-shadow:inset 0 2px 6px rgba(255,240,200,0.15), inset 0 -3px 12px rgba(0,0,0,0.3), 0 4px 24px rgba(0,0,0,0.6); }
  30% { box-shadow:inset 0 2px 6px rgba(255,240,200,0.15), inset 0 -3px 12px rgba(0,0,0,0.3), 0 0 50px rgba(255,210,120,0.5), 0 0 100px rgba(255,180,80,0.2); }
  100% { box-shadow:inset 0 2px 6px rgba(255,240,200,0.15), inset 0 -3px 12px rgba(0,0,0,0.3), 0 4px 24px rgba(0,0,0,0.6); }
}
.gratitude-tablet.glow { animation:tabletGlow 1.2s ease-out; }

/* Star ascension animation */
.star-ascension {
  position:fixed; z-index:var(--z-friend-overlay); pointer-events:none;
  display:flex; flex-direction:column; align-items:center; gap:8px;
}
.star-ascension-orb {
  width:14px; height:14px; border-radius:50%;
  background:radial-gradient(circle, #fff 0%, #ffe680 40%, #ffaa00 100%);
  box-shadow:0 0 20px 8px rgba(255,230,128,0.7), 0 0 60px 20px rgba(255,180,60,0.3);
  animation:starOrbPulse 0.6s ease-in-out infinite alternate;
}
.star-ascension.record .star-ascension-orb {
  background:radial-gradient(circle, #fff 0%, #d8b4fe 40%, #9333ea 100%);
  box-shadow:0 0 20px 8px rgba(192,132,252,0.7), 0 0 60px 20px rgba(147,51,234,0.3);
}
.star-ascension.record .star-ascension-text {
  color:#d8b4fe;
  text-shadow:0 0 10px rgba(147,51,234,0.6);
}
@keyframes starOrbPulse {
  0% { transform:scale(1); box-shadow:0 0 20px 8px rgba(255,230,128,0.7), 0 0 60px 20px rgba(255,180,60,0.3); }
  100% { transform:scale(1.3); box-shadow:0 0 30px 12px rgba(255,230,128,0.9), 0 0 80px 30px rgba(255,180,60,0.5); }
}
.star-ascension-text {
  font-family:'Nunito',sans-serif; font-size:14px; font-weight:700;
  color:#ffe0a0; text-align:center; max-width:240px;
  text-shadow:0 0 10px rgba(255,200,80,0.6);
  opacity:0; animation:starTextFade 0.5s ease-out 0.3s forwards;
}
@keyframes starTextFade {
  0% { opacity:0; transform:translateY(6px); }
  100% { opacity:1; transform:translateY(0); }
}
.star-ascension-trail {
  position:fixed; z-index:var(--z-friend-sparkle); pointer-events:none;
  width:2px; border-radius:1px;
  background:linear-gradient(to top, transparent, rgba(255,230,128,0.6));
  transform-origin:bottom center;
}
.star-nova {
  position:absolute; z-index:var(--z-sparkle-layer); pointer-events:none;
  width:6px; height:6px; border-radius:50%;
  background:transparent;
  box-shadow:0 0 30px 15px rgba(255,230,128,0.8), 0 0 60px 30px rgba(255,200,80,0.4);
  animation:starNova 0.8s ease-out forwards;
}
.star-nova.record {
  box-shadow:0 0 30px 15px rgba(192,132,252,0.8), 0 0 60px 30px rgba(147,51,234,0.4);
}
@keyframes starNova {
  0% { transform:scale(0.5); opacity:1; }
  50% { transform:scale(3); opacity:0.8; }
  100% { transform:scale(0); opacity:0; }
}
.star-dust {
  position:fixed; z-index:var(--z-friend-sparkle); pointer-events:none;
  width:3px; height:3px; border-radius:50%;
  background:#ffe680;
  box-shadow:0 0 4px 1px rgba(255,230,128,0.5);
}

/* Star-card in night sky */
.sky-star-card {
  position:absolute; border-radius:50%; background:#ffe680;
  width:5px; height:5px; cursor:pointer; pointer-events:auto;
  box-shadow:0 0 8px 2px rgba(255,230,128,0.6);
  animation:starTwinkle 2s ease-in-out infinite alternate;
  --min-o:0.7; --max-o:1; --dur:2s; --delay:0s;
}
/* Record stars — violet */
.sky-star-card.sky-star-record {
  background:#c084fc; width:6px; height:6px;
  box-shadow:0 0 10px 3px rgba(192,132,252,0.7), 0 0 20px 6px rgba(147,51,234,0.3);
  animation:starTwinkleViolet 2.5s ease-in-out infinite alternate;
}
@keyframes starTwinkleViolet {
  0% { opacity:0.75; box-shadow:0 0 10px 3px rgba(192,132,252,0.7), 0 0 20px 6px rgba(147,51,234,0.3); }
  100% { opacity:1; box-shadow:0 0 14px 5px rgba(192,132,252,0.9), 0 0 28px 10px rgba(147,51,234,0.4); }
}
/* Record star fade-out when replaced */
.sky-star-card.sky-star-fadeout {
  animation:starFadeOut 0.6s ease-out forwards;
}
@keyframes starFadeOut {
  0% { opacity:1; transform:scale(1); }
  100% { opacity:0; transform:scale(0); }
}
.sky-star-bubble {
  position:absolute; z-index:var(--z-sparkle-layer); pointer-events:none;
  background:rgba(20,10,5,0.85); border:1px solid rgba(255,220,120,0.35);
  border-radius:14px; padding:10px 16px;
  color:#ffe0a0; font-size:13px; font-weight:700;
  max-width:200px; text-align:center;
  backdrop-filter:blur(12px);
  box-shadow:0 0 16px rgba(255,180,60,0.2);
  animation:starBubbleIn 0.3s ease-out;
  transform:translateX(-50%);
}
@keyframes starBubbleIn {
  0% { opacity:0; transform:translateX(-50%) scale(0.7) translateY(6px); }
  100% { opacity:1; transform:translateX(-50%) scale(1) translateY(0); }
}

/* TOAST */
.toast {
  position:fixed; top:max(70px, calc(env(safe-area-inset-top) + 50px)); left:50%;
  transform:translateX(-50%) translateY(-20px) scale(0.8);
  background:rgba(255,100,0,0.15);
  border:1px solid rgba(255,150,50,0.4);
  border-radius:20px; padding:12px 22px;
  font-size:14px; color:#ffcc88; z-index:var(--z-overlay);
  backdrop-filter:blur(20px); text-align:center;
  display:flex; align-items:center; justify-content:center; gap:6px;
  opacity:0; transition:all 0.3s; pointer-events:none; font-weight:800;
}
.toast.show { opacity:1; transform:translateX(-50%) translateY(0) scale(1); pointer-events:all; }
.toast.toast-obs { background:rgba(200,80,180,0.18); border-color:rgba(230,120,200,0.45); color:#f0b8e0; }
.toast-cta {
  margin-left:8px; padding:3px 10px; border:none; border-radius:6px;
  background:linear-gradient(135deg,#ff6b00,#ff8800); color:#fff;
  font-size:12px; font-weight:800; cursor:pointer; flex-shrink:0;
}
.toast-cta:active { transform:scale(0.93); }

/* CHAT NOTIFICATION TOAST */
.chat-toast {
  position:fixed; top:max(70px, calc(env(safe-area-inset-top) + 50px)); left:50%;
  transform:translateX(-50%) translateY(-30px) scale(0.9);
  width:calc(100% - 32px); max-width:360px;
  background:rgba(30,40,30,0.92);
  border:1px solid rgba(100,200,100,0.35);
  border-radius:16px; padding:12px 16px;
  z-index:var(--z-overlay); backdrop-filter:blur(20px);
  opacity:0; pointer-events:none;
  transition:all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor:pointer; -webkit-tap-highlight-color:transparent;
}
.chat-toast.show {
  opacity:1; transform:translateX(-50%) translateY(0) scale(1);
  pointer-events:all;
}
.chat-toast-header {
  display:flex; align-items:center; gap:8px;
}
.chat-toast-avatar { font-size:20px; flex-shrink:0; }
.chat-toast-name {
  font-size:13px; font-weight:700; color:rgba(120,220,120,0.9);
  flex-shrink:0;
}
.chat-toast-preview {
  font-size:13px; color:rgba(255,255,255,0.7); font-weight:400;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  flex:1; min-width:0;
}
.chat-toast-full {
  font-size:14px; color:rgba(255,255,255,0.85); line-height:1.4;
  margin-top:8px; padding-top:8px;
  border-top:1px solid rgba(255,255,255,0.1);
  max-height:0; overflow:hidden;
  transition:max-height 0.3s ease, margin-top 0.3s ease, padding-top 0.3s ease;
}
.chat-toast.expanded .chat-toast-full {
  max-height:200px;
}
.chat-toast.expanded .chat-toast-preview {
  display:none;
}
.chat-toast-hint {
  font-size:10px; color:rgba(255,255,255,0.3);
  text-align:right; margin-top:4px;
}

/* SW UPDATE BANNER */
/* PWA INSTALL BANNER */
.pwa-install-banner {
  display:flex; align-items:center; gap:12px;
  background:linear-gradient(135deg, #1a0d02 0%, #2a1508 100%);
  border:1.5px solid rgba(255,106,0,0.4);
  border-radius:16px;
  padding:12px 16px;
  margin-bottom:0;
  width:100%;
  box-shadow:0 4px 20px rgba(255,80,0,0.15);
  animation:installSlideIn 0.5s ease-out;
}
@keyframes installSlideIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
.pwa-install-banner .install-icon { font-size:28px; flex-shrink:0; }
.pwa-install-banner .install-text {
  flex:1; color:rgba(255,200,120,0.85); font-size:13px; line-height:1.4;
}
.pwa-install-banner .install-btn {
  background:#ff6a00; color:#fff; border:none; border-radius:20px;
  padding:8px 16px; font-size:13px; font-weight:800; cursor:pointer;
  white-space:nowrap; min-height:40px;
  transition:background 0.2s;
}
.pwa-install-banner .install-btn:active { background:#ff8c33; }
.pwa-install-banner .install-dismiss {
  background:none; border:none; color:rgba(255,200,120,0.4); font-size:18px;
  cursor:pointer; padding:4px; line-height:1;
}
/* PENDING INVITE BANNER */
.pending-invite-banner {
  display:flex; align-items:center; gap:12px;
  background:linear-gradient(135deg, #0d1a02 0%, #142a08 100%);
  border:1.5px solid rgba(80,220,60,0.5);
  border-radius:16px;
  padding:14px 18px;
  margin:0 auto 12px; width:100%; max-width:360px;
  box-shadow:0 4px 20px rgba(80,220,60,0.15);
  animation:installSlideIn 0.5s ease-out;
}
.pending-invite-icon { font-size:28px; flex-shrink:0; }
.pending-invite-text {
  flex:1; color:rgba(180,255,160,0.9); font-size:14px; line-height:1.4; font-weight:600;
}

/* ── iOS Install Guide Overlay ── */
.ios-install-guide {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:rgba(5,2,10,0.92); backdrop-filter:blur(14px);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  opacity:0; transition:opacity 0.3s;
}
.ios-install-guide.visible { opacity:1; }
.ios-install-card {
  background:linear-gradient(160deg, #1a0d02 0%, #120818 100%);
  border:1.5px solid rgba(255,106,0,0.35);
  border-radius:24px; padding:28px 24px;
  max-width:320px; width:100%;
  display:flex; flex-direction:column; align-items:center; gap:20px;
}
.ios-install-header {
  display:flex; flex-direction:column; align-items:center; gap:8px;
}
.ios-install-header h3 {
  font-family:'Cinzel',serif; font-size:18px; color:#ff8c42;
  letter-spacing:2px; margin:0; text-align:center;
}
.ios-install-steps {
  display:flex; flex-direction:column; gap:14px; width:100%;
}
.ios-install-step {
  display:flex; align-items:center; gap:12px;
  background:rgba(255,255,255,0.04); border-radius:14px;
  padding:12px 14px;
}
.ios-step-number {
  width:28px; height:28px; border-radius:50%;
  background:rgba(255,106,0,0.2); border:1.5px solid rgba(255,106,0,0.5);
  color:#ff8c42; font-size:13px; font-weight:900;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.ios-step-icon { font-size:28px; flex-shrink:0; }
.ios-step-text {
  font-size:13px; color:rgba(255,200,120,0.8); line-height:1.4;
  font-weight:600;
}
.ios-install-arrow {
  position:relative; display:flex; flex-direction:column; align-items:center;
  margin-top:4px;
}
.ios-install-arrow > span { font-size:36px; animation:iosBounce 1.5s ease-in-out infinite; }
@keyframes iosBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(8px)} }
.ios-arrow-pulse {
  width:48px; height:48px; border-radius:50%;
  background:rgba(255,106,0,0.15); position:absolute; top:50%; left:50%;
  transform:translate(-50%,-50%);
  animation:iosArrowPulse 1.5s ease-in-out infinite;
}
@keyframes iosArrowPulse { 0%,100%{transform:translate(-50%,-50%) scale(1);opacity:0.5} 50%{transform:translate(-50%,-50%) scale(1.4);opacity:0} }

.sw-update-banner {
  position:fixed; bottom:0; left:0; right:0; z-index:var(--z-pwa-banner);
  background:linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-top:2px solid #ff6a00;
  padding:14px 20px max(14px, env(safe-area-inset-bottom));
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  transform:translateY(100%); transition:transform 0.4s cubic-bezier(.4,0,.2,1);
  box-shadow:0 -4px 20px rgba(0,0,0,0.5);
}
.sw-update-banner.visible { transform:translateY(0); }
.sw-update-banner .sw-update-text {
  color:#ffcc88; font-size:14px; font-weight:700; flex:1;
}
.sw-update-banner .sw-update-btn {
  background:#ff6a00; color:#fff; border:none; border-radius:20px;
  padding:10px 20px; font-size:14px; font-weight:800; cursor:pointer;
  white-space:nowrap; min-height:44px;
  transition:background 0.2s;
}
.sw-update-banner .sw-update-btn:active { background:#ff8c33; }
.sw-downloading-dot {
  position:fixed; top:max(8px, env(safe-area-inset-top)); right:12px; z-index:var(--z-update-banner);
  width:12px; height:12px; border-radius:50%;
  background:#ff6a00; opacity:0;
  transition:opacity 0.3s;
  pointer-events:none;
}
.sw-downloading-dot.active {
  opacity:1;
  animation:swDotPulse 1.2s ease-in-out infinite;
}
@keyframes swDotPulse { 0%,100%{opacity:0.4;transform:scale(0.8)} 50%{opacity:1;transform:scale(1.2)} }

/* SLEEP OVERLAY */
.sleep-overlay {
  position:fixed; inset:0; z-index:var(--z-sleep-overlay);
  background:rgba(5,3,8,0.92);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:12px; backdrop-filter:blur(8px);
  opacity:0; pointer-events:none; transition:opacity 0.6s;
  padding:env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing:border-box;
}
.sleep-overlay.visible { opacity:1; pointer-events:all; }
.sleep-flame-dormant { font-size:56px; animation:sleepBob 3s ease-in-out infinite; }
@keyframes sleepBob { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-6px) scale(0.96)} }
.sleep-title { font-family:'Cinzel',serif; font-size:20px; color:rgba(255,140,60,0.8); letter-spacing:3px; }
.sleep-sub { font-size:12px; color:rgba(255,200,120,0.4); letter-spacing:1px; text-align:center; max-width:260px; line-height:1.6; }
.sleep-time { font-size:11px; color:rgba(255,160,80,0.3); letter-spacing:2px; }

/* CAMERA / SELFIE overlay */
.camera-overlay {
  position:fixed; inset:0; z-index:var(--z-dock-panel);
  background:rgba(5,3,8,0.96);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; opacity:0; pointer-events:none; transition:opacity 0.4s;
  padding:env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  box-sizing:border-box;
}
.camera-overlay.visible { opacity:1; pointer-events:all; }
.camera-title { font-family:'Cinzel',serif; font-size:22px; color:rgba(255,200,100,0.7); letter-spacing:4px; }
.camera-viewfinder {
  position:relative; width:min(80vw,360px); height:min(80vw,360px);
  border-radius:20px; overflow:hidden;
  border:2px solid rgba(255,140,0,0.3);
  box-shadow:0 0 30px rgba(255,100,0,0.15);
}
.camera-viewfinder video {
  width:100%; height:100%; object-fit:cover;
  transform:scaleX(-1);
}
.camera-viewfinder canvas {
  position:absolute; inset:0; width:100%; height:100%;
  pointer-events:none; mix-blend-mode:screen;
}
.camera-player-info {
  display:flex; align-items:center; gap:8px;
  font-size:14px; color:rgba(255,200,120,0.6); letter-spacing:1px;
}
.camera-player-avatar { font-size:28px; }
.camera-actions { display:flex; gap:12px; margin-top:4px; }
.camera-btn {
  padding:12px 28px; border-radius:50px; border:none; cursor:pointer;
  font-size:16px; font-weight:700; letter-spacing:1px;
  transition:all 0.15s; -webkit-tap-highlight-color:transparent;
}
.camera-btn-capture {
  background:linear-gradient(135deg,#ff6b00,#ffaa00);
  color:white; box-shadow:0 0 20px rgba(255,100,0,0.3);
}
.camera-btn-capture:active { transform:scale(0.92); }
.camera-btn-close {
  background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.6);
  border:1px solid rgba(255,255,255,0.1);
}
.camera-btn-close:active { transform:scale(0.92); }
.camera-countdown {
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family:'Cinzel',serif; font-size:72px; color:rgba(255,200,100,0.9);
  text-shadow:0 0 40px rgba(255,100,0,0.6);
  z-index:var(--z-fire-canvas); pointer-events:none; opacity:0;
}
.camera-countdown.visible { opacity:1; }
/* Result screen */
.camera-result { display:none; flex-direction:column; align-items:center; gap:12px; }
.camera-result.visible { display:flex; }
.camera-result canvas {
  width:min(85vw,380px); height:min(85vw,380px);
  border-radius:16px; border:2px solid rgba(255,140,0,0.25);
  box-shadow:0 0 30px rgba(255,100,0,0.1);
}
.camera-live { display:flex; flex-direction:column; align-items:center; gap:12px; }
.camera-live.hidden { display:none; }
.camera-fallback-input { display:none; }

/* PROFILE MENU overlay */
.profile-menu {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:rgba(5,3,8,0.85); backdrop-filter:blur(12px);
  display:flex; flex-direction:column; align-items:center;
  gap:14px; padding:24px;
  opacity:0; pointer-events:none; transition:opacity 0.3s;
  overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding-top:max(24px, env(safe-area-inset-top, 24px));
  padding-bottom:max(24px, env(safe-area-inset-bottom, 24px));
}
.profile-menu.visible { opacity:1; pointer-events:all; }
.profile-menu-card {
  background:var(--card); border:1px solid var(--border);
  border-radius:20px; padding:20px; width:100%; max-width:320px;
  display:flex; align-items:center; gap:14px;
}
.profile-menu-avatar { font-size:42px; }
.profile-menu-info { flex:1; }
.profile-menu-name { font-size:18px; font-weight:900; color:white; letter-spacing:1px; display:flex; align-items:center; gap:6px; }
.profile-menu-edit { font-size:14px; cursor:pointer; opacity:0.4; transition:opacity 0.2s; }
.profile-menu-edit:active { opacity:0.8; transform:scale(0.9); }
.profile-menu-code { font-size:16px; letter-spacing:4px; margin-top:4px; filter:drop-shadow(0 0 4px rgba(255,180,80,0.3)); }
.profile-menu-level { font-size:11px; color:rgba(255,200,120,0.5); margin-top:3px; }
.profile-menu-flame-info { font-size:11px; color:rgba(255,160,80,0.6); margin-top:2px; }
.profile-menu-actions { width:100%; max-width:320px; display:flex; flex-direction:column; gap:8px; }
.menu-action-btn {
  background:var(--card); border:1px solid var(--border);
  border-radius:14px; padding:14px 18px;
  display:flex; align-items:center; gap:12px;
  cursor:pointer; transition:all 0.15s; -webkit-tap-highlight-color:transparent;
  font-family:'Nunito',sans-serif;
}
.menu-action-btn:active { background:rgba(255,255,255,0.08); }
.menu-action-icon { font-size:20px; width:28px; text-align:center; }
.menu-action-text { font-size:13px; font-weight:700; color:rgba(255,255,255,0.7); }
.menu-action-btn.danger { border-color:rgba(255,60,60,0.2); }
.menu-action-btn.danger .menu-action-text { color:rgba(255,100,100,0.6); }
.menu-section-title {
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.45); padding:14px 4px 4px; margin-top:2px;
}
.menu-section-collapse { cursor:pointer; -webkit-tap-highlight-color:transparent; }
.menu-section-collapse:active { color:rgba(255,200,100,0.7); }
.menu-section-spacer { height:16px; }
.menu-notif-status { font-size:14px; margin-left:auto; }
.menu-toggle { display:flex; align-items:center; gap:8px; padding:6px 0; font-size:14px; color:rgba(255,255,255,0.7); cursor:pointer; }
.menu-toggle input[type="checkbox"] { width:18px; height:18px; accent-color:#ff8800; }
.menu-update-badge {
  background:#ff6b00; color:#fff; font-size:11px; font-weight:900;
  width:20px; height:20px; border-radius:50%; display:flex;
  align-items:center; justify-content:center; margin-left:auto;
  animation: pulse-badge 1.5s infinite;
}
@keyframes pulse-badge { 0%,100%{transform:scale(1)} 50%{transform:scale(1.2)} }
.friend-version-mismatch {
  color:#ffa500; font-size:11px; font-weight:700;
}

/* Bug log overlay */
.bug-log-overlay {
  position:fixed; inset:0; z-index:var(--z-buglog);
  background:rgba(0,0,0,0.85); backdrop-filter:blur(8px);
  display:none; align-items:center; justify-content:center;
  padding:16px;
}
.bug-log-overlay.visible { display:flex; }
.bug-log-panel {
  background:rgba(15,10,25,0.95); border:1px solid rgba(255,255,255,0.1);
  border-radius:16px; padding:16px; width:100%; max-width:500px;
  max-height:80vh; display:flex; flex-direction:column; gap:10px;
}
.bug-log-header {
  display:flex; align-items:center; gap:8px;
  font-size:16px; font-weight:900; color:white;
  font-family:'Nunito',sans-serif;
}
.bug-log-count {
  background:rgba(255,60,60,0.3); color:rgba(255,120,120,0.9);
  font-size:11px; font-weight:700; padding:2px 8px;
  border-radius:10px; min-width:20px; text-align:center;
}
.bug-log-content {
  flex:1; overflow:auto; background:rgba(0,0,0,0.4);
  border:1px solid rgba(255,255,255,0.05); border-radius:10px;
  padding:10px; margin:0;
  font-family:monospace; font-size:11px; line-height:1.5;
  color:rgba(255,180,180,0.85); white-space:pre-wrap; word-break:break-all;
  max-height:50vh; min-height:100px;
}
.bug-log-actions {
  display:flex; gap:8px;
}
.bug-log-actions .btn-secondary { flex:1; font-size:12px; padding:8px; }

/* Flamia confirm dialog */
.flamia-confirm-overlay {
  position:fixed; inset:0; z-index:var(--z-school);
  background:rgba(0,0,0,0.8); backdrop-filter:blur(6px);
  display:flex; align-items:center; justify-content:center;
  padding:20px; opacity:0; transition:opacity 0.2s;
}
.flamia-confirm-overlay.visible { opacity:1; }
.flamia-confirm-box {
  background:rgba(15,10,25,0.95); border:1px solid rgba(255,150,50,0.25);
  border-radius:20px; padding:24px 20px; width:100%; max-width:320px;
  text-align:center; font-family:'Nunito',sans-serif;
  transform:scale(0.9); transition:transform 0.2s;
}
.flamia-confirm-overlay.visible .flamia-confirm-box { transform:scale(1); }
.flamia-confirm-icon { font-size:36px; margin-bottom:8px; }
.flamia-confirm-msg {
  font-size:15px; font-weight:700; color:rgba(255,255,255,0.85);
  line-height:1.4; margin-bottom:20px;
}
.flamia-confirm-btns { display:flex; gap:10px; }
.flamia-confirm-btns button {
  flex:1; padding:12px; border-radius:14px; border:none;
  font-family:'Nunito',sans-serif; font-size:14px; font-weight:800;
  cursor:pointer; transition:transform 0.1s;
  -webkit-tap-highlight-color:transparent;
}
.flamia-confirm-btns button:active { transform:scale(0.93); }
.flamia-confirm-cancel {
  background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.7);
  border:1px solid rgba(255,255,255,0.1) !important;
}
.flamia-confirm-ok {
  background:linear-gradient(135deg,rgba(255,100,0,0.7),rgba(255,60,30,0.7));
  color:white;
}
.flamia-prompt-input {
  width:100%; padding:10px 14px; margin:8px 0 4px;
  border:2px solid rgba(255,200,100,0.3); border-radius:12px;
  background:rgba(0,0,0,0.3); color:#fff; font-size:16px;
  font-family:Nunito,sans-serif; font-weight:700; text-align:center;
  outline:none; -webkit-appearance:none;
}
.flamia-prompt-input:focus { border-color:rgba(255,180,60,0.6); box-shadow:0 0 12px rgba(255,180,60,0.2); }

/* =====================
   SCREEN: ABOUT
   ===================== */
#screenAbout {
  background: radial-gradient(ellipse at 50% 80%, #1a0800 0%, #050308 70%);
  overflow-y: auto;
  justify-content: flex-start;
  padding: max(40px, env(safe-area-inset-top)) 20px max(60px, env(safe-area-inset-bottom));
}
.about-back {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); z-index: var(--z-dock);
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,150,50,0.2);
  border-radius: 50%; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.about-back:active { background: rgba(255,150,50,0.15); }
.about-flame-big { font-size: 64px; margin-bottom: 8px; text-align: center; }
.about-title {
  font-family: 'Nunito', sans-serif; font-size: 28px; font-weight: 900;
  color: white; letter-spacing: 3px; text-align: center; margin-bottom: 4px;
}
.about-version {
  font-size: 12px; color: rgba(255,180,100,0.4); text-align: center; margin-bottom: 28px;
}
.about-section {
  max-width: 380px; width: 100%; margin-bottom: 24px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,150,50,0.12);
  border-radius: 18px; padding: 20px; text-align: center;
}
.about-section-icon { font-size: 32px; margin-bottom: 8px; }
.about-section-title {
  font-family: 'Nunito', sans-serif; font-size: 16px; font-weight: 800;
  color: rgba(255,200,120,0.9); margin-bottom: 8px;
}
.about-section-text {
  font-family: 'Nunito', sans-serif; font-size: 14px; line-height: 1.6;
  color: rgba(255,255,255,0.7);
}
.about-children {
  font-weight: 800; color: rgba(255,180,80,0.9);
}
.about-footer {
  font-family: 'Nunito', sans-serif; font-size: 13px;
  color: rgba(255,180,100,0.5); text-align: center; margin-top: 8px;
}
.welcome-actions {
  display:flex; flex-direction:column; align-items:stretch;
  width:100%; max-width:360px; gap:8px;
}
.welcome-actions .btn-primary {
  width:100%; box-sizing:border-box; padding:20px 16px; margin-bottom:0;
  min-height:72px; display:flex; align-items:center; justify-content:center;
  border-radius:14px;
}
.welcome-profiles {
  display:flex; flex-direction:column; gap:8px;
  width:100%; max-height:45vh; overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.welcome-profile-card {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px; border-radius:14px;
  background:rgba(255,100,0,0.06);
  border:1px solid rgba(255,140,0,0.2);
  cursor:pointer; transition:transform 0.2s, background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color:transparent;
  will-change:transform;
}
.welcome-profile-card:active {
  background:rgba(255,100,0,0.15); border-color:rgba(255,140,0,0.5);
  transform:scale(0.97);
}
.welcome-profile-avatar {
  font-size:32px; width:44px; height:44px;
  display:flex; align-items:center; justify-content:center;
  border-radius:50%; background:rgba(255,140,0,0.1);
  flex-shrink:0;
}
.welcome-profile-info { flex:1; min-width:0; }
.welcome-profile-name {
  font-family:'Nunito',sans-serif; font-size:16px; font-weight:800;
  color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.welcome-profile-level {
  font-family:'Nunito',sans-serif; font-size:12px; color:rgba(255,200,120,0.6);
}
.welcome-profile-fire {
  font-family:'Nunito',sans-serif; font-size:11px; font-weight:600;
  color:rgba(255,160,60,0.55); margin-top:2px;
}
.welcome-profile-flame { font-size:20px; flex-shrink:0; }
.about-link {
  cursor: pointer; color: rgba(255,180,100,0.5);
  font-size: 12px; margin-top: 16px; text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.about-link:active { color: rgba(255,180,100,0.8); }
.welcome-version {
  font-family:'Nunito',sans-serif; font-size:11px; color:rgba(255,180,100,0.3);
  text-align:center; margin-top:4px;
}

/* =====================
   SCHOOL SCHEDULE
   ===================== */

/* =====================
   FRIEND PORTAL
   ===================== */
/* ── IRC / Terminal friend cards ── */
/* Friend cards — warm modern design */
.friend-card.irc-card {
  background: rgba(255,200,120,0.06);
  border: 1px solid rgba(255,200,120,0.12);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: visible;
  font-family: 'Nunito', sans-serif;
  transition: border-color 0.2s, background 0.2s;
}
.friend-card.irc-card:active { background: rgba(255,180,80,0.12); }
.friend-card.irc-card:hover { border-color: rgba(255,200,120,0.25); }
.friend-card.irc-offline { opacity: 0.7; }

/* Line 1: dot + avatar + name + meta */
.irc-line1 {
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden;
  font-size: 14px; line-height: 1.4;
}
.irc-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; display: inline-block;
}
.irc-dot.online {
  background: #4cff88;
  box-shadow: 0 0 6px rgba(76,255,136,0.6);
  animation: ircPulse 2s ease-in-out infinite;
}
.irc-dot.offline { background: rgba(255,255,255,0.2); }
.irc-avatar { font-size: 22px; flex-shrink: 0; }
@keyframes ircPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.irc-nick {
  font-weight: 700; font-size: 16px;
  color: #fff;
  overflow: hidden; text-overflow: ellipsis;
}
.irc-offline .irc-nick { color: rgba(255,255,255,0.55); }
.irc-relay { font-size: 11px; flex-shrink: 0; }
.irc-meta {
  margin-left: auto; flex-shrink: 0;
  font-size: 12px; color: rgba(255,255,255,0.45);
  font-weight: 500;
}
.irc-ver { margin-left: 2px; }
.irc-mismatch { color: rgba(255,100,60,0.7); }

/* Line 2: last message preview */
.irc-line2 {
  display: flex; align-items: center; gap: 4px;
  min-height: 18px; padding-left: 38px;
  font-size: 13px;
}
.irc-prompt {
  color: rgba(255,200,120,0.4);
  font-weight: 600; flex-shrink: 0;
}
.irc-placeholder {
  color: rgba(255,255,255,0.2);
}
.friend-last-msg-text {
  font-size: 12px; color: rgba(255,255,255,0.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
  font-family: 'Courier New', Courier, monospace;
}
.friend-last-msg-time {
  font-size: 10px; color: rgba(255,255,255,0.25);
  white-space: nowrap; flex-shrink: 0;
  font-family: 'Courier New', Courier, monospace;
}

/* ── Swipe-to-delete (Telegram-style) ── */
.swipe-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  width: 100%; box-sizing: border-box;
}
.swipe-wrap .irc-card {
  position: relative;
  z-index: 1;
  will-change: transform;
  background: #080210;
}
.swipe-delete-zone {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 90px;
  background: rgba(200,40,40,0.9);
  color: #fff;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 0 4px 4px 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
.swipe-wrap.swiping .swipe-delete-zone {
  opacity: 1; pointer-events: all;
}
.swipe-delete-zone:active {
  background: rgba(255,50,50,1);
}

/* Legacy — hidden, replaced by swipe-to-delete */
.friend-card-glow { display: none; }
.friend-avatar-wrap { display: none; }
.friend-delete-btn { display: none; }

/* online dot */
.friend-online-dot {
  width: 10px; height: 10px; border-radius: 50%;
  position: absolute; top: -1px; right: -1px;
  border: 2px solid rgba(8,4,16,1);
}
.friend-online-dot.online  { background: #4cff88; box-shadow: 0 0 6px #4cff88; }
.friend-online-dot.offline { background: #555; }

/* CONNECT MODAL — Emoji Code */
.connect-modal {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:rgba(5,2,10,0.94); backdrop-filter:blur(16px);
  display:flex; flex-direction:column;
  align-items:center; justify-content:safe center;
  gap:16px; padding:32px 20px; overflow-y:auto;
  opacity:0; pointer-events:none; transition:opacity 0.3s;
}
.connect-modal.visible { opacity:1; pointer-events:all; }
.connect-modal h2 { font-family:'Cinzel',serif; font-size:20px; color:#ff8c42; letter-spacing:3px; text-align:center; }
.connect-modal p { font-size:14px; color:rgba(255,200,120,0.55); text-align:center; line-height:1.7; max-width:300px; }
.rtc-step { display:flex; flex-direction:column; align-items:center; gap:14px; width:100%; max-width:320px; }
.rtc-step.hidden { display:none; }

/* Big emoji code display */
.emoji-code-box {
  background:rgba(255,100,0,0.07); border:1px solid rgba(255,100,0,0.2);
  border-radius:20px; padding:18px 24px; text-align:center; width:100%;
}
.emoji-code-label { font-size:14px; color:rgba(255,160,80,0.6); letter-spacing:2px; text-transform:uppercase; font-weight:800; margin-bottom:10px; }
.emoji-code-value { font-size:44px; letter-spacing:6px; line-height:1; }
.emoji-code-hint { font-size:14px; color:rgba(255,200,120,0.45); margin-top:8px; }
.emoji-code-actions { display:flex; gap:12px; justify-content:center; margin-top:10px; }
.emoji-code-action-btn {
  width:48px; height:48px; border-radius:50%; border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; transition:transform 0.15s, background 0.15s;
  background:rgba(255,255,255,0.1);
}
.emoji-code-action-btn:active { transform:scale(0.88); }
.emoji-code-whatsapp { background:#25D366; }
.emoji-code-whatsapp:active { background:#1da851; }
.emoji-code-action-btn.copied { background:rgba(80,220,80,0.3); }

/* Invite method cards */
.invite-method-card {
  width:100%; border-radius:16px; padding:16px;
  background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.08);
}
.invite-method-card.primary {
  background:rgba(255,140,40,0.08); border-color:rgba(255,160,60,0.25);
}
.invite-method-header {
  display:flex; align-items:center; gap:8px; cursor:pointer;
  font-family:'Nunito',sans-serif;
}
.invite-method-icon { font-size:22px; }
.invite-method-label { font-size:14px; font-weight:800; color:rgba(255,220,160,0.9); }
.invite-method-badge {
  font-size:11px; font-weight:700; text-transform:uppercase;
  background:rgba(255,140,40,0.3); color:rgba(255,200,120,0.9);
  padding:2px 8px; border-radius:8px; letter-spacing:0.5px;
}
.invite-method-desc {
  font-size:12px; color:rgba(255,255,255,0.5); margin:8px 0 12px;
  line-height:1.4; text-align:left;
}
.invite-wa-big-btn {
  width:100%; padding:12px 20px; border-radius:12px; border:none;
  background:#25D366; color:white; font-family:'Nunito',sans-serif;
  font-size:14px; font-weight:800; cursor:pointer;
  display:flex; align-items:center; justify-content:center; gap:8px;
  -webkit-tap-highlight-color:transparent; transition:transform 0.15s;
}
.invite-wa-big-btn:active { transform:scale(0.95); background:#1da851; }
.invite-copy-link-btn {
  width:100%; padding:8px; margin-top:8px; border-radius:10px; border:none;
  background:rgba(255,255,255,0.06); color:rgba(255,255,255,0.6);
  font-family:'Nunito',sans-serif; font-size:12px; font-weight:700;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:transform 0.15s;
}
.invite-copy-link-btn:active { transform:scale(0.95); }
details.invite-method-card summary { list-style:none; }
details.invite-method-card summary::-webkit-details-marker { display:none; }
details.invite-method-card summary::after {
  content:'▸'; margin-left:auto; color:rgba(255,255,255,0.3);
  font-size:14px; transition:transform 0.2s;
}
details.invite-method-card[open] summary::after { transform:rotate(90deg); }
.invite-method-body {
  display:flex; flex-direction:column; align-items:center; gap:18px;
  margin-top:14px;
}
.invite-privacy-note, .friend-privacy-note {
  font-size:11px; color:rgba(255,255,255,0.3); text-align:center;
  font-family:'Nunito',sans-serif; margin-top:16px;
}


/* Emoji picker for entering friend code */
.emoji-picker-label { font-size:14px; color:rgba(255,200,120,0.55); font-weight:800; letter-spacing:1px; text-transform:uppercase; align-self:flex-start; }
.emoji-slots {
  display:flex; gap:10px; justify-content:center;
}
.emoji-slot {
  width:58px; height:58px; border-radius:16px;
  background:rgba(255,255,255,0.05); border:2px solid rgba(255,255,255,0.1);
  font-size:30px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all 0.15s; -webkit-tap-highlight-color:transparent;
  position:relative;
}
.emoji-slot.active { border-color:rgba(255,140,0,0.7); background:rgba(255,100,0,0.1); box-shadow:0 0 14px rgba(255,100,0,0.2); }
.emoji-slot.filled { border-color:rgba(255,255,255,0.2); }

/* Emoji keyboard grid */
.emoji-keyboard {
  display:grid; grid-template-columns:repeat(5,1fr); gap:6px; width:100%;
  background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.07);
  border-radius:16px; padding:12px;
}
.emoji-key {
  font-size:32px; width:100%; aspect-ratio:1;
  display:flex; align-items:center; justify-content:center;
  border-radius:10px; cursor:pointer; transition:background 0.1s;
  -webkit-tap-highlight-color:transparent;
  background:none; border:none; padding:0; color:inherit;
  font-family:inherit; touch-action:manipulation;
}
.emoji-key:active { background:rgba(255,255,255,0.12); }
.emoji-key.used { opacity:0.25; }

/* Connection status */
.rtc-ping-row { display:flex; align-items:center; gap:8px; }
.rtc-ping-dot { width:8px;height:8px;border-radius:50%;background:#4cff88;box-shadow:0 0 8px #4cff88;animation:dotGreen 0.7s infinite; }
.rtc-ping-label { font-size:11px; color:rgba(100,255,150,0.7); font-weight:700; }
.rtc-status-msg { font-size:15px; color:rgba(160,255,180,0.6); text-align:center; font-weight:600; }

/* Waiting animation */
.rtc-waiting { font-size:32px; animation:schoolFloat 1.5s ease-in-out infinite; }

/* =====================
   FUSION
   ===================== */
.fusion-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:10px; padding:24px;
  opacity:0; pointer-events:none; transition:opacity 0.5s;
  background: radial-gradient(ellipse at 50% 60%, #2a0800 0%, #0e0210 50%, #050108 100%);
}
.fusion-overlay.visible { opacity:1; pointer-events:all; }

/* Countdown */
.fusion-countdown {
  font-family:'Cinzel',serif; font-size:100px; font-weight:900;
  color:#ff6b00; text-shadow:0 0 60px rgba(255,100,0,0.8);
  animation:countPulse 0.9s ease-in-out;
  line-height:1;
}
@keyframes countPulse { 0%{transform:scale(1.6);opacity:0} 50%{opacity:1} 100%{transform:scale(1);opacity:1} }

.fusion-title {
  font-family:'Cinzel',serif; font-size:16px; letter-spacing:4px;
  color:rgba(255,200,120,0.7); text-align:center;
}
.fusion-sub { font-size:15px; color:rgba(255,200,120,0.5); text-align:center; max-width:280px; line-height:1.6; }

/* Two avatars side by side */
.fusion-avatars {
  display:flex; align-items:center; gap:0; margin:8px 0;
}
.fusion-avatar {
  width:52px; height:52px; border-radius:50%;
  background:rgba(255,255,255,0.06); border:2px solid rgba(255,255,255,0.15);
  font-size:26px; display:flex; align-items:center; justify-content:center;
  position:relative; z-index:1;
  transition:transform 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.fusion-avatar.left  { transform:translateX(12px); }
.fusion-avatar.right { transform:translateX(-12px); }
.fusion-avatar.merging.left  { transform:translateX(26px) scale(1.15); }
.fusion-avatar.merging.right { transform:translateX(-26px) scale(1.15); }
.fusion-plus { font-size:20px; color:rgba(255,200,120,0.4); z-index:0; margin:0 -4px; }

/* Blow bars */
.fusion-blow-bars { display:flex; gap:16px; width:100%; max-width:280px; margin:4px 0; }
.fusion-blow-bar-wrap { flex:1; }
.fusion-blow-bar-label { font-size:14px; color:rgba(255,200,120,0.55); font-weight:800; letter-spacing:1px; text-align:center; margin-bottom:4px; text-transform:uppercase; }
.fusion-blow-bar {
  height:12px; border-radius:6px;
  background:rgba(255,255,255,0.08); overflow:hidden;
}
.fusion-blow-fill {
  height:100%; border-radius:4px; width:0%;
  transition:width 0.1s;
}
.fusion-blow-fill.me     { background:linear-gradient(90deg,#ff6b00,#ffcc00); }
.fusion-blow-fill.friend { background:linear-gradient(90deg,#4488ff,#88ccff); }

/* Big blow button during fusion */
.fusion-blow-btn {
  width:90px; height:90px; border-radius:50%;
  background:radial-gradient(circle, rgba(255,140,0,0.25) 0%, rgba(255,60,0,0.1) 100%);
  border:2px solid rgba(255,140,0,0.5);
  font-size:40px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:all 0.15s; -webkit-tap-highlight-color:transparent;
  box-shadow:0 0 30px rgba(255,100,0,0.2);
  animation:fuseGlow 2s ease-in-out infinite;
  margin:8px 0;
}
.fusion-blow-btn:active { transform:scale(0.92); background:radial-gradient(circle,rgba(255,180,0,0.5) 0%,rgba(255,60,0,0.2) 100%); }
@keyframes fuseGlow { 0%,100%{box-shadow:0 0 20px rgba(255,100,0,0.2)} 50%{box-shadow:0 0 50px rgba(255,100,0,0.5)} }

/* Result screen */
.fusion-result {
  display:flex; flex-direction:column; align-items:center; gap:10px;
  opacity:0; transition:opacity 0.8s;
}
.fusion-result.visible { opacity:1; }
.fusion-flame-result {
  font-size:80px;
  animation:resultPulse 1.5s ease-in-out infinite;
  filter:drop-shadow(0 0 30px var(--fusion-color,#ff6b00));
}
@keyframes resultPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
.fusion-result-title {
  font-family:'Cinzel',serif; font-size:18px; letter-spacing:4px;
  color:#ffcc44; text-shadow:0 0 30px rgba(255,200,0,0.6); text-align:center;
}
.fusion-result-sub { font-size:14px; color:rgba(255,220,120,0.5); text-align:center; max-width:280px; line-height:1.6; }
.fusion-memories {
  display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin-top:4px;
}
.fusion-memory {
  background:rgba(255,200,0,0.08); border:1px solid rgba(255,200,0,0.2);
  border-radius:12px; padding:10px 16px; font-size:14px;
  color:rgba(255,220,120,0.65); text-align:center;
}
.fusion-memory strong { display:block; font-size:20px; margin-bottom:2px; }

/* (Rhythm CSS removed — now canvas-based plugin) */
/* Stream toggle during countdowns */
.stream-toggle {
  display:none; align-items:center; justify-content:center; gap:8px;
  margin-top:16px; padding:10px 20px; border-radius:24px;
  background:rgba(0,0,0,0.5); backdrop-filter:blur(8px);
  border:1px solid rgba(255,255,255,0.15);
  font-family:'Nunito',sans-serif; font-size:14px; font-weight:700;
  color:rgba(255,255,255,0.7); cursor:pointer; pointer-events:auto;
  -webkit-tap-highlight-color:transparent; transition:all 0.2s;
}
.stream-toggle.visible { display:flex; }
.stream-toggle.active {
  background:rgba(0,200,100,0.2); border-color:rgba(0,255,120,0.5);
  color:#4cff88;
}
.stream-toggle:active { transform:scale(0.95); }
.stream-toggle-icon { font-size:18px; }

/* Stream notification toast (top, slides from left) */
.stream-toast {
  position:fixed; top:max(70px, calc(env(safe-area-inset-top) + 50px)); left:12px; right:12px; z-index:var(--z-overlay);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 14px; border-radius:14px;
  background:rgba(10,20,50,0.9); backdrop-filter:blur(12px);
  border:1px solid rgba(60,140,255,0.4);
  font-family:'Nunito',sans-serif; font-size:13px; color:#fff;
  box-shadow:0 4px 20px rgba(30,100,220,0.3);
  transform:translateX(-110%); opacity:0;
  transition:transform 0.35s cubic-bezier(0.2,0.9,0.3,1), opacity 0.35s;
}
.stream-toast.visible { transform:translateX(0); opacity:1; }
.stream-toast-text { flex:1; line-height:1.3; }
.stream-toast-text b { color:#7bb8ff; }
.stream-toast-btn {
  padding:6px 14px; border-radius:10px; border:none;
  background:rgba(60,140,255,0.3); color:#7bb8ff;
  font-family:'Nunito',sans-serif; font-size:12px; font-weight:800;
  cursor:pointer; white-space:nowrap;
  -webkit-tap-highlight-color:transparent; transition:background 0.2s;
}
.stream-toast-btn:active { background:rgba(60,140,255,0.5); transform:scale(0.95); }
/* Voice invite toast (reuses stream-toast, purple accent) */
.voice-invite-toast { border-color:rgba(170,100,255,0.4); }
.voice-invite-toast b { color:#c8a0ff; }
.voice-invite-btn { background:rgba(130,60,220,0.3) !important; color:#c8a0ff !important; border-color:rgba(170,100,255,0.4); }
.voice-invite-btn:active { background:rgba(130,60,220,0.5) !important; }

/* Stream indicator (game emoji orbiting near fire) */
.stream-indicator {
  position:absolute; font-size:28px; z-index:var(--z-deco-emoji); pointer-events:none;
  bottom:320px; left:50%; margin-left:-60px;
  animation:streamOrbit 6s ease-in-out infinite;
  filter:drop-shadow(0 0 10px rgba(80,160,255,0.7));
}
@keyframes streamOrbit {
  0%   { transform:translate(0, 0) scale(1); }
  25%  { transform:translate(60px, -30px) scale(1.1); }
  50%  { transform:translate(120px, 5px) scale(1); }
  75%  { transform:translate(60px, 25px) scale(1.1); }
  100% { transform:translate(0, 0) scale(1); }
}

/* =====================
   ONBOARDING
   ===================== */
#screenGame.onboarding-active .top-bar,
#screenGame.onboarding-active .dock-bar,
#screenGame.onboarding-active #btnGratitude,
#screenGame.onboarding-active #mpLiveBanner,
#screenGame.onboarding-active .friend-wall,
#screenGame.onboarding-active .scene-rail,
#screenGame.onboarding-active .scene-carousel-zone { opacity:0; pointer-events:none; transition:opacity 0.5s; }

.onboarding-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay);
  display:flex; align-items:flex-end; justify-content:center;
  padding-bottom:max(120px, env(safe-area-inset-bottom, 20px));
  opacity:0; transition:opacity 0.5s;
  background:linear-gradient(transparent 40%, rgba(0,0,0,0.6));
}
.onboarding-overlay.visible { opacity:1; }
.onboarding-bubble {
  text-align:center; max-width:320px; padding:24px;
  animation:onbBubble 2s ease-in-out infinite alternate;
}
@keyframes onbBubble { 0%{transform:translateY(0)} 100%{transform:translateY(-8px)} }
.onboarding-ignis { font-size:56px; margin-bottom:12px; filter:drop-shadow(0 0 20px rgba(255,100,0,0.6)); }
.onboarding-main { font-family:Cinzel,serif; font-size:20px; font-weight:900; color:#ffd700; text-shadow:0 2px 12px rgba(255,160,0,0.5); }
.onboarding-sub { font-size:14px; color:rgba(255,220,180,0.7); margin-top:8px; }

/* Pulse effect for guided elements */
.onboarding-pulse {
  animation:onbPulse 1.4s ease-in-out infinite !important;
  position:relative; z-index:10;
}
.onboarding-pulse::before, .onboarding-pulse::after {
  content:''; position:absolute; inset:-12px; border-radius:50%;
  border:2.5px solid rgba(255,200,0,0.7);
  animation:onbRing 1.8s ease-out infinite;
  pointer-events:none;
}
.onboarding-pulse::after { animation-delay:0.9s; }
@keyframes onbPulse {
  0%,100%{ transform:scale(1); box-shadow:0 0 18px 6px rgba(255,180,0,0.45); }
  50%{ transform:scale(1.12); box-shadow:0 0 40px 14px rgba(255,180,0,0.7); }
}
@keyframes onbRing {
  0%{ transform:scale(0.8); opacity:1; }
  100%{ transform:scale(2.2); opacity:0; }
}
.onboarding-arrow {
  position:absolute; bottom:-28px; left:50%; transform:translateX(-50%);
  font-family:'Nunito',sans-serif; font-size:13px; font-weight:700;
  color:#ffd700; white-space:nowrap;
  text-shadow:0 1px 4px rgba(0,0,0,0.6);
  animation:onbArrowBounce 1s ease-in-out infinite;
  pointer-events:none; z-index:20;
}
@keyframes onbArrowBounce {
  0%,100%{ transform:translateX(-50%) translateY(0); }
  50%{ transform:translateX(-50%) translateY(-6px); }
}

/* First wish overlay */
.onboarding-wish-overlay { align-items:center; padding-bottom:0; background:rgba(0,0,0,0.7); }
.onboarding-wish-card {
  background:rgba(20,8,2,0.95); border:1px solid rgba(255,160,0,0.3);
  border-radius:24px; padding:28px 20px; max-width:320px; width:90%; text-align:center;
}
.onboarding-wish-title { font-family:Cinzel,serif; font-size:18px; font-weight:900; color:#ffd700; margin-bottom:20px; }
.onboarding-wish-choices { display:flex; flex-direction:column; gap:10px; }
.onboarding-wish-btn {
  background:rgba(255,100,0,0.12); border:1px solid rgba(255,140,0,0.3);
  border-radius:14px; padding:14px 18px; color:#ffe0c0; font-size:15px; font-weight:700;
  cursor:pointer; transition:all 0.15s; -webkit-tap-highlight-color:transparent;
}
.onboarding-wish-btn:active { transform:scale(0.95); background:rgba(255,100,0,0.25); }

/* Connect panel gate */
.onboarding-gate { text-align:center; padding:40px 20px; }
.onboarding-gate-emoji { font-size:48px; margin-bottom:16px; }
.onboarding-gate-title { font-family:Cinzel,serif; font-size:17px; font-weight:900; color:#ffd700; margin-bottom:12px; }
.onboarding-gate-progress { font-size:24px; letter-spacing:8px; margin-bottom:12px; }
.onboarding-gate-sub { font-size:13px; color:rgba(255,200,150,0.5); }

/* =====================
   FIRE INFO TAG + POPOVER
   ===================== */
.fire-info-tag {
  position:fixed;
  bottom:max(24px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  left:max(12px, env(safe-area-inset-left, 12px)); z-index:var(--z-fire-tag);
  padding:6px 14px; border-radius:14px;
  background:rgba(0,0,0,0.45); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  border:1px solid rgba(255,200,100,0.2);
  font-size:14px; font-weight:700; color:rgba(255,220,160,0.85);
  cursor:pointer; user-select:none; -webkit-user-select:none;
  transition:color 0.3s, border-color 0.3s;
}
.fire-info-tag.low { color:rgba(255,160,80,0.9); border-color:rgba(255,140,60,0.3); }
.fire-info-tag.critical { color:rgba(255,100,50,1); border-color:rgba(255,80,40,0.5); animation:fireTagPulse 1.5s infinite; }
@keyframes fireTagPulse { 0%,100%{opacity:0.9} 50%{opacity:0.5} }
.fire-info-popover {
  position:fixed;
  bottom:max(56px, calc(env(safe-area-inset-bottom, 0px) + 56px));
  left:max(12px, env(safe-area-inset-left, 12px)); z-index:var(--z-ignis-bubble);
  background:rgba(15,8,25,0.92); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  border:1px solid rgba(200,140,255,0.2);
  border-radius:16px; padding:14px 16px;
  min-width:180px; max-width:220px;
  opacity:0; pointer-events:none; transform:translateY(8px) scale(0.95);
  transition:opacity 0.2s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow:0 8px 32px rgba(0,0,0,0.5);
}
.fire-info-popover.visible { opacity:1; pointer-events:auto; transform:translateY(0) scale(1); }
.fire-info-row {
  display:flex; justify-content:space-between; align-items:center;
  padding:5px 0; font-size:12px; color:rgba(255,255,255,0.75);
}
.fire-info-row + .fire-info-row { border-top:1px solid rgba(255,255,255,0.06); }
.fire-info-label { opacity:0.5; }
.fire-info-value { font-weight:700; color:rgba(255,220,160,0.95); }
.fire-energy { font-size:1.1em; }
.fire-energy.legendary { color:#ffd700; text-shadow:0 0 8px rgba(255,215,0,0.6); }
.fire-energy.low { color:#e74c3c; }
#fireInfoTag.legendary { color:#ffd700; text-shadow:0 0 6px rgba(255,215,0,0.5); }

/* =====================
   DOCK BAR
   ===================== */
.dock-bar {
  position:fixed; bottom:0; left:0; right:0;
  z-index:var(--z-dock-bar); min-height:72px;
  padding:12px 8px;
  padding-bottom:max(12px, env(safe-area-inset-bottom, 12px));
  padding-left:max(8px, env(safe-area-inset-left, 8px));
  padding-right:max(8px, env(safe-area-inset-right, 8px));
  display:flex; align-items:center; justify-content:space-around;
  background:rgba(8,4,16,0.85);
  border-top:1px solid rgba(255,255,255,0.10);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
}
.dock-icon {
  width:58px; height:58px; min-width:58px; min-height:58px; aspect-ratio:1;
  border-radius:50%; flex-shrink:0;
  border:1.5px solid rgba(255,200,100,0.25);
  background:linear-gradient(160deg, rgba(255,180,80,0.14) 0%, rgba(120,60,20,0.18) 100%);
  font-size:38px; display:flex; align-items:center; justify-content:center;
  overflow:visible;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:all 0.18s cubic-bezier(0.34,1.56,0.64,1); backdrop-filter:blur(10px);
  box-shadow:
    0 2px 8px rgba(0,0,0,0.35),
    0 1px 3px rgba(0,0,0,0.25),
    inset 0 1px 1px rgba(255,220,150,0.15);
  text-shadow:0 1px 4px rgba(0,0,0,0.4);
}
.dock-icon:active { transform:scale(0.88); background:linear-gradient(160deg, rgba(255,140,40,0.25) 0%, rgba(160,60,0,0.3) 100%); border-color:rgba(255,160,40,0.5); }
.dock-icon.active { background:linear-gradient(160deg, rgba(255,140,40,0.3) 0%, rgba(180,70,0,0.3) 100%); border-color:rgba(255,160,40,0.55); box-shadow:0 2px 8px rgba(0,0,0,0.35), 0 0 16px rgba(255,120,0,0.3), inset 0 1px 1px rgba(255,220,150,0.2); }
.dock-icon.pulse-wood {
  animation: dockPulseWood 1.2s ease-in-out infinite;
}
@keyframes dockPulseWood {
  0%,100% { box-shadow:0 0 8px rgba(255,140,0,0.1); transform:scale(1); }
  50% { box-shadow:0 0 20px rgba(255,140,0,0.5); transform:scale(1.12); border-color:rgba(255,140,0,0.6); }
}
/* ============================================================
   SCENE RAIL — vertical right-edge button column (replace dock)
   ============================================================ */
.scene-rail {
  position:fixed; z-index:var(--z-dock-bar);
  right:max(10px, env(safe-area-inset-right, 10px));
  bottom:max(100px, calc(env(safe-area-inset-bottom, 0px) + 100px));
  display:flex; flex-direction:column-reverse; gap:14px;
  align-items:center;
}
.scene-btn {
  position:relative;
  width:72px; height:72px; border-radius:50%;
  border:1.5px solid rgba(255,200,100,0.25);
  background:linear-gradient(160deg, rgba(255,180,80,0.14) 0%, rgba(120,60,20,0.18) 100%);
  font-size:38px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:all 0.18s cubic-bezier(0.34,1.56,0.64,1);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  box-shadow:0 2px 8px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,220,150,0.15);
  text-shadow:0 1px 4px rgba(0,0,0,0.4);
  overflow:visible;
}
.scene-btn:active { transform:scale(0.88); border-color:rgba(255,160,40,0.5); }
.scene-btn.active { background:linear-gradient(160deg, rgba(255,140,40,0.3) 0%, rgba(180,70,0,0.3) 100%); border-color:rgba(255,160,40,0.55); box-shadow:0 2px 8px rgba(0,0,0,0.35), 0 0 16px rgba(255,120,0,0.3), inset 0 1px 1px rgba(255,220,150,0.2); }
/* Short screens (landscape phone) — compact rail to avoid overflow */
@media (max-height: 500px) {
  .scene-rail { bottom:max(40px, calc(env(safe-area-inset-bottom, 0px) + 40px)); gap:8px; }
  .scene-btn { width:52px; height:52px; font-size:26px; }
}

/* ============================================================
   COMMUNITY PANEL — tabs (Ma Tribu + Village)
   ============================================================ */
.community-tabs {
  display:flex; gap:0; flex:1;
}
.community-tab {
  flex:1; padding:10px 6px; border:none; background:transparent;
  color:rgba(255,200,100,0.55); font-family:inherit; font-size:15px; font-weight:700;
  cursor:pointer; border-bottom:2px solid transparent;
  transition:color 0.2s, border-color 0.2s;
  display:flex; align-items:center; justify-content:center; gap:4px;
}
.community-tab.active {
  color:rgba(255,200,100,0.95);
  border-bottom-color:rgba(255,160,40,0.7);
}
.community-tab:hover { color:rgba(255,200,100,0.8); }
.community-pane { display:none; }
.community-pane.active { display:block; overflow-x:hidden; overflow-y:auto; max-width:100%; }

/* Arcade tabs (Games / Challenges / Village) */
/* Override panel header for arcade — tabs replace centered title */
#panelStore > .dock-panel-header {
  justify-content:stretch !important;
}
#panelStore > .dock-panel-header > .dock-panel-close {
  position:relative; right:auto; top:auto; transform:none;
  flex-shrink:0;
}
.arcade-tabs {
  display:flex !important; flex:1; gap:0; min-width:0;
  width:100%;
  border-bottom:1px solid rgba(255,200,100,0.1);
}
.arcade-tab {
  flex:1; padding:12px 6px; border:none; background:transparent;
  color:rgba(255,200,100,0.5); font-family:'Nunito',sans-serif; font-size:14px; font-weight:700;
  cursor:pointer; border-bottom:3px solid transparent;
  transition:color 0.2s, border-color 0.2s;
  display:flex; align-items:center; justify-content:center; gap:4px;
  position:relative; white-space:nowrap;
}
.arcade-tab.active {
  color:rgba(255,200,100,1);
  border-bottom-color:#ff9020;
}
.arcade-pane { display:none; width:100%; }
.arcade-pane.active { display:block; overflow-x:hidden; overflow-y:auto; max-width:100%; }

/* ============================================================
   STORE — game catalog panel (full-height dock panel)
   ============================================================ */
.dock-panel-store .dock-panel-content {
  max-height:75vh;
  align-items:stretch;
}
/* Store rows */
.store-row {
  margin-bottom:24px;
  width:100%;
}
.store-row-title {
  font-size:14px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.85); margin-bottom:10px; padding-left:4px;
  text-shadow:0 0 12px rgba(255,160,40,0.2);
}
.store-row-scroll {
  display:flex; flex-wrap:nowrap; gap:12px;
  overflow-x:auto; -webkit-overflow-scrolling:touch;
  padding-bottom:8px; scroll-snap-type:x mandatory;
}
.store-row-scroll::-webkit-scrollbar { display:none; }
/* Game cards in store — Roblox-style thumbnail + info */
.store-card {
  flex:0 0 140px; min-width:140px; scroll-snap-align:start;
  background:rgba(20,12,30,0.95);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:14px;
  display:flex; flex-direction:column;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:transform 0.18s cubic-bezier(0.34,1.56,0.64,1), border-color 0.25s, box-shadow 0.25s;
  position:relative; overflow:hidden;
  box-shadow:0 4px 12px rgba(0,0,0,0.4);
}
.store-card:active { transform:scale(0.94); }
.store-card.locked { opacity:0.45; filter:grayscale(0.5); }
/* Thumbnail area — colored gradient + big emoji */
.store-card-thumb {
  position:relative;
  height:100px; width:100%;
  display:flex; align-items:center; justify-content:center;
  border-radius:14px 14px 0 0;
  overflow:hidden;
}
.store-card-thumb::after {
  content:''; position:absolute; inset:0;
  background:linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.4) 100%);
  pointer-events:none;
}
.store-card-emoji {
  font-size:48px; line-height:1;
  filter:drop-shadow(0 4px 8px rgba(0,0,0,0.4));
  z-index:1;
}
/* Info footer */
.store-card-info {
  padding:8px 10px 10px;
  display:flex; flex-direction:column; gap:3px;
}
.store-card-name {
  font-size:13px; font-weight:700; color:rgba(255,255,255,0.9);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
/* Badge — top-right on thumbnail */
.store-card-badge {
  position:absolute; top:8px; right:8px; z-index:2;
  font-size:11px; font-weight:800; letter-spacing:0.5px;
  padding:3px 7px; border-radius:8px;
  background:rgba(0,0,0,0.5); color:rgba(255,200,100,0.95);
  backdrop-filter:blur(6px); -webkit-backdrop-filter:blur(6px);
}
.store-card-badge.duel {
  background:rgba(200,40,30,0.6); color:rgba(255,200,180,0.95);
}
.store-card-badge.new {
  background:linear-gradient(135deg,#ff6b00,#ffcc00); color:#1a1a2e;
  animation:store-badge-pulse 1.5s ease-in-out infinite;
}
.store-card-badge.resume {
  background:linear-gradient(135deg,#22cc66,#44ff88); color:#1a1a2e;
  font-size:13px; padding:3px 8px;
  animation:store-badge-pulse 1.5s ease-in-out infinite;
}
@keyframes store-badge-pulse {
  0%,100%{ transform:scale(1); }
  50%{ transform:scale(1.1); }
}
/* Plays count — bottom-left on thumbnail */
.store-card-plays {
  position:absolute; bottom:6px; left:8px; z-index:2;
  font-size:10px; font-weight:700; color:rgba(255,255,255,0.7);
}
/* Lock text */
.store-card-lock {
  font-size:11px; color:rgba(255,200,150,0.4);
}
/* Continue — warm border glow */
.store-card.continue {
  border-color:rgba(255,160,60,0.35);
  box-shadow:0 4px 12px rgba(0,0,0,0.4), 0 0 12px rgba(255,140,40,0.15);
}
/* Duel — red border glow */
.store-card.duel {
  border-color:rgba(255,80,60,0.4);
  box-shadow:0 4px 12px rgba(0,0,0,0.4), 0 0 12px rgba(255,60,40,0.2);
}
/* Social line — compact "👥 2 · 🏆 43.5K" */
.store-card-social {
  font-size:11px; color:rgba(255,200,100,0.7);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  letter-spacing:0.3px;
}
/* Play count / personal record */
.store-card-meta {
  font-size:10px; color:rgba(255,255,255,0.35);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
/* Online friends bar at top of store */
.store-online-bar {
  display:flex; align-items:center; gap:6px;
  padding:10px 14px; margin-bottom:12px;
  background:rgba(40,180,80,0.12);
  border:1px solid rgba(40,180,80,0.3);
  border-radius:12px;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:background 0.2s, border-color 0.2s;
}
.store-online-bar:active { background:rgba(40,180,80,0.22); border-color:rgba(40,180,80,0.5); }
.store-online-dot {
  width:8px; height:8px; border-radius:50%;
  background:#2ecc71;
  box-shadow:0 0 6px rgba(46,204,113,0.5);
  flex-shrink:0;
}
.store-online-avatar {
  font-size:18px; line-height:1;
}
.store-online-text {
  font-size:12px; color:rgba(46,204,113,0.8); font-weight:600;
}
/* Empty state */
.store-empty {
  text-align:center; padding:20px;
  color:rgba(255,200,150,0.35); font-size:13px;
}

/* Empty fuel prompt */
.fuel-empty-prompt {
  position:fixed; left:0; right:0;
  top:50%; transform:translateY(-50%);
  z-index:10; pointer-events:none;
  text-align:center;
  animation:fuelEmptyFade 2s ease-in-out infinite alternate;
}
.fuel-empty-prompt span {
  font-size:48px; display:block; margin-bottom:8px;
}
.fuel-empty-prompt p {
  font-size:15px; color:rgba(255,180,100,0.7);
  font-weight:700; letter-spacing:0.5px;
}
@keyframes fuelEmptyFade {
  0% { opacity:0.4; }
  100% { opacity:1; }
}
/* SCENE DECORATIONS */
.scene-deco {
  position:fixed; z-index:var(--z-scene-deco); font-size:32px;
  cursor:grab; user-select:none; -webkit-user-select:none;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition:transform 0.15s;
  touch-action:none;
}
.scene-deco.sky { z-index:var(--z-scene-deco); }
.scene-deco.dragging { transform:scale(1.25); cursor:grabbing; z-index:var(--z-screen); transition:none; }
.deco-trash {
  position:fixed;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 74px);
  left:50%; transform:translateX(-50%) scale(0);
  z-index:10; width:48px; height:48px; border-radius:50%;
  background:rgba(255,60,40,0.12); border:1.5px solid rgba(255,80,60,0.25);
  display:flex; align-items:center; justify-content:center;
  font-size:22px; pointer-events:none;
  transition:transform 0.25s ease, background 0.15s, border-color 0.15s;
}
.deco-trash.visible { transform:translateX(-50%) scale(1); pointer-events:auto; }
.deco-trash.hover { transform:translateX(-50%) scale(1.3); background:rgba(255,60,40,0.4); border-color:rgba(255,80,60,0.8); }
.scene-deco.placed { animation:decoPlace 0.3s ease-out; }
@keyframes decoPlace {
  0% { transform:scale(1.3); }
  100% { transform:scale(1); }
}
.scene-selfie {
  position:fixed; z-index:var(--z-scene-deco);
  width:56px; height:56px; border-radius:50%;
  border:2px solid rgba(255,200,120,0.5);
  box-shadow:0 0 12px rgba(255,140,0,0.3);
  object-fit:cover; cursor:grab; touch-action:none;
  user-select:none; -webkit-user-select:none;
}
.scene-selfie.dragging { transform:scale(1.2); z-index:50; }

/* ---- Mon Ciel (Photo Stars) ---- */
.sky-photos-overlay {
  position:fixed; inset:0; z-index:var(--z-overlay);
  background:radial-gradient(ellipse at 50% 30%, #0a0520 0%, #050210 60%, #000 100%);
  display:flex; flex-direction:column; align-items:center;
  opacity:0; pointer-events:none; transition:opacity 0.35s;
}
.sky-photos-overlay.visible { opacity:1; pointer-events:auto; }
.sky-photos-header {
  width:100%; display:flex; justify-content:space-between; align-items:center;
  padding:16px 20px 8px; box-sizing:border-box;
  padding-top:max(16px, env(safe-area-inset-top, 16px));
  padding-left:max(20px, env(safe-area-inset-left, 20px));
  padding-right:max(20px, env(safe-area-inset-right, 20px));
}
.sky-photos-title-wrap { display:flex; flex-direction:column; align-items:flex-start; }
.sky-photos-title { font-family:'Cinzel',serif; font-size:20px; color:#ffe8a0; }
.sky-photos-count { font-size:14px; color:rgba(255,232,160,0.6); margin-top:4px; font-weight:600; letter-spacing:1px; }
.sky-photos-close {
  width:40px; height:40px; border:none; background:rgba(255,255,255,0.08);
  border-radius:50%; color:#fff; font-size:20px; cursor:pointer;
}
.sky-photos-main {
  flex:1; width:100%; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:12px 16px 24px;
  padding-left:max(16px, env(safe-area-inset-left, 16px));
  padding-right:max(16px, env(safe-area-inset-right, 16px));
  padding-bottom:max(24px, env(safe-area-inset-bottom, 24px));
}
.sky-photos-grid {
  display:grid; grid-template-columns:repeat(3, 1fr); gap:12px;
  max-width:360px; margin:0 auto;
}
.sky-photos-card {
  aspect-ratio:1; border-radius:50%; position:relative;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; cursor:pointer;
  transition:transform 0.15s, box-shadow 0.15s;
}
.sky-photos-card:active { transform:scale(0.93); }
.sky-photos-card.empty {
  background:rgba(255,255,255,0.04);
  border:2px dashed rgba(255,200,100,0.25);
}
.sky-photos-card.empty .sky-photos-card-plus {
  font-size:28px; color:rgba(255,200,100,0.4);
  line-height:1;
}
.sky-photos-card.filled {
  border:2px solid rgba(255,200,100,0.35);
  box-shadow:0 0 12px rgba(255,180,60,0.2);
}
.sky-photos-card.filled img {
  width:100%; height:100%; object-fit:cover; border-radius:50%;
}
.sky-photos-card-name {
  position:absolute; bottom:4px; left:50%; transform:translateX(-50%);
  font-size:10px; color:#ffe8a0; white-space:nowrap;
  text-shadow:0 1px 4px rgba(0,0,0,0.8);
  max-width:90%; overflow:hidden; text-overflow:ellipsis;
}
@keyframes skyPulse {
  0%,100% { box-shadow:0 0 8px rgba(255,180,60,0.2); }
  50% { box-shadow:0 0 18px rgba(255,180,60,0.5); }
}
.sky-photos-card.empty:first-child { animation:skyPulse 2s infinite; }
/* Source picker */
.sky-photos-source {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:20px; padding:40px 20px; flex:1;
  padding-bottom:max(20px, env(safe-area-inset-bottom, 20px));
}
.sky-photos-source-btn {
  width:140px; height:140px; border-radius:24px;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; cursor:pointer; color:#fff; font-size:14px;
  transition:background 0.15s, transform 0.15s;
}
.sky-photos-source-btn:active { transform:scale(0.95); background:rgba(255,255,255,0.1); }
.sky-photos-source-emoji { font-size:48px; }
/* Camera view */
.sky-photos-camera {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:16px; padding:20px; flex:1;
  padding-bottom:max(20px, env(safe-area-inset-bottom, 20px));
}
.sky-photos-video {
  width:260px; height:260px; border-radius:50%; object-fit:cover;
  border:3px solid rgba(255,200,100,0.4);
  transform:scaleX(-1); /* mirror front camera */
}
.sky-photos-capture {
  width:64px; height:64px; border-radius:50%; border:3px solid #fff;
  background:rgba(255,255,255,0.15); cursor:pointer; font-size:24px;
  display:flex; align-items:center; justify-content:center;
}
.sky-photos-capture:active { background:rgba(255,255,255,0.3); }
/* Crop view */
.sky-photos-crop {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; padding:20px; flex:1;
  padding-bottom:max(20px, env(safe-area-inset-bottom, 20px));
}
.sky-photos-crop canvas {
  border-radius:50%; touch-action:none;
}
.sky-photos-name-input {
  width:200px; padding:10px 14px; border-radius:20px;
  border:1px solid rgba(255,200,100,0.3); background:rgba(255,255,255,0.08);
  color:#fff; font-size:16px; text-align:center; font-family:'Nunito',sans-serif;
}
.sky-photos-name-input::placeholder { color:rgba(255,255,255,0.3); }
.sky-photos-suggestions {
  display:flex; flex-wrap:wrap; justify-content:center; gap:8px;
}
.sky-photos-suggestion {
  padding:6px 14px; border-radius:16px;
  background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.12);
  color:rgba(255,255,255,0.7); font-size:13px; cursor:pointer;
}
.sky-photos-suggestion:active { background:rgba(255,255,255,0.15); }
.sky-photos-confirm {
  padding:12px 32px; border-radius:24px; border:none;
  background:linear-gradient(135deg, #ff9800, #ff5722);
  color:#fff; font-size:16px; font-weight:700; cursor:pointer;
  font-family:'Nunito',sans-serif;
}
.sky-photos-confirm:active { transform:scale(0.96); }
.sky-photos-back {
  width:40px; height:40px; border:none; background:rgba(255,255,255,0.08);
  border-radius:50%; color:#fff; font-size:18px; cursor:pointer;
  position:absolute; top:max(16px, env(safe-area-inset-top, 16px)); left:max(16px, env(safe-area-inset-left, 16px));
}
/* Photo stars in the night sky */
.sky-photo-star {
  position:absolute; transform:translate(-50%,-50%);
  width:44px; height:44px; z-index:2; cursor:grab;
  touch-action:none; user-select:none; -webkit-user-select:none;
  pointer-events:auto;
}
.sky-photo-star img {
  width:100%; height:100%; border-radius:50%; object-fit:cover;
  border:2px solid rgba(255,200,100,0.5);
  box-shadow:0 0 10px rgba(255,180,60,0.4), 0 0 20px rgba(255,140,0,0.2);
  animation:starGlow 3s infinite alternate;
}
@keyframes starGlow {
  0% { box-shadow:0 0 8px rgba(255,180,60,0.3), 0 0 16px rgba(255,140,0,0.15); }
  100% { box-shadow:0 0 14px rgba(255,200,80,0.6), 0 0 28px rgba(255,160,0,0.3); }
}
.sky-photo-star-name {
  position:absolute; bottom:-16px; left:50%; transform:translateX(-50%);
  font-size:10px; color:rgba(255,230,180,0.8); white-space:nowrap;
  text-shadow:0 1px 3px rgba(0,0,0,0.8);
}
/* Detail bubble */
.sky-photo-detail {
  position:absolute; transform:translate(-50%,-120%);
  background:rgba(20,10,30,0.92); border:1px solid rgba(255,200,100,0.3);
  border-radius:16px; padding:12px; z-index:10;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  opacity:0; transition:opacity 0.2s; pointer-events:none;
}
.sky-photo-detail.visible { opacity:1; pointer-events:auto; }
.sky-photo-detail-img { width:64px; height:64px; border-radius:50%; object-fit:cover; }
.sky-photo-detail-name { font-size:14px; color:#ffe8a0; }
.sky-photo-detail-actions { display:flex; gap:12px; }
.sky-photo-detail-btn {
  width:40px; height:40px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.1); font-size:18px; cursor:pointer;
}
.sky-photo-detail-btn-delete { background:rgba(255,60,40,0.15); }
/* Ascension animation */
.sky-photo-ascension {
  position:fixed; z-index:var(--z-deco-tooltip); transform:translate(-50%,-50%);
  display:flex; flex-direction:column; align-items:center; gap:6px;
  animation:skyAscensionAppear 0.6s ease-out;
}
.sky-photo-ascension img {
  width:80px; height:80px; border-radius:50%; object-fit:cover;
  border:3px solid rgba(255,200,100,0.6);
  box-shadow:0 0 24px rgba(255,180,60,0.5);
}
.sky-photo-ascension-name {
  font-size:14px; color:#ffe8a0; text-shadow:0 1px 4px #000;
  transition:opacity 0.4s;
}
@keyframes skyAscensionAppear {
  0% { opacity:0; transform:translate(-50%,-50%) scale(0.3); }
  100% { opacity:1; transform:translate(-50%,-50%) scale(1); }
}

/* Deco store panel */
.deco-store-grid {
  display:grid; grid-template-columns:repeat(5, 1fr); gap:8px;
  padding:8px 4px;
}
.deco-store-item {
  width:48px; height:48px; border-radius:12px;
  background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1);
  display:flex; align-items:center; justify-content:center;
  font-size:24px; cursor:pointer;
  transition:background 0.15s, transform 0.15s;
}
.deco-store-item:active { transform:scale(0.9); background:rgba(255,140,0,0.15); }
.deco-store-item.owned { border-color:rgba(255,200,100,0.4); background:rgba(255,140,0,0.08); }
.deco-store-section {
  font-size:11px; color:rgba(255,200,120,0.6); font-weight:700;
  text-transform:uppercase; letter-spacing:1px; margin:8px 4px 4px;
}
.deco-store-actions {
  display:flex; gap:8px; padding:8px 4px; justify-content:center;
}
.deco-clear-btn {
  font-size:12px; color:rgba(255,120,80,0.7); background:none; border:1px solid rgba(255,120,80,0.2);
  border-radius:8px; padding:4px 12px; cursor:pointer;
}
.deco-clear-btn:active { background:rgba(255,80,60,0.15); }
/* Scene preview overlay */
.scene-preview-overlay {
  position:fixed; inset:0; z-index:var(--z-friend-overlay);
  background:rgba(0,0,0,0.92);
  display:none; flex-direction:column;
  align-items:center; justify-content:center; gap:16px;
}
.scene-preview-overlay.visible { display:flex; }
.scene-preview-img {
  max-width:85vw; max-height:60vh;
  border-radius:16px; border:1.5px solid rgba(255,200,100,0.2);
  box-shadow:0 0 30px rgba(255,100,0,0.15);
}
.scene-preview-actions {
  display:flex; gap:12px; flex-wrap:wrap; justify-content:center;
}
.scene-preview-btn {
  display:flex; align-items:center; gap:6px;
  padding:10px 20px; border-radius:14px; border:none;
  font-size:15px; font-weight:700; cursor:pointer;
  font-family:'Nunito',sans-serif;
  transition:transform 0.15s;
}
.scene-preview-btn:active { transform:scale(0.92); }
.scene-preview-btn.whatsapp { background:#25D366; color:#fff; }
.scene-preview-btn.share { background:rgba(255,200,100,0.15); color:#ffcc88; border:1px solid rgba(255,200,100,0.3); }
.scene-preview-btn.download { background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.7); border:1px solid rgba(255,255,255,0.15); }
.scene-preview-close {
  position:absolute;
  top:max(16px, env(safe-area-inset-top, 16px));
  right:max(16px, env(safe-area-inset-right, 16px));
  width:40px; height:40px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.1); color:#fff;
  font-size:20px; cursor:pointer;
}

/* Dock panels wrapper */
.dock-panels-wrap {
  position:fixed;
  bottom:env(safe-area-inset-bottom, 0px);
  left:0; right:0;
  z-index:var(--z-dock-bar); pointer-events:none;
}
.dock-panel-backdrop {
  position:fixed; inset:0;
  background:rgba(0,0,0,0.3);
  opacity:0; pointer-events:none;
  transition:opacity 0.25s; z-index:0;
}
.dock-panel-backdrop.visible { opacity:1; pointer-events:all; }

.dock-panel {
  position:absolute; bottom:0; left:0; right:0; z-index:1;
  background:rgba(10,5,18,0.97);
  border-top:1.5px solid rgba(255,160,60,0.25);
  border-radius:20px 20px 0 0;
  backdrop-filter:blur(30px); -webkit-backdrop-filter:blur(30px);
  padding:16px 16px 20px;
  transform:translateY(100%); opacity:0;
  transition:transform 0.3s cubic-bezier(0.32,0.72,0,1), opacity 0.25s;
  pointer-events:none;
}
.dock-panel.open { transform:translateY(0); opacity:1; pointer-events:all; }
.dock-panel::before {
  content:''; display:block; width:40px; height:4px;
  border-radius:2px; background:rgba(255,200,100,0.25);
  margin:0 auto 8px;
}
.dock-panel-header {
  display:flex; align-items:center; justify-content:center;
  position:relative; width:100%; margin-bottom:8px;
}
.dock-panel-title {
  font-size:15px; font-weight:800; letter-spacing:2.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.95); text-align:center;
}
.dock-panel-close {
  position:absolute; right:-4px; top:50%; transform:translateY(-50%);
  width:44px; height:44px; border-radius:50%; border:none;
  background:rgba(255,255,255,0.1); color:rgba(255,255,255,0.7);
  font-size:18px; display:flex; align-items:center; justify-content:center;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:all 0.15s; z-index:5;
}
.dock-panel-close:active { background:rgba(255,255,255,0.15); transform:translateY(-50%) scale(0.9); }
.dock-panel-content {
  display:flex; flex-direction:column; align-items:center; gap:12px;
  max-height:65vh; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding-bottom:24px;
}

/* Backpack — Mon Ciel button */
.foyer-sky-btn {
  width:100%; padding:12px 16px; margin-bottom:4px;
  background:linear-gradient(135deg, rgba(30,30,80,0.5) 0%, rgba(60,30,100,0.3) 100%);
  border:1px solid rgba(140,120,255,0.25); border-radius:14px;
  font-size:15px; font-weight:700; color:rgba(200,190,255,0.9);
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  display:flex; align-items:center; justify-content:center; gap:6px;
  transition:all 0.15s;
}
.foyer-sky-btn:active { transform:scale(0.96); background:rgba(60,30,120,0.4); }

/* Backpack — balance header */
.bp-balance {
  width:100%; text-align:center; padding:8px 0 4px;
  font-size:22px; font-weight:900; color:#ffcc33;
  letter-spacing:0.5px;
  text-shadow:0 0 12px rgba(255,160,0,0.4);
}

/* Backpack section labels */
.bp-section-label {
  width:100%; font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:rgba(255,200,100,0.5); padding:10px 4px 6px; margin-top:2px;
  border-top:1px solid rgba(255,255,255,0.06);
}
.bp-section-label:first-child { border-top:none; margin-top:0; padding-top:0; }

/* Backpack — wrapping grid (wood + powders) */
.bp-scroll {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  width:100%; padding:4px 0 12px 12px; pointer-events:all;
  box-sizing:border-box;
}

/* Backpack — inventory cell (shared by wood + powder) */
.bp-cell {
  display:flex; flex-direction:column; align-items:center; gap:3px;
  padding:8px 4px 6px; border-radius:14px;
  border:1.5px solid rgba(255,160,60,0.2);
  background:rgba(40,20,8,0.7);
  backdrop-filter:blur(8px);
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:all 0.15s;
  min-width:60px;
}
.bp-cell:active, .bp-cell.adding {
  transform:scale(0.90);
  border-color:rgba(255,180,80,0.6);
  box-shadow:0 6px 20px rgba(255,100,0,0.35);
}
.bp-cell-emoji { font-size:26px; line-height:1.1; }
.bp-cell-name {
  font-size:10px; font-weight:700; color:rgba(255,210,150,0.9);
  text-align:center; line-height:1.1; white-space:nowrap;
}
.bp-cell-cost {
  font-size:10px; font-weight:600; color:rgba(255,180,80,0.7);
}
.bp-cell.locked {
  opacity:0.4; pointer-events:all; cursor:default;
}
.bp-cell.locked .bp-cell-cost::before {
  content:'🔒 ';
}
.bp-cell.locked:active {
  transform:none; border-color:rgba(255,160,60,0.2);
  box-shadow:none;
}
@keyframes bpCostPulse {
  0%,100% { transform:scale(1); }
  50% { transform:scale(1.2); color:#ff4444; }
}
.bp-cell-cost.pulse { animation:bpCostPulse 0.3s ease 2; }

/* Powder cells use custom properties for per-item colors */
.bp-scroll .bp-cell {
  background:var(--bp-bg, rgba(40,20,8,0.7));
  border-color:var(--bp-border, rgba(255,160,60,0.2));
}
.bp-scroll .bp-cell:active {
  border-color:var(--bp-border, rgba(255,180,80,0.6));
  box-shadow:0 4px 16px var(--bp-bg, rgba(255,100,0,0.2));
}

/* Legacy compat — powder-btn active override (no longer nested in powder-item) */
.dock-panel .powder-btn:active { transform:scale(0.85); }

/* Friend portal in connect panel */
#panelCommunity > .dock-panel-content {
  align-items:stretch;
}
.dock-panel .friend-portal {
  position:static; display:flex; flex-direction:column; gap:8px;
  width:100%; transition:none; opacity:1;
}
.dock-panel .friend-portal.hidden { opacity:1; pointer-events:all; transform:none; }
/* Tribe invite chips */
.tribe-invite-prompt { width:100%; text-align:center; }
.tribe-invite-title {
  font-size:13px; font-weight:800; color:rgba(255,200,120,0.8);
  font-family:'Nunito',sans-serif; margin-bottom:10px;
}
.tribe-invite-chips {
  display:flex; flex-wrap:wrap; gap:6px; justify-content:center;
  margin-bottom:10px;
}
.tribe-chip {
  padding:7px 12px; border-radius:20px; border:none;
  background:rgba(255,140,40,0.1); border:1px solid rgba(255,160,60,0.25);
  color:rgba(255,220,160,0.9); font-family:'Nunito',sans-serif;
  font-size:12px; font-weight:700; cursor:pointer;
  -webkit-tap-highlight-color:transparent; transition:all 0.15s;
  display:flex; align-items:center; gap:4px;
}
.tribe-chip:active { transform:scale(0.92); background:rgba(255,140,40,0.25); }

.tribe-actions-row { display:flex; gap:8px; margin-bottom:10px; }
.tribe-action-btn {
  flex:1; display:flex; align-items:center; gap:8px;
  background:rgba(8,4,16,0.85); border:1px solid rgba(255,255,255,0.1);
  border-radius:14px; padding:10px 12px;
  cursor:pointer; transition:all 0.15s;
  -webkit-tap-highlight-color:transparent;
  backdrop-filter:blur(14px); font-size:20px;
}
.tribe-action-btn:active { transform:scale(0.95); }
.tribe-action-label-wrap { display:flex; flex-direction:column; }
.tribe-action-label { font-size:13px; font-weight:700; color:rgba(255,200,100,0.95); line-height:1.2; }
.tribe-action-sub { font-size:10px; font-weight:400; color:rgba(255,200,100,0.35); margin-top:1px; }
.tribe-action-invite { border-color:rgba(255,255,255,0.08); }

/* ── Connect modal: details/summary for manual code ── */
.connect-manual-details { width:100%; margin-top:4px; }
.connect-manual-summary { display:flex; align-items:center; gap:6px; cursor:pointer; padding:10px 14px; border-radius:12px; background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); color:rgba(255,255,255,0.7); font-size:14px; font-weight:600; list-style:none; -webkit-tap-highlight-color:transparent; transition:background 0.15s; }
.connect-manual-summary::-webkit-details-marker { display:none; }
.connect-manual-summary::before { content:'▸'; font-size:11px; transition:transform 0.2s; }
.connect-manual-details[open] .connect-manual-summary::before { transform:rotate(90deg); }

/* ── Mini-Games Carousel ── */
.games-carousel-wrap { width:100%; display:flex; flex-direction:column; align-items:center; gap:0; }
.games-carousel {
  display:grid; grid-template-columns:1fr 1fr; gap:12px;
  overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:4px 12px 16px; width:100%; max-height:55vh;
  scrollbar-width:none;
}
.games-carousel::-webkit-scrollbar { display:none; }
.game-card {
  width:100%; height:clamp(120px,18vh,160px); border-radius:22px;
  background:rgba(255,140,40,0.08); border:1.5px solid rgba(255,160,60,0.25);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position:relative;
}
.game-card:active { transform:scale(0.92); }
.game-card.unlocked:hover { border-color:rgba(255,180,60,0.5); box-shadow:0 0 20px rgba(255,100,0,0.25); }
.game-card.locked { opacity:0.35; pointer-events:none; }
.game-card.coming-soon { border-style:dashed; border-color:rgba(255,255,255,0.15); }
.game-card.coming-soon .game-card-emoji { opacity:0.4; }
.game-card-emoji { font-size:clamp(40px,10vw,56px); line-height:1; }
.game-card-label {
  font-size:clamp(14px,3.5vw,17px); font-weight:700; color:rgba(255,220,160,0.95);
  text-align:center; max-width:100%; overflow:hidden;
}
.game-card-resume {
  position:absolute; top:8px; right:8px;
  font-size:12px; font-weight:800; padding:2px 7px; border-radius:8px;
  background:linear-gradient(135deg,#22cc66,#44ff88); color:#1a1a2e;
  animation:store-badge-pulse 1.5s ease-in-out infinite;
}
.game-card-stats {
  display:flex; gap:6px; justify-content:center; align-items:center;
  font-family:'Nunito',sans-serif; font-size:11px; font-weight:700;
  color:rgba(255,200,100,0.55); margin-top:2px; line-height:1;
  text-overflow:ellipsis; white-space:nowrap;
}
.games-carousel-dots { display:none; }

/* =============================================
   RESPONSIVE — Mobile phones (narrow screens)
   ============================================= */
@media (max-width: 430px) {
  #fireCanvas {
    width:min(100vw, 400px);
    height:min(calc(100vw * 1.5625), calc(100dvh - 200px));
    bottom:calc(env(safe-area-inset-bottom, 0px) + 60px);
  }
  .family-emoji-ring {
    bottom:calc(env(safe-area-inset-bottom, 0px) + 60px);
    width:240px; height:240px;
  }
  .family-emoji { font-size:28px; }
  .family-emoji-name { font-size:11px; }
  .friend-wall {
    top:42%; max-height:clamp(80px, 18vh, 140px);
  }
  .fw-cell { min-width:46px; max-width:52px; }
  .fw-avatar { font-size:24px; }
  .fw-name { font-size:11px; max-width:50px; }
  /* Right-side icons: more spacing on iPhone to avoid overlap */
  .mailbox-btn {
    top:max(160px, calc(env(safe-area-inset-top, 0px) + 140px));
    right:max(12px, env(safe-area-inset-right, 12px));
    width:36px; height:36px; font-size:18px;
  }
  .top-mp-controls .mp-ctrl-btn { width:38px; height:38px; font-size:19px; }
  .top-terminal-toggle { width:38px; height:38px; font-size:19px; }
}
/* Tall phones (iPhone X/11/12/13/14/15, etc.) — reduce sky */
@media (max-width: 430px) and (min-height: 750px) {
  /* Sky now covers full viewport on all devices */
}

/* =============================================
   RESPONSIVE — Tablet & Desktop
   ============================================= */

/* ── Tablet portrait (iPad Mini, iPad) ── */
@media (min-width: 600px) {
  /* Dock bar: constrain width */
  .dock-bar {
    max-width:480px; left:50%; transform:translateX(-50%);
    border-radius:20px 20px 0 0;
    border-left:1px solid rgba(255,255,255,0.08);
    border-right:1px solid rgba(255,255,255,0.08);
  }

  /* Dock panels: constrain */
  .dock-panels-wrap { width:100%; max-width:480px; left:50%; right:auto; transform:translateX(-50%); }
  .dock-panel { border-radius:20px 20px 0 0; }

  /* Connect modal: bigger content area */
  .connect-modal { padding:40px 32px; }
  .rtc-step { max-width:420px; }
  .emoji-code-value { font-size:52px; letter-spacing:10px; }
  .emoji-slot { width:68px; height:68px; font-size:36px; }
  .emoji-keyboard { grid-template-columns:repeat(5,1fr); gap:8px; max-width:420px; }
  .emoji-key { font-size:28px; min-height:52px; }

  /* Fusion overlay: scale up */
  .fusion-blow-bars { max-width:380px; }
  .fusion-blow-btn { width:110px; height:110px; font-size:48px; }
  .fusion-countdown { font-size:120px; }
  .fusion-avatar { width:64px; height:64px; font-size:32px; }
  .fusion-result-title { font-size:22px; }
  .fusion-flame-result { font-size:100px; }
  .fusion-sub { max-width:380px; }
  .fusion-result-sub { max-width:380px; }
  .fusion-memories { max-width:420px; }

  /* Friend cards: limit width on tablet */
  .friend-card.irc-card { max-width:500px; }
  .friend-portal { align-items:center; }

  /* Scene rail: tablet */
  .scene-btn { width:80px; height:80px; font-size:42px; }
  .scene-rail { gap:16px; }

  /* Rhythm result: breathe on tablet */
}

/* ── Tablet landscape / small desktop ── */
@media (min-width: 900px) {
  #fireCanvas { width:560px; height:875px; bottom:60px; }
  .dock-bar { max-width:520px; }
  .dock-panels-wrap { max-width:520px; }

  /* Sky: full viewport on desktop — seamless with fire */
  .night-sky { height:100%; }

  /* Fire canvas: no CSS box-shadow on desktop — ambient glow on particleCanvas suffices */
  #fireCanvas { box-shadow:none !important; }

  /* Scene rail: keep on right side (same as mobile), just scale up */
  .scene-btn { width:74px; height:74px; font-size:38px; }
  .scene-rail { gap:18px; }

  /* Invite button: above the fire, not overlapping */
  .fw-invite-btn {
    position:relative;
    z-index:var(--z-game-ui, 100);
  }

  /* Scene carousel / banners: constrain width on desktop */
  .scene-carousel-zone { width:min(90vw, 520px); }

  /* Fuel empty prompt: constrain width */
  .fuel-empty-prompt { max-width:520px; left:50%; right:auto; transform:translate(-50%, -50%); }

  /* Announce zone + cards: constrain width on wide screens */
  .announce-zone {
    max-width:560px;
    left:50% !important; right:auto !important;
    transform:translateX(-50%);
  }
  .tip-card, .announce-card { max-width:520px; margin:0 auto; }

  /* Friend wall: centered above the fire */
  .friend-wall {
    top:45%; transform:translateY(-50%);
    left:0; right:90px;
    max-width:none;
  }
  .friend-wall-scroll {
    justify-content:center; gap:10px;
    mask-image:none; -webkit-mask-image:none;
    padding:0 16px;
  }
  .fw-cell { min-width:56px; max-width:64px; }

  .rtc-step { max-width:480px; }
  .emoji-code-value { font-size:56px; }
  .emoji-slot { width:72px; height:72px; font-size:38px; }
  .emoji-keyboard { grid-template-columns:repeat(5,1fr); max-width:480px; }
  .emoji-key { font-size:30px; min-height:54px; }

  .fusion-blow-bars { max-width:440px; }
  .fusion-blow-btn { width:120px; height:120px; font-size:52px; }
  .fusion-sub { max-width:400px; }

  /* Rhythm result: comfortable on landscape tablet */
}

/* ── Desktop (1200px+) ── */
@media (min-width: 1200px) {
  #fireCanvas { width:600px; height:937px; bottom:60px; }
  .top-bar { padding:16px 24px; }
  .top-bar .top-profile { font-size:16px; padding:6px 16px; }
  .dock-bar { max-width:560px; height:76px; }
  .dock-icon { width:64px; height:64px; min-width:64px; min-height:64px; font-size:42px; }
  .dock-panels-wrap { max-width:560px; }

  /* Scene rail: keep on right side, scale up */
  .scene-rail { gap:22px; }
  .scene-btn { width:80px; height:80px; font-size:42px; }

  /* Friend wall: wider on desktop */
  .friend-wall { max-width:800px; bottom:calc(env(safe-area-inset-bottom, 0px) + 230px); }
  .friend-wall-scroll { gap:14px; }
  .fw-cell { min-width:60px; max-width:68px; }

  /* Connect modal: comfortable sizing */
  .connect-modal { padding:48px 40px; }
  .rtc-step { max-width:520px; }
  .connect-modal h2 { font-size:24px; letter-spacing:4px; }
  .connect-modal p { font-size:16px; max-width:420px; }
  .emoji-code-box { padding:24px 32px; border-radius:24px; }
  .emoji-code-value { font-size:60px; letter-spacing:14px; }
  .emoji-code-label { font-size:15px; }
  .emoji-code-hint { font-size:15px; }
  .emoji-slot { width:76px; height:76px; font-size:40px; border-radius:18px; }
  .emoji-keyboard { grid-template-columns:repeat(5,1fr); gap:10px; max-width:520px; padding:16px; }
  .emoji-key { font-size:32px; min-height:56px; border-radius:12px; }

  /* Fusion: comfortable on big screen */
  .fusion-overlay { gap:16px; padding:40px; }
  .fusion-countdown { font-size:140px; }
  .fusion-title { font-size:20px; letter-spacing:6px; }
  .fusion-avatar { width:76px; height:76px; font-size:38px; }
  .fusion-blow-bars { max-width:500px; }
  .fusion-blow-bar { height:16px; }
  .fusion-blow-btn { width:130px; height:130px; font-size:56px; }
  .fusion-sub { font-size:17px; max-width:450px; }
  .fusion-result-title { font-size:26px; letter-spacing:6px; }
  .fusion-flame-result { font-size:120px; }
  .fusion-result-sub { font-size:16px; max-width:450px; }
  .fusion-memories { max-width:500px; gap:12px; }
  .fusion-memory { padding:14px 20px; font-size:16px; }

  /* Friend cards */
  .friend-card.irc-card { max-width:520px; padding:10px 16px; }
  .irc-nick { font-size:15px; }
  .irc-meta { font-size:12px; }

  /* Rhythm result: spacious on desktop */
}

/* ── Large desktop (1600px+) ── */
@media (min-width: 1600px) {
  #fireCanvas { width:700px; height:1093px; bottom:60px; }
  .scene-rail { gap:26px; }
  .scene-btn { width:84px; height:84px; font-size:44px; }
  .friend-wall { max-width:900px; }
}

/* ── Small phone fix (≤375px) ── */
@media (max-width: 375px) {
  .emoji-slot { width:50px; height:50px; font-size:26px; border-radius:12px; }
  .emoji-slots { gap:6px; }
  .emoji-keyboard { grid-template-columns:repeat(5,1fr); gap:4px; padding:8px; }
  .emoji-key { font-size:20px; }
  .emoji-code-value { font-size:36px; letter-spacing:4px; }
  .connect-modal { padding:24px 12px; gap:12px; }
  .rtc-step { max-width:100%; gap:10px; }
  .fusion-blow-btn { width:80px; height:80px; font-size:36px; }
  .fusion-blow-bars { max-width:100%; }
  .fusion-countdown { font-size:80px; }

  /* Right-side icons: extra spacing on narrow phones */
  .mailbox-btn { top:max(160px, calc(env(safe-area-inset-top, 0px) + 140px)); width:34px; height:34px; font-size:16px; }
  .top-mp-controls .mp-ctrl-btn { width:36px; height:36px; font-size:17px; }
  .top-terminal-toggle { width:36px; height:36px; font-size:17px; }

  /* Scene rail: compact on small phones */
  .scene-btn { width:60px; height:60px; font-size:30px; }
  .scene-rail { gap:10px; }

  /* Rhythm result — compact for small phones */
}

/* ── Small phone (≤360px) ── */
@media (max-width: 360px) {
  .dock-icon { width:50px; height:50px; min-width:50px; min-height:50px; font-size:32px; }
  .scene-btn { width:56px; height:56px; font-size:28px; }
  .scene-rail { gap:8px; }
}
/* ── Very small phone (≤320px, iPhone 5/SE1) ── */
@media (max-width: 320px) {
  .dock-icon { width:46px; height:46px; min-width:46px; min-height:46px; font-size:28px; }
  .scene-btn { width:50px; height:50px; font-size:26px; }
}

/* Space game CSS removed — now rendered 100% on canvas via SpacePlugin */


/* ============================================================
   CHAT — Feu de Camp (community tab)
   ============================================================ */
#communityChat {
  display:flex; flex-direction:column; height:100%;
  min-height:0; overflow:hidden; max-width:100%; box-sizing:border-box;
}
/* ── Chat list view (Slack-mobile style) ─────────────────── */
.chat-list-view {
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:0 0 8px;
}
.chat-section { margin-bottom:2px; }
.chat-section-header {
  display:flex; align-items:center; gap:6px; padding:10px 14px 6px;
  color:rgba(255,200,100,0.5); font-size:11px; font-weight:800;
  text-transform:uppercase; letter-spacing:1.2px; cursor:pointer;
  user-select:none; -webkit-user-select:none;
}
.chat-section-header .chevron {
  font-size:10px; transition:transform 0.2s; display:inline-block;
}
.chat-section.collapsed .chevron { transform:rotate(-90deg); }
.chat-section.collapsed .chat-section-items { display:none; }
.chat-list-item {
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  cursor:pointer; transition:background 0.15s; border-radius:10px;
  margin:0 6px;
}
.chat-list-item:active { background:rgba(255,255,255,0.08); }
.chat-list-item-emoji { font-size:18px; flex-shrink:0; width:28px; text-align:center; }
.chat-list-item-info { flex:1; min-width:0; }
.chat-list-item-name {
  font-size:14px; font-weight:700; color:rgba(255,200,100,0.9);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-list-item-meta {
  font-size:11px; color:rgba(255,200,120,0.45); margin-top:1px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-list-item-preview {
  font-size:12px; color:rgba(255,255,255,0.35); margin-top:1px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-list-item-badge {
  background:rgba(76,200,100,0.9); color:#fff; font-size:11px; font-weight:800;
  min-width:18px; border-radius:10px; display:flex;
  align-items:center; justify-content:center; padding:3px 6px; flex-shrink:0;
  line-height:1;
}
.chat-list-item .online-dot {
  width:8px; height:8px; border-radius:50%; flex-shrink:0;
}
.chat-list-item .online-dot.on { background:#4cff88; box-shadow:0 0 6px rgba(76,255,136,0.4); }
.chat-list-item .online-dot.off { background:rgba(255,255,255,0.15); }
.chat-list-item.muted { opacity:0.4; }

/* ── Conversation view header ──────────────────────────── */
.chat-conv-view {
  display:flex; flex-direction:column; flex:1; min-height:0;
}
.chat-conv-header {
  display:flex; align-items:center; gap:8px; padding:8px 10px;
  border-bottom:1px solid rgba(255,255,255,0.06); flex-shrink:0;
}
.chat-conv-info {
  display:flex; flex-direction:column; flex:1; min-width:0; gap:1px;
}
.chat-conv-status {
  font-size:11px; color:rgba(255,200,100,0.5); font-weight:600;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  margin-top:-2px; font-family:Nunito, sans-serif;
}
.chat-conv-actions { display:flex; gap:4px; margin-left:auto; }
.chat-action-btn {
  border:none; background:rgba(255,255,255,0.06); border-radius:10px;
  width:34px; height:34px; font-size:16px; cursor:pointer;
  transition:background 0.15s; color:rgba(255,220,160,0.7);
}
.chat-action-btn:hover { background:rgba(255,255,255,0.12); }
/* Call button: green circle with white phone SVG — child-friendly */
.chat-call-btn {
  background:#2ecc71 !important; border-radius:50% !important;
  width:40px !important; height:40px !important;
  display:flex !important; align-items:center; justify-content:center;
  box-shadow:0 0 12px rgba(46,204,113,0.5);
  transition:transform 0.15s, box-shadow 0.15s;
  padding:0 !important;
}
.chat-call-btn svg { display:block; }
.chat-call-btn:active { background:#27ae60 !important; transform:scale(0.9); box-shadow:0 0 4px rgba(46,204,113,0.3); }
/* Call button in friend list */
.chat-list-call-btn {
  background:#2ecc71; border:none; border-radius:50%;
  width:32px; height:32px; min-width:32px;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0; margin-left:auto;
  box-shadow:0 0 8px rgba(46,204,113,0.3);
  transition:transform 0.15s;
}
.chat-list-call-btn:active { transform:scale(0.85); background:#27ae60; }
.chat-list-call-btn svg { display:block; }
.chat-action-btn.live { background:rgba(255,60,60,0.15); color:#ff6060; animation:chatLivePulse 2s ease-in-out infinite; }
@keyframes chatLivePulse { 0%,100%{box-shadow:none} 50%{box-shadow:0 0 8px rgba(255,60,60,0.3)} }
.chat-back-btn {
  border:none; background:none; color:rgba(255,200,100,0.7);
  font-size:20px; cursor:pointer; padding:4px 8px;
  font-family:inherit; -webkit-tap-highlight-color:transparent;
}
.chat-back-btn:active { color:rgba(255,200,100,1); }
.chat-conv-title {
  flex:1; font-size:15px; font-weight:700; color:rgba(255,200,100,0.9);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-conv-search {
  border:none; background:none; font-size:16px; cursor:pointer;
  padding:4px 8px; -webkit-tap-highlight-color:transparent;
}
.chat-messages {
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:8px 10px; display:flex; flex-direction:column; gap:6px;
  min-height:0;
}
.chat-empty {
  text-align:center; color:rgba(255,200,100,0.4);
  font-size:14px; padding:40px 20px;
}
.chat-msg {
  max-width:85%; padding:8px 12px; border-radius:14px;
  font-size:14px; line-height:1.35; word-wrap:break-word;
  animation:chatFadeIn 0.2s ease-out;
}
@keyframes chatFadeIn {
  from { opacity:0; transform:translateY(8px); }
  to { opacity:1; transform:translateY(0); }
}
.chat-msg.mine {
  align-self:flex-end;
  background:rgba(255,140,40,0.2); color:rgba(255,220,160,0.95);
  border-bottom-right-radius:4px;
}
.chat-msg.theirs {
  align-self:flex-start;
  background:rgba(255,255,255,0.08); color:rgba(255,255,255,0.85);
  border-bottom-left-radius:4px;
}
.chat-msg-name {
  font-size:11px; font-weight:700; color:rgba(255,160,40,0.7);
  margin-bottom:2px;
}
.chat-msg-time {
  font-size:10px; color:rgba(255,255,255,0.3);
  margin-top:2px; text-align:right;
  display:flex; align-items:center; justify-content:flex-end; gap:4px;
}
.chat-msg.theirs .chat-msg-time { justify-content:flex-start; }
/* WhatsApp-style ticks: pending→sealed→distributed→read */
.chat-msg-tick {
  font-size:10px; font-weight:700; letter-spacing:-1px;
  color:rgba(255,255,255,0.25); /* ✓ gray — sent, pending server */
}
.chat-msg-tick.sealed { color:rgba(80,220,120,0.8); }      /* ✓ green — server confirmed */
.chat-msg-tick.distributed { color:rgba(255,255,255,0.35); } /* ✓✓ gray — delivered to device */
.chat-msg-tick.read { color:rgba(80,220,120,0.9); }          /* ✓✓ green — read by recipient */
.chat-input-bar {
  flex-shrink:0; padding:6px 8px 10px;
  border-top:1px solid rgba(255,255,255,0.08);
  background:rgba(0,0,0,0.2);
  box-sizing:border-box; width:100%; max-width:100%; overflow:hidden;
}
.chat-emoji-row {
  display:flex; gap:2px; padding:4px 0 6px;
  overflow-x:auto; scrollbar-width:none;
}
.chat-emoji-row::-webkit-scrollbar { display:none; }
.chat-emoji-btn {
  flex-shrink:0; width:36px; height:36px; border:none;
  background:rgba(255,255,255,0.06); border-radius:10px;
  font-size:18px; cursor:pointer; display:flex;
  align-items:center; justify-content:center;
  transition:background 0.15s;
}
.chat-emoji-btn:active { background:rgba(255,255,255,0.15); }
.chat-input-row {
  display:flex; gap:6px; align-items:center; min-width:0; max-width:100%;
}
.chat-input {
  flex:1; padding:10px 14px; border:none;
  background:rgba(255,255,255,0.1); color:rgba(255,220,160,0.95);
  border-radius:22px; font-size:15px; font-family:inherit;
  outline:none; min-width:0;
}
.chat-input::placeholder { color:rgba(255,200,100,0.35); }
.chat-input:focus { background:rgba(255,255,255,0.15); }
.chat-send-btn {
  width:44px; height:44px; border:none; border-radius:50%;
  background:linear-gradient(135deg, #ff6d00, #ff8f00);
  color:#fff; font-size:20px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; transition:transform 0.1s;
}
.chat-send-btn:active { transform:scale(0.9); }
.chat-typing {
  font-size:12px; color:rgba(80,255,120,0.5); font-style:italic;
  padding:4px 12px; animation:chatFadeIn 0.2s;
}
.chat-badge {
  background:#2e7d32; color:#fff; font-size:10px;
  font-weight:700; min-width:16px; height:16px;
  border-radius:8px; display:inline-flex;
  align-items:center; justify-content:center; padding:0 4px;
}
/* DM list */
.chat-dm-list {
  display:flex; flex-direction:column; gap:4px; padding:6px 0;
}
.chat-dm-item {
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  background:rgba(255,255,255,0.05); border-radius:12px;
  cursor:pointer; transition:background 0.15s;
}
.chat-dm-item:active { background:rgba(255,255,255,0.1); }
.chat-dm-avatar { font-size:24px; }
.chat-dm-info { flex:1; min-width:0; }
.chat-dm-name { font-size:14px; font-weight:700; color:rgba(255,200,100,0.9); }
.chat-dm-preview { font-size:12px; color:rgba(255,255,255,0.4);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-dm-time { font-size:11px; color:rgba(255,255,255,0.3); }
.chat-dm-back {
  border:none; background:none; color:rgba(255,200,100,0.7);
  font-size:14px; font-weight:700; cursor:pointer; padding:8px 4px;
  font-family:inherit;
}
.chat-dm-back:active { color:rgba(255,200,100,0.95); }

/* ── Chat action menu (long press) ── */
.chat-action-menu {
  position:absolute; bottom:calc(100% + 6px); left:4px; right:4px;
  background:rgba(20,10,30,0.97); border:1px solid rgba(255,200,100,0.25);
  border-radius:14px; padding:10px; z-index:var(--z-modal-base,300);
  display:flex; flex-direction:column; gap:8px;
  box-shadow:0 8px 30px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,200,100,0.08);
  animation:chatMenuIn 0.15s ease-out;
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
}
@keyframes chatMenuIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.chat-action-reactions {
  display:flex; gap:4px; justify-content:center;
}
.chat-action-react-btn {
  border:none; background:rgba(255,255,255,0.08); border-radius:8px;
  font-size:22px; padding:6px 8px; cursor:pointer;
  transition:background 0.15s, transform 0.1s;
}
.chat-action-react-btn:active { transform:scale(0.85); background:rgba(255,200,100,0.2); }
.chat-action-delete-btn {
  border:none; background:rgba(200,50,50,0.3); color:#ff6666;
  border-radius:8px; font-size:13px; font-weight:700; padding:8px;
  cursor:pointer; font-family:inherit;
  transition:background 0.15s;
}
.chat-action-delete-btn:active { background:rgba(200,50,50,0.5); }

/* ── Chat reaction badges ── */
.chat-msg-reactions, .chat-reaction-bar {
  display:flex; flex-wrap:wrap; gap:4px; margin-top:4px;
}
.chat-reaction-badge {
  background:rgba(255,200,100,0.1); border:1px solid rgba(255,200,100,0.18);
  border-radius:12px; padding:2px 8px; font-size:14px;
  color:rgba(255,220,160,0.85); cursor:pointer;
  transition:background 0.15s;
}
.chat-reaction-badge:active { background:rgba(255,200,100,0.25); }
.chat-reaction-badge.mine {
  background:rgba(255,160,40,0.2); border-color:rgba(255,160,40,0.4);
}

/* ── Chat search bar ── */
.chat-search-bar {
  display:flex; gap:6px; padding:6px 8px;
  background:rgba(0,0,0,0.3); border-bottom:1px solid rgba(255,255,255,0.06);
}
.chat-search-input {
  flex:1; border:none; background:rgba(255,255,255,0.08); color:#fff;
  border-radius:8px; padding:6px 10px; font-size:13px; font-family:inherit;
  outline:none;
}
.chat-search-input::placeholder { color:rgba(255,200,100,0.3); }
.chat-search-close {
  border:none; background:none; color:rgba(255,200,100,0.6);
  font-size:18px; cursor:pointer; padding:0 4px;
}
.chat-search-results { font-size:11px; color:rgba(255,200,100,0.5); padding:2px 8px; }
.chat-msg.search-highlight { background:rgba(255,200,0,0.15); border-left:2px solid rgba(255,200,0,0.5); }

/* ── Chat action buttons row ── */
.chat-action-btns {
  display:flex; flex-wrap:wrap; gap:6px;
}
.chat-action-btns .chat-action-btn {
  border:none; background:rgba(255,255,255,0.08); border-radius:10px;
  color:rgba(255,220,160,0.85); font-size:13px; font-weight:700;
  padding:8px 14px; cursor:pointer; font-family:Nunito, sans-serif;
  transition:background 0.15s; white-space:nowrap;
}
.chat-action-btns .chat-action-btn:active { background:rgba(255,200,100,0.2); }
.chat-action-btn:active { background:rgba(255,255,255,0.15); }
.chat-action-report { color:rgba(255,150,100,0.8); }
.chat-action-report:active { background:rgba(200,50,50,0.15); }

/* ── Chat edit input (inline) ── */
.chat-edit-input {
  width:100%; border:1px solid rgba(255,200,100,0.3); background:rgba(0,0,0,0.4);
  color:#fff; border-radius:8px; padding:6px 8px; font-size:14px;
  font-family:inherit; outline:none; margin-top:4px;
}
.chat-edit-input:focus { border-color:rgba(255,200,100,0.6); }

/* ── Chat edited tag ── */
.chat-msg-edited {
  font-size:11px; color:rgba(255,200,100,0.4); font-style:italic; margin-left:4px;
}

/* ── Chat reply bar (above input) ── */
.chat-reply-bar {
  display:flex; align-items:center; gap:6px;
  background:rgba(255,200,100,0.08); border-left:3px solid rgba(255,200,100,0.5);
  padding:6px 10px; font-size:12px; color:rgba(255,220,160,0.8);
}
.chat-reply-name { font-weight:700; color:rgba(255,200,100,0.9); white-space:nowrap; }
.chat-reply-text { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:rgba(255,255,255,0.5); }
.chat-reply-close {
  border:none; background:none; color:rgba(255,200,100,0.5); font-size:16px;
  cursor:pointer; padding:0 2px; flex-shrink:0;
}

/* ── Chat quoted message (in reply) ── */
.chat-msg-quote {
  background:rgba(255,200,100,0.06); border-left:2px solid rgba(255,200,100,0.3);
  border-radius:0 6px 6px 0; padding:3px 8px; margin-bottom:4px;
  font-size:12px; color:rgba(255,220,160,0.6);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* ── Score message ── */
.chat-msg[data-score] .chat-msg-text {
  background:linear-gradient(135deg, rgba(255,200,0,0.12), rgba(255,100,0,0.12));
  border:1px solid rgba(255,200,0,0.2); border-radius:8px;
  padding:6px 10px; font-weight:700; text-align:center;
}

/* ── Chat mute indicator ── */
/* (chat-channel-btn removed — replaced by chat-list-item) */

/* ============================================================ */
/* SOCIAL TRACES IN THE FIRE — issue #73                        */
/* ============================================================ */

/* --- 1.2 Floating emoji from DM --- */
.social-floating-emoji {
  position: absolute;
  left: 50%;
  bottom: 35%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-game-ui, 100);
  filter: drop-shadow(0 0 8px rgba(255,200,50,0.6));
  will-change: transform, opacity;
}
.social-floating-emoji.animate {
  animation: socialEmojiFloat 5s ease-out forwards;
}
@keyframes socialEmojiFloat {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.5); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.1); }
  15%  { transform: translateX(-50%) translateY(-15px) scale(1); }
  80%  { opacity: 0.9; transform: translateX(-50%) translateY(-80px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-120px) scale(0.8); }
}

/* --- 1.3 Golden halo on record --- */
/* .record-halo is a flag class on #fireCanvas.
   The golden glow is composited inline by fire.js renderFire()
   (appends pulsing gold box-shadow layers when class is present).
   No CSS animation here — avoids conflict with fire.js inline box-shadow. */

/* --- 1.4 Surpass arrow --- */
.social-surpass-arrow {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translateX(-50%);
  font-size: 2.8rem;
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-game-ui, 100);
  filter: drop-shadow(0 0 12px rgba(255,80,0,0.7));
  will-change: transform, opacity;
}
.social-surpass-arrow.animate {
  animation: socialSurpassFly 2s ease-in forwards;
}
@keyframes socialSurpassFly {
  0%   { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.6); }
  10%  { opacity: 1; transform: translateX(-50%) translateY(-10px) scale(1.2); }
  20%  { transform: translateX(-50%) translateY(-30px) scale(1); }
  70%  { opacity: 0.9; transform: translateX(-50%) translateY(-150px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-250px) scale(0.5); }
}

/* ============================================================
   FIRE ORBITS — Phase 2 social traces (#73)
   Envelopes (💌), swords (⚔️), gifts (🎁) orbiting the fire
   ============================================================ */

.fire-orbit-container {
  position: fixed; inset: 0;
  z-index: var(--z-fire-orbits, 10);
  pointer-events: none;
  overflow: hidden;
}

.fire-orbit-item {
  position: fixed; top: 0; left: 0;
  pointer-events: all;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.3));
  transition: filter 0.2s;
}
.fire-orbit-item:active {
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.7)) brightness(1.3);
  transform: scale(1.15) !important;
}

/* Envelope — subtle white/pink glow */
.fire-orbit-item.envelope {
  filter: drop-shadow(0 0 8px rgba(255,180,200,0.6)) drop-shadow(0 0 16px rgba(255,100,150,0.25));
  animation: orbitEnvelopeGlow 3s ease-in-out infinite;
}
@keyframes orbitEnvelopeGlow {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255,180,200,0.6)) drop-shadow(0 0 16px rgba(255,100,150,0.25)); }
  50%      { filter: drop-shadow(0 0 12px rgba(255,200,220,0.8)) drop-shadow(0 0 24px rgba(255,100,150,0.4)); }
}

/* Sword — pulsing red glow + scale */
.fire-orbit-item.sword {
  filter: drop-shadow(0 0 8px rgba(255,80,40,0.6)) drop-shadow(0 0 16px rgba(255,40,0,0.3));
  animation: orbitSwordPulse 2s ease-in-out infinite;
}
@keyframes orbitSwordPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255,80,40,0.6)) drop-shadow(0 0 16px rgba(255,40,0,0.3)); }
  50%      { transform: scale(1.2); filter: drop-shadow(0 0 14px rgba(255,100,50,0.9)) drop-shadow(0 0 28px rgba(255,50,0,0.5)); }
}

/* Gift — bounce entrance */
.fire-orbit-item.gift {
  filter: drop-shadow(0 0 8px rgba(255,220,100,0.6)) drop-shadow(0 0 16px rgba(255,180,0,0.3));
  animation: orbitGiftShimmer 2.5s ease-in-out infinite;
}
@keyframes orbitGiftShimmer {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255,220,100,0.6)) drop-shadow(0 0 16px rgba(255,180,0,0.3)); }
  50%      { filter: drop-shadow(0 0 14px rgba(255,240,140,0.9)) drop-shadow(0 0 22px rgba(255,200,50,0.5)); }
}

/* Trail — small fading dot behind orbit items */
.fire-orbit-trail {
  position: fixed; top: 0; left: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.fire-orbit-trail.envelope {
  background: radial-gradient(circle, rgba(255,180,200,0.7), rgba(255,100,150,0) 70%);
  width: 10px; height: 10px;
}
.fire-orbit-trail.sword {
  background: radial-gradient(circle, rgba(255,80,40,0.7), rgba(255,40,0,0) 70%);
  width: 10px; height: 10px;
}
.fire-orbit-trail.gift {
  background: radial-gradient(circle, rgba(255,220,100,0.7), rgba(255,180,0,0) 70%);
  width: 12px; height: 12px;
}

/* ---- Etincelle balance in profile menu ---- */

/* ============================================================
   FIRE JOURNAL — Book overlay (issue #73 Phase 4)
   ============================================================ */

.journal-overlay {
  position: fixed; inset: 0; z-index: var(--z-journal, 310);
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.journal-overlay.visible { opacity: 1; pointer-events: auto; }

.journal-book {
  width: min(440px, calc(100% - 24px));
  max-height: calc(100dvh - 40px);
  border-radius: 24px;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: linear-gradient(165deg,
    #1a0e04 0%,
    #2a1508 15%,
    #1f0f03 40%,
    #251206 70%,
    #1a0a02 100%);
  border: 1.5px solid rgba(255,180,80,0.2);
  box-shadow:
    0 0 60px rgba(255,120,0,0.12),
    0 24px 48px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,200,100,0.08);
  animation: journalBookIn 0.35s cubic-bezier(.34,1.56,.64,1);
  contain: layout;
}

@keyframes journalBookIn {
  from { transform: scale(0.85) translateY(30px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ── Header ── */
.journal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid rgba(255,180,80,0.1);
}
.journal-header-left { display: flex; align-items: center; gap: 8px; }
.journal-book-icon { font-size: 28px; filter: drop-shadow(0 0 8px rgba(255,180,80,0.4)); }
.journal-title {
  font-family: 'Cinzel', 'Fredoka One', serif;
  font-size: 20px; font-weight: 700;
  color: #ffd090;
  text-shadow: 0 0 12px rgba(255,180,80,0.3);
}
.journal-header-right { display: flex; gap: 6px; }
.journal-header-right button {
  border: none; background: rgba(255,255,255,0.06);
  border-radius: 10px; width: 36px; height: 36px;
  font-size: 16px; cursor: pointer;
  color: rgba(255,220,160,0.7);
  transition: background 0.15s;
}
.journal-header-right button:hover { background: rgba(255,255,255,0.12); }
.journal-btn-close { font-family: sans-serif; font-size: 18px; font-weight: 700; }

/* ── Search ── */
.journal-search-bar { padding: 0 16px 8px; }
.journal-search-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px;
  border: 1px solid rgba(255,180,80,0.15);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: #fff; font-size: 14px;
  font-family: Nunito, sans-serif;
  outline: none;
}
.journal-search-input::placeholder { color: rgba(255,220,160,0.35); }
.journal-search-input:focus { border-color: rgba(255,180,80,0.35); }

/* ── Filter chips ── */
.journal-filters { padding: 4px 16px 8px; }
.journal-filter-row {
  display: flex; gap: 6px; overflow-x: auto;
  scrollbar-width: none; -ms-overflow-style: none;
  padding-bottom: 6px;
}
.journal-filter-row::-webkit-scrollbar { display: none; }

.journal-chip, .journal-period-chip {
  border: none; border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 700;
  font-family: Nunito, sans-serif;
  white-space: nowrap; cursor: pointer;
  background: rgba(255,255,255,0.06);
  color: rgba(255,220,160,0.6);
  transition: all 0.15s;
  flex-shrink: 0;
}
.journal-chip.active, .journal-period-chip.active {
  background: rgba(255,160,40,0.2);
  color: #ffc060;
  box-shadow: 0 0 8px rgba(255,160,40,0.15);
}

/* ── Entry list ── */
.journal-list {
  flex: 1; overflow-y: auto;
  padding: 8px 12px;
  contain: layout paint;
}
.journal-list::-webkit-scrollbar { width: 4px; }
.journal-list::-webkit-scrollbar-thumb {
  background: rgba(255,180,80,0.2); border-radius: 4px;
}

.journal-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,180,80,0.06);
  transition: background 0.15s;
}
.journal-entry:active { background: rgba(255,180,80,0.08); }

.journal-sealed {
  border-color: rgba(255,200,80,0.15);
  background: linear-gradient(135deg, rgba(255,200,80,0.04), rgba(255,160,40,0.02));
}

.journal-entry-emoji {
  font-size: 26px; flex-shrink: 0;
  width: 36px; text-align: center;
  filter: drop-shadow(0 0 4px rgba(255,180,80,0.2));
}

.journal-entry-body { flex: 1; min-width: 0; }
.journal-entry-title {
  font-size: 14px; font-weight: 600;
  color: rgba(255,240,220,0.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: Nunito, sans-serif;
}
.journal-entry-game { font-size: 13px; }
.journal-entry-date {
  font-size: 11px; color: rgba(255,220,160,0.4);
  margin-top: 2px; font-family: Nunito, sans-serif;
}

.journal-entry-seal {
  font-size: 18px; flex-shrink: 0;
  animation: sealGlow 2s ease-in-out infinite alternate;
}
.journal-entry-noseal {
  width: 18px; flex-shrink: 0;
}

@keyframes sealGlow {
  from { filter: drop-shadow(0 0 4px rgba(255,200,80,0.3)); }
  to   { filter: drop-shadow(0 0 10px rgba(255,200,80,0.6)); }
}

/* ── Empty state ── */
.journal-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px 20px; gap: 12px;
}
.journal-empty-emoji { font-size: 48px; opacity: 0.5; }
.journal-empty-text {
  font-size: 14px; color: rgba(255,220,160,0.4);
  text-align: center; max-width: 240px; line-height: 1.5;
  font-family: Nunito, sans-serif;
}

/* ── Footer ── */
.journal-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(255,180,80,0.08);
  display: flex; flex-direction: column; gap: 6px;
}
.journal-footer-stats {
  font-size: 12px; color: rgba(255,220,160,0.4);
  font-family: Nunito, sans-serif;
}
.journal-cloud-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: rgba(255,220,160,0.6);
  cursor: pointer; font-family: Nunito, sans-serif;
}
.journal-cloud-toggle input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: #ff9020;
}
.journal-footer-seal {
  font-size: 10px; color: rgba(255,180,80,0.25);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}
