:root {
  --bg: #05070a;
  --bg-2: #080c11;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-solid: #0a1017;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eef4;
  --muted: #8496a6;
  --teal: #2dd4bf;
  --sky: #38bdf8;
  --amber: #f5a524;
  --green: #34d399;
  --rose: #fb7185;
  --mono: "Fira Code", ui-monospace, monospace;
  --sans: "Fira Sans", system-ui, -apple-system, sans-serif;
  --r: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}
.glow-a { width: 520px; height: 520px; top: -180px; left: -120px; background: rgba(45, 212, 191, 0.18); }
.glow-b { width: 620px; height: 620px; top: 220px; right: -260px; background: rgba(56, 189, 248, 0.12); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(5, 7, 10, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #04120f;
  background: linear-gradient(140deg, var(--teal), var(--sky));
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.25);
}
.mark svg { width: 20px; height: 20px; stroke-width: 2; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 17px; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.pill svg { width: 14px; height: 14px; }
.pill.live { color: var(--teal); border-color: rgba(45, 212, 191, 0.32); background: rgba(45, 212, 191, 0.08); }
.pill.live.down { color: var(--rose); border-color: rgba(251, 113, 133, 0.35); background: rgba(251, 113, 133, 0.08); }

main {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(16px, 4vw, 40px) 80px;
}

.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.4vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 600;
  max-width: 20ch;
}
.intro p { margin: 0; max-width: 62ch; color: var(--muted); font-size: clamp(15px, 1.6vw, 17px); }
.intro code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--teal);
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: 6px;
  padding: 1px 6px;
}

.intro-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 34px;
}
.intro-stats div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.intro-stats b { font-family: var(--mono); font-size: 16px; color: var(--text); }
.intro-stats span { font-size: 12.5px; color: var(--muted); }

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  padding: 18px;
}

.stage-panel { padding: 16px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}
.seg-btn svg { width: 14px; height: 14px; }
.seg-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.seg-btn.is-on { color: #04120f; background: var(--teal); font-weight: 500; }

.canvas-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(45deg, #0d131a 25%, transparent 25%) 0 0/22px 22px,
    linear-gradient(-45deg, #0d131a 25%, transparent 25%) 0 11px/22px 22px,
    #080c11;
  border: 1px solid var(--line);
  touch-action: none;
}
#stage { display: block; width: 100%; height: auto; cursor: crosshair; }

.skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0a1017 25%, #101923 50%, #0a1017 75%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
  transition: opacity 0.25s;
}
.skeleton.hide { opacity: 0; pointer-events: none; }
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -20% 0; } }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 12.5px;
}
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend b { font-family: var(--mono); color: var(--text); font-weight: 500; }

.readout { display: grid; gap: 14px; }

.result-card .label {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.big {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0 0;
  font-size: clamp(34px, 4.6vw, 44px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.big small { font-size: 15px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.big.accent { color: var(--amber); margin-bottom: 2px; }

.spark {
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  margin: 10px 0 18px;
  overflow: hidden;
}
.spark span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--teal), var(--sky));
  transition: width 0.3s ease;
}

.message-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-left: 3px solid var(--line-strong);
  transition: border-color 0.2s, background 0.2s;
}
.message-card p { margin: 0; font-size: 14px; }
.message-card .msg-icon { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; margin-top: 2px; }
.message-card.ok { border-left-color: var(--teal); background: rgba(45, 212, 191, 0.06); }
.message-card.ok .msg-icon { color: var(--teal); }
.message-card.bad { border-left-color: var(--rose); background: rgba(251, 113, 133, 0.07); }
.message-card.bad .msg-icon { color: var(--rose); }

.formula-card h3, .controls h3 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.formula { margin: 0; display: grid; gap: 7px; font-size: 12.5px; }
.formula div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}
.formula div:last-child { border-bottom: 0; padding-bottom: 0; color: var(--teal); }
.formula dt { color: var(--muted); font-family: var(--sans); font-size: 12.5px; }
.formula dd { margin: 0; color: var(--text); }

.controls .ctl { display: block; margin-bottom: 16px; }
.ctl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
  margin-bottom: 7px;
}
.ctl-head b { color: var(--teal); font-size: 13px; }
.ctl-hint { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.ctl-hint.tight { margin-top: 8px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #04120f;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.6), 0 2px 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--teal);
  border: 3px solid #04120f;
  cursor: pointer;
}
input[type="range"]:focus-visible { box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.35); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 1 auto;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { transform: translateY(-2px); background: rgba(45, 212, 191, 0.1); border-color: rgba(45, 212, 191, 0.4); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); }
.btn:active { transform: translateY(0); }
.btn.is-on { border-color: var(--teal); background: rgba(45, 212, 191, 0.14); }
.btn.ghost { width: 100%; background: transparent; border-style: dashed; }
.file-btn { cursor: pointer; }

.gallery-section, .checks-section { margin-top: clamp(44px, 6vw, 72px); }

.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(21px, 2.6vw, 27px);
  letter-spacing: -0.02em;
  font-weight: 600;
}
.section-head p { margin: 0 0 22px; color: var(--muted); max-width: 68ch; font-size: 15px; }
.section-head .mono { color: var(--teal); font-size: 0.9em; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px;
}
.shot {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  animation: fadeUp 0.5s both;
}
.frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0a1017;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
}
.frame img { display: block; width: 100%; height: auto; }
.shot:hover .frame { transform: translateY(-4px); border-color: rgba(45, 212, 191, 0.45); box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55); }
.shot figcaption { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.shot figcaption b { display: block; color: var(--text); font-weight: 500; font-size: 13px; }

.table-panel { padding: 6px 18px 18px; overflow-x: auto; }

.checks { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
.checks th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.checks td { padding: 11px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: top; }
.checks tr:last-child td { border-bottom: 0; }
.checks tbody tr { transition: background 0.16s; }
.checks tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.checks .part { font-family: var(--mono); color: var(--sky); font-size: 12px; white-space: nowrap; }
.checks .val { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.checks .val.app { color: var(--text); }
.loading { color: var(--muted); text-align: center; padding: 26px 0; }

.tick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.1);
  color: var(--green);
  white-space: nowrap;
}
.tick.bad { border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.1); color: var(--rose); }
.tick svg { width: 12px; height: 12px; }

footer {
  margin-top: clamp(44px, 6vw, 70px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}
footer p { margin: 0; max-width: 62ch; }
footer strong { color: var(--text); font-weight: 600; }
footer .mono { color: rgba(45, 212, 191, 0.7); font-size: 12px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 28px;
  background: rgba(3, 5, 8, 0.9);
  backdrop-filter: blur(8px);
  animation: fadeUp 0.2s both;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-height: 78vh;
  max-width: min(420px, 92vw);
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65);
}
.lightbox p { margin: 0; color: var(--muted); font-size: 13.5px; text-align: center; }
.lb-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.14); transform: rotate(90deg); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro, .stage, .gallery-section, .checks-section { animation: fadeUp 0.55s both; }
.stage { animation-delay: 0.06s; }
.gallery-section { animation-delay: 0.12s; }
.checks-section { animation-delay: 0.18s; }

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .topbar-right .pill:not(.live) { display: none; }
}

@media (max-width: 560px) {
  .intro-stats div { flex: 1 1 44%; }
  .panel-head { gap: 10px; }
  .seg-btn { padding: 6px 9px; font-size: 12px; }
  .seg-btn span { display: none; }
  footer { flex-direction: column; }
}

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

.col-left { display: grid; gap: 18px; align-content: start; }

.note-card h3 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.note-card ul { margin: 0; padding-left: 18px; display: grid; gap: 7px; font-size: 13px; color: var(--muted); }
.note-card li::marker { color: var(--teal); }
.note-card b { color: var(--text); font-weight: 500; }
