:root{
  --bg0:#05070f;
  --bg1:#070b16;
  --glass: rgba(255,255,255,.06);
  --glass2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.70);
  --muted2: rgba(255,255,255,.55);
  --brand:#7c5cff;
  --brand2:#22d3ee;
  --ok:#22c55e;
  --warn:#fbbf24;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 18% 10%, rgba(124,92,255,.22), transparent 60%),
    radial-gradient(900px 420px at 72% 18%, rgba(34,211,238,.16), transparent 60%),
    radial-gradient(900px 560px at 50% 92%, rgba(34,197,94,.10), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  overflow-x:hidden;
}

a{ color:inherit; text-decoration:none; }
small{ color: var(--muted2); }

.wrap{ width:min(1180px, 100% - 36px); margin: 0 auto; }

.topbar{
  position:sticky; top:0; z-index: 50;
  background: rgba(8,10,18,.55);
  border-bottom:1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(14px);
}
.topbar .in{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; padding: 12px 0;
}

.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width: 36px; height:36px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(124,92,255,.9), rgba(34,211,238,.75));
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.t1{ font-weight: 950; letter-spacing:.2px; }
.t2{ font-size: 12.5px; color: var(--muted2); margin-top:2px; }

nav{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.pill{
  padding: 9px 12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.82);
  font-weight: 800;
  transition: .15s ease;
}
.pill:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.18); }
.pill.active{ border-color: rgba(124,92,255,.55); background: rgba(124,92,255,.12); }

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.90);
  font-weight: 900;
  cursor:pointer;
  transition: .15s ease;
}
.btn:hover{ transform: translateY(-1px); border-color: rgba(255,255,255,.22); }
.btn.primary{
  border-color: rgba(124,92,255,.60);
  background: linear-gradient(135deg, rgba(124,92,255,.55), rgba(34,211,238,.18));
}
.btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; }

.hero{ padding: 18px 0 6px; }
.hero-card{
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 26px;
  overflow:hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.hero-bg{
  height: 22px;
  background: linear-gradient(90deg, rgba(124,92,255,.55), rgba(34,211,238,.22), rgba(34,197,94,.18));
  opacity: .75;
}
.hero-inner{
  display:flex; gap:16px; align-items:stretch;
  padding: 18px;
}
.hero-inner h1{
  margin: 0 0 8px;
  font-size: clamp(28px, 3.4vw, 44px);
  letter-spacing: .2px;
}
.lead{ margin:0; color: rgba(255,255,255,.78); line-height:1.55; }

.badges{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 14px; }
.badge{
  display:flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.80);
  font-weight: 800;
  font-size: 13px;
}
.dot{
  width:8px; height:8px; border-radius:999px;
  background: rgba(34,211,238,.85);
  box-shadow: 0 0 0 4px rgba(34,211,238,.15);
}

.media{
  width: min(420px, 40vw);
  border-radius: 22px;
  border:1px solid rgba(255,255,255,.12);
  background: radial-gradient(1200px 600px at 30% 20%, rgba(124,92,255,.20), transparent 60%),
              radial-gradient(1200px 600px at 70% 60%, rgba(34,211,238,.14), transparent 60%),
              rgba(255,255,255,.03);
  overflow:hidden;
  position:relative;
}
.media img{ width:100%; height:100%; object-fit:cover; display:block; opacity:.86; }

/* Глобально прячем любые тех-подписи */
.cap, .caption, .filecap, .imgcap, .media .cap{ display:none !important; }

section{ padding: 12px 0; }

.panel{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  border-radius: 22px;
  overflow:hidden;
}
.panel .head{
  display:flex; justify-content:space-between; gap:12px;
  padding: 14px 16px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.panel .head h2{ margin:0; font-size: 18px; }
.panel .head p{ margin:6px 0 0; color: rgba(255,255,255,.72); line-height:1.45; }
.tag{
  font-family: var(--mono);
  font-size: 12.5px;
  color: rgba(255,255,255,.70);
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  padding: 6px 10px;
  border-radius: 999px;
  height: fit-content;
}
.panel .body{
  padding: 16px;
  display:flex; gap:16px;
  align-items: stretch;
}
@media (max-width: 980px){
  .hero-inner{ flex-direction:column; }
  .media{ width:100%; height: 220px; }
  .panel .body{ flex-direction:column; }
}

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}
@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
}

.card{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  border-radius: 18px;
}
.card .in{ padding: 14px 14px; }
.card h3{ margin:0 0 8px; font-size: 16px; }
.card p{ margin:0; color: rgba(255,255,255,.74); line-height:1.55; }

.notice{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  border-radius: 16px;
  padding: 12px 14px;
  color: rgba(255,255,255,.78);
  line-height:1.55;
}

.controls{
  width: min(360px, 100%);
  border:1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(0,0,0,.16);
  padding: 12px;
}
.ctrl{ margin-bottom: 12px; }
.ctrl label{
  display:flex; justify-content:space-between; gap:10px;
  align-items:center;
  font-weight: 900;
  color: rgba(255,255,255,.86);
  margin-bottom: 8px;
}
.row{ display:flex; gap:10px; flex-wrap:wrap; }

.hud{
  position:absolute;
  left:12px; bottom:12px;
  display:flex; gap:8px; flex-wrap:wrap;
}
.chip{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  border-radius: 999px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12.3px;
  color: rgba(255,255,255,.78);
}

input[type="range"]{ width:100%; }

select{ width:100%; padding: 10px 12px; font-weight: 900; border-radius: 12px; }
select{
  background: rgba(10,16,28,.72);
  color: rgba(255,255,255,.92);
  border:1px solid rgba(255,255,255,.16);
  outline:none;
}
select option{ background: #0b1224; color: rgba(255,255,255,.92); }

/* Аккордеоны (для теории) */
.acc{
  border:1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  overflow:hidden;
  background: rgba(255,255,255,.03);
}
.acc .item{ border-top:1px solid rgba(255,255,255,.10); }
.acc .item:first-child{ border-top:none; }
.acc .btnline{
  width:100%;
  text-align:left;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.90);
  font-weight: 950;
  cursor:pointer;
}
.acc .content{
  display:none;
  padding: 0 14px 14px;
  color: rgba(255,255,255,.74);
  line-height:1.6;
}
.acc .item.open .content{ display:block; }

.footer{
  padding: 24px 0 30px;
  color: rgba(255,255,255,.72);
}
.footer .wrap{
  border-top:1px solid rgba(255,255,255,.10);
  padding-top: 16px;
}

.canvas-wrap{ position:relative; height:560px; }
@media (max-width: 980px){ .canvas-wrap{ height:420px; } }
.canvas-wrap canvas{ position:absolute; inset:0; width:100%; height:100%; display:block; }
/* 3D сцена должна иметь высоту на всех брейкпоинтах */
#molStage.canvas-wrap{ flex:1; height:560px; min-height:560px; }
@media (max-width: 980px){
  #molStage.canvas-wrap{ height:420px; min-height:420px; }
}
/* Фикс: на некоторых размерах окна контейнер под canvas схлопывается */
#molStage.canvas-wrap{
  flex: 1;
  min-height: 560px;
}

@media (max-width: 980px){
  #molStage.canvas-wrap{
    min-height: 420px;
  }
}

/* На всякий: canvas должен занимать контейнер */
#molCanvas{
  width: 100%;
  height: 100%;
  display: block;
}
/* HUD под сценой (не поверх canvas) */
#molHudUnder.mol-hud-under{
  position: static !important;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 10px;
}

/* на всякий: убираем любые абсолютные позиции, если где-то были */
#hudMol, #hudAtoms, #hudBonds{
  position: static !important;
}
