/* Quantum Atlas — шкала жизни.
   Оформление синхронизировано с разделами /particles/, /atoms/ и /molecules/. */

:root {
  --active-color: #6ab6ff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6f8ff;
  background: #030711;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

button, a { font: inherit; }

button:focus-visible { outline: 2px solid var(--active-color); outline-offset: 2px; }

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 58%, color-mix(in srgb, var(--active-color) 12%, transparent), transparent 34%),
    #030711;
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 7, 17, .84), transparent 28%, transparent 70%, rgba(3, 7, 17, .82)),
    linear-gradient(180deg, rgba(3, 7, 17, .84), transparent 29%, transparent 72%, rgba(3, 7, 17, .72));
}

.atlas-ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 20px 24px 16px;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(360px, 1fr) minmax(330px, 385px);
  grid-template-rows: 54px auto minmax(0, 1fr) 26px;
  gap: 12px 18px;
  pointer-events: none;
}

.interactive { pointer-events: auto; }

/* ---------- верхняя панель ---------- */

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--active-color) 60%, transparent);
  border-radius: 14px;
  color: var(--active-color);
  background: color-mix(in srgb, var(--active-color) 10%, rgba(8, 14, 28, .88));
  box-shadow: 0 0 24px color-mix(in srgb, var(--active-color) 18%, transparent);
}

.eyebrow, .section-label, .level-kicker {
  color: #8391ac;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.brand-title { margin-top: 2px; font-size: 18px; font-weight: 740; letter-spacing: -.02em; }

.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 11px;
  color: #a9b6cd;
  background: rgba(8, 14, 27, .72);
  backdrop-filter: blur(18px);
  text-decoration: none;
  font-size: 11px;
  font-weight: 720;
}

.ghost-btn:hover {
  color: #fff;
  border-color: color-mix(in srgb, var(--active-color) 38%, transparent);
  background: color-mix(in srgb, var(--active-color) 12%, rgba(8, 14, 27, .8));
}

.ghost-btn.static { color: #8391ac; cursor: default; }
.ghost-btn.static:hover { color: #8391ac; border-color: rgba(255, 255, 255, .09); background: rgba(8, 14, 27, .72); }

/* ---------- список уровней ---------- */

.level-rail {
  grid-column: 1;
  grid-row: 2 / 5;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 18px;
  background: rgba(8, 14, 27, .7);
  backdrop-filter: blur(20px);
}

.rail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #dce5f7;
  font-size: 12px;
  font-weight: 760;
}
.rail-heading small { color: #70809d; }

.level-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 3px;
}

.level-list::-webkit-scrollbar, .detail-panel::-webkit-scrollbar { width: 5px; }
.level-list::-webkit-scrollbar-thumb, .detail-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 99px; }

.level-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #b4bfd4;
  background: rgba(255, 255, 255, .018);
  cursor: pointer;
  text-align: left;
  transition: .18s ease;
}

.level-card:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.level-card.active {
  border-color: color-mix(in srgb, var(--level-color) 42%, transparent);
  color: #fff;
  background: color-mix(in srgb, var(--level-color) 11%, rgba(255, 255, 255, .025));
  box-shadow: inset 3px 0 var(--level-color);
}

.level-chip {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--level-color);
  background: color-mix(in srgb, var(--level-color) 12%, #0b1222);
  font-size: 16px;
  font-weight: 780;
}

.level-card-copy { min-width: 0; }
.level-card-copy strong, .level-card-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-card-copy strong { font-size: 12px; }
.level-card-copy small { margin-top: 2px; color: #687791; font-size: 9px; }

/* ---------- заголовок ---------- */

.level-heading {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  width: min(620px, 96%);
  text-align: center;
  text-shadow: 0 2px 22px #030711;
}

.level-heading h1 {
  margin: 7px 0 8px;
  font-size: clamp(26px, 3.1vw, 42px);
  line-height: 1;
  letter-spacing: -.045em;
}

.level-heading h1 .level-number {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-right: 12px;
  border: 1px solid color-mix(in srgb, var(--level-color) 45%, transparent);
  border-radius: 14px;
  color: var(--level-color);
  background: color-mix(in srgb, var(--level-color) 11%, rgba(6, 11, 23, .75));
  font-size: .5em;
  font-weight: 780;
  vertical-align: 6px;
  box-shadow: 0 0 32px color-mix(in srgb, var(--level-color) 16%, transparent);
}

.level-heading > p {
  max-width: 620px;
  margin: 0 auto;
  color: #9eabc1;
  font-size: 13px;
  line-height: 1.5;
}

.status-line { display: flex; justify-content: center; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.status, .model-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  color: #8d9bb4;
  background: rgba(5, 10, 21, .68);
  font-size: 9px;
  font-weight: 720;
}
.status { color: color-mix(in srgb, var(--level-color) 75%, #ffffff); border-color: color-mix(in srgb, var(--level-color) 28%, transparent); }

/* ---------- сцена ---------- */

.model-stage {
  position: relative;
  grid-column: 2;
  grid-row: 3;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  cursor: grab;
}

.model-stage:active { cursor: grabbing; }

#canvas-container { position: absolute; inset: 0; }
#canvas-container canvas { display: block; }

/* ---------- правая панель ---------- */

.detail-panel {
  grid-column: 3;
  grid-row: 2 / 5;
  min-height: 0;
  overflow-y: auto;
  padding: 19px;
  border: 1px solid rgba(255, 255, 255, .085);
  border-radius: 20px;
  background: rgba(8, 14, 27, .76);
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.panel-header { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 14px; }
.panel-header h2 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.03em; white-space: nowrap; }
.panel-symbol { color: var(--level-color); font-size: 30px; font-weight: 800; line-height: 1; }

.facts { margin: 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.fact-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .065);
}
.fact-row dt { color: #71809c; font-size: 10px; font-weight: 720; }
.fact-row dd { color: #d7dfef; font-size: 11px; line-height: 1.45; }

.panel-block { margin-top: 16px; }

.description { margin-top: 8px; }
.description p { color: #8795ae; font-size: 10.5px; line-height: 1.6; }

.tag-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-list span {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 7px;
  color: #a9b6cd;
  background: rgba(255, 255, 255, .025);
  font-size: 9px;
}

.visual-note {
  margin-top: 16px;
  padding: 11px 12px;
  border-left: 2px solid color-mix(in srgb, var(--level-color) 55%, transparent);
  border-radius: 0 9px 9px 0;
  background: rgba(255, 255, 255, .025);
}
.visual-note > span { color: #dce5f7; font-size: 10px; font-weight: 770; }
.visual-note p { margin-top: 5px; color: #8795ae; font-size: 10px; line-height: 1.55; }
.visual-note .visual-caveat { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .07); color: #6f7d96; }

.canvas-hint {
  grid-column: 2;
  grid-row: 4;
  justify-self: center;
  align-self: center;
  color: #596783;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
}

/* ---------- адаптив ---------- */

@media (max-width: 1250px) {
  .ghost-btn .btn-text { display: none; }
}

@media (max-width: 1050px) {
  .atlas-ui { grid-template-columns: 210px minmax(320px, 1fr) 320px; padding-inline: 14px; }
  .ghost-btn.static { display: none; }
}

@media (min-width: 821px) and (max-height: 760px) {
  .level-heading h1 { margin: 5px 0 6px; font-size: clamp(24px, 2.6vw, 32px); }
  .level-heading h1 .level-number { width: 40px; height: 40px; margin-right: 10px; vertical-align: 4px; }
  .level-heading > p { font-size: 12px; }
}

@media (max-width: 820px) {
  html, body { overflow: auto; }
  .app-shell { min-height: 100%; height: auto; overflow: visible; }
  .atlas-ui {
    position: relative;
    min-height: 100svh;
    padding: 12px;
    display: block;
    overflow: visible;
  }
  .topbar { min-height: 48px; }
  .brand-title { font-size: 15px; }
  .brand-mark { width: 38px; height: 38px; }
  .level-rail { margin-top: 10px; padding: 9px; }
  .rail-heading { display: none; }
  .level-list { flex-direction: row; overflow-x: auto; padding: 0 0 3px; }
  .level-card { flex: 0 0 150px; min-height: 48px; }
  .level-chip { width: 31px; height: 31px; font-size: 14px; }
  .level-card-copy strong { font-size: 10px; }
  .level-card-copy small { display: none; }
  .level-heading { width: 100%; padding: 16px 6px 0; }
  .level-heading h1 { font-size: clamp(24px, 8vw, 34px); }
  .level-heading h1 .level-number { width: 40px; height: 40px; margin-right: 8px; }
  .model-label { display: none; }
  .model-stage { height: 52svh; min-height: 280px; margin-top: 10px; border: 1px solid rgba(255, 255, 255, .06); background: rgba(6, 11, 23, .5); }
  .detail-panel { position: relative; margin-top: 10px; overflow: visible; padding: 18px; background: rgba(8, 14, 27, .94); }
  .canvas-hint { display: block; margin: 10px 0 4px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
