:root {
  color-scheme: dark;
  --ink: #eef1f8;
  --muted: #9aa3b8;
  --night: #0b1020;
  --panel: rgba(17, 23, 42, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --amber: #f5b14c;
  --teal: #5ad1c7;
  --danger: #ff8a7a;
  --radius: 14px;
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(120% 80% at 50% 0%, #182246 0%, var(--night) 60%) fixed;
  color: var(--ink);
  min-height: 100vh;
}
a {
  color: var(--teal);
}
h1,
h2 {
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.muted {
  color: var(--muted);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
[hidden] {
  display: none !important;
}

/* bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.bar nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.bar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
}
.bar nav a.active,
.bar nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}
.chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--night);
  background: var(--amber);
  vertical-align: middle;
}

main {
  padding: 0 clamp(16px, 4vw, 40px) 48px;
  max-width: 1200px;
  margin: 0 auto;
}

/* buttons and forms */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
}
.button:hover {
  background: rgba(255, 255, 255, 0.14);
}
.button.primary {
  color: var(--night);
  background: var(--amber);
  border-color: transparent;
}
.button.primary:hover {
  background: #ffc46a;
}
.button.ghost {
  background: rgba(11, 16, 32, 0.55);
  backdrop-filter: blur(8px);
}
.button.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}
.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 400;
}
label.consent {
  color: var(--muted);
  font-size: 0.86rem;
}
input,
textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
input[type='checkbox'] {
  width: auto;
  margin-top: 4px;
  accent-color: var(--amber);
}
input:focus,
textarea:focus,
.button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.error {
  color: var(--danger);
  min-height: 1.2em;
  margin: 0;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* explore */
.hero {
  padding: clamp(24px, 6vw, 72px) 0 28px;
  max-width: 760px;
}
.hero h1 {
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  margin: 0 0 16px;
}
.lede {
  font-size: 1.15rem;
  color: #c9cfdd;
  margin: 0 0 24px;
}
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.section-title {
  margin: 40px 0 16px;
  font-size: 1.3rem;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.tile {
  display: grid;
  gap: 4px;
  color: var(--ink);
  text-decoration: none;
  padding: 10px 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  transition: transform 0.15s ease, background 0.15s ease;
}
.tile:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.07);
}
.tile .thumb {
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #1d2a52, #0f1631);
  margin-bottom: 6px;
}
.tile .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile .muted {
  font-size: 0.86rem;
}

/* Earth */
.map-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #071022;
}
.map-frame.mini {
  margin: 12px 0 4px;
}
.earth {
  position: relative;
  aspect-ratio: 2 / 1;
  width: 100%;
  user-select: none;
}
.earth.picking {
  cursor: crosshair;
}
.earth-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  filter: saturate(0.8) brightness(0.8);
}
.earth-pins {
  position: absolute;
  inset: 0;
}
.pin {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 177, 76, 0.3), 0 0 18px rgba(245, 177, 76, 0.8);
}
.pin.pick {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(90, 209, 199, 0.3), 0 0 18px rgba(90, 209, 199, 0.8);
}
.pin-label {
  position: absolute;
  left: 18px;
  top: -6px;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--ink);
  background: var(--panel);
  padding: 2px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.pin:hover .pin-label,
.pin:focus .pin-label {
  opacity: 1;
}

/* cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 32px;
}
.card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: clamp(18px, 3vw, 28px);
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}
.card h2 {
  margin: 0;
}
.card > .button {
  justify-self: start;
}
.card.wide {
  max-width: 820px;
  margin: 32px auto 0;
}
.card.notice {
  margin-top: 32px;
}
.key code {
  word-break: break-all;
  font-size: 0.95rem;
  padding: 8px 10px;
  display: inline-block;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}
.progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 3%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 0.8s ease;
}
.list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.item.failed .muted {
  color: var(--danger);
}

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px clamp(16px, 4vw, 40px);
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

/* place */
body.place {
  overflow: hidden;
  background: var(--night);
}
#view {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
  touch-action: none;
}
.bar.overlay {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 3;
  background: linear-gradient(rgba(11, 16, 32, 0.7), transparent);
}
.panel {
  position: fixed;
  z-index: 2;
  top: 72px;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 32px));
  overflow-y: auto;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.panel.closed {
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}
.panel h1 {
  font-size: 1.6rem;
  margin: 4px 0 4px;
}
.panel details {
  margin: 12px 0;
}
.panel summary {
  cursor: pointer;
  color: var(--muted);
}
.panel dl {
  display: grid;
  gap: 2px 0;
  font-size: 0.86rem;
}
.panel dt {
  color: var(--muted);
  margin-top: 8px;
}
.panel dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.attribution {
  font-size: 0.86rem;
  color: var(--muted);
}
.chip.draft {
  background: var(--teal);
}
.editor {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}
.editor h2 {
  margin: 0;
  font-size: 1.15rem;
}
.loading {
  position: fixed;
  z-index: 1;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
.loading .progress {
  width: min(320px, 70vw);
  margin: 0 auto;
}
.hint {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(11, 16, 32, 0.7);
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: opacity 1s;
}
.hint.faded {
  opacity: 0;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: min(440px, calc(100vw - 32px));
}
dialog form {
  display: grid;
  gap: 12px;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}
@media (max-width: 720px) {
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 55vh;
  }
  .panel.closed {
    transform: translateY(calc(100% + 24px));
  }
  .hint {
    display: none;
  }
}
