:root {
  color-scheme: light;
  --ink: #171f22;
  --muted: #667273;
  --line: rgba(23, 31, 34, 0.12);
  --panel: rgba(255, 255, 255, 0.86);
  --paper: #f8f5ed;
  --layer: #8d6a38;
  --shadow: 0 22px 58px rgba(28, 31, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 22% 18%, rgba(47, 117, 138, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(178, 93, 45, 0.16), transparent 42%),
    var(--paper);
}

button,
a {
  font: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 0 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  font-weight: 850;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 14px 22px rgba(28, 31, 29, 0.12));
}

.top-actions {
  display: flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

.mode-button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 0 13px;
  cursor: pointer;
}

.mode-button.is-active {
  color: #ffffff;
  background: var(--layer);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 330px minmax(360px, 480px);
  gap: 18px;
  align-items: stretch;
}

.earth-panel,
.layer-browser,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.earth-panel {
  display: flex;
  min-height: 730px;
  flex-direction: column;
  padding: 18px;
}

.earth-stage {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.34)),
    radial-gradient(circle at center, rgba(23, 31, 34, 0.08), transparent 62%);
}

#earthCanvas {
  width: min(100%, 690px);
  aspect-ratio: 1;
  display: block;
}

.layer-callout {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: min(260px, calc(100% - 40px));
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(16, 22, 23, 0.78);
  color: #ffffff;
  padding: 14px;
  backdrop-filter: blur(12px);
}

.layer-callout span,
.layer-callout small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 750;
}

.layer-callout strong {
  display: block;
  margin: 4px 0;
  font-size: 1.42rem;
}

.scale-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.scale-strip i {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #245e8a, #8d6a38, #d15f2f, #9a3034, #f0a531, #f6d25b);
}

.layer-browser {
  padding: 18px;
}

.browser-head p {
  margin: 0 0 8px;
  color: var(--layer);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.browser-head h1 {
  margin: 0;
  font-size: clamp(2rem, 3.8vw, 3.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.layer-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.layer-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.layer-button.is-active {
  border-color: color-mix(in srgb, var(--layer) 48%, transparent);
  background: color-mix(in srgb, var(--layer) 12%, white);
}

.swatch {
  width: 30px;
  height: 46px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.layer-button strong,
.layer-button small,
.layer-button i {
  display: block;
}

.layer-button strong {
  font-weight: 850;
}

.layer-button small {
  margin-top: 3px;
  color: var(--muted);
}

.layer-button i {
  grid-column: 2;
  width: fit-content;
  border-radius: 999px;
  background: rgba(23, 31, 34, 0.06);
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
  padding: 4px 7px;
}

.detail-panel {
  overflow: hidden;
}

.detail-top {
  padding: 22px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--layer) 24%, white), rgba(255, 255, 255, 0.8)),
    #ffffff;
  border-bottom: 1px solid var(--line);
}

.layer-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: var(--layer);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 5px 9px;
}

.detail-top h2 {
  margin: 16px 0 10px;
  font-size: clamp(2.3rem, 4vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.detail-top p,
.info-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.stat-grid article {
  min-height: 112px;
  padding: 17px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat-grid article:nth-child(2n) {
  border-right: 0;
}

.stat-grid span,
.metric-row span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-grid strong {
  display: block;
  margin-top: 9px;
  font-size: 1.18rem;
  line-height: 1.2;
}

.metric-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.metric-row strong {
  color: var(--layer);
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 31, 34, 0.09);
}

.bar-track i {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: var(--layer);
}

.info-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.info-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  padding: 16px;
}

.info-grid article.is-featured {
  border-color: color-mix(in srgb, var(--layer) 46%, transparent);
  background: color-mix(in srgb, var(--layer) 11%, white);
}

.info-grid h3 {
  margin: 0 0 9px;
  font-size: 1rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-list span {
  border: 1px solid color-mix(in srgb, var(--layer) 28%, transparent);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: #3d4647;
  font-size: 0.86rem;
  font-weight: 780;
  padding: 6px 9px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .earth-panel {
    grid-column: 1 / -1;
    min-height: 560px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 14px;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mode-button {
    padding: 0 8px;
  }

  .workspace,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .earth-panel {
    min-height: 430px;
    padding: 12px;
  }

  .layer-callout {
    position: static;
    width: 100%;
    margin-top: 12px;
  }

  .earth-stage {
    display: block;
    padding: 8px;
  }

  #earthCanvas {
    margin: 0 auto;
  }

  .stat-grid article,
  .stat-grid article:nth-child(2n) {
    border-right: 0;
  }
}
