:root {
  color-scheme: dark;
  --bg: #090b0d;
  --bg-2: #0f1315;
  --ink: rgba(228, 225, 216, 0.8);
  --muted: rgba(228, 225, 216, 0.38);
  --line: rgba(228, 225, 216, 0.08);
  --font-ui: "Instrument Sans", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(95, 122, 118, 0.08), transparent 22%),
    radial-gradient(circle at 74% 18%, rgba(138, 110, 108, 0.08), transparent 24%),
    radial-gradient(circle at 48% 72%, rgba(191, 179, 150, 0.05), transparent 30%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  font-family: var(--font-ui);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 80px 100%, 100% 80px;
  opacity: 0.22;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.78), transparent 92%);
}

.atlas-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  outline: none;
}

.atlas-shell.is-fullscreen .atlas-panel {
  display: none;
}

.atlas-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.atlas-panel {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 1;
  width: min(420px, calc(100vw - 36px));
}

.atlas-mobile-panel-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: none;
  appearance: none;
  border: 1px solid rgba(228, 225, 216, 0.14);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(9, 11, 13, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.atlas-mobile-panel-toggle:hover,
.atlas-mobile-panel-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(228, 225, 216, 0.24);
  outline: none;
}

.atlas-shell.uses-collapsible-panel .atlas-mobile-panel-toggle:not([hidden]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.atlas-shell.uses-collapsible-panel .atlas-panel {
  top: 60px;
  left: 12px;
  width: calc(100vw - 24px);
}

.atlas-shell.uses-collapsible-panel .atlas-panel.is-collapsed {
  display: none;
}

.atlas-loader {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 11, 13, 0.56);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.atlas-movement-shell {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 11, 13, 0.5);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.atlas-movement-list {
  margin: 0;
  min-height: 10em;
  max-height: min(28vh, 280px);
  overflow: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.atlas-gallery-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(9, 11, 13, 0.5);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.atlas-gallery-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-gallery-summary::-webkit-details-marker {
  display: none;
}

.atlas-gallery-summary::after {
  content: "Compare deterministic patch-topology identities";
  margin-left: 10px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: none;
}

.atlas-gallery-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.atlas-gallery-input {
  min-height: 120px;
}

.atlas-gallery-status {
  min-height: 2.4em;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.atlas-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  max-height: min(44vh, 420px);
  overflow: auto;
}

.atlas-gallery-card {
  appearance: none;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(228, 225, 216, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.atlas-gallery-card:hover,
.atlas-gallery-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(228, 225, 216, 0.24);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.atlas-gallery-card.is-error {
  cursor: default;
}

.atlas-gallery-card.is-error:hover,
.atlas-gallery-card.is-error:focus-visible {
  transform: none;
}

.atlas-gallery-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: rgba(8, 10, 12, 0.76);
}

.atlas-gallery-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
}

.atlas-gallery-meta strong {
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
}

.atlas-loader-input {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid rgba(228, 225, 216, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.atlas-loader-input:focus {
  outline: none;
  border-color: rgba(186, 208, 209, 0.28);
  box-shadow: 0 0 0 1px rgba(186, 208, 209, 0.16);
}

.atlas-loader-input::placeholder {
  color: rgba(228, 225, 216, 0.28);
}

.atlas-loader-actions {
  display: flex;
  gap: 10px;
}

.atlas-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atlas-button {
  appearance: none;
  border: 1px solid rgba(228, 225, 216, 0.12);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.atlas-button:hover,
.atlas-button:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(228, 225, 216, 0.24);
  outline: none;
}

.atlas-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.atlas-button-primary {
  background: rgba(194, 179, 154, 0.12);
  border-color: rgba(194, 179, 154, 0.22);
}

.atlas-shortcut-button {
  min-width: 42px;
  padding-inline: 0;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-status {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(9, 11, 13, 0.46);
  backdrop-filter: blur(14px);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .atlas-panel {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
  }

  .atlas-loader-actions {
    flex-wrap: wrap;
  }
}
