/* ═══════════════════════════════════════════════════════════
   NORMIE MAP - Normies World Map
   Dark monochrome aesthetic inspired by normies.art

   Z-INDEX MAP
   ───────────────────
   3000  Globe loading overlay
   2000  Tooltip (pointer-events:none)
   1500  Toast notifications
   1000  Topbar, Footer
    800  Info card
    700  Normchat panel (when open)
    650  Heatmap/Random FABs
    600  FABs, Radio player
    500  Side panel (Place Normie)
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES ──────────────────────────────────────── */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --bg-card: #141414;
  --bg-hover: #1e1e1e;

  --text-primary: #e3e5e4;
  --text-secondary: #8a8a8a;
  --text-muted: #555555;

  --accent: #e3e5e4;
  --accent-dim: #48494b;

  --border: #2a2a2a;
  --border-hover: #3a3a3a;

  --normie-dark: #48494b;
  --normie-light: #e3e5e4;

  --danger: #e74c3c;
  --success: #27ae60;
  --traveling: #e67e22;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --topbar-h: 56px;
  --footer-h: 48px;
  --panel-w: 380px;
}

/* ─── RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.7; }

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes markerDrop {
  0% { opacity: 0; transform: scale(0.3) translateY(-30px); }
  50% { opacity: 1; transform: scale(1.15) translateY(2px); }
  70% { transform: scale(0.95) translateY(-1px); }
  100% { transform: scale(1) translateY(0); }
}

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

@keyframes reactionPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ─── TOP BAR ────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 100%;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  width: 34px;
  height: 34px;
  border-radius: 4px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-primary);
}

.topbar-stats {
  display: flex;
  align-items: center;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

/* Stats ticker */
.stats-ticker {
  display: inline-flex;
  position: relative;
  min-width: 100px;
}
.stats-ticker-item {
  display: none;
  white-space: nowrap;
}
.stats-ticker-item.active {
  display: inline;
  animation: tickerSlide 0.4s ease;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ─── TOPBAR SEARCH ─────────────────────────────────────── */
.topbar-search {
  display: flex;
  align-items: center;
}

.search-box {
  display: flex;
  align-items: center;
  height: 34px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0 4px 0 12px;
  transition: border-color 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent-dim);
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-input {
  width: 80px;
  height: 100%;
  padding: 0 8px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-main);
  -moz-appearance: textfield;
}
.search-input::-webkit-outer-spin-button,
.search-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.search-input::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.search-go {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  background: var(--bg-hover);
  border: none;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.search-go:hover {
  background: var(--accent-dim);
  color: var(--text-primary);
}

/* ─── TOAST NOTIFICATION ────────────────────────────────── */
.toast {
  position: fixed;
  top: calc(var(--topbar-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 20px;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 1500;
  white-space: nowrap;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease forwards;
}
.toast.toast-error {
  border-color: rgba(231, 76, 60, 0.4);
  color: var(--danger);
}
.toast.toast-success {
  border-color: rgba(39, 174, 96, 0.4);
  color: var(--success);
}

/* ─── FILTER BUTTONS ─────────────────────────────────────── */
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
}
.filter-btn.active {
  background: var(--bg-tertiary);
  border-color: var(--accent-dim);
  color: var(--text-primary);
}

.filter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.filter-dot.resident { background: var(--success); }
.filter-dot.traveling { background: var(--traveling); }

/* ─── MAIN LAYOUT ────────────────────────────────────────── */
.main {
  position: relative;
  width: 100%;
  height: 100vh;
  padding-top: var(--topbar-h);
  overflow: hidden;
}

#globeContainer {
  width: 100%;
  height: 100%;
}

/* ─── FAB TOGGLE (right — Place Your Normie) ─────────────── */
.fab-toggle {
  position: fixed;
  bottom: calc(var(--footer-h) + 24px);
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  z-index: 600;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.25s;
}
.fab-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
}
.fab-toggle.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ─── FAB LEFT (Normchat) ──────────────────────────────── */
.fab-left {
  position: fixed;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  z-index: 600;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.25s;
}
.fab-left:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
}
.fab-left.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.fab-normchat {
  bottom: calc(var(--footer-h) + 80px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.fab-normchat:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.fab-heatmap {
  bottom: calc(var(--footer-h) + 136px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.fab-heatmap:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}
.fab-heatmap.active {
  background: rgba(230, 126, 34, 0.15);
  border-color: rgba(230, 126, 34, 0.4);
  color: var(--traveling);
}

.fab-random {
  bottom: calc(var(--footer-h) + 192px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.fab-random:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

/* ─── SIDE PANEL (right — Place Normie) ──────────────────── */
.panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  width: var(--panel-w);
  height: calc(100vh - var(--topbar-h) - var(--footer-h));
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--border);
  z-index: 500;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel.collapsed {
  transform: translateX(var(--panel-w));
}

.panel-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s, background 0.2s;
}
.panel-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.panel-content {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── PANEL SECTIONS ─────────────────────────────────────── */
.panel-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── INPUTS ─────────────────────────────────────────────── */
.input-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.input-field {
  flex: 1;
  height: 42px;
  padding: 0 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus { border-color: var(--accent-dim); }

/* Remove number spinners */
.input-field[type="number"]::-webkit-outer-spin-button,
.input-field[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-field[type="number"] { -moz-appearance: textfield; }

/* ─── STATUS TOGGLE (Resident / Traveling) ───────────────── */
.status-toggle {
  display: flex;
  gap: 8px;
}

.status-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
}
.status-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-secondary);
  background: var(--bg-hover);
}
.status-btn.active[data-status="resident"] {
  background: rgba(39, 174, 96, 0.1);
  border-color: rgba(39, 174, 96, 0.4);
  color: var(--success);
}
.status-btn.active[data-status="traveling"] {
  background: rgba(230, 126, 34, 0.1);
  border-color: rgba(230, 126, 34, 0.4);
  color: var(--traveling);
}

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 15px;
  height: 46px;
  border-radius: var(--radius-md);
  letter-spacing: 0.5px;
}
.btn-primary:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(227, 229, 228, 0.15);
}
.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0 14px;
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-danger {
  width: 100%;
  height: 38px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
  font-size: 13px;
}
.btn-danger:hover {
  background: rgba(231, 76, 60, 0.1);
  border-color: var(--danger);
}

/* ─── NORMIE PREVIEW ─────────────────────────────────────── */
.normie-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  animation: fadeIn 0.3s ease;
}

.normie-preview img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--normie-light);
}

.normie-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.normie-name {
  font-size: 15px;
  font-weight: 700;
}

.normie-traits {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── LOCATION RESULTS ───────────────────────────────────── */
.location-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.location-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-bottom: 1px solid var(--border);
}
.location-item:last-child { border-bottom: none; }
.location-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ─── SELECTED LOCATION ──────────────────────────────────── */
.selected-location {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(39, 174, 96, 0.08);
  border: 1px solid rgba(39, 174, 96, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  animation: fadeIn 0.3s ease;
}

.hint-text {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* ─── STATUS & ERRORS ────────────────────────────────────── */
.error-msg {
  padding: 10px 14px;
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--danger);
}

.status-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  animation: fadeIn 0.3s ease;
}
.status-msg.success {
  background: rgba(39, 174, 96, 0.08);
  border: 1px solid rgba(39, 174, 96, 0.25);
  color: var(--success);
}
.status-msg.error {
  background: rgba(231, 76, 60, 0.08);
  border: 1px solid rgba(231, 76, 60, 0.25);
  color: var(--danger);
}

/* ─── TOOLTIP ────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.15s ease;
}

.tooltip-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--normie-light);
}

.tooltip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tooltip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.tooltip-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tooltip-status.resident { color: var(--success); }
.tooltip-status.traveling { color: var(--traveling); }

.tooltip-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.tooltip-coords {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── INFO CARD (click on marker) ────────────────────────── */
.info-card {
  position: fixed;
  bottom: calc(var(--footer-h) + 20px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  z-index: 800;
  max-width: 420px;
  animation: fadeIn 0.25s ease;
}

.info-card-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.info-card-close:hover { color: var(--text-primary); }

.info-card-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--normie-light);
  flex-shrink: 0;
}

.info-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-right: 16px;
}

.info-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.info-card-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-card-status.resident { color: var(--success); }
.info-card-status.traveling { color: var(--traveling); }

.info-card-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.info-card-twitter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  width: fit-content;
  transition: background 0.2s, border-color 0.2s;
}
.info-card-twitter:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  opacity: 1;
}

.info-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card-country {
  font-size: 11px;
  color: var(--text-secondary);
}

.info-card-coords {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── RADIO PLAYER ──────────────────────────────────────── */
.radio-player {
  position: fixed;
  bottom: calc(var(--footer-h) + 24px);
  left: 24px;
  z-index: 600;
  display: flex;
  align-items: center;
  transition: opacity 0.25s;
}

.radio-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  z-index: 2;
}
.radio-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.radio-toggle.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.radio-controls {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 14px 6px 10px;
  margin-left: -6px;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 0 100px 100px 0;
  animation: fadeIn 0.2s ease;
}
.radio-player.expanded .radio-controls {
  display: flex;
}

.radio-btn {
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.radio-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.radio-btn.radio-play {
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.radio-btn.radio-play:hover {
  border-color: var(--border-hover);
}

.radio-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 6px;
  min-width: 0;
  max-width: 120px;
}
.radio-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.radio-genre {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-live {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  font-size: 9px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.radio-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

/* ─── NORMCHAT PANEL (left side) ──────────────────────── */
.normchat-panel {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: var(--panel-w);
  height: calc(100vh - var(--topbar-h) - var(--footer-h));
  background: rgba(14, 14, 14, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
  z-index: 700;
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.normchat-panel.collapsed {
  transform: translateX(calc(-1 * var(--panel-w)));
}

.normchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
}
.normchat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}
.normchat-close {
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}
.normchat-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.normchat-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.normchat-body::-webkit-scrollbar { width: 4px; }
.normchat-body::-webkit-scrollbar-track { background: transparent; }
.normchat-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ─── CHAT MESSAGES ──────────────────────────────────────── */
.chat-message {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  animation: fadeIn 0.2s ease;
}
.chat-message:last-child { border-bottom: none; }

.chat-message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-nick {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.chat-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chat-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
}

/* ─── CHAT REACTIONS ────────────────────────────────────── */
.chat-reactions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.chat-reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  line-height: 1;
}
.chat-reaction-btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
  transform: scale(1.05);
}
.chat-reaction-btn.has-count {
  background: rgba(227, 229, 228, 0.08);
  border-color: rgba(227, 229, 228, 0.2);
}
.chat-reaction-btn .reaction-count {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.chat-reaction-btn.reacted {
  animation: reactionPop 0.3s ease;
}

/* ─── GM BADGE ──────────────────────────────────────────── */
.gm-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.25);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  letter-spacing: 0.5px;
  margin-left: 6px;
}

/* ─── CHAT INPUT BAR ─────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-nick-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-nick-row label {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.chat-nick-input {
  flex: 1;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}
.chat-nick-input::placeholder { color: var(--text-muted); }
.chat-nick-input:focus { border-color: var(--accent-dim); }

.chat-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-input {
  flex: 1;
  height: 38px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { border-color: var(--accent-dim); }

.chat-send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.chat-send-btn:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
}
.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-char-count {
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  font-family: var(--font-mono);
}
.chat-char-count.chat-char-warn { color: var(--traveling); }
.chat-char-count.chat-char-over { color: var(--danger); }

/* ─── CHAT PHOTO ATTACH ─────────────────────────────────── */
.chat-attach-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.chat-attach-btn:hover { color: var(--text-primary); border-color: var(--accent-dim); }

.chat-photo-preview {
  position: relative;
  display: inline-block;
  margin-bottom: 6px;
}
.chat-photo-preview img {
  max-height: 80px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.chat-photo-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px; height: 20px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-photo {
  margin-top: 6px;
}
.chat-photo img {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.2s;
}
.chat-photo img:hover { opacity: 0.85; }

/* ─── CHAT EMPTY STATE ───────────────────────────────────── */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
}
.chat-empty svg { opacity: 0.3; }
.chat-empty p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.chat-empty span { font-size: 11px; }

/* ─── GLOBE LOADING ──────────────────────────────────────── */
.globe-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-primary);
  z-index: 3000;
  transition: opacity 0.5s, visibility 0.5s;
}
.globe-loading.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.globe-loading p {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ─── FOOTER ─────────────────────────────────────────────── */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-h);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 1000;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-inner a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.footer-inner a:hover {
  color: var(--text-primary);
  opacity: 1;
}

/* ─── SCROLLBAR ──────────────────────────────────────────── */
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.panel::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

.location-results::-webkit-scrollbar { width: 4px; }
.location-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ─── UTILITY ────────────────────────────────────────────── */
.hidden:not(.globe-loading) {
  display: none !important;
}

/* ─── RESPONSIVE: TABLET & MOBILE ────────────────────────── */
@media (max-width: 768px) {
  :root {
    --panel-w: 100%;
  }

  /* Right FAB compact */
  .fab-toggle {
    bottom: calc(var(--footer-h) + 16px);
    right: 16px;
    padding: 12px 18px;
    font-size: 13px;
  }
  .fab-toggle span { display: none; }

  /* Side panel as bottom sheet */
  .panel {
    top: auto;
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateX(0) translateY(0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .panel.collapsed { transform: translateY(100%); }

  /* Topbar compact */
  .topbar-inner {
    padding: 0 12px;
    gap: 8px;
  }
  .topbar-stats { display: none; }
  .logo-text {
    font-size: 14px;
    letter-spacing: 2px;
  }
  .search-input { width: 56px; }
  .search-input::placeholder { font-size: 11px; }

  /* Filter pills compact */
  .filter-btn {
    padding: 4px 8px;
    font-size: 11px;
    gap: 3px;
  }
  .filter-group { gap: 4px; }

  /* Left FABs compact */
  .fab-left {
    left: 16px;
    padding: 12px;
    font-size: 12px;
  }
  .fab-left span { display: none; }
  .fab-normchat { bottom: calc(var(--footer-h) + 72px); }
  .fab-heatmap { bottom: calc(var(--footer-h) + 120px); }
  .fab-random { bottom: calc(var(--footer-h) + 168px); }

  /* Radio player compact */
  .radio-player {
    left: 16px;
    bottom: calc(var(--footer-h) + 16px);
  }
  .radio-toggle {
    width: 40px;
    height: 40px;
  }
  .radio-info { max-width: 90px; }

  /* Normchat panel as bottom sheet */
  .normchat-panel {
    top: auto;
    bottom: var(--footer-h);
    left: 0;
    right: 0;
    width: 100%;
    height: 85vh;
    border-right: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateX(0) translateY(0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .normchat-panel.collapsed { transform: translateY(100%); }
}

@media (max-width: 420px) {
  .topbar-inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
  }
  .topbar-inner::-webkit-scrollbar { display: none; }
  .topbar-logo {
    gap: 6px;
    flex-shrink: 0;
  }
  .logo-img { width: 28px; height: 28px; }
  .logo-text { font-size: 11px; letter-spacing: 1.5px; }
  .search-input { width: 44px; }
  .filter-group { flex-shrink: 0; }
  .filter-btn {
    padding: 4px 8px;
    font-size: 10px;
    white-space: nowrap;
  }
}
