:root {
  --ice: #f3fbfb;
  --glass: rgba(255, 255, 255, 0.58);
  --cyan: #29b3c2;
  --cyan-deep: #0e6f7a;
  --plasma: #d98a2b;
  --ink: #163238;
  --mute: #5e7a7e;
  --lock: #b4232c;
  --ok: #2a7a62;
  --display: "Fraunces", "Songti SC", serif;
  --sans: "Sora", "Noto Sans SC", "PingFang SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 88px;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(41, 179, 194, 0.18), transparent 55%),
    radial-gradient(900px 500px at 110% 20%, rgba(217, 138, 43, 0.12), transparent 50%),
    var(--ice);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-link {
  color: var(--cyan-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button,
select,
input {
  font-family: inherit;
}

.frost-veil {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.28;
  background-image: url("images/texture.webp");
  background-size: 420px auto;
  mix-blend-mode: multiply;
}

.tube-rail {
  position: fixed;
  left: 10px;
  top: 0;
  width: 28px;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.85;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 80;
  background: var(--cyan);
  color: #fff;
  padding: 8px 12px;
}

.loop-mast {
  position: sticky;
  top: 14px;
  z-index: 40;
  width: min(1120px, calc(100% - 48px));
  margin: 14px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 10px 18px;
  background: var(--glass);
  border: 1px solid rgba(41, 179, 194, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(14, 111, 122, 0.08);
}

.brand {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.01em;
}

.brand small {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--cyan-deep);
}

.nav-toggle {
  display: none;
  background: var(--cyan);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.loop-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.loop-nav a {
  font-size: 13px;
  color: var(--mute);
}

.loop-nav a.is-active {
  color: var(--cyan-deep);
}

.loop-nav .live {
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
  padding: 7px 14px;
  border-radius: 999px;
}

.glass-hero {
  position: relative;
  min-height: 88vh;
  margin: 28px 18px 0;
  border-radius: 36px;
  overflow: hidden;
  isolation: isolate;
}

.glass-hero figure {
  margin: 0;
  height: 100%;
}

.glass-hero img {
  width: 100%;
  height: 88vh;
  object-fit: cover;
  min-height: 460px;
}

.glass-copy {
  position: absolute;
  inset: auto 0 0 0;
  padding: 48px 40px 40px;
  background: linear-gradient(180deg, transparent, rgba(243, 251, 251, 0.2) 18%, rgba(243, 251, 251, 0.92));
  backdrop-filter: blur(8px);
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan-deep);
  margin: 0 0 10px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(34px, 5.4vw, 62px);
}

h2 {
  font-size: clamp(26px, 3.2vw, 40px);
}

h3 {
  font-size: 22px;
}

.lead {
  font-size: 17px;
  max-width: 42em;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  border: 1px solid var(--cyan);
}

.btn.cyan {
  background: var(--cyan);
  color: #07343a;
}

.btn.ghost {
  background: transparent;
  color: var(--cyan-deep);
}

.w {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 72px 0;
}

.frost-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.frost-card {
  background: var(--glass);
  border: 1px solid rgba(41, 179, 194, 0.22);
  border-radius: 24px;
  padding: 20px 18px;
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.frost-card.warn {
  border-color: rgba(217, 138, 43, 0.55);
}

.frost-card ul {
  margin: 0;
  padding-left: 18px;
}

.circuit-ribbon {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.circuit-ribbon li {
  position: relative;
  background: #fff;
  border-radius: 22px;
  padding: 18px 16px 16px;
  border: 1px solid rgba(41, 179, 194, 0.18);
}

.circuit-ribbon li::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 28px;
  width: 18px;
  height: 8px;
  background: var(--cyan);
  border-radius: 99px;
  opacity: 0.45;
}

.circuit-ribbon li:nth-child(3n)::after {
  display: none;
}

.circuit-ribbon span {
  font-family: var(--mono);
  color: var(--cyan-deep);
  font-size: 12px;
}

.circuit-ribbon strong {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-size: 22px;
  margin: 6px 0 8px;
}

.circuit-ribbon p {
  margin: 0;
  color: var(--mute);
  font-size: 14px;
}

.side-glass {
  margin: 36px 0 0;
  background: var(--glass);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(41, 179, 194, 0.2);
}

.side-glass img,
.machine-cut img {
  width: 100%;
  height: 320px;
  object-fit: cover;
}

.side-glass figcaption,
.machine-cut figcaption {
  padding: 12px 16px 16px;
  font-size: 13px;
  color: var(--mute);
}

#gate {
  background: linear-gradient(180deg, rgba(41, 179, 194, 0.1), transparent);
}

.gate-bench {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  margin-top: 28px;
  align-items: start;
}

.lock-card select,
.lock-card input[type="range"] {
  width: 100%;
  margin-top: 6px;
}

.lock-card select {
  border: 1px solid rgba(41, 179, 194, 0.35);
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
}

.lock-card input[type="range"] {
  accent-color: var(--plasma);
}

.lock-card.is-lock {
  box-shadow: inset 0 0 0 2px var(--lock);
}

.lock-card.is-ca {
  box-shadow: inset 0 0 0 2px var(--plasma);
}

.lock-card.is-ok {
  box-shadow: inset 0 0 0 2px var(--ok);
}

.n {
  font-family: var(--display);
  font-style: italic;
  font-size: 42px;
  margin: 4px 0 14px;
}

#gate-state {
  min-height: 3em;
  margin-bottom: 0;
}

#gate-state.is-lock {
  color: var(--lock);
}

#gate-state.is-ca {
  color: var(--plasma);
}

#gate-state.is-ok {
  color: var(--ok);
}
#aph-toggle {
  margin-top: 12px;
  background: var(--plasma);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  font-weight: 700;
}

.clock-col {
  display: grid;
  gap: 14px;
}

.calcium-clock {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--plasma) calc(var(--pct, 58) * 1%), rgba(41, 179, 194, 0.18) 0);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.7), 0 18px 40px rgba(217, 138, 43, 0.18);
  position: relative;
}

.calcium-clock::before {
  content: "";
  position: absolute;
  inset: 16px;
  background: var(--ice);
  border-radius: 50%;
}

.calcium-clock span,
.calcium-clock small {
  position: relative;
  z-index: 1;
}

.calcium-clock span {
  font-family: var(--mono);
  font-size: 48px;
  line-height: 1;
}

.calcium-clock small {
  position: absolute;
  bottom: 48px;
  font-size: 12px;
  color: var(--mute);
}

.clock-col img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  border-radius: 22px;
}

.hint {
  font-size: 13px;
  color: var(--mute);
  margin: 0;
}

.machine-cut {
  margin: 28px 0 0;
  border-radius: 28px;
  overflow: hidden;
}

.lines {
  margin: 0;
  padding-left: 18px;
}

.lines li {
  margin: 8px 0;
}

.session-list {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.session-list li {
  background: #fff;
  border-radius: 20px;
  padding: 16px 18px;
  border-left: 5px solid var(--cyan);
}

.session-list code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan-deep);
}

.session-list strong {
  display: block;
  margin: 4px 0 6px;
  font-family: var(--display);
  font-style: italic;
}

.session-list p {
  margin: 0;
  color: var(--mute);
}

footer {
  padding: 28px 24px 56px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
}

@media (max-width: 880px) {
  .tube-rail {
    display: none;
  }

  .loop-mast {
    width: calc(100% - 20px);
    border-radius: 22px;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: inline-block;
  }

  .loop-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 6px 10px;
  }

  .loop-nav.open {
    display: flex;
  }

  .glass-hero {
    margin: 16px 10px 0;
    border-radius: 24px;
  }

  .glass-hero img {
    height: 52vh;
    min-height: 280px;
  }

  .glass-copy {
    padding: 24px 18px 28px;
  }

  .frost-grid,
  .circuit-ribbon,
  .gate-bench {
    grid-template-columns: 1fr;
  }

  .circuit-ribbon li::after {
    display: none;
  }

  .w {
    width: min(1080px, calc(100% - 28px));
    padding: 48px 0;
  }

  h1 {
    font-size: 32px;
  }
}
