:root {
  --bg-deep: #060912;
  --bg: #0a0f1e;
  --bg-soft: #0e1830;
  --panel-width: clamp(320px, 23.2vw, 356px);
  --glass: rgba(13, 23, 42, 0.76);
  --glass-strong: rgba(16, 29, 52, 0.9);
  --line: rgba(110, 170, 245, 0.17);
  --line-bright: rgba(112, 194, 255, 0.44);
  --text: #edf4ff;
  --text-soft: #c4d4ea;
  --muted: #8da3c2;
  --dim: #627694;
  --blue: #69b8ff;
  --cyan: #67e3ff;
  --green: #69f0c2;
  --warm: #ffbf77;
  --red: #ff6363;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 72% 38%, rgba(26, 55, 99, 0.55) 0%, rgba(10, 15, 30, 0) 45%),
    radial-gradient(circle at 92% 92%, rgba(16, 72, 105, 0.24) 0%, rgba(6, 9, 18, 0) 38%),
    var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

::selection {
  color: #04111f;
  background: var(--cyan);
}

.app {
  display: grid;
  grid-template-columns: var(--panel-width) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Left teaching panel
   -------------------------------------------------------------------------- */

.panel {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(18px, 1.55vw, 26px) clamp(16px, 1.35vw, 22px) 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(17, 31, 55, 0.96) 0%, rgba(9, 17, 33, 0.93) 52%, rgba(7, 13, 26, 0.96) 100%);
  border-right: 1px solid rgba(92, 159, 235, 0.2);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  animation: panel-in 0.72s var(--ease) both;
}

.panel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 1px;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(103, 227, 255, 0.5) 34%, rgba(105, 184, 255, 0.12) 72%, transparent);
  pointer-events: none;
}

.panel::after {
  position: absolute;
  top: -120px;
  left: -110px;
  width: 320px;
  height: 320px;
  content: "";
  background: radial-gradient(circle, rgba(74, 148, 255, 0.13), transparent 68%);
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  padding: 0 2px 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  gap: 1px;
  border: 1px solid rgba(111, 193, 255, 0.38);
  border-radius: 18px;
  color: var(--text);
  background:
    radial-gradient(circle at 35% 20%, rgba(103, 227, 255, 0.2), transparent 58%),
    rgba(15, 35, 62, 0.84);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 30px rgba(8, 35, 67, 0.6),
    0 0 26px rgba(80, 170, 255, 0.1);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.brand-h {
  color: #f6f9ff;
  font-size: 12px;
}

.brand-o {
  color: #ff7373;
  font-size: 18px;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: #6fa7dd;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.17em;
  white-space: nowrap;
}

.brand h1 {
  margin: 0;
  color: #f5f9ff;
  font-size: clamp(19px, 1.45vw, 23px);
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.panel-note {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  margin: 0 0 13px;
  padding: 8px 10px;
  border: 1px solid rgba(103, 170, 245, 0.13);
  border-radius: 10px;
  color: #91a8c7;
  background: rgba(6, 14, 28, 0.4);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(103, 227, 255, 0.09), 0 0 12px rgba(103, 227, 255, 0.8);
  animation: soft-pulse 2.6s ease-in-out infinite;
}

.info-stack {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: clamp(8px, 0.9vh, 12px);
  min-height: 0;
  margin-right: -4px;
  padding-right: 4px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.info-stack::-webkit-scrollbar,
.panel::-webkit-scrollbar {
  display: none;
}

.info-card {
  position: relative;
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  gap: clamp(6px, 0.8vh, 10px);
  padding: clamp(12px, 1.15vw, 17px) clamp(13px, 1.25vw, 18px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(30, 53, 87, 0.3), rgba(8, 17, 33, 0.14) 50%),
    rgba(10, 20, 37, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  opacity: 0.76;
  transition:
    opacity 0.45s var(--ease),
    border-color 0.45s var(--ease),
    background 0.45s var(--ease),
    box-shadow 0.45s var(--ease),
    transform 0.45s var(--ease);
}

.info-card::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 0;
  width: 2px;
  content: "";
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--cyan), rgba(105, 184, 255, 0.05));
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}

.info-card:hover {
  border-color: rgba(112, 194, 255, 0.3);
  opacity: 0.92;
}

.info-card.is-active {
  border-color: rgba(100, 197, 255, 0.46);
  background:
    radial-gradient(circle at 8% 2%, rgba(55, 153, 255, 0.14), transparent 46%),
    linear-gradient(135deg, rgba(31, 60, 101, 0.44), rgba(10, 20, 38, 0.62));
  box-shadow:
    inset 0 1px 0 rgba(196, 232, 255, 0.09),
    0 0 0 1px rgba(79, 172, 255, 0.04),
    0 14px 36px rgba(0, 0, 0, 0.18),
    0 0 34px rgba(61, 150, 255, 0.06);
  opacity: 1;
  transform: translateX(2px);
}

.info-card.is-active::before {
  opacity: 1;
}

.card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.card-index {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(112, 194, 255, 0.28);
  border-radius: 7px;
  color: #8ed7ff;
  background: rgba(17, 46, 79, 0.5);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.card-head h2 {
  margin: 0;
  color: #eff7ff;
  font-size: clamp(14px, 1.05vw, 16px);
  font-weight: 650;
  letter-spacing: 0.015em;
}

.macro-badge {
  margin-left: auto;
  padding: 3px 7px;
  border: 1px solid rgba(116, 181, 255, 0.2);
  border-radius: 999px;
  color: #9dc9f8;
  background: rgba(49, 99, 161, 0.14);
  font-size: 8.5px;
  font-weight: 550;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.macro-badge-warm {
  color: #ffc98d;
  border-color: rgba(255, 172, 86, 0.22);
  background: rgba(127, 78, 28, 0.18);
}

.macro-badge-cyan {
  color: #8ceaff;
  border-color: rgba(103, 227, 255, 0.2);
  background: rgba(24, 104, 128, 0.16);
}

.representation {
  display: grid;
  gap: 3px;
}

.rep-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: #6d9ac9;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.rep-label::before {
  width: 10px;
  height: 1px;
  content: "";
  background: currentColor;
  opacity: 0.6;
}

.rep-text {
  margin: 0;
  color: #aebfd6;
  font-size: clamp(10.5px, 0.78vw, 12px);
  font-weight: 400;
  line-height: 1.58;
  letter-spacing: 0.015em;
}

.rep-text strong {
  color: #e4f2ff;
  font-weight: 600;
}

.formula-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px dashed rgba(113, 170, 235, 0.16);
}

.formula-label {
  color: #6884a7;
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.formula {
  color: #c6e6ff;
  font-family: "Cambria Math", "Segoe UI", var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.015em;
  white-space: nowrap;
  text-shadow: 0 0 20px rgba(90, 180, 255, 0.24);
}

.formula sub {
  font-size: 0.66em;
  line-height: 0;
}

.formula-lg {
  font-size: 17px;
}

.formula-note {
  margin-left: auto;
  color: #7189a6;
  font-size: 8.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.formula-row-reaction {
  align-items: center;
}

.formula-reaction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  font-size: 12px;
  white-space: normal;
}

.reaction-arrow {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: 34px;
  color: #73a7d6;
  font-family: var(--font);
  font-size: 7.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.arrow-line {
  margin-top: -1px;
  color: #83c7ff;
  font-size: 16px;
  font-weight: 400;
  line-height: 10px;
}

/* Temperature slider */

.temperature-control {
  display: grid;
  gap: 5px;
  padding: 2px 0 1px;
}

.temperature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.temperature-head label {
  color: #7fa8d3;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.1em;
}

.temperature-head output {
  min-width: 53px;
  padding: 2px 7px;
  border: 1px solid rgba(103, 227, 255, 0.22);
  border-radius: 6px;
  color: #9beaff;
  background: rgba(23, 78, 101, 0.2);
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: inset 0 0 12px rgba(65, 179, 255, 0.06);
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 6px 0 2px;
  border-radius: 999px;
  outline: none;
  background:
    linear-gradient(90deg, #43b8f4 0%, #6de4ff var(--range-progress, 30%), rgba(112, 160, 207, 0.2) var(--range-progress, 30%), rgba(112, 160, 207, 0.2) 100%);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  border: 2px solid #a9edff;
  border-radius: 50%;
  background: #e8fbff;
  box-shadow:
    0 0 0 4px rgba(80, 198, 255, 0.14),
    0 0 16px rgba(80, 198, 255, 0.72);
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(112, 160, 207, 0.2);
}

input[type="range"]::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #43b8f4, #6de4ff);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid #a9edff;
  border-radius: 50%;
  background: #e8fbff;
  box-shadow: 0 0 0 4px rgba(80, 198, 255, 0.14), 0 0 16px rgba(80, 198, 255, 0.72);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px rgba(80, 198, 255, 0.17), 0 0 22px rgba(80, 198, 255, 0.8);
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: #5f7795;
  font-size: 7.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 8px;
  margin-top: 12px;
  padding: 11px 2px 0;
  border-top: 1px solid rgba(105, 163, 225, 0.12);
  color: #5e7695;
  font-size: 8px;
  letter-spacing: 0.045em;
}

.atom-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.key-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.key-h {
  background: #fff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.55);
}

.key-o {
  margin-left: 4px;
  background: var(--red);
  box-shadow: 0 0 7px rgba(255, 99, 99, 0.5);
}

/* --------------------------------------------------------------------------
   Right 3D stage
   -------------------------------------------------------------------------- */

.stage {
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 54% 48%, rgba(23, 48, 84, 0.4) 0%, rgba(10, 15, 30, 0) 52%),
    linear-gradient(145deg, #0a1020 0%, #080d19 48%, #060a13 100%);
  animation: stage-in 1s var(--ease) both;
}

.stage::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
  background: radial-gradient(ellipse at center, transparent 42%, rgba(3, 7, 15, 0.5) 100%);
  pointer-events: none;
}

.stage::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(103, 227, 255, 0.28), transparent);
  pointer-events: none;
}

.scene-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.scene-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.stage-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(72vw, 920px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(50, 135, 235, 0.11) 0%, rgba(40, 120, 210, 0.035) 38%, transparent 68%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.stage-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: radial-gradient(circle, rgba(112, 174, 255, 0.28) 0.8px, transparent 0.9px);
  background-size: 30px 30px;
  opacity: 0.16;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 66%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 66%);
  pointer-events: none;
}

.stage-header {
  position: absolute;
  top: clamp(22px, 2.6vw, 38px);
  left: clamp(22px, 2.6vw, 38px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  animation: hud-in 0.9s 0.1s var(--ease) both;
}

.stage-index {
  color: rgba(124, 187, 255, 0.55);
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  line-height: 0.85;
  letter-spacing: -0.055em;
  text-shadow: 0 0 26px rgba(81, 162, 255, 0.2);
}

.stage-heading {
  display: grid;
  gap: 3px;
  padding-left: 14px;
  border-left: 1px solid rgba(104, 174, 245, 0.25);
}

.stage-kicker {
  color: #648ebc;
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.17em;
}

.stage-heading h2 {
  margin: 0;
  color: #e8f3ff;
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 560;
  letter-spacing: 0.03em;
  text-shadow: 0 0 24px rgba(91, 178, 255, 0.15);
}

.scene-legend {
  position: absolute;
  top: clamp(24px, 2.7vw, 40px);
  right: clamp(22px, 2.6vw, 38px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid rgba(111, 179, 248, 0.16);
  border-radius: 999px;
  color: #9eb2cc;
  background: rgba(8, 17, 32, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  pointer-events: none;
  animation: hud-in 0.9s 0.16s var(--ease) both;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-h {
  background: #f7faff;
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.4);
}

.legend-o {
  background: #ff5b5b;
  box-shadow: 0 0 9px rgba(255, 83, 83, 0.42);
}

.legend-divider {
  width: 1px;
  height: 10px;
  background: rgba(126, 178, 235, 0.18);
}

/* Bottom-left module switcher */

.module-switcher {
  position: absolute;
  bottom: clamp(20px, 2.2vw, 30px);
  left: clamp(20px, 2.2vw, 30px);
  z-index: 6;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(111, 179, 248, 0.18);
  border-radius: 999px;
  background: rgba(7, 15, 29, 0.78);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: hud-in 0.9s 0.22s var(--ease) both;
}

.module-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #93a8c2;
  background: transparent;
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 0.28s ease,
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    transform 0.28s var(--ease);
}

.module-btn:hover {
  color: #d8ecff;
  background: rgba(91, 160, 235, 0.1);
}

.module-btn:active {
  transform: scale(0.97);
}

.module-btn.is-active {
  border-color: rgba(147, 219, 255, 0.32);
  color: #07121f;
  background: linear-gradient(135deg, #a5ebff 0%, #64c8ff 52%, #56a9ff 100%);
  box-shadow:
    0 0 22px rgba(78, 184, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-index {
  font-size: 8px;
  font-weight: 700;
  opacity: 0.55;
  letter-spacing: 0.03em;
}

.module-btn.is-active .btn-index {
  opacity: 0.66;
}

/* Reaction controls */

.reaction-controls {
  position: absolute;
  bottom: clamp(82px, 9vh, 104px);
  left: 50%;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 10px 12px;
  border: 1px solid rgba(103, 227, 255, 0.22);
  border-radius: 17px;
  background: rgba(8, 18, 34, 0.84);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    visibility 0s linear 0.4s;
}

.stage[data-module="3"] .reaction-controls {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition-delay: 0.18s, 0.18s, 0s;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s ease, background 0.25s ease, opacity 0.25s ease;
}

.action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.action-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.action-btn:disabled {
  cursor: wait;
  opacity: 0.56;
}

.action-primary {
  color: #031220;
  background: linear-gradient(135deg, #99efff 0%, #55d3ff 54%, #5bb0ff 100%);
  box-shadow: 0 6px 18px rgba(56, 184, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.action-primary:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(56, 184, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.action-ghost {
  border-color: rgba(116, 177, 239, 0.2);
  color: #b0c6df;
  background: rgba(25, 48, 79, 0.42);
}

.action-ghost:hover:not(:disabled) {
  border-color: rgba(116, 196, 255, 0.38);
  color: #e1f2ff;
  background: rgba(34, 72, 116, 0.46);
}

.btn-icon {
  font-size: 9px;
  line-height: 1;
}

.reaction-status {
  flex: 1 0 100%;
  margin: 1px 0 0;
  color: #88a0bf;
  font-size: 9.5px;
  line-height: 1.35;
  text-align: center;
  letter-spacing: 0.025em;
  transition: color 0.3s ease;
}

.reaction-controls.is-busy .reaction-status {
  color: #8cdcff;
}

.reaction-controls.is-done .reaction-status {
  color: #75ecc9;
}

/* Conservation toast */

.conservation-toast {
  position: absolute;
  top: clamp(88px, 10vh, 112px);
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: min(480px, calc(100% - 48px));
  padding: 11px 16px 11px 12px;
  border: 1px solid rgba(105, 240, 194, 0.28);
  border-radius: 14px;
  background: rgba(8, 26, 33, 0.85);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36), 0 0 32px rgba(63, 224, 177, 0.07);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    visibility 0s linear 0.4s;
}

.conservation-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.toast-icon {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(105, 240, 194, 0.32);
  border-radius: 50%;
  color: #8bffda;
  background: rgba(54, 198, 153, 0.13);
  font-size: 12px;
  box-shadow: inset 0 0 12px rgba(90, 255, 208, 0.08);
}

.toast-copy {
  display: grid;
  gap: 2px;
}

.toast-copy strong {
  color: #a6ffdf;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
}

.toast-copy p {
  margin: 0;
  color: #a8c8c2;
  font-size: 10px;
  line-height: 1.45;
}

.toast-copy sub {
  font-size: 0.7em;
}

/* Canvas hint */

.canvas-hint {
  position: absolute;
  right: clamp(20px, 2.2vw, 30px);
  bottom: clamp(21px, 2.25vw, 31px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(110, 171, 234, 0.13);
  border-radius: 999px;
  color: #748ba7;
  background: rgba(7, 14, 27, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 9px;
  letter-spacing: 0.035em;
  pointer-events: none;
  animation: hud-in 0.9s 0.28s var(--ease) both;
}

.mouse-symbol {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 16px;
  border: 1px solid rgba(156, 198, 238, 0.65);
  border-radius: 6px;
}

.mouse-wheel {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 1.5px;
  height: 4px;
  border-radius: 2px;
  background: #a7d8ff;
  transform: translateX(-50%);
  animation: wheel-scroll 2.2s ease-in-out infinite;
}

/* Boot screen */

.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  background:
    radial-gradient(circle at 50% 45%, rgba(25, 52, 91, 0.62), transparent 46%),
    #080d19;
  transition: opacity 0.65s var(--ease), visibility 0s linear 0.65s;
}

.boot-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-orb {
  position: relative;
  width: 100px;
  height: 90px;
  margin-bottom: 8px;
  animation: boot-float 3s ease-in-out infinite;
}

.boot-atom {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.boot-o {
  top: 21px;
  left: 34px;
  width: 42px;
  height: 42px;
  background: radial-gradient(circle at 35% 30%, #ff9c9c, #e63737 58%, #991a1a 100%);
  box-shadow: 0 0 32px rgba(255, 74, 74, 0.28);
}

.boot-h {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 35% 30%, #ffffff, #ccd9ea 66%, #8eabc9 100%);
  box-shadow: 0 0 22px rgba(195, 226, 255, 0.24);
}

.boot-h1 {
  top: 8px;
  left: 14px;
}

.boot-h2 {
  top: 8px;
  right: 14px;
}

.boot-title {
  margin: 0;
  color: #d8ebff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.boot-detail {
  margin: 0;
  color: #6f88a8;
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.boot-detail.is-error {
  color: #ff9a9a;
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 100;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(255, 129, 129, 0.3);
  border-radius: 12px;
  color: #ffd2d2;
  background: rgba(74, 15, 26, 0.92);
  font-size: 13px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Responsive / projection adjustments
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  :root {
    --panel-width: 324px;
  }

  .panel {
    padding-right: 15px;
    padding-left: 16px;
  }

  .brand {
    gap: 11px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
  }

  .stage-header {
    top: 24px;
    left: 24px;
  }

  .scene-legend {
    top: 25px;
    right: 24px;
  }

  .module-switcher {
    bottom: 22px;
    left: 24px;
  }

  .canvas-hint {
    right: 24px;
    bottom: 23px;
  }
}

@media (max-height: 980px) {
  .panel {
    padding-top: 16px;
    padding-bottom: 10px;
  }

  .brand {
    padding-bottom: 10px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
  }

  .panel-note {
    display: none;
  }

  .reaction-controls {
    bottom: 82px;
  }

  .conservation-toast {
    top: 82px;
  }
}

@media (max-height: 850px) {
  .info-stack {
    gap: 8px;
  }

  .info-card {
    gap: 5px;
    padding: 10px 12px;
    border-radius: 13px;
  }

  .card-head {
    gap: 6px;
  }

  .card-index {
    width: 20px;
    height: 20px;
  }

  .rep-text {
    font-size: 10px;
    line-height: 1.48;
  }

  .formula-row {
    padding-top: 7px;
  }

  .temperature-control {
    gap: 3px;
    padding-top: 0;
  }

  input[type="range"] {
    margin-top: 4px;
    margin-bottom: 0;
  }

  .panel-footer {
    margin-top: 8px;
    padding-top: 8px;
  }

  .reaction-controls {
    bottom: 76px;
    padding: 8px 10px;
  }

  .conservation-toast {
    top: 78px;
  }
}

@media (max-width: 1050px) {
  .module-btn {
    padding: 8px 10px;
    font-size: 10px;
  }

  .scene-legend {
    display: none;
  }

  .canvas-hint {
    bottom: 75px;
  }

  .reaction-controls {
    bottom: 122px;
  }
}

@media (max-width: 820px) {
  :root {
    --panel-width: 320px;
  }

  .stage-header {
    gap: 9px;
  }

  .stage-index {
    font-size: 34px;
  }

  .stage-heading {
    padding-left: 9px;
  }

  .stage-heading h2 {
    font-size: 16px;
  }

  .module-switcher {
    gap: 2px;
    padding: 4px;
  }

  .module-btn {
    gap: 4px;
    padding: 7px 8px;
    font-size: 9px;
  }

  .btn-index {
    display: none;
  }

  .canvas-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  .info-card,
  .module-btn,
  .action-btn,
  .reaction-controls,
  .conservation-toast {
    transition-duration: 0.001ms !important;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes stage-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hud-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    opacity: 0.65;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

@keyframes wheel-scroll {
  0%,
  100% {
    opacity: 0.35;
    transform: translate(-50%, 0);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, 4px);
  }
  70% {
    opacity: 0;
    transform: translate(-50%, 5px);
  }
}

@keyframes boot-float {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-7px) rotate(1deg);
  }
}
