:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-solid: #ffffff;
  --ink: #162217;
  --muted: #58715b;
  --accent: #177245;
  --accent-strong: #0c4e2d;
  --soft: #dfeadf;
  --warning: #9d5b18;
  --danger: #8a2332;
  --shadow: 0 24px 60px rgba(17, 41, 22, 0.12);
  --radius: 24px;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(133, 198, 144, 0.35), transparent 32%),
    linear-gradient(180deg, #eef7ef 0%, #f7f5ef 52%, #eef2ff 100%);
}

.app-shell {
  width: min(1100px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 8px 0 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 2px 4px 10px;
}

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

.topbar-title {
  display: grid;
  gap: 2px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  line-height: 0.98;
}

.status-pill {
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 12px 28px rgba(17, 41, 22, 0.08);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  white-space: nowrap;
}

.page {
  display: grid;
  gap: 16px;
}

.hero,
.panel,
.map-panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
}

.hero-start-shell {
  display: grid;
  gap: 18px;
}

.hero-copy {
  display: grid;
  gap: 12px;
}

.hero h2 {
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.hero p {
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.6;
}

.hero-start-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 34, 23, 0.06);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.panel {
  padding: 20px;
}

.panel h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.panel p,
.meta,
.list {
  color: var(--muted);
  line-height: 1.55;
}

.actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

button,
.link-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #2c9356 100%);
  color: #fff;
}

.secondary {
  background: #f0f6f0;
  color: var(--ink);
}

.danger {
  background: #fee9ee;
  color: var(--danger);
}

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  line-height: 1.5;
}

.stack {
  display: grid;
  gap: 12px;
}

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

label {
  font-weight: 600;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d9e6da;
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
}

.map-panel {
  overflow: hidden;
}

#map {
  height: min(68vh, 620px);
}

#globe {
  height: min(76vh, 720px);
  background:
    radial-gradient(circle at 20% 18%, rgba(124, 214, 255, 0.26), transparent 30%),
    radial-gradient(circle at 80% 25%, rgba(103, 255, 204, 0.12), transparent 24%),
    linear-gradient(180deg, #0b1b29 0%, #102232 35%, #0d1a26 100%);
}

.globe-shell {
  background:
    linear-gradient(180deg, rgba(9, 24, 37, 0.94) 0%, rgba(8, 18, 29, 0.98) 100%);
  border: 1px solid rgba(136, 226, 255, 0.16);
}

.viewer-switcher {
  display: flex;
  gap: 10px;
  padding: 14px 14px 0;
}

.viewer-controls {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.group-join-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(22, 34, 23, 0.08);
}

.globe-shell .group-join-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(137, 222, 255, 0.12);
}

.join-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.participant-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.participant-chip {
  display: grid;
  gap: 4px;
  min-width: 144px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid color-mix(in srgb, var(--participant-accent) 20%, transparent);
  color: var(--ink);
  text-align: left;
}

.participant-chip.active {
  background: color-mix(in srgb, var(--participant-soft) 72%, white);
  border-color: var(--participant-accent);
}

.participant-chip-label {
  font-weight: 700;
}

.participant-chip-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.globe-shell .participant-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #f2fbff;
}

.globe-shell .participant-chip-meta,
.globe-shell .group-join-card .meta,
.globe-shell .group-join-card .notice {
  color: #d7f4ff;
}

.switch-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-weight: 600;
}

.switch-link.active {
  background: linear-gradient(135deg, var(--accent) 0%, #2c9356 100%);
  color: #fff;
}

.viewer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid rgba(22, 34, 23, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.meta-chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--muted);
  font-size: 0.94rem;
}

.globe-shell .viewer-meta {
  background: rgba(9, 22, 31, 0.78);
  border-top: 1px solid rgba(137, 222, 255, 0.12);
}

.globe-shell .meta-chip {
  background: rgba(255, 255, 255, 0.08);
  color: #d7f4ff;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.success {
  color: var(--accent-strong);
}

.small {
  font-size: 0.92rem;
}

.recent-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(22, 34, 23, 0.06);
}

.recent-title {
  color: var(--ink);
  font-weight: 700;
}

.recent-actions {
  margin-top: 0;
}

.session-dock {
  display: grid;
  gap: 12px;
}

@media (min-width: 760px) {
  .hero-start-shell {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    align-items: end;
  }
}

.share-stack {
  margin-top: 8px;
}

.share-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(22, 34, 23, 0.06);
}

.compact-card {
  padding: 14px;
}

.settings-sheet-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(5, 12, 17, 0.38);
  z-index: 20;
}

.settings-sheet {
  width: min(680px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(22, 34, 23, 0.08);
  box-shadow: 0 24px 54px rgba(12, 26, 18, 0.2);
}

.settings-sheet-backdrop[hidden] {
  display: none !important;
}

.settings-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 14px;
}

body.compact-topbar .topbar {
  padding-bottom: 6px;
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 12px, 100%);
    padding-bottom: 84px;
  }

  .topbar {
    gap: 10px;
    padding: 0 2px 8px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

  h1 {
    font-size: 1.18rem;
  }

  body.compact-topbar .topbar-title h1 {
    font-size: 1.06rem;
  }

  .status-pill {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  .join-inline {
    grid-template-columns: 1fr;
  }

  #map {
    height: 58vh;
  }

  #globe {
    height: 62vh;
  }
}
