:root {
  color-scheme: dark;
  --bg: #080b0e;
  --panel: #11171d;
  --panel-2: #171e25;
  --panel-3: #1e2730;
  --line: #2a3540;
  --text: #eef4f6;
  --muted: #91a0aa;
  --soft: #c8d3d8;
  --accent: #35d0a3;
  --accent-2: #71a7ff;
  --warn: #f6bd4f;
  --danger: #ff706f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #050708;
  color: var(--text);
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.phone {
  width: min(100%, 430px);
  height: min(860px, calc(100vh - 36px));
  min-height: 700px;
  background: var(--bg);
  border: 1px solid #202a33;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 30px 56px 1fr 66px;
}

.phone.onboarding {
  grid-template-rows: 30px 1fr;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 22px 0;
  color: #d7dde1;
  font-size: 12px;
  font-weight: 800;
}

.status-icons {
  display: flex;
  gap: 5px;
  align-items: center;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.battery {
  width: 18px;
  height: 9px;
  border: 1px solid currentColor;
  border-radius: 4px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(10, 13, 16, 0.96);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 18px;
  font-weight: 850;
}

.brand-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinmark {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 3px;
  transform: rotate(-45deg);
  background: var(--accent);
  position: relative;
  flex: 0 0 auto;
}

.pinmark::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 7px;
  left: 7px;
  background: #061411;
}

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

.icon-btn,
.nav-btn {
  border: 1px solid var(--line);
  background: #12181e;
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.screen {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.scroll {
  height: 100%;
  overflow-y: auto;
  padding: 12px;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 16, 20, 0.98);
  padding: 6px 4px 8px;
  z-index: 20;
}

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  font-size: 10px;
  font-weight: 750;
}

.nav-icon {
  font-size: 18px;
  height: 20px;
}

.nav-btn.active {
  color: var(--accent);
}

.onboarding-screen {
  padding: 22px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  background:
    radial-gradient(circle at 75% 12%, rgba(53, 208, 163, 0.15), transparent 34%),
    radial-gradient(circle at 10% 86%, rgba(113, 167, 255, 0.12), transparent 30%),
    var(--bg);
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 26px;
}

.hero-copy h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy p,
.muted {
  color: var(--muted);
  line-height: 1.45;
}

.onboarding-card,
.card {
  border: 1px solid var(--line);
  background: rgba(17, 23, 29, 0.92);
  border-radius: 8px;
}

.onboarding-card {
  padding: 14px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #0d1318;
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
  min-height: 42px;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: start;
  gap: 9px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
}

.checkbox-row input {
  margin-top: 2px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #151d24;
  color: var(--text);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn.primary {
  background: var(--accent);
  color: #041511;
  border-color: var(--accent);
}

.btn.warn {
  background: rgba(246, 189, 79, 0.16);
  color: #ffe0a0;
  border-color: rgba(246, 189, 79, 0.45);
}

.btn.danger {
  background: rgba(255, 112, 111, 0.14);
  color: #ffbbbb;
  border-color: rgba(255, 112, 111, 0.45);
}

.btn.full {
  width: 100%;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.48;
  cursor: default;
}

.notice {
  border: 1px solid rgba(53, 208, 163, 0.35);
  background: rgba(53, 208, 163, 0.08);
  color: var(--soft);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.error {
  border-color: rgba(255, 112, 111, 0.45);
  background: rgba(255, 112, 111, 0.1);
  color: #ffc4c4;
}

.map-screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(8, 11, 14, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 5;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  background: #0d1216;
  border-radius: 8px;
  padding: 3px;
  flex: 1;
}

.segmented button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  font-size: 12px;
}

.segmented button.active {
  background: #1c252d;
  color: var(--text);
}

#map {
  height: 100%;
  min-height: 0;
  background: #0d1419;
}

.leaflet-container {
  background: #0d1419;
  font-family: inherit;
}

.leaflet-control-attribution {
  background: rgba(8, 11, 14, 0.8) !important;
  color: var(--muted) !important;
}

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

.person-marker,
.party-marker {
  border: 2px solid #081015;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.person-marker {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #73828d, #1e2730);
  position: relative;
}

.person-marker::before {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  top: 8px;
  left: 12px;
  background: rgba(255, 255, 255, 0.35);
}

.person-marker::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  right: 0;
  bottom: 2px;
  background: var(--accent);
  border: 2px solid #081015;
}

.person-marker.offline::after {
  background: #596571;
}

.person-marker.anon {
  background: linear-gradient(135deg, #77715e, #20242a);
}

.party-marker {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(246, 189, 79, 0.24);
  border-color: rgba(246, 189, 79, 0.8);
  color: var(--warn);
  font-size: 21px;
  font-weight: 900;
}

.popup {
  min-width: 190px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}

.leaflet-popup-content {
  margin: 10px;
}

.popup-name {
  font-weight: 900;
  margin-bottom: 3px;
}

.popup-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.sheet {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 500;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(17, 23, 29, 0.97);
  padding: 10px;
}

.person-row,
.chat-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: linear-gradient(135deg, #73828d, #1e2730);
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
}

.avatar.round {
  border-radius: 50%;
}

.avatar::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  top: 10px;
  left: 19px;
  background: rgba(255, 255, 255, 0.32);
}

.avatar::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 5px;
  height: 22px;
  border-radius: 999px 999px 5px 5px;
  background: rgba(255, 255, 255, 0.18);
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.name {
  font-size: 16px;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.distance {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.chips {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: #151d24;
  border-radius: 999px;
  color: var(--soft);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.chip.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #041511;
}

.chip.warn {
  background: var(--warn);
  border-color: var(--warn);
  color: #201602;
}

.chip.blue {
  background: rgba(113, 167, 255, 0.18);
  border-color: rgba(113, 167, 255, 0.45);
  color: #cfe0ff;
}

.list-stack {
  display: grid;
  gap: 8px;
}

.card {
  padding: 10px;
}

.card-title {
  font-weight: 900;
  font-size: 16px;
  margin-bottom: 4px;
}

.card-copy {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.42;
  margin-top: 5px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.feed-composer {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
}

.duration-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.duration-grid button {
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #12191f;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.duration-grid button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #041511;
}

.feed-post {
  display: grid;
  gap: 7px;
}

.feed-body {
  color: var(--text);
  line-height: 1.42;
}

.post-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid var(--line);
  background: #141b22;
  color: var(--soft);
  min-height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
}

.profile-hero {
  height: 190px;
  border-radius: 0 0 16px 16px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.28) 0 34px, transparent 35px),
    radial-gradient(ellipse at 50% 108%, rgba(255, 255, 255, 0.14) 0 92px, transparent 93px),
    linear-gradient(135deg, #53636e, #1a222a 68%);
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 8px;
  color: var(--soft);
  font-size: 13px;
}

.detail span:first-child {
  color: var(--muted);
}

.message-window {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
}

.messages {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: 78%;
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
}

.bubble.them {
  background: #18212a;
  border-bottom-left-radius: 4px;
}

.bubble.me {
  align-self: flex-end;
  background: #174536;
  color: #edfff9;
  border-bottom-right-radius: 4px;
}

.system-note {
  align-self: center;
  border: 1px solid var(--line);
  background: #10161b;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
}

.composer {
  display: flex;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.composer input {
  flex: 1;
}

.setting-card {
  display: grid;
  gap: 7px;
}

.setting-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #26313a;
  border: 0;
  padding: 3px;
  flex: 0 0 auto;
}

.toggle::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dbe2e6;
}

.toggle.on {
  background: var(--accent);
}

.toggle.on::after {
  transform: translateX(20px);
  background: #061411;
}

.toast {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 76px;
  z-index: 1000;
  border: 1px solid rgba(53, 208, 163, 0.4);
  background: rgba(16, 22, 27, 0.97);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

@media (min-width: 900px) {
  .app-shell {
    background:
      radial-gradient(circle at 20% 20%, rgba(53, 208, 163, 0.09), transparent 30%),
      radial-gradient(circle at 80% 70%, rgba(113, 167, 255, 0.08), transparent 28%),
      #050708;
  }

  .phone {
    height: 860px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 0;
  }

  .phone {
    width: 100%;
    height: 100vh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }
}
