:root {
  color-scheme: dark;
  --bg: #050914;
  --paper: rgba(10, 19, 32, 0.88);
  --ink: #eef7ff;
  --muted: #a9b8cb;
  --line: rgba(105, 151, 190, 0.26);
  --cyan: #4fd9ff;
  --green: #6df0ca;
  --amber: #f7c76b;
  --rose: #c68bff;
  --navy: #09111f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 167, 194, 0.08), transparent 28rem),
    linear-gradient(180deg, #f7faf9 0%, var(--bg) 34rem);
  letter-spacing: 0;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea,
select {
  -webkit-user-select: text;
  user-select: text;
}

a {
  color: inherit;
}

img,
canvas {
  max-width: 100%;
  display: block;
}

p,
li {
  color: var(--muted);
  line-height: 1.65;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  position: static;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 227, 230, 0.82);
  background: rgba(246, 248, 247, 0.92);
  backdrop-filter: blur(14px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
  color: var(--navy);
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 167, 194, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 167, 194, 0.16), rgba(13, 140, 103, 0.14));
  color: var(--green);
  font-weight: 950;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: block;
  object-fit: contain;
  border-radius: 10px;
  filter: drop-shadow(0 0 16px rgba(79, 217, 255, 0.2));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #33404a;
  font-weight: 700;
  font-size: 0.94rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: #eaf3f1;
  color: var(--green);
}

.button,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--navy);
}

.button.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.34);
}

.hero {
  position: relative;
  min-height: 610px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #0e141d;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 12, 18, 0.92) 0%, rgba(6, 12, 18, 0.72) 42%, rgba(6, 12, 18, 0.24) 100%),
    linear-gradient(0deg, rgba(6, 12, 18, 0.86) 0%, transparent 34%);
  z-index: 1;
}

.brand-hero {
  min-height: auto;
  display: block;
}

.brand-hero::before {
  background:
    linear-gradient(90deg, rgba(3, 8, 17, 0.58) 0%, rgba(3, 8, 17, 0.12) 36%, rgba(3, 8, 17, 0.12) 70%, rgba(3, 8, 17, 0.42) 100%),
    linear-gradient(0deg, rgba(3, 8, 17, 0.92) 0%, rgba(3, 8, 17, 0.3) 24%, transparent 58%);
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-hero img {
  position: relative;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 92px 0 54px;
}

.brand-hero-content {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.brand-hero-content h1 {
  max-width: 620px;
  font-size: 2.2rem;
}

.brand-hero-content .lead {
  max-width: 620px;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.hero .eyebrow {
  color: #78e0c5;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h1 {
  max-width: 890px;
  color: #fff;
  font-size: 4.35rem;
}

h2 {
  font-size: 2.55rem;
}

h3 {
  font-size: 1.28rem;
}

.lead {
  max-width: 760px;
  color: #d9e4e5;
  font-size: clamp(1rem, 1.08vw, 1.1rem);
}

.hero-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-strip {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.12);
}

.hero-strip div {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 18px;
  background: rgba(8, 14, 22, 0.76);
}

.hero-strip strong {
  display: block;
  color: #fff;
  font-size: 1.14rem;
}

.hero-strip span {
  color: #bdd0d4;
  line-height: 1.45;
}

.hero-strip .button {
  justify-self: start;
}

section {
  padding: 58px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-head p {
  max-width: 650px;
  margin: 8px 0 0;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.panel,
.tool-panel,
.lab-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(16, 20, 24, 0.05);
}

.card {
  padding: 22px;
}

.card h3,
.panel h3 {
  margin-bottom: 10px;
}

.card p:last-child,
.panel p:last-child {
  margin-bottom: 0;
}

.stat {
  display: block;
  color: var(--cyan);
  font-weight: 950;
  font-size: 1.58rem;
  line-height: 1;
}

.band {
  background: #101820;
  color: #fff;
}

.band h2,
.band h3 {
  color: #fff;
}

.band p,
.band li {
  color: #c9d6d7;
}

.topic-list {
  display: grid;
  gap: 12px;
}

.topic-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.topic-row strong {
  color: var(--navy);
}

.page-hero {
  padding: 72px 0 46px;
  background:
    linear-gradient(135deg, rgba(0, 167, 194, 0.1), transparent 30rem),
    linear-gradient(180deg, #ffffff, #f3f7f6);
  border-bottom: 1px solid var(--line);
}

.page-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 32px;
  align-items: center;
}

.page-hero-copy {
  min-width: 0;
}

.page-hero-visual {
  margin: 0;
  min-width: 0;
  border: 1px solid rgba(105, 151, 190, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: #030712;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.36), 0 0 34px rgba(79, 217, 255, 0.1);
}

.page-hero-visual img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.page-hero h1 {
  color: var(--ink);
  max-width: 980px;
  font-size: 3.45rem;
}

.page-hero .lead {
  color: var(--muted);
}

.lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.lab-panel {
  overflow: hidden;
}

.concept-theater {
  padding-top: 40px;
}

.concept-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: stretch;
}

.concept-visual {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.concept-canvas {
  width: 100%;
  min-height: 460px;
  background: #030712;
}

.concept-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(79, 217, 255, 0.2);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.82);
  backdrop-filter: blur(10px);
}

.concept-caption strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.concept-caption span {
  color: var(--muted);
}

.concept-controls {
  display: grid;
  align-content: start;
  gap: 16px;
}

.concept-controls > label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.concept-steps {
  display: grid;
  gap: 10px;
}

.concept-steps div {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.46);
}

.concept-steps span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(79, 217, 255, 0.12);
  color: var(--green);
  font-weight: 900;
}

.concept-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.equation-studio {
  padding-top: 24px;
}

.equation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.equation-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 0%, rgba(79, 217, 255, 0.11), transparent 18rem),
    rgba(7, 16, 28, 0.9);
  box-shadow: var(--shadow);
}

.equation-canvas {
  width: 100%;
  min-height: 280px;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
  background: #030712;
}

.equation-copy {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.equation-copy h3 {
  color: var(--ink);
}

.equation-copy p {
  margin: 0;
}

.equation-copy .formula {
  background: rgba(3, 8, 17, 0.78);
  color: #dff6ff;
  border-color: rgba(79, 217, 255, 0.2);
}

.cat-lab {
  padding-top: 10px;
}

.cat-experiment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.cat-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.cat-canvas {
  width: 100%;
  min-height: 430px;
  background: #030712;
}

.cat-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.cat-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.cat-readout span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cat-controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

.cat-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cat-button-row .button {
  min-width: 112px;
  justify-content: center;
}

.cat-controls .formula {
  margin: 0;
  background: rgba(3, 8, 17, 0.78);
  color: #dff6ff;
  border-color: rgba(79, 217, 255, 0.2);
}

.wave-hero-visual {
  min-height: 280px;
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 217, 255, 0.16), transparent 18rem),
    #030712;
}

.wave-mini-canvas {
  display: block;
  width: 100%;
  min-height: 280px;
}

.wave-console {
  padding-top: 28px;
}

.wave-layout,
.wave-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.wave-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(198, 139, 255, 0.12), transparent 22rem),
    #030712;
  background-size: 72px 72px, 72px 72px, auto, auto;
  box-shadow: var(--shadow);
  touch-action: none;
}

.wave-stage canvas {
  display: block;
  width: 100%;
  min-height: 520px;
  cursor: grab;
}

.wave-stage canvas.is-dragging {
  cursor: grabbing;
}

.wave-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.wave-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.wave-readout span {
  color: var(--muted);
  font-size: 13px;
}

.wave-controls,
.wave-theory-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.wave-controls select,
.wave-controls input[type="range"],
.wave-controls button {
  width: 100%;
}

.toggle-line {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
}

.wave-slice-card {
  overflow: hidden;
}

.wave-slice-canvas {
  display: block;
  width: 100%;
  min-height: 420px;
  background: #000;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
}

.wave-gallery-canvas {
  display: block;
  width: 100%;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.wave-legend {
  display: grid;
  grid-template-columns: auto minmax(180px, 420px) auto;
  gap: 12px;
  align-items: center;
  max-width: 720px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 13px;
}

.legend-ramp {
  min-height: 20px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: linear-gradient(90deg, #120528, #641f91, #ff6b17, #ffe58a, #ffffff);
}

.legend-negative,
.legend-positive {
  white-space: nowrap;
}

.qcd-hero-visual {
  min-height: 280px;
  background:
    radial-gradient(circle at 28% 50%, rgba(255, 79, 139, 0.16), transparent 14rem),
    radial-gradient(circle at 72% 50%, rgba(79, 217, 255, 0.16), transparent 14rem),
    #030712;
}

.qcd-mini-canvas {
  display: block;
  width: 100%;
  min-height: 280px;
}

.qcd-topic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.qcd-simulator {
  padding-top: 28px;
}

.qcd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 360px);
  gap: 16px;
  align-items: stretch;
}

.qcd-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 217, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(198, 139, 255, 0.12), transparent 24rem),
    #030712;
  background-size: 72px 72px, 72px 72px, auto, auto;
  box-shadow: var(--shadow);
}

.qcd-stage canvas {
  display: block;
  width: 100%;
  min-height: 520px;
}

.qcd-potential-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.qcd-readout {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.78);
  backdrop-filter: blur(12px);
}

.qcd-readout strong {
  color: var(--ink);
  font-size: 15px;
}

.qcd-readout span {
  color: var(--muted);
  font-size: 13px;
}

.qcd-controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

.qcd-controls select,
.qcd-controls input[type="range"] {
  width: 100%;
}

.qcd-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.qcd-panel {
  overflow: hidden;
}

.qcd-panel-canvas {
  display: block;
  width: 100%;
  min-height: 340px;
  background: #030712;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
}

.qcd-figure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.qcd-figure {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 16, 28, 0.9);
  box-shadow: var(--shadow);
}

.qcd-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.82;
  object-fit: contain;
  padding: 8px;
  background: #f6fbff;
  border-bottom: 1px solid rgba(79, 217, 255, 0.18);
  filter: contrast(1.32) saturate(0.85);
}

.qcd-figure figcaption {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.qcd-equations .card,
.qcd-equations .formula {
  min-width: 0;
  max-width: 100%;
}

.qcd-equations .formula {
  overflow-x: auto;
  scrollbar-width: thin;
}

.lab-canvas {
  width: 100%;
  min-height: 360px;
  background: #0e151d;
}

.lab-copy {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.control-stack {
  display: grid;
  gap: 14px;
}

.control {
  display: grid;
  gap: 7px;
}

.control label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #23313c;
  font-weight: 800;
}

input[type="range"],
input[type="number"],
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
}

input[type="range"] {
  padding: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tabs button {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}

.tabs button[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
}

.news-list {
  display: grid;
  gap: 12px;
}

.news-item {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.news-item a {
  color: var(--navy);
  font-weight: 900;
  text-decoration: none;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #6b747d;
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #fff;
  color: #31404b;
  font-weight: 750;
  font-size: 0.86rem;
}

.formula {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  padding: 14px;
  color: #22303a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.agent-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(13, 140, 103, 0.12);
}

.agent-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-pilot {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-pilot .small {
  margin: 0;
  max-width: 520px;
}

.visitor-counter,
.pageview-counter {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, auto);
  gap: 18px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 18, 34, 0.94), rgba(14, 24, 48, 0.84));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.visitor-label {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.visitor-counter strong,
.pageview-counter strong {
  display: block;
  color: var(--ink);
  font-size: 1.55rem;
  line-height: 1;
}

.visitor-counter dl,
.pageview-counter dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.visitor-counter dl div,
.pageview-counter dl div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.76);
}

.visitor-counter dt,
.pageview-counter dt {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.visitor-counter dd,
.pageview-counter dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.footer-rating {
  display: grid;
  gap: 5px;
  min-width: min(100%, 260px);
  padding: 10px 12px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.68);
  color: #d6e5f4;
  font-size: 0.82rem;
  font-weight: 800;
}

.footer-rating strong {
  color: #eef7ff;
}

.rating-stars {
  color: #ffd166;
  font-size: 1.08rem;
  letter-spacing: 0;
}

.contact-band {
  background: linear-gradient(135deg, rgba(6, 17, 34, 0.96), rgba(18, 22, 54, 0.9));
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
  gap: 28px;
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.86);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.26);
}

.contact-form input[name="website"] {
  position: absolute;
  inset: auto;
  width: 1px;
  height: 1px;
  margin: -1px;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  opacity: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.contact-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.9);
  color: var(--ink);
  font: inherit;
  padding: 12px 13px;
}

.contact-form textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.feedback-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  width: min(360px, calc(100vw - 24px));
  border: 1px solid rgba(109, 240, 202, 0.34);
  border-radius: 8px;
  background:
    radial-gradient(circle at 90% 0%, rgba(109, 240, 202, 0.16), transparent 13rem),
    rgba(5, 12, 24, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
  color: var(--ink);
  padding: 14px;
  transform: translate(-50%, -50%);
}

.feedback-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(3, 8, 17, 0.7);
  color: #d6e5f4;
}

.feedback-form {
  display: grid;
  gap: 9px;
}

.feedback-form h2 {
  max-width: 270px;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.18;
}

.star-rating {
  display: flex;
  gap: 4px;
}

.star-button {
  width: 38px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(255, 209, 102, 0.2);
  background: rgba(3, 8, 17, 0.7);
  color: rgba(255, 209, 102, 0.46);
  font-size: 1.2rem;
}

.star-button.is-selected,
.star-button:hover {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.5);
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.14);
}

.feedback-form textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.88);
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
  font-size: 0.9rem;
}

.feedback-status {
  min-height: 20px;
  margin: 0;
  color: #b7c7da;
  font-size: 0.84rem;
  font-weight: 800;
}

.small {
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 980px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    overflow-x: visible;
    padding-bottom: 4px;
  }

  .nav-links a {
    min-width: 0;
    text-align: center;
    white-space: normal;
  }

  .hero {
    min-height: 720px;
  }

  .brand-hero {
    min-height: auto;
  }

  .brand-hero img {
    object-position: center top;
  }

  .hero-strip,
  .grid-2,
  .grid-3,
  .grid-4,
  .equation-grid,
  .concept-stage,
  .cat-experiment,
  .wave-layout,
  .wave-split,
  .qcd-layout,
  .qcd-panel-grid,
  .qcd-figure-grid,
  .contact-layout,
  .lab-layout {
    grid-template-columns: 1fr;
  }

  .wave-stage canvas,
  .qcd-stage canvas {
    min-height: 430px;
  }

  .wave-legend {
    grid-template-columns: 1fr;
  }

  .qcd-topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .element-category-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    display: block;
  }

  .page-hero-inner {
    grid-template-columns: 1fr;
  }

  .page-hero-visual {
    max-width: 680px;
  }

  .topic-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  h1,
  .page-hero h1 {
    font-size: 2.85rem;
  }

  h2 {
    font-size: 2.05rem;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 22px, 1180px);
  }

  .nav {
    gap: 10px;
    min-height: auto;
    padding: 10px 0;
  }

  .brand {
    font-size: 1rem;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

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

  .nav-links {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    overflow-x: visible;
    padding: 2px 0 3px;
  }

  .nav-links a {
    min-height: 34px;
    min-width: 0;
    padding: 7px 3px;
    font-size: 0.68rem;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }

  .hero-content {
    padding-top: 56px;
  }

  .page-hero {
    padding: 46px 0 34px;
  }

  .page-hero-inner {
    gap: 20px;
  }

  h1,
  .page-hero h1 {
    font-size: 2rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.55rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .lead {
    font-size: 0.98rem;
    line-height: 1.55;
  }

  .element-category-legend {
    grid-template-columns: 1fr;
  }

  .element-category-key {
    font-size: 0.78rem;
  }

  section {
    padding: 42px 0;
  }

  .agent-row {
    grid-template-columns: 18px 1fr;
    align-items: start;
  }

  .agent-row .pill {
    grid-column: 2;
    justify-self: start;
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
  }

  .footer-pilot {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .footer-pilot .button {
    width: 100%;
    max-width: 320px;
  }

  .visitor-counter,
  .pageview-counter {
    grid-template-columns: 1fr;
  }

  .visitor-counter dl,
  .pageview-counter dl {
    grid-template-columns: 1fr;
  }

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

  .concept-visual {
    min-height: 500px;
  }
}

/* Quantum-security theme layer, matched to the QEntangle reference artwork. */
body {
  background:
    radial-gradient(circle at 12% 4%, rgba(79, 217, 255, 0.18), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(198, 139, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, #040812 0%, var(--bg) 34rem);
}

.topbar {
  border-bottom-color: rgba(105, 151, 190, 0.22);
  background: rgba(5, 9, 20, 0.9);
}

.brand {
  color: var(--ink);
}

.brand-mark {
  border-color: rgba(79, 217, 255, 0.5);
  background: linear-gradient(135deg, rgba(79, 217, 255, 0.22), rgba(198, 139, 255, 0.2));
  color: var(--green);
  box-shadow: 0 0 24px rgba(79, 217, 255, 0.18);
}

.nav-links a {
  color: #c6d5e7;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: rgba(79, 217, 255, 0.12);
  color: var(--green);
}

.button,
button {
  background: linear-gradient(135deg, #132b48, #102239);
  box-shadow: 0 0 18px rgba(79, 217, 255, 0.1);
}

.button.secondary,
button.secondary,
.tabs button {
  border-color: var(--line);
  background: rgba(9, 17, 31, 0.76);
  color: var(--ink);
}

.button.ghost {
  border-color: rgba(181, 214, 255, 0.36);
}

.tabs button[aria-selected="true"] {
  background: linear-gradient(135deg, #122b4a, #13223a);
  color: #fff;
  box-shadow: 0 0 20px rgba(79, 217, 255, 0.14);
}

.hero,
.lab-canvas {
  background: #030712;
}

.hero-strip {
  border-top-color: rgba(105, 151, 190, 0.28);
  background: rgba(79, 217, 255, 0.08);
}

.hero-strip div {
  background: rgba(5, 11, 22, 0.92);
}

.hero-strip span {
  color: #b8cbe0;
}

.card,
.panel,
.tool-panel,
.lab-panel,
.news-item {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stat {
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(79, 217, 255, 0.32);
}

.band {
  background:
    radial-gradient(circle at 80% 0%, rgba(198, 139, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #07101c, #050914);
}

.page-hero {
  background:
    radial-gradient(circle at 16% 12%, rgba(79, 217, 255, 0.18), transparent 24rem),
    radial-gradient(circle at 82% 10%, rgba(198, 139, 255, 0.14), transparent 26rem),
    linear-gradient(180deg, #07101d, #050914);
  border-bottom-color: var(--line);
}

.topic-row strong {
  color: var(--green);
}

.control label {
  color: #d7e8f9;
}

input[type="number"],
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  background: rgba(3, 8, 17, 0.74);
  color: var(--ink);
}

.news-item a {
  color: #dff6ff;
}

.meta {
  color: #90a7bd;
}

.pill {
  background: rgba(79, 217, 255, 0.08);
  color: #dff6ff;
}

.formula {
  background: rgba(3, 8, 17, 0.74);
  color: #dff6ff;
  overflow-x: auto;
  text-align: center;
  line-height: 1.45;
  scrollbar-color: rgba(79, 217, 255, 0.44) rgba(3, 8, 17, 0.82);
}

.formula mjx-container[display="true"] {
  margin: 0.35em 0 !important;
  min-width: max-content;
}

.footer {
  background: #040812;
}

.app-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.app-label {
  font-size: 1.55rem;
  font-weight: 950;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(79, 217, 255, 0.24);
}

.app-demo {
  display: grid;
  gap: 14px;
}

.app-meter {
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 217, 255, 0.16), transparent 8rem),
    rgba(3, 8, 17, 0.74);
  text-align: center;
}

.app-meter strong {
  display: block;
  font-size: 2rem;
  color: var(--green);
}

.app-mini-list {
  display: grid;
  gap: 10px;
}

.app-mini-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(3, 8, 17, 0.56);
}

.app-mini-item span {
  display: block;
  color: var(--green);
  font-size: 0.86rem;
  margin: 5px 0;
}

.feature-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.feature-table th,
.feature-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: left;
}

.feature-table th {
  color: var(--ink);
  background: rgba(79, 217, 255, 0.08);
}

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

.login-link {
  border: 1px solid rgba(109, 240, 202, 0.42);
  background: rgba(109, 240, 202, 0.1);
  color: var(--green) !important;
}

.logout-link {
  border: 1px solid rgba(255, 123, 123, 0.42);
  background: rgba(255, 123, 123, 0.1);
  color: #ffb8b8 !important;
}

.science-canvas {
  width: 100%;
  min-height: 420px;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: #030712;
  box-shadow: var(--shadow);
}

.simulation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.simulation-layout > * {
  min-width: 0;
}

.science-panel {
  overflow: hidden;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.5);
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.element-category-status {
  grid-column: span 2;
}

.element-category-status strong {
  font-size: 1rem;
}

.periodic-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-access-note {
  margin: 0 0 14px;
  color: #b7c7da;
  font-size: 0.9rem;
  font-weight: 750;
}

.element-category-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}

.element-category-key {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.54);
  color: #d6e5f4;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
}

.element-category-key i {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--legend-color, #4fd9ff);
  box-shadow: 0 0 12px rgba(79, 217, 255, 0.34);
}

.element-category-key strong {
  margin-left: auto;
  color: #eef7ff;
  font-size: 0.7rem;
}

.periodic-table {
  display: grid;
  grid-template-columns: repeat(18, minmax(42px, 1fr));
  gap: 5px;
  min-width: 900px;
}

.element-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 10px;
  scrollbar-color: rgba(79, 217, 255, 0.44) rgba(3, 8, 17, 0.82);
}

.element-table-wrap::-webkit-scrollbar {
  height: 10px;
}

.element-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(79, 217, 255, 0.44);
}

.element-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(3, 8, 17, 0.82);
}

.element-tile {
  position: relative;
  min-height: 64px;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--element-border, rgba(79, 217, 255, 0.42));
  border-radius: 8px;
  background:
    linear-gradient(145deg, var(--element-bg-a, rgba(79, 217, 255, 0.3)), var(--element-bg-b, rgba(7, 16, 28, 0.94))),
    radial-gradient(circle at 82% 18%, var(--element-glow, rgba(79, 217, 255, 0.2)), transparent 72%),
    rgba(7, 16, 28, 0.92);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 -20px 32px rgba(0, 0, 0, 0.2);
}

.element-lock {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: rgba(3, 8, 17, 0.72);
  color: #d6e5f4;
  font-size: 0.5rem;
  font-weight: 900;
  line-height: 1;
}

body:not(.auth-required-locked) .element-lock {
  display: none;
}

.element-tile:hover,
.element-tile.is-active {
  border-color: var(--element-active, rgba(109, 240, 202, 0.88));
  background:
    linear-gradient(145deg, var(--element-hover-a, rgba(79, 217, 255, 0.4)), var(--element-bg-b, rgba(7, 16, 28, 0.92))),
    radial-gradient(circle at 82% 18%, var(--element-glow, rgba(79, 217, 255, 0.3)), transparent 72%),
    rgba(7, 16, 28, 0.92);
  box-shadow:
    0 0 18px var(--element-glow, rgba(79, 217, 255, 0.24)),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.element-number {
  color: rgba(238, 247, 255, 0.72);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
}

.element-symbol {
  color: #eef7ff;
  font-size: 1.12rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 12px var(--element-glow, rgba(79, 217, 255, 0.68));
}

.element-name {
  color: #d6e5f4;
  font-size: clamp(0.46rem, 0.56vw, 0.62rem);
  font-weight: 800;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-detail {
  position: static;
  align-self: start;
  max-width: 100%;
  overflow: visible;
}

.element-detail h2 {
  font-size: 1.9rem;
}

.element-atom-stage {
  margin: 16px 0;
}

.element-atom-canvas {
  width: 100%;
  display: block;
  border: 1px solid rgba(79, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.82);
  box-shadow: inset 0 0 34px rgba(79, 217, 255, 0.08), 0 18px 34px rgba(0, 0, 0, 0.24);
  cursor: grab;
}

.element-atom-canvas.is-dragging {
  cursor: grabbing;
}

.element-atom-stage .small {
  margin: 8px 0 0;
  color: #b7c7da;
}

.model-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 18px;
}

.model-legend span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.52);
  color: #d6e5f4;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.legend-dot,
.legend-line,
.legend-wave {
  flex: 0 0 auto;
  display: inline-block;
}

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}

.legend-nucleus {
  background: radial-gradient(circle at 35% 35%, #fff, #6df0ca 42%, #243078);
  box-shadow: 0 0 12px rgba(109, 240, 202, 0.58);
}

.legend-electron {
  background: #c59cff;
  box-shadow: 0 0 10px rgba(197, 156, 255, 0.7);
}

.legend-line {
  width: 22px;
  height: 10px;
  border-top: 2px dashed rgba(79, 217, 255, 0.88);
  transform: translateY(4px);
}

.legend-wave {
  width: 22px;
  height: 10px;
  border-top: 2px solid #ffd166;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.isotope-panel {
  margin: 12px 0 18px;
}

.isotope-panel h3 {
  margin-bottom: 10px;
}

.isotope-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.isotope-grid div:last-child {
  grid-column: 1 / -1;
}

.isotope-grid strong {
  font-size: 0.98rem;
  line-height: 1.35;
}

.element-shells {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.element-shells span {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 6px 9px;
  border: 1px solid rgba(79, 217, 255, 0.2);
  border-radius: 999px;
  background: rgba(3, 8, 17, 0.62);
  color: var(--ink);
  font-weight: 850;
}

.auth-shell {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
}

.auth-card {
  width: min(560px, 100%);
  margin: 0 auto;
}

.auth-card h1 {
  max-width: 100%;
  font-size: clamp(1.75rem, 4vw, 2.8rem);
  line-height: 1.08;
  overflow-wrap: normal;
}

.auth-card form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.auth-status {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--green);
  font-weight: 800;
}

.auth-lock-notice {
  padding-top: 28px;
  padding-bottom: 0;
}

.auth-lock-notice .card {
  border-color: rgba(109, 240, 202, 0.32);
  background:
    radial-gradient(circle at 92% 20%, rgba(109, 240, 202, 0.12), transparent 16rem),
    rgba(5, 12, 24, 0.92);
}

.auth-required-locked main input,
.auth-required-locked main select,
.auth-required-locked main textarea,
.auth-required-locked main button {
  opacity: 0.62;
  cursor: not-allowed;
}

.auth-required-locked main [data-preview-access="true"],
.auth-required-locked main .is-preview-enabled {
  opacity: 1;
  cursor: pointer;
}

.is-auth-locked {
  pointer-events: none;
  filter: grayscale(0.28) brightness(0.72);
}

.periodic-table.is-auth-locked {
  filter: none;
}

.auth-required-locked main .element-tile {
  opacity: 0.94;
}

.auth-required-locked main .element-tile[data-preview-locked="true"] {
  opacity: 0.48;
  filter: grayscale(0.45) brightness(0.8);
}

.quantum-computer-hero .page-hero-visual img {
  object-position: center;
}

.qc-stage-section {
  padding-top: 46px;
}

.qc-sim-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.qc-sim-panel {
  min-width: 0;
}

.qc-main-canvas {
  width: 100%;
  display: block;
  border: 1px solid rgba(79, 217, 255, 0.24);
  border-radius: 8px;
  background: rgba(3, 8, 17, 0.9);
  box-shadow: inset 0 0 44px rgba(79, 217, 255, 0.08), 0 24px 54px rgba(0, 0, 0, 0.28);
}

.qc-readout-grid,
.qc-compare-grid,
.qc-gate-grid,
.qc-build-timeline {
  display: grid;
  gap: 14px;
}

.qc-readout-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.qc-readout-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(79, 217, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.82);
}

.qc-readout-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.qc-readout-grid strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--green);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qc-controls {
  position: sticky;
  top: 92px;
}

.qc-compare-grid,
.qc-build-timeline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.qc-gate-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qc-build-timeline article {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(79, 217, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 12, 24, 0.76);
}

.qc-build-timeline span {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
}

.qc-build-timeline h3 {
  margin-top: 8px;
}

@media (max-width: 980px) {
  .simulation-layout {
    grid-template-columns: 1fr;
  }

  .element-detail {
    position: static;
  }

  .qc-sim-layout,
  .qc-compare-grid,
  .qc-gate-grid,
  .qc-build-timeline {
    grid-template-columns: 1fr;
  }

  .qc-controls {
    position: static;
  }
}

@media (max-width: 620px) {
  .periodic-toolbar {
    grid-template-columns: 1fr;
  }

  .periodic-table {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    gap: 6px;
  }

  .element-tile {
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: 70px;
  }

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

  .element-category-status {
    grid-column: auto;
  }

  .qc-readout-grid {
    grid-template-columns: 1fr;
  }

  .qc-main-canvas {
    min-height: 420px;
  }
}

/* Compact typography layer. */
html {
  font-size: 13px;
}

body,
input,
textarea,
select,
button {
  font-size: 0.92rem;
}

p,
li {
  line-height: 1.5;
}

.nav {
  min-height: 60px;
}

.brand {
  gap: 8px;
  font-size: 0.92rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.nav-links a {
  padding: 8px 9px;
  font-size: 0.78rem;
}

.button,
button {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 0.86rem;
}

.hero {
  min-height: 520px;
}

.hero-content {
  padding: 68px 0 42px;
}

.eyebrow,
.visitor-label,
.preview-access-note,
.qc-build-timeline span {
  font-size: 0.64rem;
}

h1 {
  font-size: 3.1rem;
  line-height: 1.03;
}

.page-hero h1 {
  font-size: 2.45rem;
}

h2 {
  font-size: 1.75rem;
  line-height: 1.08;
}

h3 {
  font-size: 1rem;
  line-height: 1.16;
}

.lead {
  font-size: 0.9rem;
  line-height: 1.45;
}

section {
  padding: 42px 0;
}

.page-hero {
  padding: 52px 0 34px;
}

.hero-strip strong,
.status-grid strong,
.element-category-status strong,
.isotope-grid strong,
.qc-readout-grid strong {
  font-size: 0.9rem;
}

.hero-strip span,
.card,
.panel,
.tool-panel,
.lab-panel,
.feature-table th,
.feature-table td,
.contact-form input,
.contact-form select,
.contact-form textarea,
.auth-card input {
  font-size: 0.86rem;
}

.card,
.contact-form,
.qc-build-timeline article {
  padding: 16px;
}

.stat,
.visitor-value,
.app-label {
  font-size: 1.15rem;
}

.app-meter strong {
  font-size: 1.35rem;
}

.small,
.visitor-counter dt,
.pageview-counter dt,
.footer-rating,
.status-grid span,
.element-category-key,
.model-legend span,
.app-mini-item span,
.qc-readout-grid span {
  font-size: 0.68rem;
}

.rating-stars {
  font-size: 0.86rem;
}

.feedback-popup {
  width: min(340px, calc(100vw - 20px));
  padding: 12px;
}

.feedback-form h2 {
  font-size: 0.9rem;
}

.feedback-form textarea {
  font-size: 0.78rem;
}

.star-button {
  width: 32px;
  min-height: 30px;
  font-size: 1rem;
}

.periodic-toolbar {
  grid-template-columns: minmax(180px, 1fr) 180px;
}

.element-category-key {
  gap: 5px;
  padding: 6px 7px;
}

.periodic-table {
  grid-template-columns: repeat(18, minmax(36px, 1fr));
  min-width: 780px;
  gap: 4px;
}

.element-tile {
  min-height: 54px;
  gap: 1px;
  padding: 5px;
}

.element-number {
  font-size: 0.5rem;
}

.element-symbol {
  font-size: 0.9rem;
}

.element-name {
  font-size: clamp(0.4rem, 0.48vw, 0.52rem);
}

.element-lock {
  font-size: 0.42rem;
}

.element-detail h2,
.auth-card h1 {
  font-size: 1.45rem;
}

.model-legend span {
  padding: 6px 7px;
}

.qc-readout-grid div,
.status-grid div,
.visitor-counter dl div,
.pageview-counter dl div,
.app-mini-item {
  padding: 9px;
}

@media (max-width: 980px) {
  h1,
  .page-hero h1 {
    font-size: 2.1rem;
  }

  h2 {
    font-size: 1.45rem;
  }
}

@media (max-width: 620px) {
  html {
    font-size: 12px;
  }

  .shell {
    width: min(100vw - 18px, 1180px);
  }

  .brand {
    font-size: 0.82rem;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .nav-links a {
    min-height: 30px;
    padding: 6px 2px;
    font-size: 0.58rem;
  }

  h1,
  .page-hero h1 {
    font-size: 1.55rem;
    line-height: 1.08;
  }

  h2 {
    font-size: 1.18rem;
  }

  h3 {
    font-size: 0.9rem;
  }

  .lead {
    font-size: 0.8rem;
  }

  section {
    padding: 32px 0;
  }

  .page-hero {
    padding: 34px 0 26px;
  }

  .button,
  button {
    min-height: 32px;
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  .periodic-table {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
    gap: 5px;
  }

  .element-tile {
    min-height: 58px;
  }
}

#siteFeedbackPopup.feedback-popup {
  width: min(320px, calc(100vw - 28px));
  background:
    radial-gradient(circle at 90% 0%, rgba(109, 240, 202, 0.14), transparent 12rem),
    rgba(5, 12, 24, 0.985);
}

#siteFeedbackPopup .feedback-form h2 {
  max-width: 240px;
  font-size: 18px !important;
  line-height: 1.16;
}

#siteFeedbackPopup .eyebrow {
  font-size: 10px;
}

#siteFeedbackPopup .star-button {
  width: 30px;
  min-height: 28px;
  font-size: 15px !important;
}

#siteFeedbackPopup .feedback-form textarea {
  min-height: 54px;
  font-size: 12px !important;
}

#siteFeedbackPopup .button,
#siteFeedbackPopup button {
  min-height: 32px;
  font-size: 12px !important;
  padding: 7px 10px;
}

#siteFeedbackPopup .feedback-status {
  font-size: 11px;
}

/* Readable typography correction after compact pass. */
html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
input,
textarea,
select,
button {
  font-size: 15px;
}

body h1,
body .page-hero h1,
body .auth-card h1 {
  font-size: clamp(28px, 2.6vw, 36px) !important;
  line-height: 1.18 !important;
}

body h2,
body .element-detail h2 {
  font-size: clamp(20px, 1.8vw, 26px) !important;
  line-height: 1.14 !important;
}

body h3,
body .card h3,
body .panel h3,
body .tool-panel h3,
body .lab-panel h3,
body .equation-card h3,
body .wave-theory-card h3,
body .qcd-panel h3 {
  font-size: 18px;
  line-height: 1.18;
}

body h3 {
  font-size: 16px;
}

body p,
body li,
body label,
body .lead,
body .card,
body .panel,
body .tool-panel,
body .lab-panel,
body .equation-card,
body .wave-controls,
body .wave-theory-card,
body .qcd-controls,
body .qcd-panel,
body .feature-table th,
body .feature-table td,
body .contact-form input,
body .contact-form select,
body .contact-form textarea {
  font-size: 14px;
  line-height: 1.55;
}

body .nav-links a,
body .brand,
body .button,
body button {
  font-size: 13px;
}

body .small,
body .footer-rating,
body .visitor-counter dt,
body .pageview-counter dt,
body .status-grid span,
body .element-category-key,
body .model-legend span,
body .app-mini-item span,
body .qc-readout-grid span,
body .preview-access-note {
  font-size: 12px;
}

body .element-category-key strong {
  font-size: 11px;
}

body .element-lock {
  display: none;
}

body .eyebrow,
body .visitor-label,
body .qc-build-timeline span {
  font-size: 11px;
}

body .element-number {
  font-size: 11px;
}

body .element-symbol {
  font-size: 16px;
}

body .periodic-table .element-name {
  display: block;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 7px;
  line-height: 1.05;
  text-align: center;
}

@media (max-width: 620px) {
  html {
    font-size: 14px;
  }

  body,
  input,
  textarea,
  select,
  button {
    font-size: 14px;
  }

  body h1,
  body .page-hero h1,
  body .auth-card h1 {
    font-size: clamp(24px, 6.2vw, 28px) !important;
    line-height: 1.18 !important;
  }

  body h2,
  body .element-detail h2 {
    font-size: clamp(19px, 5vw, 22px) !important;
  }

  body h3,
  body .card h3,
  body .panel h3,
  body .tool-panel h3,
  body .lab-panel h3,
  body .equation-card h3,
  body .wave-theory-card h3,
  body .qcd-panel h3 {
    font-size: 17px;
  }

  body p,
  body li,
  body label,
  body .lead,
  body .card,
  body .panel,
  body .tool-panel,
  body .lab-panel,
  body .equation-card,
  body .wave-controls,
  body .wave-theory-card,
  body .qcd-controls,
  body .qcd-panel {
    font-size: 14px;
  }

  body .nav-links a,
  body .brand,
  body .button,
  body button {
    font-size: 12px;
  }

  body .small,
  body .footer-rating,
  body .visitor-counter dt,
  body .pageview-counter dt,
  body .status-grid span,
  body .element-category-key,
  body .model-legend span,
  body .preview-access-note {
    font-size: 11px;
  }

  body .element-category-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body .element-category-key {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body .element-category-key strong {
    font-size: 11px;
  }

  body .periodic-table .element-name {
    font-size: 8px;
  }
}

/* Readable typography refinement: quieter headings and no forced caps. */
body h1,
body .page-hero h1,
body .auth-card h1 {
  font-size: clamp(24px, 2.05vw, 30px) !important;
  line-height: 1.22 !important;
  font-weight: 600 !important;
}

body h2,
body .element-detail h2 {
  font-size: clamp(20px, 1.55vw, 24px) !important;
  line-height: 1.2 !important;
  font-weight: 600 !important;
}

body h3,
body .card h3,
body .panel h3,
body .tool-panel h3,
body .lab-panel h3,
body .equation-card h3,
body .wave-theory-card h3,
body .qcd-panel h3 {
  font-size: 17px !important;
  line-height: 1.24 !important;
  font-weight: 600 !important;
}

body .eyebrow,
body .visitor-label,
body .preview-access-note,
body .qc-build-timeline span {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}

body .brand,
body .nav-links a,
body .button,
body button {
  font-weight: 500 !important;
}

body strong,
body b,
body .stat,
body .hero-strip strong,
body .status-grid strong,
body .element-category-status strong,
body .isotope-grid strong,
body .qc-readout-grid strong {
  font-weight: 600 !important;
}

body .brand-hero-content,
body .brand-hero-content * {
  position: absolute !important;
  width: 1px !important;
  max-width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

body .visitor-counter strong,
body .pageview-counter strong {
  line-height: 1.25 !important;
}

@media (max-width: 620px) {
  body h1,
  body .page-hero h1,
  body .auth-card h1 {
    font-size: clamp(22px, 5.7vw, 26px) !important;
    line-height: 1.24 !important;
  }

  body h2,
  body .element-detail h2 {
    font-size: clamp(18px, 4.8vw, 21px) !important;
  }

  body h3,
  body .card h3,
  body .panel h3,
  body .tool-panel h3,
  body .lab-panel h3,
  body .equation-card h3,
  body .wave-theory-card h3,
  body .qcd-panel h3 {
    font-size: 16px !important;
  }
}

/* Contrast-safe automatic light/dark theme system. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050914;
  --page-bg: #050914;
  --surface: rgba(10, 19, 32, 0.92);
  --surface-strong: #091423;
  --surface-soft: rgba(12, 27, 46, 0.76);
  --ink: #f2f8ff;
  --muted: #b9c8d9;
  --subtle: #8da2b8;
  --line: rgba(129, 178, 220, 0.28);
  --nav-bg: rgba(5, 9, 20, 0.92);
  --nav-text: #d9e7f5;
  --field-bg: #06101d;
  --field-text: #f5f9ff;
  --button-bg: #13345a;
  --button-text: #f8fbff;
  --button-secondary-bg: #0b1829;
  --canvas-bg: #030712;
  --hero-band: linear-gradient(180deg, #07101d, #050914);
  --section-band: linear-gradient(180deg, #07101c, #050914);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6fbff;
  --page-bg: #f6fbff;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft: #edf6fc;
  --ink: #102033;
  --muted: #42556b;
  --subtle: #5d7187;
  --line: rgba(45, 91, 128, 0.22);
  --cyan: #006da0;
  --green: #006b61;
  --amber: #8a5a00;
  --rose: #6d43a8;
  --navy: #12314f;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --nav-text: #24374b;
  --field-bg: #ffffff;
  --field-text: #102033;
  --button-bg: #123d63;
  --button-text: #ffffff;
  --button-secondary-bg: #ffffff;
  --canvas-bg: #eef6fb;
  --hero-band: linear-gradient(180deg, #f8fcff, #eaf4fb);
  --section-band: linear-gradient(180deg, #eef7fc, #f8fcff);
  --shadow: 0 14px 36px rgba(23, 48, 72, 0.12);
}

html[data-theme] body {
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 4%, rgba(0, 109, 160, 0.12), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(109, 67, 168, 0.10), transparent 28rem),
    var(--page-bg);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 4%, rgba(79, 217, 255, 0.18), transparent 25rem),
    radial-gradient(circle at 78% 10%, rgba(198, 139, 255, 0.16), transparent 28rem),
    linear-gradient(180deg, #040812 0%, var(--bg) 34rem);
}

html[data-theme] p,
html[data-theme] li,
html[data-theme] label,
html[data-theme] .lead,
html[data-theme] .small,
html[data-theme] .meta,
html[data-theme] .hero-strip span,
html[data-theme] .visitor-counter dt,
html[data-theme] .pageview-counter dt {
  color: var(--muted) !important;
}

html[data-theme] h1,
html[data-theme] h2,
html[data-theme] h3,
html[data-theme] strong,
html[data-theme] .brand,
html[data-theme] .visitor-counter strong,
html[data-theme] .visitor-counter dd,
html[data-theme] .pageview-counter strong,
html[data-theme] .pageview-counter dd {
  color: var(--ink) !important;
}

html[data-theme] .topbar {
  border-bottom-color: var(--line) !important;
  background: var(--nav-bg) !important;
}

html[data-theme] .nav-links a {
  color: var(--nav-text) !important;
}

html[data-theme] .nav-links a:hover,
html[data-theme] .nav-links a[aria-current="page"] {
  background: rgba(0, 109, 160, 0.12) !important;
  color: var(--green) !important;
}

html[data-theme] .button,
html[data-theme] button {
  background: var(--button-bg) !important;
  color: var(--button-text) !important;
  border-color: transparent;
  box-shadow: none !important;
}

html[data-theme] .button.secondary,
html[data-theme] button.secondary,
html[data-theme] .tabs button {
  background: var(--button-secondary-bg) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme] .button.ghost {
  background: transparent !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme] .card,
html[data-theme] .panel,
html[data-theme] .tool-panel,
html[data-theme] .lab-panel,
html[data-theme] .news-item,
html[data-theme] .auth-card,
html[data-theme] .visitor-counter,
html[data-theme] .pageview-counter,
html[data-theme] .footer-rating,
html[data-theme] .formula,
html[data-theme] .status-grid div,
html[data-theme] .hero-strip div,
html[data-theme] .element-category-key,
html[data-theme] .model-legend span,
html[data-theme] .isotope-panel,
html[data-theme] .qcd-controls,
html[data-theme] .wave-controls {
  border-color: var(--line) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow);
}

html[data-theme] .page-hero,
html[data-theme] .band {
  background: var(--hero-band) !important;
  border-color: var(--line) !important;
}

html[data-theme] .band {
  background: var(--section-band) !important;
}

html[data-theme] .footer {
  background: var(--surface-strong) !important;
  border-top-color: var(--line) !important;
}

html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea,
html[data-theme] input[type="number"],
html[data-theme] input[type="text"],
html[data-theme] input[type="email"],
html[data-theme] input[type="password"] {
  background: var(--field-bg) !important;
  color: var(--field-text) !important;
  border-color: var(--line) !important;
}

html[data-theme] input::placeholder,
html[data-theme] textarea::placeholder {
  color: var(--subtle) !important;
}

html[data-theme] .page-hero-visual,
html[data-theme] canvas,
html[data-theme] .concept-canvas,
html[data-theme] .qcd-panel-canvas,
html[data-theme] .wave-stage canvas {
  background-color: var(--canvas-bg) !important;
}

html[data-theme="light"] .hero::before,
html[data-theme="light"] .brand-hero::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 48%, rgba(255, 255, 255, 0.08) 100%),
    linear-gradient(0deg, rgba(246, 251, 255, 0.92) 0%, rgba(246, 251, 255, 0.2) 26%, transparent 60%);
}

.theme-toggle {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface-soft) !important;
  color: var(--ink) !important;
}

.theme-toggle .theme-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-icon-sun {
  display: none;
}

.theme-toggle .theme-icon-moon {
  display: block;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: block;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon {
  display: none;
}

html[data-theme="light"] .qcd-figure img {
  background: #ffffff !important;
}

html[data-theme="light"] .formula mjx-container,
html[data-theme="light"] .formula svg {
  color: var(--ink) !important;
}

/* Fixed site-wide header navigation with compact dropdown groups. */
.nav-links[data-fixed-menu="true"] {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.nav-menu {
  position: relative;
  flex: 0 0 auto;
}

.nav-menu-toggle {
  min-height: 36px !important;
  padding: 8px 11px !important;
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--nav-text, #24374b) !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.nav-menu-toggle::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.nav-menu.active > .nav-menu-toggle,
.nav-menu.open > .nav-menu-toggle,
.nav-menu-toggle:focus-visible {
  background: rgba(0, 109, 160, 0.12) !important;
  color: var(--green) !important;
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  min-width: 240px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, #fff);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.nav-menu.open .nav-submenu,
.nav-menu:focus-within .nav-submenu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.nav-submenu a {
  display: block;
  width: 100%;
  padding: 9px 10px !important;
  border-radius: 7px !important;
  color: var(--nav-text, #24374b) !important;
  text-align: left !important;
  white-space: nowrap !important;
}

.nav-links[data-fixed-menu="true"] > a,
.nav-links[data-fixed-menu="true"] .login-link,
.nav-links[data-fixed-menu="true"] .logout-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px !important;
  font-size: 13px !important;
  white-space: nowrap !important;
}

.nav-home-link {
  color: var(--nav-text, #24374b) !important;
}

html[data-theme="dark"] .nav-submenu {
  background: #081320;
}

html[data-theme] .nav-menu-toggle {
  color: var(--nav-text) !important;
}

html[data-theme] .nav-submenu {
  border-color: var(--line) !important;
  background: var(--surface-strong) !important;
}

@media (hover: hover) and (pointer: fine) {
  .nav-menu:hover > .nav-menu-toggle {
    background: rgba(0, 109, 160, 0.12) !important;
    color: var(--green) !important;
  }

  .nav-menu:hover .nav-submenu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
}

@media (max-width: 980px) {
  .nav-links[data-fixed-menu="true"] {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    align-items: stretch;
  }

  .nav-links[data-fixed-menu="true"] > a,
  .nav-links[data-fixed-menu="true"] .login-link,
  .nav-links[data-fixed-menu="true"] .logout-link,
  .nav-menu-toggle {
    width: 100%;
    min-width: 0;
    white-space: normal !important;
    text-align: center !important;
  }

  .nav-submenu {
    left: 0;
    right: auto;
    min-width: min(260px, calc(100vw - 28px));
  }
}

@media (max-width: 620px) {
  .nav-links[data-fixed-menu="true"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-submenu {
    display: none;
    left: 50%;
    right: auto;
    width: min(340px, calc(100vw - 30px));
    min-width: 0;
    transform: translate(-50%, -4px);
  }

  .nav-menu:focus-within .nav-submenu {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -4px);
  }

  .nav-menu.open .nav-submenu {
    display: grid;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
  }

  .nav-menu:hover .nav-submenu {
    display: none;
  }

  .nav-menu.open:hover .nav-submenu {
    display: grid;
  }

  .nav-links[data-fixed-menu="true"] > a,
  .nav-links[data-fixed-menu="true"] .login-link,
  .nav-links[data-fixed-menu="true"] .logout-link,
  .nav-menu-toggle {
    min-height: 34px !important;
    padding: 7px 5px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  .nav-submenu a {
    font-size: 12px !important;
    min-height: 34px;
  }
}
