:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #181b21;
  --panel-2: #20242c;
  --ink: #f4efe4;
  --muted: #a8b0aa;
  --line: rgba(244, 239, 228, 0.16);
  --mint: #7ee7c1;
  --coral: #ff8a70;
  --gold: #f1c75b;
  --aqua: #6dc9ef;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 12% 22%, rgba(126, 231, 193, 0.08), transparent 27rem),
    linear-gradient(135deg, #101216 0%, #161816 44%, #0c1014 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 16px;
  min-height: 100vh;
  padding: 16px;
}

.atlas-panel {
  position: relative;
  height: calc(100vh - 32px);
  min-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1012;
  box-shadow: var(--shadow);
}

#atlasCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.map-chrome {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 17, 21, 0.76);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.top-left {
  top: 18px;
  left: 18px;
  display: block;
  max-width: min(520px, calc(100% - 36px));
  padding: 16px 18px;
}

.top-left h1 {
  max-width: 14ch;
  margin: 2px 0 0;
  font-size: clamp(2rem, 6vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.top-right {
  top: 18px;
  right: 18px;
  padding: 10px 12px;
}

#clock {
  color: var(--mint);
  font-weight: 800;
}

#weather {
  color: var(--muted);
  font-size: 0.88rem;
}

.bottom-left {
  bottom: 18px;
  left: 18px;
  padding: 8px;
}

.icon-button,
.text-button,
.tab {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel-2);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  font-size: 1.3rem;
}

.icon-button:hover,
.text-button:hover,
.tab:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 231, 193, 0.48);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 33, 0.92);
  box-shadow: var(--shadow);
  padding: 14px;
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 36, 44, 0.58);
  padding: 14px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading strong {
  display: block;
  margin-top: 2px;
  font-size: 1.3rem;
}

.section-heading.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.meter {
  min-width: 0;
  border-radius: 8px;
  background: #12151a;
  padding: 10px;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.meter strong {
  display: block;
  margin-top: 4px;
  color: var(--mint);
  font-size: 1.5rem;
  line-height: 1;
}

label {
  display: block;
  margin: 12px 0 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101319;
  color: var(--ink);
  padding: 0 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
}

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

.tab {
  min-height: 38px;
  border-radius: 8px;
}

.tab.active {
  background: var(--mint);
  color: #102019;
  font-weight: 850;
}

.tab-panel {
  display: grid;
  gap: 8px;
}

.manifest-item,
.run-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #12151a;
  padding: 10px;
}

.signal-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: 0 0 18px currentColor;
}

.manifest-item strong,
.run-card strong {
  display: block;
  font-size: 0.94rem;
}

.manifest-item span,
.run-card span {
  color: var(--muted);
  font-size: 0.78rem;
}

.item-score {
  color: var(--gold);
  font-weight: 850;
}

.text-button {
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  color: #101319;
  background: var(--gold);
  font-weight: 850;
}

.saved-runs {
  display: grid;
  gap: 8px;
  max-height: 225px;
  overflow: auto;
  padding-right: 2px;
}

.run-card {
  grid-template-columns: 1fr auto;
}

.run-card button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #20242c;
  cursor: pointer;
}

body.quiet .map-chrome,
body.quiet .control-panel {
  background: rgba(17, 19, 23, 0.72);
}

body.quiet #atlasCanvas {
  filter: saturate(0.72) brightness(0.86);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .atlas-panel {
    min-height: 68vh;
  }

  .control-panel {
    min-height: auto;
  }

  .top-left h1 {
    font-size: clamp(2.15rem, 12vw, 4.4rem);
  }
}

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

  .atlas-panel,
  .control-panel {
    min-height: auto;
  }

  .atlas-panel {
    height: 72vh;
  }

  .top-right {
    top: auto;
    right: 12px;
    bottom: 12px;
  }

  .top-left,
  .bottom-left {
    left: 12px;
  }

  .top-left {
    top: 12px;
  }

  .bottom-left {
    bottom: 72px;
  }

  .meter-grid {
    grid-template-columns: 1fr;
  }
}
