:root {
  --bg: #0b0812;
  --surface: #120d1c;
  --surface-2: #191126;
  --panel: rgba(24, 17, 36, 0.88);
  --panel-solid: #181124;
  --text: #f8f4ff;
  --muted: #b7adc8;
  --subtle: #8a7f99;
  --purple: #b86cff;
  --pink: #ff6bc7;
  --cyan: #65e6ff;
  --green: #70f5a4;
  --yellow: #ffd76a;
  --red: #ff7188;
  --line: #3a2d4d;
  --line-soft: rgba(255, 255, 255, 0.08);
  --radius: 20px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 70% -15%, rgba(184, 108, 255, 0.18), transparent 34rem),
    radial-gradient(circle at 10% 85%, rgba(101, 230, 255, 0.08), transparent 28rem),
    var(--bg);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
code, pre { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
code { color: var(--cyan); }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: var(--cyan);
  color: #071016;
  font-weight: 800;
}
.skip-link:focus { top: 1rem; }

.ambient {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.17;
}
.ambient-a { width: 26rem; height: 26rem; top: 8%; right: -12rem; background: var(--purple); }
.ambient-b { width: 22rem; height: 22rem; bottom: 4%; left: -10rem; background: var(--cyan); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 8, 18, 0.82);
  backdrop-filter: blur(18px);
}
.brand, .top-actions, .dev-card { display: flex; align-items: center; }
.brand { gap: 14px; }
.brand-copy strong { display: block; letter-spacing: 0.09em; }
.brand-copy small { display: block; color: var(--muted); font-size: 0.73rem; }
.top-actions { gap: 12px; }
.secure-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(112, 245, 164, 0.25);
  border-radius: 999px;
  color: var(--green);
  background: rgba(112, 245, 164, 0.07);
  font-size: 0.78rem;
  font-weight: 800;
}

.fox {
  position: relative;
  width: 46px;
  height: 37px;
  display: grid;
  place-items: center;
  border-radius: 46% 46% 52% 52%;
  background: linear-gradient(145deg, var(--purple), var(--pink));
  box-shadow: 0 0 30px rgba(184, 108, 255, 0.35);
}
.fox .face { z-index: 2; color: #180c25; font-size: 0.8rem; font-weight: 900; }
.ear {
  position: absolute;
  top: -8px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 17px solid var(--purple);
}
.ear.left { left: 3px; transform: rotate(-18deg); }
.ear.right { right: 3px; transform: rotate(18deg); border-bottom-color: var(--pink); }
.tail {
  position: absolute;
  right: -30px;
  top: 16px;
  width: 37px;
  height: 14px;
  border-top: 7px solid var(--pink);
  border-radius: 50%;
  transform-origin: left center;
  animation: swish 1.8s ease-in-out infinite;
}
@keyframes swish { 0%, 100% { transform: rotate(15deg); } 50% { transform: rotate(-18deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; } }

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  height: calc(100vh - 76px);
  padding: 28px 20px 22px;
  border-right: 1px solid var(--line-soft);
  background: rgba(13, 9, 21, 0.58);
  overflow-y: auto;
}
.nav-label { margin: 0 10px 10px; color: var(--subtle); font-size: 0.7rem; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.side-nav { display: grid; gap: 6px; }
.side-nav a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  transition: 0.18s ease;
}
.side-nav a span { color: var(--cyan); text-align: center; }
.side-nav a:hover, .side-nav a:focus-visible { color: white; border-color: var(--line); background: rgba(184, 108, 255, 0.09); }
.sidebar-note {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(184, 108, 255, 0.08), rgba(101, 230, 255, 0.04));
}
.sidebar-note strong { color: var(--cyan); }
.sidebar-note p { margin: 7px 0 0; color: var(--muted); font-size: 0.78rem; }
.dev-card { gap: 10px; margin-top: 18px; padding: 12px; color: var(--muted); }
.dev-card strong, .dev-card small { display: block; }
.dev-card strong { color: white; font-size: 0.84rem; }
.dev-card small { font-size: 0.72rem; }
.dev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); }

.workspace { min-width: 0; padding: 38px clamp(22px, 4vw, 62px) 0; }
.section-card, .section-block { scroll-margin-top: 96px; }
.section-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(29, 19, 43, 0.9), rgba(13, 9, 21, 0.86));
  box-shadow: var(--shadow);
}
.hero {
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.92fr);
  align-items: center;
  gap: clamp(34px, 5vw, 74px);
  padding: clamp(36px, 6vw, 78px);
  overflow: hidden;
}
.eyebrow { margin: 0 0 12px; color: var(--cyan); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(3.1rem, 7vw, 6.4rem); line-height: 0.91; letter-spacing: -0.065em; }
.hero h1 span { color: transparent; background: linear-gradient(90deg, var(--purple), var(--pink), var(--cyan)); background-clip: text; }
.lede { max-width: 690px; margin: 25px 0; color: var(--muted); font-size: 1.08rem; }
.hero-actions, .filter-row, .lab-tabs { display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #21182f;
  color: white;
  cursor: pointer;
  transition: 0.18s ease;
}
.button:hover, .button:focus-visible { transform: translateY(-1px); border-color: var(--purple); }
.button.primary { border: 0; background: linear-gradient(135deg, var(--purple), #7558ff); box-shadow: 0 12px 34px rgba(142, 85, 255, 0.28); }
.button.ghost { background: transparent; }
.button.small { padding: 7px 11px; font-size: 0.84rem; }

.terminal-card { overflow: hidden; border: 1px solid #443354; border-radius: 18px; background: #09070f; box-shadow: 0 22px 62px rgba(0, 0, 0, 0.5), 0 0 80px rgba(161, 84, 255, 0.12); }
.terminal-bar { height: 42px; display: flex; align-items: center; gap: 7px; padding: 0 14px; background: #171220; color: var(--subtle); font-size: 0.78rem; }
.terminal-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.terminal-bar i:nth-child(2) { background: var(--yellow); }
.terminal-bar i:nth-child(3) { background: var(--green); }
.terminal-bar span { margin: 0 auto; }
.terminal-card pre { margin: 0; padding: 28px; overflow: auto; font-size: 0.88rem; line-height: 1.62; }
.purple { color: var(--purple); } .cyan { color: var(--cyan); } .green { color: var(--green); } .yellow { color: var(--yellow); } .dim { color: #7d728b; }

.overview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0 0; }
.metric-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.metric-card span { display: block; color: var(--cyan); font-size: 2rem; font-weight: 900; }
.metric-card strong { display: block; }
.metric-card p { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }

.section-block { padding: 78px 0 10px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
.section-heading.compact { display: block; margin-bottom: 6px; }
.section-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -0.045em; line-height: 1; }
.section-heading > p { max-width: 570px; margin: 0; color: var(--muted); }
.section-copy { max-width: 700px; color: var(--muted); }
.filter-row, .lab-tabs { margin-bottom: 22px; }
.chip { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: #151020; color: var(--muted); cursor: pointer; }
.chip.active, .chip:hover, .chip:focus-visible { border-color: var(--purple); background: #2a1d3c; color: white; }

.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.tool-card { min-height: 220px; display: flex; flex-direction: column; padding: 24px; border: 1px solid #392d4c; border-radius: var(--radius); background: linear-gradient(155deg, rgba(27, 20, 40, 0.92), rgba(18, 14, 28, 0.9)); transition: 0.22s ease; }
.tool-card:hover { transform: translateY(-4px); border-color: #8257ac; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32); }
.tool-card .icon { font-size: 1.65rem; }
.tool-card h3 { margin: 15px 0 7px; }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.tool-card .tag { margin-top: auto; padding-top: 18px; color: var(--cyan); font: 700 0.74rem ui-monospace, monospace; }

.split-section { display: grid; grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr); gap: 30px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 15px 50px rgba(0, 0, 0, 0.22); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 22px; margin-top: 22px; }
.form-grid label, .lab-inputs label, .matrix-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 0.81rem; font-weight: 750; }
.form-grid .wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid #443654; border-radius: 10px; outline: none; background: #0f0b18; color: white; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(164, 93, 255, 0.13); }
textarea { resize: vertical; font-size: 0.81rem; }
.command-output { position: sticky; top: 98px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.command-output pre { min-height: 235px; margin: 0; padding: 24px; overflow: auto; background: #09070f; color: var(--green); font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; }
.notes { padding: 17px; color: var(--muted); font-size: 0.82rem; }

.matrix-toolbar { display: flex; align-items: end; justify-content: space-between; padding: 18px 22px; margin-bottom: 18px; }
.matrix-toolbar label { min-width: 260px; }
.formula { text-align: right; }
.formula strong, .formula span { display: block; }
.formula span { color: var(--muted); font-size: 0.8rem; }
.score-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.summary-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #171224; }
.summary-card strong { display: block; font-size: 2rem; }
.summary-card span { color: var(--muted); font-size: 0.8rem; }
.matrix-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.category-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #151020; }
.category-head { display: flex; justify-content: space-between; padding: 18px; border-bottom: 1px solid var(--line); }
.category-head strong { display: block; }
.category-head small { color: var(--subtle); }
.category-head span { color: var(--cyan); font-weight: 900; }
.factor-row { display: grid; grid-template-columns: 1fr 74px 58px; gap: 10px; padding: 10px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.055); font-size: 0.81rem; }
.factor-row:last-child { border-bottom: 0; }
.factor-row i { align-self: center; height: 5px; overflow: hidden; border-radius: 4px; background: #322641; }
.factor-row i::after { content: ""; display: block; width: var(--w); height: 100%; background: linear-gradient(90deg, var(--purple), var(--cyan)); }
.factor-row b { text-align: right; }
.disclaimer { margin-top: 18px; color: var(--subtle); font-size: 0.77rem; }

.dropzone { display: grid; gap: 7px; padding: 36px; border: 1px dashed #725393; border-radius: 18px; background: #171124; text-align: center; cursor: pointer; }
.dropzone input { display: none; }
.dropzone span { color: var(--muted); font-size: 0.82rem; }
.report-empty { min-height: 285px; display: grid; place-items: center; padding: 25px; color: var(--muted); }
.report-score { padding: 20px; border-bottom: 1px solid var(--line); }
.report-score:last-child { border-bottom: 0; }
.report-header { display: flex; align-items: center; gap: 20px; }
.report-meta { color: var(--muted); font-size: 0.8rem; }
.score-ring { position: relative; width: 90px; height: 90px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--score) * 1%), #31263f 0); }
.score-ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #171225; }
.score-ring strong { z-index: 1; }

.lab-panel { display: none; grid-template-columns: 1fr 1fr; gap: 20px; }
.lab-panel.active { display: grid; }
.lab-inputs { display: grid; gap: 13px; }
.results { min-height: 310px; padding: 22px; }
.result-row { display: grid; grid-template-columns: 58px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.status { font-size: 0.7rem; font-weight: 900; }
.status.pass { color: var(--green); }
.status.warn { color: var(--yellow); }
.status.fail { color: var(--red); }

footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 76px; padding: 30px 0 42px; border-top: 1px solid var(--line-soft); color: var(--subtle); font-size: 0.8rem; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .workspace { padding-left: 30px; padding-right: 30px; }
  .hero { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .tool-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .topbar { padding: 0 15px; }
  .secure-pill { display: none; }
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
  .nav-label, .sidebar-note, .dev-card { display: none; }
  .side-nav { display: flex; min-width: max-content; }
  .side-nav a { grid-template-columns: auto auto; padding: 8px 10px; }
  .workspace { padding: 24px 18px 0; }
  .hero { padding: 34px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 12px; }
  .split-section, .lab-panel.active { grid-template-columns: 1fr; }
  .command-output { position: static; }
  .matrix-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .brand-copy small, .top-actions .ghost { display: none; }
  .workspace { padding-left: 12px; padding-right: 12px; }
  .hero { padding: 28px 22px; border-radius: 22px; }
  .hero h1 { font-size: 3.35rem; }
  .overview-grid, .tool-grid, .form-grid, .score-summary { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .matrix-toolbar { align-items: stretch; gap: 15px; flex-direction: column; }
  .matrix-toolbar label { min-width: 0; }
  .formula { text-align: left; }
  .factor-row { grid-template-columns: 1fr 55px; }
  .factor-row i { display: none; }
  footer { flex-direction: column; }
}

/* v1.3 local live-mode and Internal Link Graph */
.live-section { scroll-margin-top: 92px; }
.live-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.live-mode-banner > div { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.live-mode-banner p { grid-column: 2; margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }
.live-mode-banner code { white-space: nowrap; border: 1px solid var(--line); background: #0b0812; border-radius: 10px; padding: 8px 11px; }
.connection-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 16px color-mix(in srgb, var(--yellow) 65%, transparent); }
.connection-dot.online { background: var(--green); box-shadow: 0 0 18px rgba(112,245,164,.65); }
.connection-dot.offline { background: var(--red); box-shadow: 0 0 18px rgba(255,113,136,.55); }
.live-grid { display: grid; grid-template-columns: minmax(310px, .72fr) minmax(0, 1.28fr); gap: 16px; align-items: start; }
.live-form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 20px; }
.live-form label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.live-form .wide { grid-column: 1 / -1; }
.live-form .check { display: flex; align-items: center; grid-template-columns: auto 1fr; gap: 9px; min-height: 42px; }
.live-form .check input { width: auto; accent-color: var(--purple); }
.optional { color: var(--subtle); font-weight: 500; }
.form-note { margin: 0; color: var(--subtle); font-size: .76rem; font-weight: 500; }
.live-output { overflow: hidden; }
.graph-actions { display: flex; gap: 7px; }
#live-graph { display: block; width: 100%; height: 510px; background: radial-gradient(circle at center, #151021, #08060d 72%); }
.live-summary { min-height: 72px; padding: 15px 18px; border-top: 1px solid var(--line); color: var(--muted); }
.live-summary p { margin: 0; }
.live-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.live-summary-grid article { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.025); }
.live-summary-grid strong { display: block; color: var(--text); font-size: 1.2rem; }
.live-summary-grid span { color: var(--muted); font-size: .72rem; }
.live-findings { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.finding-card { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; }
.finding-card summary { cursor: pointer; padding: 14px 16px; display: flex; justify-content: space-between; gap: 12px; font-weight: 750; }
.finding-card pre { max-height: 280px; overflow: auto; margin: 0; padding: 14px 16px; border-top: 1px solid var(--line-soft); background: #09070f; color: var(--muted); font-size: .73rem; white-space: pre-wrap; word-break: break-word; }
.live-loading { animation: livePulse 1.25s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: .45; } }
.subsection-heading { max-width: 780px; margin: 54px 0 20px; }
.subsection-heading h3 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.5rem); letter-spacing: -.035em; }
.subsection-heading > p:last-child { margin: 10px 0 0; color: var(--muted); }
.quality-grid { display: grid; grid-template-columns: minmax(280px, .55fr) minmax(0, 1.45fr); gap: 16px; align-items: start; }
.quality-form { display: grid; gap: 15px; padding: 20px; }
.quality-form label { display: grid; gap: 7px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.quality-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 9px; margin-bottom: 20px; }
.quality-summary article { padding: 13px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.025); }
.quality-summary strong { display: block; font-size: 1.4rem; }
.quality-summary span { color: var(--muted); font-size: .72rem; }
.quality-section + .quality-section { margin-top: 22px; }
.quality-section h3 { margin: 0 0 5px; font-size: 1rem; }

@media (max-width: 1120px) {
  .live-grid { grid-template-columns: 1fr; }
  .quality-grid { grid-template-columns: 1fr; }
  .live-findings { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .live-mode-banner { align-items: flex-start; flex-direction: column; }
  .live-form { grid-template-columns: 1fr; }
  .live-form .wide { grid-column: auto; }
  #live-graph { height: 400px; }
  .live-summary-grid, .live-findings, .quality-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .live-summary-grid, .live-findings, .quality-summary { grid-template-columns: 1fr; }
}
