:root {
  --bg-0: #04030a;
  --bg-1: #0d1023;
  --bg-2: #091b1f;
  --panel: rgba(11, 14, 28, 0.88);
  --panel-border: rgba(110, 255, 236, 0.28);
  --text: #eef5ff;
  --muted: #9fb3c7;
  --accent-cyan: #5ff7ff;
  --accent-pink: #ff5ea8;
  --accent-lime: #d9ff63;
  --danger: #ff7c8f;
  --shadow-neon: 0 0 0 1px rgba(95, 247, 255, 0.15), 0 0 24px rgba(95, 247, 255, 0.18), 0 0 42px rgba(255, 94, 168, 0.12);
  --radius: 16px;
  --hud-gap: 12px;
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-right: max(12px, env(safe-area-inset-right));
  --safe-bottom: max(12px, env(safe-area-inset-bottom));
  --safe-left: max(12px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background: #05070f;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#starfield {
  display: none;
}

.top-bar {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  right: calc(var(--safe-right) + 76px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 40;
  pointer-events: none;
}

.brand-pill,
.coord-pill {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(11,14,28,0.82), rgba(7,10,20,0.92));
  border: 1px solid rgba(95,247,255,0.18);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow-neon);
  backdrop-filter: blur(14px);
}

.brand-pill {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 70%;
}

.brand-title {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  color: var(--accent-cyan);
  text-shadow: 0 0 14px rgba(95,247,255,0.45);
}

.brand-sub,
.coord-pill {
  color: var(--muted);
  font-size: 0.78rem;
}

.coord-pill {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

#viewport.dragging {
  cursor: grabbing;
}

#world {
  position: absolute;
  left: 0;
  top: 0;
  width: 5000px;
  height: 5000px;
  transform-origin: 0 0;
  will-change: transform;
}

#worldGrid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(95,247,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95,247,255,0.05) 1px, transparent 1px),
    linear-gradient(rgba(255,94,168,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,94,168,0.08) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(95,247,255,0.06), rgba(0,0,0,0.15) 55%, rgba(0,0,0,0.45));
  background-size: 40px 40px, 40px 40px, 200px 200px, 200px 200px, 100% 100%;
  border: 1px solid rgba(95,247,255,0.14);
  box-shadow: inset 0 0 40px rgba(95,247,255,0.08), inset 0 0 80px rgba(255,94,168,0.05);
}

#worldGrid::before,
#worldGrid::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#worldGrid::before {
  background: radial-gradient(circle at 25% 15%, rgba(95,247,255,0.08), transparent 45%),
              radial-gradient(circle at 75% 80%, rgba(255,94,168,0.08), transparent 45%);
}

#worldGrid::after {
  background-image:
    radial-gradient(circle, rgba(217,255,99,0.7) 0 1px, transparent 1px);
  background-size: 250px 250px;
  background-position: 125px 125px;
  opacity: 0.18;
}

/* Lightweight board surface override: remove expensive dense grid layers */
#worldGrid,
body.zoom-far #worldGrid,
body.zoom-ultra #worldGrid {
  background:
    radial-gradient(1200px 900px at 14% 16%, rgba(73, 242, 255, 0.12), transparent 58%),
    radial-gradient(1000px 800px at 84% 24%, rgba(255, 87, 170, 0.11), transparent 60%),
    radial-gradient(1200px 1000px at 52% 76%, rgba(157, 110, 255, 0.09), transparent 62%),
    radial-gradient(circle at 13% 61%, rgba(255,255,255,0.08) 0 1px, transparent 1.8px),
    radial-gradient(circle at 72% 44%, rgba(255,255,255,0.06) 0 1px, transparent 1.7px),
    radial-gradient(circle at 41% 29%, rgba(95,247,255,0.09) 0 1px, transparent 1.8px),
    radial-gradient(circle at 89% 76%, rgba(255,94,168,0.08) 0 1px, transparent 1.8px),
    radial-gradient(circle at 22% 88%, rgba(217,255,99,0.07) 0 1px, transparent 1.8px),
    linear-gradient(180deg, #040711, #070b18 48%, #03050d);
  background-size: 100% 100%, 100% 100%, 100% 100%, 420px 420px, 520px 520px, 620px 620px, 700px 700px, 860px 860px, 100% 100%;
  background-position: center, center, center, 0 0, 130px 70px, 210px 140px, 60px 240px, 300px 20px, center;
  border: 1px solid rgba(95,247,255,0.06);
  box-shadow: inset 0 0 42px rgba(95,247,255,0.035), inset 0 0 90px rgba(255,94,168,0.02);
}

#worldGrid::before,
#worldGrid::after,
body.zoom-far #worldGrid::before,
body.zoom-far #worldGrid::after,
body.zoom-ultra #worldGrid::before,
body.zoom-ultra #worldGrid::after {
  display: none !important;
}

body.zoom-far #worldGrid {
  border-color: rgba(95,247,255,0.05);
  box-shadow: inset 0 0 20px rgba(95,247,255,0.02);
  filter: saturate(0.95);
}

body.zoom-ultra #worldGrid {
  border-color: rgba(95,247,255,0.035);
  box-shadow: none;
  filter: saturate(0.88) brightness(0.96);
}

body.zoom-ultra #worldGrid::before,
body.zoom-ultra #worldGrid::after {
  display: none;
}

#notesLayer {
  position: absolute;
  inset: 0;
  contain: layout paint style;
}

#placementMarker {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent-lime);
  box-shadow: 0 0 18px rgba(217,255,99,0.7), inset 0 0 12px rgba(217,255,99,0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

#placementMarker::before,
#placementMarker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(217,255,99,0.65);
  transform: translate(-50%, -50%);
}

#placementMarker::before { width: 1px; height: 26px; }
#placementMarker::after { width: 26px; height: 1px; }

.placement-action {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-100% - 14px));
  z-index: 34;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(217,255,99,0.42);
  background: linear-gradient(180deg, rgba(18,24,10,0.92), rgba(12,16,8,0.95));
  color: var(--accent-lime);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(217,255,99,0.14), 0 8px 18px rgba(0,0,0,0.28);
  cursor: pointer;
  white-space: nowrap;
}

.placement-action:hover {
  border-color: rgba(217,255,99,0.62);
  transform: translate(-50%, calc(-100% - 15px));
}

.placement-action:active {
  transform: translate(-50%, calc(-100% - 13px));
}

.note {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 120px;
  max-width: 260px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(95,247,255,0.22);
  background: linear-gradient(180deg, rgba(8,12,24,0.85), rgba(9,11,20,0.94));
  box-shadow: 0 8px 22px rgba(0,0,0,0.35), 0 0 22px rgba(95,247,255,0.08);
  color: var(--text);
  pointer-events: auto;
  contain: layout paint style;
}

.note::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(95,247,255,0.05), transparent 45%, rgba(255,94,168,0.05));
}

.note.note-text {
  padding: 10px 12px 8px;
}

.note-text .note-content {
  margin: 0 0 8px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.25;
  font-size: 0.88rem;
}

.note.note-image {
  width: min(260px, max(140px, calc(160px + 4vw)));
}

.note-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  background: rgba(255,255,255,0.03);
}

.note-caption {
  margin: 0;
  padding: 8px 10px 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-image .note-caption {
  border-top: 1px solid rgba(95,247,255,0.12);
  background: rgba(4, 7, 15, 0.35);
}

.note-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.92;
  box-shadow: 0 0 8px rgba(95,247,255,0.16);
  border: 1px solid rgba(255,255,255,0.12);
}

.note-dot.note-dot-text {
  background: rgba(95,247,255,0.95);
}

.note-dot.note-dot-image {
  background: rgba(255,94,168,0.95);
  border-radius: 3px;
}

.note-dot.is-compact {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.16);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  background: rgba(8,10,18,0.85);
  pointer-events: none;
  box-shadow: none;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.67rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

.note-meta-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.note-author {
  color: var(--accent-cyan);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-username {
  color: rgba(255,94,168,0.9);
}

.note-image .note-meta {
  padding: 8px 10px;
  border-top: 1px solid rgba(95,247,255,0.14);
  background: rgba(4, 7, 15, 0.72);
}

.note-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(217,255,99,0.3);
  color: var(--accent-lime);
  padding: 2px 6px;
  font-size: 0.6rem;
}

.empty-hint {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + 72px);
  transform: translateX(-50%);
  z-index: 30;
  background: rgba(8,10,18,0.85);
  border: 1px solid rgba(95,247,255,0.2);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  box-shadow: var(--shadow-neon);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.zoom-controls {
  position: absolute;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: grid;
  gap: 8px;
  z-index: 45;
}

.hud-btn,
.icon-btn,
.primary-btn,
.ghost-btn,
.lang-btn,
.composer-tab {
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border: 1px solid rgba(95,247,255,0.22);
  background: linear-gradient(180deg, rgba(12,16,30,0.85), rgba(7,9,16,0.95));
  box-shadow: 0 4px 18px rgba(0,0,0,0.25), 0 0 18px rgba(95,247,255,0.08);
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.hud-btn:hover,
.icon-btn:hover,
.primary-btn:hover,
.ghost-btn:hover,
.lang-btn:hover,
.composer-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(95,247,255,0.38);
}

.hud-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.15rem;
  font-family: "Orbitron", sans-serif;
}

.profile-fab {
  position: absolute;
  top: var(--safe-top);
  right: var(--safe-right);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: transparent;
  padding: 0;
  z-index: 60;
  cursor: pointer;
}

.fab-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 120deg, rgba(95,247,255,0.95), rgba(255,94,168,0.8), rgba(217,255,99,0.75), rgba(95,247,255,0.95));
  box-shadow: 0 0 22px rgba(95,247,255,0.35), 0 0 34px rgba(255,94,168,0.18);
  animation: spin 8s linear infinite;
}

body.perf-dragging .fab-ring {
  animation: none;
}

body.perf-dragging #starfield {
  opacity: 0.32;
}

body.perf-dragging #worldGrid::before,
body.perf-dragging #worldGrid::after {
  opacity: 0.02;
}

body.perf-dragging .placement-action {
  transform: translate(-50%, calc(-100% - 12px));
}

body.perf-dragging #worldGrid {
  filter: saturate(0.9);
}

body.perf-dragging .note {
  box-shadow: none;
}

body.zoom-far .note-dot {
  width: 10px;
  height: 10px;
  box-shadow: none;
  border-color: rgba(255,255,255,0.18);
}

body.zoom-ultra .note-dot {
  opacity: 0.9;
  width: 12px;
  height: 12px;
  border-width: 1px;
  border-color: rgba(255,255,255,0.24);
}

body.zoom-ultra .note-dot.note-dot-text {
  background: rgba(95,247,255,0.75);
}

body.zoom-ultra .note-dot.note-dot-image {
  background: rgba(255,94,168,0.8);
}

.profile-fab::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(7,10,19,0.95), rgba(10,13,22,0.95));
  border: 1px solid rgba(95,247,255,0.15);
}

.fab-avatar {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  color: var(--text);
  z-index: 2;
  text-transform: uppercase;
}

.fab-status-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  right: 1px;
  bottom: 1px;
  border-radius: 50%;
  background: #6b7280;
  border: 2px solid rgba(7,10,19,0.95);
  z-index: 3;
}

.fab-status-dot.online {
  background: var(--accent-lime);
  box-shadow: 0 0 12px rgba(217,255,99,0.8);
}

.menu-panel {
  position: absolute;
  top: calc(var(--safe-top) + 72px);
  right: var(--safe-right);
  width: min(380px, calc(100vw - var(--safe-left) - var(--safe-right)));
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 84px);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 84px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  z-index: 55;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(10, 14, 30, 0.94), rgba(8, 11, 24, 0.98));
  box-shadow: 0 20px 60px rgba(0,0,0,0.45), 0 0 50px rgba(95,247,255,0.08), 0 0 70px rgba(255,94,168,0.06);
  backdrop-filter: blur(16px);
  padding: 14px;
  padding-bottom: calc(14px + var(--safe-bottom));
  transform-origin: top right;
  transform: scale(0.94) translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

.menu-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.menu-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 0%, rgba(95,247,255,0.08), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(255,94,168,0.08), transparent 45%);
  border-radius: inherit;
}

.menu-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(9,12,23,0.98), rgba(9,12,23,0.9));
  padding: 8px 6px 10px;
  border-bottom: 1px solid rgba(95,247,255,0.08);
}

.menu-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-title {
  margin: 2px 0 0;
  font-family: "Orbitron", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
}

.panel-section {
  position: relative;
  border-radius: 14px;
  border: 1px solid rgba(95,247,255,0.1);
  background: rgba(7, 10, 19, 0.55);
  padding: 12px;
  margin-bottom: 10px;
}

.panel-section.compact {
  margin-bottom: 0;
}

.section-title {
  color: var(--accent-lime);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.section-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 8px 0 0;
  line-height: 1.35;
}

.user-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(95,247,255,0.2), rgba(255,94,168,0.18));
  border: 1px solid rgba(95,247,255,0.22);
  font-family: "Orbitron", sans-serif;
}

.user-name {
  font-weight: 700;
  line-height: 1.2;
}

.user-sub {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  word-break: break-word;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 600;
}

.primary-btn {
  background: linear-gradient(135deg, rgba(95,247,255,0.18), rgba(255,94,168,0.16));
  border-color: rgba(95,247,255,0.3);
}

.ghost-btn {
  background: rgba(255,255,255,0.02);
}

.lang-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lang-btn {
  border-radius: 10px;
  padding: 8px 0;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.lang-btn.active {
  border-color: rgba(217,255,99,0.5);
  color: var(--accent-lime);
  box-shadow: 0 0 20px rgba(217,255,99,0.12);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-box {
  border-radius: 12px;
  border: 1px solid rgba(95,247,255,0.1);
  background: rgba(255,255,255,0.015);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.stat-box strong {
  font-family: "Orbitron", sans-serif;
  color: var(--text);
  font-size: 0.95rem;
}

.info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
}

.tg-link {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-cyan);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid rgba(95,247,255,0.22);
  padding: 8px 12px;
  background: rgba(255,255,255,0.015);
}

.tg-link:hover {
  border-color: rgba(95,247,255,0.35);
}

.tg-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.control-legend {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.composer-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(2, 4, 9, 0.55);
  backdrop-filter: blur(6px);
  padding: 20px;
}

.composer-card {
  width: min(560px, 100%);
  border-radius: 20px;
  border: 1px solid rgba(95,247,255,0.22);
  background:
    linear-gradient(180deg, rgba(9,12,23,0.96), rgba(7,9,16,0.98));
  box-shadow: 0 18px 60px rgba(0,0,0,0.45), 0 0 48px rgba(95,247,255,0.08);
  padding: 14px;
}

.composer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.composer-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#composerTitle {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-family: "Orbitron", sans-serif;
}

.composer-coords {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.composer-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.composer-tab {
  border-radius: 12px;
  padding: 9px 12px;
  text-align: center;
  font-weight: 700;
}

.composer-tab.active {
  border-color: rgba(95,247,255,0.4);
  background: linear-gradient(135deg, rgba(95,247,255,0.12), rgba(255,94,168,0.1));
}

.composer-form {
  margin-top: 12px;
}

.composer-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.composer-field > span {
  color: var(--muted);
  font-size: 0.85rem;
}

.composer-field textarea,
.composer-field input[type="file"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(95,247,255,0.18);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}

.composer-field textarea:focus,
.composer-field input[type="file"]:focus {
  border-color: rgba(95,247,255,0.35);
  box-shadow: 0 0 0 3px rgba(95,247,255,0.08);
}

.composer-field small {
  color: var(--muted);
  font-size: 0.75rem;
}

.composer-note {
  color: var(--accent-lime);
  font-size: 0.82rem;
  min-height: 1.2em;
}

.composer-error {
  border-radius: 12px;
  border: 1px solid rgba(255,124,143,0.35);
  background: rgba(255,124,143,0.08);
  color: #ffd3da;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 0.82rem;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.toast-stack {
  position: absolute;
  left: var(--safe-left);
  bottom: var(--safe-bottom);
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - var(--safe-left) - var(--safe-right) - 68px));
}

.toast {
  border-radius: 12px;
  border: 1px solid rgba(95,247,255,0.2);
  background: rgba(7, 10, 19, 0.92);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 0 24px rgba(95,247,255,0.07);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.85rem;
}

.toast.error {
  border-color: rgba(255,124,143,0.35);
}

.toast.success {
  border-color: rgba(217,255,99,0.35);
}

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

@media (max-width: 900px) {
  .top-bar {
    right: calc(var(--safe-right) + 66px);
  }

  .coord-pill {
    display: none;
  }

  .menu-panel {
    top: calc(var(--safe-top) + 68px);
    width: min(380px, calc(100vw - var(--safe-left) - var(--safe-right)));
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 76px);
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 76px);
  }
}

@media (max-width: 640px) {
  .brand-pill {
    padding: 9px 12px;
    gap: 8px;
  }

  .brand-title {
    font-size: 0.85rem;
  }

  .brand-sub {
    font-size: 0.7rem;
  }

  .profile-fab {
    width: 54px;
    height: 54px;
  }

  .zoom-controls {
    gap: 6px;
  }

  .hud-btn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .menu-panel {
    width: calc(100vw - var(--safe-left) - var(--safe-right));
    right: var(--safe-right);
    border-radius: 18px;
    padding: 12px;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .toast-stack {
    width: calc(100vw - var(--safe-left) - var(--safe-right));
  }

  .note {
    max-width: 220px;
  }

  .composer-overlay {
    padding: 14px;
    align-items: end;
  }

  .composer-card {
    border-radius: 18px;
    max-height: min(86vh, 720px);
    overflow: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .profile-fab .fab-ring {
    animation: none;
  }

  .menu-panel,
  .hud-btn,
  .icon-btn,
  .primary-btn,
  .ghost-btn,
  .lang-btn,
  .composer-tab {
    transition: none;
  }
}
