:root,
[data-theme='dusk'] {
  --bg: #231A31;
  --bg-deep: #1a1226;
  --surface: #2e2342;
  --surface-2: #3a2d52;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f5f2fb;
  --muted: #a99ec0;
  --placeholder: #7d7194;
  --accent: #E42F45;
  --accent-deep: #B42B3F;
  --on-accent: #ffffff;
  --accent-shadow: rgba(228, 47, 69, 0.3);
  --me: #8AB2FF;
  --them: #E42F45;
  --link: #8AB2FF;
  --on-me: #1a1226;
  --switch-on: #E42F45;
  --error: #ff8d9b;
  --glass: rgba(35, 26, 49, 0.86);
  --shadow: rgba(0, 0, 0, 0.4);
  --map-bg: #1b1426;
  --glow-1: rgba(138, 178, 255, 0.34);
  --glow-2: rgba(228, 47, 69, 0.4);
  --hero-1: #2c2142;
  --hero-2: #231A31;
  --hero-muted: #c4b9d9;
  --dot: rgba(255, 255, 255, 0.08);
  --tile-filter: sepia(0.85) hue-rotate(205deg) saturate(1.1) brightness(1.15) contrast(0.95);
}

[data-theme='ocean'] {
  --bg: #0F1C33;
  --bg-deep: #0A1426;
  --surface: #172846;
  --surface-2: #213659;
  --line: rgba(190, 215, 255, 0.11);
  --text: #eef4ff;
  --muted: #9db0d1;
  --placeholder: #6b7fa3;
  --accent: #3A74F2;
  --accent-deep: #2457C9;
  --on-accent: #ffffff;
  --accent-shadow: rgba(58, 116, 242, 0.38);
  --me: #A9CCFF;
  --them: #3A74F2;
  --link: #8DB9FF;
  --on-me: #0a1426;
  --switch-on: #3A74F2;
  --error: #ff9aa8;
  --glass: rgba(15, 28, 51, 0.86);
  --shadow: rgba(0, 0, 0, 0.45);
  --map-bg: #0b1527;
  --glow-1: rgba(120, 200, 255, 0.3);
  --glow-2: rgba(58, 116, 242, 0.5);
  --hero-1: #17305a;
  --hero-2: #0F1C33;
  --hero-muted: #b4c6e6;
  --dot: rgba(190, 215, 255, 0.09);
  --tile-filter: sepia(0.9) hue-rotate(172deg) saturate(1.5) brightness(1.1) contrast(0.95);
}

[data-theme='crimson'] {
  --bg: #1d0c12;
  --bg-deep: #14070c;
  --surface: #2c1219;
  --surface-2: #3b1a24;
  --line: rgba(255, 200, 210, 0.1);
  --text: #fff1f3;
  --muted: #c79aa4;
  --placeholder: #94707a;
  --accent: #F0384F;
  --accent-deep: #BC2339;
  --on-accent: #ffffff;
  --accent-shadow: rgba(240, 56, 79, 0.38);
  --me: #FFA3B0;
  --them: #F0384F;
  --link: #FF9AA9;
  --on-me: #14070c;
  --switch-on: #F0384F;
  --error: #ffb0ba;
  --glass: rgba(29, 12, 18, 0.86);
  --shadow: rgba(0, 0, 0, 0.5);
  --map-bg: #170a0f;
  --glow-1: rgba(255, 130, 150, 0.3);
  --glow-2: rgba(240, 56, 79, 0.48);
  --hero-1: #3d1622;
  --hero-2: #1d0c12;
  --hero-muted: #deb4bd;
  --dot: rgba(255, 200, 210, 0.09);
  --tile-filter: sepia(0.9) hue-rotate(310deg) saturate(1.4) brightness(1.1) contrast(0.95);
}

[data-theme='onyx'] {
  --bg: #0b0b0d;
  --bg-deep: #050506;
  --surface: #151518;
  --surface-2: #212126;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --placeholder: #6b6b76;
  --accent: #f4f4f6;
  --accent-deep: #c4c4ce;
  --on-accent: #0b0b0d;
  --accent-shadow: rgba(255, 255, 255, 0.12);
  --me: #b8c4dd;
  --them: #ff4d5e;
  --link: #afc2ff;
  --on-me: #0b0b0d;
  --switch-on: #4c86ff;
  --error: #ff8d9b;
  --glass: rgba(11, 11, 13, 0.86);
  --shadow: rgba(0, 0, 0, 0.6);
  --map-bg: #08080a;
  --glow-1: rgba(138, 178, 255, 0.22);
  --glow-2: rgba(255, 77, 94, 0.3);
  --hero-1: #1c1c22;
  --hero-2: #0b0b0d;
  --hero-muted: #b4b4c0;
  --dot: rgba(255, 255, 255, 0.09);
  --tile-filter: grayscale(1) brightness(1.1) contrast(1.05);
}

[data-theme='blush'] {
  --bg: #fbf3f6;
  --bg-deep: #f4e9ef;
  --surface: #ffffff;
  --surface-2: #f2e4ec;
  --line: rgba(43, 34, 54, 0.11);
  --text: #2b2236;
  --muted: #6f6182;
  --placeholder: #a294b2;
  --accent: #D9546C;
  --accent-deep: #C03F59;
  --on-accent: #ffffff;
  --accent-shadow: rgba(217, 84, 108, 0.32);
  --me: #8fb3ff;
  --them: #f59ab0;
  --link: #3f6fd8;
  --on-me: #1b2a52;
  --switch-on: #D9546C;
  --error: #c62b47;
  --glass: rgba(255, 255, 255, 0.88);
  --shadow: rgba(120, 80, 130, 0.22);
  --map-bg: #efe9f0;
  --glow-1: rgba(143, 179, 255, 0.6);
  --glow-2: rgba(245, 154, 176, 0.65);
  --hero-1: #fde7ee;
  --hero-2: #e6eeff;
  --hero-muted: #5d4f70;
  --dot: rgba(43, 34, 54, 0.1);
  --tile-filter: none;
}

:root {
  --radius: 18px;
  --nav-h: 64px;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --badge: #E42F45;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  transition: background 0.3s, color 0.3s;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 2000;
}

.boot .mark {
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    transform: scale(1.12);
    opacity: 0.75;
  }
}

.mark {
  width: 28px;
  height: 28px;
}

.mark-lg {
  width: 72px;
  height: 72px;
}

.mark .m-a {
  fill: var(--me);
}

.mark .m-b {
  fill: var(--them);
}

.mark .m-c {
  fill: var(--accent-deep);
}

[data-theme='onyx'] .mark .m-c {
  fill: #ffffff;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(800px 500px at 100% 110%, var(--glow-2), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 32px 24px 24px;
  box-shadow: 0 30px 80px var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.auth-card.wide {
  max-width: 640px;
}

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

.brand-center {
  flex-direction: column;
  text-align: center;
  gap: 8px;
  margin-bottom: 24px;
}

.brand-center h1 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand-center p {
  color: var(--muted);
  max-width: 340px;
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span,
.field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field input,
.code-input {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.code-input:focus {
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 25%, transparent);
}

.field input::placeholder,
.code-input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

.error {
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

.error.center {
  text-align: center;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.1s, filter 0.2s, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  box-shadow: 0 10px 24px var(--accent-shadow);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-blue {
  background: var(--me);
  color: var(--on-me);
}

.btn-blue:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-small {
  width: auto;
  padding: 10px 16px;
  background: var(--surface-2);
  font-size: 14px;
}

.btn-small:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--muted);
}

.link-btn {
  color: var(--link);
  font-weight: 600;
  font-size: 13px;
  padding: 6px;
}

.link-btn:hover {
  text-decoration: underline;
}

#onboard .link-btn {
  display: block;
  margin: 12px auto 0;
}

.choice-grid {
  display: grid;
  gap: 14px;
}

.choice {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice h2 {
  font-size: 18px;
  font-weight: 600;
}

.choice p {
  color: var(--muted);
  font-size: 13px;
  flex: 1;
}

.code-input {
  text-align: center;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.brand-center h1,
.hero-body h1,
.auth-form h2,
.choice h2,
.dc-mid strong,
.chat-head strong,
.card h3,
.code-row code,
.code-input {
  font-family: var(--display);
  font-variant-numeric: lining-nums;
}

.auth-screen {
  display: block;
  place-items: stretch;
  padding: 0;
  background: var(--bg);
}

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: calc(20px + env(safe-area-inset-top)) 24px 30px;
  background:
    radial-gradient(520px 340px at 0% 0%, var(--glow-1), transparent 65%),
    radial-gradient(560px 380px at 100% 100%, var(--glow-2), transparent 65%),
    linear-gradient(160deg, var(--hero-1), var(--hero-2) 70%);
  transition: background 0.3s;
}

.auth-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 40%, transparent);
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  pointer-events: none;
}

.blob-a {
  width: 280px;
  height: 280px;
  top: -80px;
  right: -60px;
  background: var(--them);
  animation: float-a 14s ease-in-out infinite alternate;
}

.blob-b {
  width: 240px;
  height: 240px;
  bottom: -90px;
  left: -50px;
  background: var(--me);
  animation: float-b 17s ease-in-out infinite alternate;
}

@keyframes float-a {
  to {
    transform: translate(-60px, 70px) scale(1.15);
  }
}

@keyframes float-b {
  to {
    transform: translate(80px, -50px) scale(1.1);
  }
}

.hero-body,
.auth-hero .brand,
.hero-foot {
  position: relative;
  z-index: 1;
}

.auth-hero .brand-name,
.hero-body h1 {
  color: var(--text);
}

.hero-body h1 {
  font-size: clamp(38px, 11vw, 58px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-body h1 em {
  font-style: italic;
  font-weight: 500;
  background: linear-gradient(90deg, var(--link), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.08em;
}

.hero-body > p {
  margin-top: 12px;
  max-width: 400px;
  color: var(--hero-muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chips span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chips i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--link);
}

.chips span:nth-child(2) i {
  background: var(--accent);
}

.chips span:nth-child(3) i {
  background: var(--them);
}

.hero-foot {
  display: none;
  color: var(--hero-muted);
  font-size: 13px;
}

.orbit {
  position: relative;
  height: 110px;
  margin-top: 22px;
  max-width: 440px;
}

.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  border-radius: 50%;
  border: 1.5px solid var(--link);
  opacity: 0;
  animation: radar 4.5s ease-out infinite;
}

.ring:nth-of-type(2) {
  animation-delay: 1.5s;
}

.ring:nth-of-type(3) {
  animation-delay: 3s;
}

@keyframes radar {
  0% {
    transform: scale(0.4);
    opacity: 0.7;
  }
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

.orbit-line {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  border-top: 2px dashed color-mix(in srgb, var(--link) 60%, transparent);
}

.orb {
  position: absolute;
  top: 50%;
  width: 58px;
  height: 58px;
  margin-top: -29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid;
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  box-shadow: 0 10px 26px var(--shadow);
}

.orb-blue {
  left: 2%;
  border-color: var(--me);
  animation: drift-a 4.5s ease-in-out infinite alternate;
}

.orb-red {
  right: 2%;
  border-color: var(--them);
  animation: drift-b 4.5s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to {
    transform: translateX(70px);
  }
}

@keyframes drift-b {
  to {
    transform: translateX(-70px);
  }
}

.orbit-tag {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--link);
  color: var(--link);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.auth-panel {
  display: grid;
  place-items: start center;
  padding: 28px 20px 40px;
  background: var(--bg);
  transition: background 0.3s;
}

.auth-form {
  width: 100%;
  max-width: 380px;
}

.auth-form h2 {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.auth-form .sub {
  color: var(--muted);
  margin: 4px 0 24px;
}

.input-wrap {
  position: relative;
}

.input-wrap .lead {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  color: var(--muted);
  pointer-events: none;
}

.auth-form .field input {
  padding: 15px 48px 15px 44px;
  background: var(--surface);
}

.input-wrap:focus-within .lead {
  color: var(--link);
}

.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}

.eye:hover {
  color: var(--text);
  background: var(--line);
}

.eye svg {
  width: 20px;
  height: 20px;
}

.eye .ico-hide {
  display: none;
}

.eye.on {
  color: var(--link);
}

.eye.on .ico-show {
  display: none;
}

.eye.on .ico-hide {
  display: block;
}

.auth-form .btn {
  margin-top: 6px;
  padding: 15px 18px;
}

.btn .spin {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--on-accent) 35%, transparent);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn.loading span {
  display: none;
}

.btn.loading .spin {
  display: inline-block;
}

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

.theme-block {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.theme-block > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 4px 8px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: border-color 0.2s, transform 0.1s, color 0.2s;
}

.swatch:hover {
  color: var(--text);
}

.swatch:active {
  transform: scale(0.96);
}

.swatch[aria-pressed='true'] {
  border-color: var(--link);
  color: var(--text);
}

.swatch .sw {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--s1) 50%, var(--s2) 50%);
  box-shadow: inset 0 0 0 1.5px rgba(128, 128, 128, 0.35);
}

[data-pick='dusk'] {
  --s1: #231A31;
  --s2: #E42F45;
}

[data-pick='ocean'] {
  --s1: #0F1C33;
  --s2: #3A74F2;
}

[data-pick='crimson'] {
  --s1: #1d0c12;
  --s2: #F0384F;
}

[data-pick='onyx'] {
  --s1: #0b0b0d;
  --s2: #f4f4f6;
}

[data-pick='blush'] {
  --s1: #8fb3ff;
  --s2: #f59ab0;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0;
  height: calc(56px + env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--placeholder);
}

.pill.on {
  color: var(--text);
}

.pill.on i {
  background: var(--link);
  animation: ping 1.8s infinite;
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--link) 60%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

.layout {
  flex: 1;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.mapview {
  position: relative;
  min-height: 0;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--map-bg);
  font-family: inherit;
}

.leaflet-tile-pane {
  filter: var(--tile-filter);
}

#map.map-fallback .leaflet-tile-pane {
  filter: invert(1) hue-rotate(190deg) saturate(0.7) brightness(0.85) contrast(1.05);
}

.leaflet-control-attribution {
  background: var(--glass) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--link) !important;
}

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line) !important;
}

.dist-card {
  position: absolute;
  z-index: 500;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 22px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px var(--shadow);
}

.dc-mid {
  text-align: center;
  min-width: 0;
}

.dc-mid strong {
  display: block;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.dc-mid span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.av {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  padding: 3px;
  display: block;
}

.av-blue {
  background: var(--me);
}

.av-red {
  background: var(--them);
}

.av-xl {
  width: 112px;
  height: 112px;
  padding: 4px;
}

.av-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
}

.av-xl .av-inner {
  font-size: 40px;
}

.av-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.map-actions {
  position: absolute;
  z-index: 500;
  right: 12px;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 22px var(--shadow);
  transition: filter 0.2s, transform 0.1s;
}

.fab:hover {
  filter: brightness(1.1);
}

.fab:active {
  transform: scale(0.94);
}

.fab svg {
  width: 20px;
  height: 20px;
}

.notice {
  position: absolute;
  z-index: 500;
  left: 12px;
  right: 70px;
  bottom: 28px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-left: 3px solid var(--them);
  border-radius: 14px;
  font-size: 13px;
  color: var(--text);
}

.pin-wrap {
  background: none;
  border: 0;
}

.pin {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 3px;
  box-shadow: 0 8px 20px var(--shadow);
}

.pin-me {
  background: var(--me);
  color: var(--me);
}

.pin-them {
  background: var(--them);
  color: var(--them);
}

.pin .av-inner {
  color: var(--text);
}

.pin.live::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: ring 2.2s ease-out infinite;
}

@keyframes ring {
  0% {
    transform: scale(0.9);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.dist-tag {
  width: max-content;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--link);
  border: 1px solid var(--link);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px var(--shadow);
}

.panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

#app[data-tab='chat'] .panel,
#app[data-tab='me'] .panel {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 5;
}

#app[data-tab='me'] #viewChat {
  display: none;
}

#app:not([data-tab='me']) #viewMe {
  display: none;
}

.panel-tabs {
  display: none;
}

.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.pane.scroll {
  overflow-y: auto;
  padding: 16px;
  gap: 14px;
}

.chat-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.chat-head .av {
  width: 42px;
  height: 42px;
}

.chat-head strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.chat-head span:not(.av):not(.av-inner) {
  font-size: 12px;
  color: var(--muted);
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
}

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  max-width: 240px;
  font-size: 14px;
}

.day {
  align-self: center;
  margin: 12px 0 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: pop 0.18s ease-out;
}

@keyframes pop {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
}

.bubble time {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  opacity: 0.75;
  text-align: right;
}

.bubble.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
}

.bubble.theirs {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.bubble.theirs time {
  text-align: left;
  color: var(--link);
  opacity: 0.95;
}

.bubble.pending {
  opacity: 0.55;
}

.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 12px 16px;
  outline: none;
  line-height: 1.35;
  transition: border-color 0.2s;
}

.composer textarea:focus {
  border-color: var(--link);
}

.send {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  transition: transform 0.1s, filter 0.2s;
}

.send:hover {
  filter: brightness(1.1);
}

.send:active {
  transform: scale(0.92);
}

.send:disabled {
  opacity: 0.5;
}

.send svg {
  width: 20px;
  height: 20px;
  transform: translate(-1px, 1px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card .theme-picker {
  margin-top: 12px;
}

.card .swatch {
  background: var(--bg-deep);
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.avatar-edit {
  position: relative;
  margin-bottom: 4px;
}

.cam {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: 3px solid var(--surface);
  transition: transform 0.1s, filter 0.2s;
}

.cam:hover {
  filter: brightness(1.1);
}

.cam:active {
  transform: scale(0.92);
}

.cam svg {
  width: 17px;
  height: 17px;
}

.handle {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.name-form {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.name-form .field {
  flex: 1;
  margin: 0;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 8px;
}

.code-row code {
  flex: 1;
  background: var(--bg-deep);
  border: 1px dashed color-mix(in srgb, var(--link) 55%, transparent);
  border-radius: 14px;
  padding: 12px 12px 12px calc(12px + 0.3em);
  text-align: center;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.3em;
  color: var(--link);
}

.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 1;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.2s;
}

.switch span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.switch input:checked + span {
  background: var(--switch-on);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.switch input:focus-visible + span {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.bottom-nav {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
}

.ntab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.2s;
}

.ntab svg {
  width: 22px;
  height: 22px;
}

.ntab.active {
  color: var(--link);
}

.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--badge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}

.ntab .badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 8px);
}

.toast {
  position: fixed;
  z-index: 3000;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 14px 40px var(--shadow);
  animation: pop 0.2s ease-out;
}

@media (max-width: 899px) {
  .leaflet-control-zoom {
    display: none;
  }
}

@media (min-width: 560px) {
  .choice-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .topbar {
    padding-left: 24px;
    padding-right: 24px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) 400px;
  }

  .panel,
  #app[data-tab='chat'] .panel,
  #app[data-tab='me'] .panel {
    display: flex;
    position: static;
    border-left: 1px solid var(--line);
  }

  .panel-tabs {
    flex: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
  }

  .ptab {
    padding: 10px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, color 0.2s;
  }

  .ptab:hover {
    color: var(--text);
  }

  .ptab.active {
    background: var(--surface-2);
    color: var(--text);
  }

  .bottom-nav {
    display: none;
  }

  .dist-card {
    right: auto;
    width: 380px;
    top: 20px;
    left: 20px;
  }

  .map-actions {
    right: 20px;
    bottom: 36px;
  }

  .notice {
    left: 20px;
    right: auto;
    max-width: 360px;
    bottom: 36px;
  }

  .toast {
    bottom: 32px;
  }

  .auth-shell {
    grid-template-columns: 1.15fr 1fr;
    grid-template-rows: none;
  }

  .auth-hero {
    justify-content: space-between;
    padding: 44px 56px;
  }

  .hero-body h1 {
    font-size: 72px;
  }

  .hero-body > p {
    font-size: 17px;
  }

  .orbit {
    height: 150px;
    margin-top: 40px;
  }

  .orb {
    width: 66px;
    height: 66px;
    margin-top: -33px;
  }

  .hero-foot {
    display: block;
  }

  .auth-panel {
    place-items: center;
    padding: 48px;
  }

  .auth-form h2 {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.auth-col {
  width: 100%;
  max-width: 380px;
}
