/* Final system typography and responsive glass layer. */
html, body, button, input, select, textarea, output, dialog, code, pre,
.brand, .status, .eyebrow, .stats strong, .card .top, .card .symbol,
.card .price, .detail-symbol, .selected-element strong, .console-plus,
.step-no, .stage-status, .vessel-label, .result-panel .equation, .risk,
.particle-key, .effect-badge, .model-name, .state-summary,
.multi-equations code, .log-item code, .run-counter strong,
.run-counter span, .terms-group summary, .legal-drawer summary, footer {
  font-family: system-ui, "Helvetica Neue", "PingFang SC", sans-serif !important;
}

.eyebrow { display: none !important; }
.brand { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.status { font-size: 11px; font-weight: 550; letter-spacing: 0; }
.stats strong, .run-counter strong { font-weight: 650; letter-spacing: -.045em; }
.card .top, .card .price, .step-no, .stage-status, .vessel-label,
.particle-key, .effect-badge, .model-name, .run-counter span {
  letter-spacing: -.005em;
}
.result-panel .equation, .multi-equations code, .state-summary {
  font-weight: 500; letter-spacing: -.01em;
}
.detail-symbol, .selected-element strong, .card .symbol { font-weight: 650; }
.about-grid span, .syllabus-badge { font-family: inherit !important; }
.syllabus-badge { letter-spacing: 0; }

@keyframes glass-flow {
  from { background-position: 180% 0, 0 0; }
  to { background-position: -90% 0, 0 0; }
}

@keyframes glass-glint {
  0%, 68%, 100% { transform: translateX(-145%) skewX(-18deg); opacity: 0; }
  8%, 34% { opacity: .72; }
  48% { transform: translateX(245%) skewX(-18deg); opacity: 0; }
}

.lab-layout, .lab-console > .console-block, .console-options,
.extra-reactant, .selected-element, .result-panel, .experiment-log {
  position: relative;
  isolation: isolate;
}

.lab-console > .console-block, .console-options, .extra-reactant,
.selected-element, .result-panel, .experiment-log {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12) !important;
  background-image:
    linear-gradient(112deg, transparent 18%, rgba(255,255,255,.11) 34%, rgba(201,255,69,.08) 43%, transparent 58%),
    linear-gradient(145deg, rgba(58,58,63,.48), rgba(24,24,27,.66)) !important;
  background-size: 240% 100%, 100% 100%;
  box-shadow: inset 0 1px rgba(255,255,255,.16),
    inset 0 -1px rgba(255,255,255,.025), 0 14px 36px rgba(0,0,0,.16);
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  animation: glass-flow 9s ease-in-out infinite;
}

.lab-console > .console-block { padding: 16px; border-radius: 18px; margin-bottom: 10px; }
.console-options { padding: 16px; border-radius: 18px; }
.extra-reactant { padding: 18px 14px 14px; border-radius: 18px; }
.selected-element { animation-duration: 7s; }
.result-panel { animation-duration: 11s; }
.experiment-log { animation-duration: 13s; }

.lab-console > .console-block::after, .console-options::after,
.selected-element::after, .result-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -35%; bottom: -35%; left: -28%; width: 28%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
  filter: blur(2px);
  transform: translateX(-145%) skewX(-18deg);
  animation: glass-glint 8s ease-in-out infinite;
  pointer-events: none;
}
.console-options::after { animation-delay: 1.4s; }
.selected-element::after { animation-delay: 2.2s; }
.result-panel::after { animation-delay: 3.1s; }

.console-block select, .console-options select, .extra-reactant > select,
.amount-control input {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 14px !important;
  border: 1px solid rgba(255,255,255,.13) !important;
  background-color: rgba(118,118,128,.18) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.1), 0 5px 15px rgba(0,0,0,.12);
  color: #f5f5f7 !important;
  padding-inline: 14px !important;
}

.console-block select, .console-options select, .extra-reactant > select {
  background-image:
    linear-gradient(45deg, transparent 50%, #c9ff45 50%),
    linear-gradient(135deg, #c9ff45 50%, transparent 50%) !important;
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px !important;
  background-size: 5px 5px, 5px 5px !important;
  background-repeat: no-repeat !important;
  padding-right: 38px !important;
}

.console-block select:focus, .console-options select:focus,
.extra-reactant > select:focus, .amount-control input:focus {
  outline: 0 !important;
  border-color: rgba(201,255,69,.55) !important;
  box-shadow: 0 0 0 4px rgba(201,255,69,.11), inset 0 1px rgba(255,255,255,.15);
}

.console-options input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%; height: 28px;
  background: transparent;
  cursor: pointer;
  accent-color: #c9ff45;
}
.console-options input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 99px;
  background: linear-gradient(90deg, #c9ff45 0 var(--range-progress, 10.23%), rgba(118,118,128,.36) var(--range-progress, 10.23%));
  box-shadow: inset 0 1px 2px rgba(0,0,0,.4), 0 1px rgba(255,255,255,.08);
}
.console-options input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px; height: 26px;
  margin-top: -9.5px;
  border: 0; border-radius: 50%;
  background: linear-gradient(145deg, #fff, #e7e7ea);
  box-shadow: 0 3px 9px rgba(0,0,0,.48), inset 0 1px rgba(255,255,255,.9);
  transition: transform .16s ease;
}
.console-options input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.08); }
.console-options input[type="range"]::-moz-range-track {
  height: 7px; border-radius: 99px; background: rgba(118,118,128,.36);
}
.console-options input[type="range"]::-moz-range-progress {
  height: 7px; border-radius: 99px; background: #c9ff45;
}
.console-options input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 9px rgba(0,0,0,.48);
}

@media (prefers-reduced-motion: reduce) {
  .lab-console > .console-block, .console-options, .extra-reactant,
  .selected-element, .result-panel, .experiment-log,
  .lab-console > .console-block::after, .console-options::after,
  .selected-element::after, .result-panel::after { animation: none !important; }
}

/* Edge-to-edge navigation; rounded geometry stays inside controls. */
.topbar {
  top: 0;
  width: 100%;
  max-width: none;
  height: 64px;
  margin: 0;
  padding-inline: max(20px, 5vw);
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.09);
  border-radius: 0;
  background: linear-gradient(180deg,rgba(18,19,19,.84),rgba(10,11,11,.68));
  box-shadow: 0 1px rgba(255,255,255,.025), 0 12px 36px rgba(0,0,0,.12);
}
.topbar::after { display: none; }
.topbar nav { border-radius: 13px; }
.topbar .nav-link { border-radius: 10px; }

/* Pointer-reactive glass: highlight follows the user instead of looping. */
@property --glass-x { syntax: "<percentage>"; inherits: false; initial-value: 50%; }
@property --glass-y { syntax: "<percentage>"; inherits: false; initial-value: 35%; }
@property --glass-energy { syntax: "<number>"; inherits: false; initial-value: 0; }

.lab-console > .console-block, .console-options, .extra-reactant,
.selected-element, .result-panel, .experiment-log {
  --glass-x: 50%;
  --glass-y: 35%;
  --glass-energy: 0;
  animation: none !important;
  background-image:
    radial-gradient(circle at var(--glass-x) var(--glass-y),
      rgba(255,255,255,calc(.09 * var(--glass-energy))) 0,
      rgba(201,255,69,calc(.035 * var(--glass-energy))) 9%,
      transparent 25%),
    linear-gradient(145deg, rgba(58,58,63,.48), rgba(24,24,27,.66)) !important;
  background-size: 100% 100%, 100% 100%;
  transition: --glass-x .14s cubic-bezier(.22,.75,.25,1),
    --glass-y .14s cubic-bezier(.22,.75,.25,1),
    --glass-energy .42s cubic-bezier(.2,.75,.25,1), border-color .3s ease, box-shadow .3s ease;
}

.lab-console > .console-block::after, .console-options::after,
.selected-element::after, .result-panel::after {
  inset: 0;
  width: auto;
  z-index: -1;
  opacity: var(--glass-energy);
  transform: none;
  animation: none !important;
  filter: blur(12px);
  background:
    conic-gradient(from 215deg at var(--glass-x) var(--glass-y),
      transparent 0 27%, rgba(255,255,255,.075) 30%,
      rgba(201,255,69,.04) 32%, transparent 37% 100%);
  transition: opacity .18s ease;
}

.glass-engaged {
  border-color: rgba(255,255,255,.21) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.2),
    inset 0 -1px rgba(255,255,255,.035),
    0 17px 42px rgba(0,0,0,.22) !important;
}

.console-options.range-engaged {
  box-shadow: inset 0 1px rgba(255,255,255,.24),
    0 0 0 1px rgba(201,255,69,.08),
    0 18px 46px rgba(0,0,0,.24) !important;
}

/* Calm content hierarchy with glass reserved for controls. */
:root {
  --ui-surface: rgba(28,28,30,.92);
  --ui-surface-raised: rgba(44,44,46,.78);
  --ui-separator: rgba(84,84,88,.52);
  --ui-radius-outer: 26px;
  --ui-radius-inner: 18px;
  --ui-ease: cubic-bezier(.2,.8,.2,1);
}

button, select, input { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; }
button, .card, select, input { transition-timing-function: var(--ui-ease) !important; }
button:active, .card:active { transform: scale(.975) !important; }

.hero-actions button, .run-button, .add-reactant, .filter {
  border-radius: 999px !important;
}

.search { min-height: 44px; border-radius: 15px !important; }
.search input { font-size: 17px; }
.filters { gap: 7px; }
.filter { min-height: 36px; padding: 7px 15px; }

.lab-layout { border-radius: var(--ui-radius-outer) !important; }
.lab-console > .console-block, .extra-reactant, .console-options,
.experiment-log {
  background: var(--ui-surface) !important;
  border-color: rgba(255,255,255,.075) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.035), 0 12px 32px rgba(0,0,0,.12) !important;
}
.lab-console > .console-block::after, .console-options::after { opacity: calc(var(--glass-energy) * .55); }
.selected-element, .result-panel {
  background-image:
    radial-gradient(circle at var(--glass-x) var(--glass-y),
      rgba(255,255,255,calc(.08 * var(--glass-energy))) 0,
      rgba(114,242,193,calc(.035 * var(--glass-energy))) 10%, transparent 27%),
    linear-gradient(145deg, rgba(56,56,60,.66), rgba(28,28,30,.82)) !important;
}

.console-block label, .console-options label {
  font-size: 13px;
  font-weight: 590;
  color: #f2f2f7;
}
.console-block select, .console-options select, .extra-reactant > select,
.amount-control input {
  min-height: 48px;
  border-radius: 13px !important;
  font-size: 16px;
  background-color: rgba(118,118,128,.22) !important;
}
.reactant-settings { gap: 8px; }
.selected-element { min-height: 58px; border-radius: 13px !important; }
.run-button { min-height: 56px; padding-inline: 21px; font-size: 16px; }
.run-button span { font-size: 14px; font-weight: 650; }

.topbar, .topbar nav, .primary, .run-button, .search, .filter,
.secondary, .add-reactant, .close, .account-avatar {
  --glass-x: 50%; --glass-y: 50%; --glass-energy: 0;
  transition: --glass-x .14s cubic-bezier(.22,.75,.25,1),
    --glass-y .14s cubic-bezier(.22,.75,.25,1),
    --glass-energy .42s cubic-bezier(.2,.75,.25,1), transform .2s var(--ui-ease), box-shadow .3s ease;
}
.topbar.glass-engaged, .topbar nav.glass-engaged, .primary.glass-engaged,
.run-button.glass-engaged, .search.glass-engaged, .filter.glass-engaged,
.secondary.glass-engaged, .add-reactant.glass-engaged, .close.glass-engaged {
  background-image: radial-gradient(circle at var(--glass-x) var(--glass-y),
    rgba(255,255,255,calc(.10 * var(--glass-energy))), transparent 23%) !important;
}
.account-avatar {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 50%;
  color: #102016;
  background: linear-gradient(145deg,#dfff69,#72f2c1);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.72), 0 5px 16px rgba(114,242,193,.2);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.account-avatar:hover { transform: scale(1.04); }
.account-avatar:active { transform: scale(.94) !important; }
.primary.glass-engaged, .run-button.glass-engaged {
  background-image: radial-gradient(circle at var(--glass-x) var(--glass-y),
    rgba(255,255,255,.20), transparent 24%),
    linear-gradient(145deg,#dcff69,#abea32) !important;
}

dialog { border-radius: 28px; }
.close { width: 44px; height: 44px; font-size: 22px; }
.fact-grid { border-radius: var(--ui-radius-inner); }
.about-grid article, .card { border-radius: var(--ui-radius-inner); }

@media (max-width: 700px) {
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .topbar { height: 54px; padding-inline: 16px; background: linear-gradient(180deg,rgba(5,5,6,.9),rgba(5,5,6,.62),transparent); border: 0; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .topbar nav {
    left: 12px; right: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    height: 66px;
    border-radius: 25px;
    padding: 6px;
  }
  .topbar nav::before { border-radius: 24px; }
  .topbar nav .nav-link, .topbar nav .nav-link.lab-entry {
    min-height: 52px;
    font-size: 10px !important;
    font-weight: 560;
    border-radius: 19px !important;
    transition: transform .22s var(--ui-ease), color .22s, background .22s !important;
  }
  .topbar nav .nav-link::before { font-size: 19px; }
  .topbar nav .nav-link.active {
    background: rgba(255,255,255,.115) !important;
    box-shadow: inset 0 1px rgba(255,255,255,.13), 0 3px 9px rgba(0,0,0,.18) !important;
  }
  .catalog, .about-view, .experiment-view { padding-inline: 16px; }
  .experiment-heading { padding-inline: 4px; }
  .lab-layout { border-radius: 24px !important; }
  .lab-console { padding: 12px; }
  .lab-console > .console-block, .extra-reactant, .console-options { border-radius: 18px !important; }
  .console-block select, .console-options select, .extra-reactant > select,
  .amount-control input { font-size: 16px; }
  dialog { width: 100vw; max-width: none; max-height: 92vh; margin: auto 0 0; border-radius: 28px 28px 0 0; }
}

/* Native-feeling structure, transitions, and scroll-edge behavior. */
html { background: #050506; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
::selection { color: #10120f; background: rgba(201,255,69,.88); }

.topbar {
  top: 12px;
  width: calc(100% - 32px);
  max-width: 1320px;
  height: 58px;
  margin: 0 auto;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 22px;
  background: rgba(32,32,34,.64);
  box-shadow: inset 0 1px rgba(255,255,255,.15), 0 14px 44px rgba(0,0,0,.28);
  backdrop-filter: blur(34px) saturate(185%);
  -webkit-backdrop-filter: blur(34px) saturate(185%);
  transition: background .28s ease, box-shadow .28s ease, transform .38s var(--ui-ease);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 18px; right: 18px; top: -13px;
  height: 13px;
  background: linear-gradient(#050506 12%, rgba(5,5,6,.76), transparent);
  pointer-events: none;
}
.brand-mark { border-radius: 12px; }
.topbar nav {
  padding: 3px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 15px;
  background: rgba(118,118,128,.1);
}
.topbar .nav-link {
  min-height: 36px;
  padding: 7px 15px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 570;
  transition: color .22s, background .22s, transform .18s var(--ui-ease), box-shadow .22s;
}
.topbar .nav-link.active {
  background: rgba(255,255,255,.13);
  color: #f5f5f7;
  box-shadow: inset 0 1px rgba(255,255,255,.12), 0 2px 7px rgba(0,0,0,.18);
}
.topbar .nav-link.lab-entry.active { color: #111 !important; }
.status {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(118,118,128,.1);
  color: #aaaab0;
}

.catalog:not(.hidden), .about-view:not(.hidden), .experiment-view:not(.hidden) {
  animation: ui-view-in .42s var(--ui-ease) both;
}
@keyframes ui-view-in {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to { opacity: 1; transform: none; }
}

.primary, .secondary, .run-button, .add-reactant, .filter,
.topbar .nav-link, .close {
  touch-action: manipulation;
}
.primary:hover, .run-button:hover { transform: translateY(-1px); }
.primary:active, .run-button:active { transform: scale(.97) !important; filter: brightness(.96); }
.secondary:active, .add-reactant:active, .filter:active { transform: scale(.965) !important; }

.card {
  border-color: rgba(255,255,255,.085);
  box-shadow: inset 0 1px rgba(255,255,255,.045);
}
.card:hover {
  border-color: rgba(255,255,255,.14);
  box-shadow: inset 0 1px rgba(255,255,255,.08), 0 18px 48px rgba(0,0,0,.3);
}
.card .tag { border-radius: 7px; }

.lab-stage { border-radius: 0 25px 25px 0; }
.result-panel { box-shadow: inset 0 1px rgba(255,255,255,.1), 0 14px 36px rgba(0,0,0,.2); }
.vessel { transition: filter .45s var(--ui-ease), transform .45s var(--ui-ease); }
.vessel.running { transform: scale(1.025); }

dialog[open] { animation: ui-sheet-in .4s var(--ui-ease) both; }
@keyframes ui-sheet-in {
  from { opacity: 0; transform: translateY(18px) scale(.975); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 700px) {
  .topbar {
    top: 0;
    width: 100%;
    height: 54px;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
  }
  .topbar::after { display: none; }
  .topbar nav {
    transition: height .38s var(--ui-ease), transform .38s var(--ui-ease),
      left .38s var(--ui-ease), right .38s var(--ui-ease), border-radius .38s var(--ui-ease);
  }
  .topbar.nav-compact nav {
    left: 38px;
    right: 38px;
    height: 54px;
    transform: translateY(4px);
    border-radius: 22px;
  }
  .topbar.nav-compact nav::before { border-radius: 21px; }
  .topbar.nav-compact nav .nav-link {
    min-height: 42px;
    gap: 0;
  }
  .topbar.nav-compact nav .nav-link::before { font-size: 18px; }
  .topbar.nav-compact nav .nav-link { font-size: 0 !important; }
  .lab-stage { border-radius: 0 0 23px 23px; }
  dialog[open] { animation-name: ui-mobile-sheet-in; }
  @keyframes ui-mobile-sheet-in {
    from { opacity: .6; transform: translateY(70px); }
    to { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog:not(.hidden), .about-view:not(.hidden), .experiment-view:not(.hidden),
  dialog[open] { animation: none !important; }
}
