:root {
  color-scheme: dark;
  --bg: #080b0d;
  --panel: rgba(17, 22, 24, 0.86);
  --panel-solid: #111618;
  --panel-soft: #171d1f;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.17);
  --text: #f3f5f2;
  --muted: #99a39f;
  --green: #c8ff3d;
  --green-deep: #98d600;
  --amber: #ffbc57;
  --red: #ff7474;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -25%, rgba(200, 255, 61, 0.08), transparent 38rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
a { color: var(--green); }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(200,255,61,.55);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.055;
  pointer-events: none;
}
.ambient-one { top: 8%; left: -220px; background: var(--green); }
.ambient-two { right: -260px; top: 48%; background: #63d5ff; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-decoration: none;
}
.brand > span:last-child span { color: var(--green); }
.brand-mark { display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.brand-mark i { display: block; width: 4px; border-radius: 2px; background: var(--green); transform: skew(-10deg); }
.brand-mark i:nth-child(1) { height: 10px; opacity: 0.62; }
.brand-mark i:nth-child(2) { height: 16px; opacity: 0.82; }
.brand-mark i:nth-child(3) { height: 22px; }

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.header-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }

main { width: min(1080px, calc(100% - 40px)); margin: 0 auto; }

.hero { padding: 92px 0 64px; text-align: center; }
.eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.21em;
}
.hero h1 {
  margin: 18px 0 20px;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}
.hero h1 em { color: var(--green); font-style: normal; }
.hero-copy { max-width: 680px; margin: 0 auto; color: #b1bab6; font-size: 18px; line-height: 1.65; }
.trust-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 30px; margin-top: 34px; color: #7e8884; font-size: 12px; font-weight: 650; letter-spacing: 0.025em; }
.trust-row b { margin-right: 7px; color: var(--green); font-size: 10px; }

.workspace { display: grid; gap: 18px; }
.panel {
  position: relative;
  padding: clamp(24px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.panel::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 1px rgba(255,255,255,.035); }
.panel-heading { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 28px; }
.step { flex: 0 0 auto; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(200,255,61,.28); border-radius: 10px; background: rgba(200,255,61,.06); color: var(--green); font-size: 11px; font-weight: 850; }
.panel h2 { margin: 1px 0 8px; font-size: 24px; letter-spacing: -0.025em; }
.panel-heading p, .card-heading p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.panel-heading strong { color: #c8cfcc; }

.drop-zone {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1px dashed rgba(200,255,61,.34);
  border-radius: 14px;
  background: rgba(200,255,61,.025);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--green); background: rgba(200,255,61,.055); transform: translateY(-1px); }
.drop-zone:focus-within, .file-button:focus-within {
  outline: 3px solid rgba(200,255,61,.55);
  outline-offset: 3px;
  border-color: var(--green);
}
.drop-zone input, .file-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.upload-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 13px; border-radius: 50%; background: var(--green); color: #0a0d08; font-size: 23px; font-weight: 900; }
.drop-zone strong { font-size: 15px; }
.drop-zone small { margin-top: 7px; color: var(--muted); }
.drop-zone.has-file { border-style: solid; border-color: rgba(200,255,61,.6); }

.template-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 22px; padding: 20px 0 4px; }
.template-row label:not(.file-button) { display: block; font-size: 13px; font-weight: 750; }
.template-row label span { margin-left: 5px; color: #77817d; font-size: 11px; font-weight: 600; }
.template-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.file-button, .quiet-button {
  flex: 0 0 auto;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: #d9dedb;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.file-button:hover, .quiet-button:hover { border-color: rgba(200,255,61,.45); color: var(--green); }

.format-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 22px; padding: 13px 15px; border-radius: 10px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 11px; line-height: 1.55; }
.format-note > span { flex: 0 0 auto; display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #66706b; border-radius: 50%; color: #bac2be; font-size: 10px; font-weight: 800; }
.format-note p { margin: 0; }
.format-note code { color: #c8cfcc; }

.control-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; }
.control { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.control > span { color: #d7dcda; font-size: 12px; font-weight: 750; }
.control small { color: #98a29e; font-size: 11px; line-height: 1.4; }
.control input, .control select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #0d1113;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
.control input:focus, .control select:focus { border-color: rgba(200,255,61,.6); box-shadow: 0 0 0 3px rgba(200,255,61,.07); }
.control input::placeholder { color: #4e5753; }
.suffix-input, .seed-control { display: flex; position: relative; }
.suffix-input input { padding-right: 34px; }
.suffix-input span { position: absolute; right: 12px; top: 13px; color: #6f7975; font-size: 12px; }
.seed-control input { padding-right: 42px; }
.seed-control button { position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--green); cursor: pointer; font-size: 18px; }
.seed-control button:hover { background: rgba(200,255,61,.07); }

.advanced { margin-top: 28px; border-top: 1px solid var(--line); }
.advanced summary { padding: 20px 0 0; list-style: none; color: #aeb6b2; cursor: pointer; font-size: 12px; font-weight: 750; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "+"; display: inline-block; width: 18px; color: var(--green); }
.advanced[open] summary::before { content: "−"; }
.advanced-grid { margin-top: 20px; }
.span-two { grid-column: span 2; }

.run-row { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.engine-note { display: flex; align-items: center; gap: 12px; }
.engine-note > div { display: flex; flex-direction: column; gap: 3px; }
.engine-note strong { font-size: 12px; }
.engine-note small { color: #98a29e; font-size: 11px; line-height: 1.4; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(200,255,61,.08); }
.run-button {
  min-width: 210px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 18px 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: #090c08;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(152,214,0,.14);
  transition: background .18s, transform .18s, box-shadow .18s;
}
.run-button:hover { background: #d5ff68; transform: translateY(-1px); box-shadow: 0 14px 36px rgba(152,214,0,.2); }
.run-button:disabled { opacity: .48; cursor: wait; transform: none; }
.run-button b { font-size: 19px; }
.workspace[aria-busy="true"] input,
.workspace[aria-busy="true"] select,
.workspace[aria-busy="true"] summary,
.workspace[aria-busy="true"] .file-button,
.workspace[aria-busy="true"] .drop-zone { cursor: wait; }

.hidden { display: none !important; }
.run-status, .error-panel { margin: 18px 0; padding: 22px 26px; display: flex; align-items: center; gap: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.run-status strong, .error-panel strong { font-size: 13px; }
.run-status p, .error-panel p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.loader { display: flex; gap: 4px; height: 22px; align-items: flex-end; }
.loader i { width: 4px; border-radius: 4px; background: var(--green); animation: bars 1s ease-in-out infinite; }
.loader i:nth-child(1) { height: 9px; }
.loader i:nth-child(2) { height: 17px; animation-delay: .14s; }
.loader i:nth-child(3) { height: 12px; animation-delay: .28s; }
@keyframes bars { 0%,100% { transform: scaleY(.55); opacity: .45; } 50% { transform: scaleY(1.1); opacity: 1; } }
.error-panel { border-color: rgba(255,116,116,.25); background: rgba(255,116,116,.055); }
.error-panel > span { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: rgba(255,116,116,.15); color: var(--red); font-weight: 900; }
.error-panel p { color: #d6a4a4; }

.results { padding: 80px 0 30px; outline: none; }
.results:focus-visible { box-shadow: 0 0 0 3px rgba(200,255,61,.35); }
.results.is-stale { opacity: .72; }
.results.is-stale .results-heading .eyebrow::after { content: " · PREVIOUS RESULT"; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.results-heading h2 { margin: 7px 0 4px; font-size: 34px; letter-spacing: -0.04em; }
.results-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.warning-list { margin: 0 0 16px; padding: 14px 18px; border: 1px solid rgba(255,188,87,.22); border-radius: 11px; background: rgba(255,188,87,.055); color: #d8b57e; font-size: 11px; line-height: 1.55; }
.warning-list p { margin: 3px 0; }

.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
.metric-grid article { min-height: 118px; padding: 18px; display: flex; flex-direction: column; justify-content: flex-end; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.metric-grid span { margin-bottom: auto; color: #9ba5a1; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.metric-grid strong { font-size: 24px; letter-spacing: -.035em; }
.metric-grid small { margin-top: 3px; color: #9ba5a1; font-size: 10px; }

.result-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 14px; }
.result-card, .download-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.result-card { min-width: 0; overflow: hidden; }
.card-heading { min-height: 83px; padding: 20px 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.card-heading h3, .download-card h3 { margin: 0 0 5px; font-size: 14px; }
.card-heading p { font-size: 10px; }
.card-heading > span { padding: 5px 8px; border-radius: 6px; background: rgba(200,255,61,.07); color: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.table-scroll { max-height: 450px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; background: #101517; color: #a2aca8; text-align: right; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
th:nth-child(1), th:nth-child(2) { text-align: left; }
td { padding: 13px 12px; border-top: 1px solid rgba(255,255,255,.055); color: #c7ceca; text-align: right; font-variant-numeric: tabular-nums; }
td:nth-child(1) { color: var(--green); text-align: left; font-weight: 800; }
td:nth-child(2) { min-width: 290px; max-width: 380px; color: #e3e7e5; text-align: left; white-space: normal; line-height: 1.5; }
tbody tr:hover { background: rgba(255,255,255,.018); }

.exposure-rows { max-height: 450px; padding: 8px 20px 18px; overflow-y: auto; }
.exposure-row { padding: 12px 0 9px; }
.exposure-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.exposure-name { min-width: 0; }
.exposure-name strong { display: block; overflow: hidden; color: #dce1df; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.exposure-name small { color: #9ba5a1; font-size: 9px; }
.exposure-meta > strong { color: var(--green); font-size: 10px; font-variant-numeric: tabular-nums; }
.exposure-track { height: 3px; overflow: hidden; border-radius: 4px; background: #292f30; }
.exposure-track i { display: block; height: 100%; border-radius: inherit; background: var(--green); }

.download-card { margin-top: 14px; padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.download-card > div:first-child { display: flex; align-items: center; gap: 14px; }
.download-card p { margin: 0; color: var(--muted); font-size: 10px; }
.download-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; background: rgba(200,255,61,.08); color: var(--green); font-size: 19px; }
.download-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.download-actions button { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #111719; color: #aeb7b3; font-size: 9px; font-weight: 750; cursor: pointer; }
.download-actions button:hover { color: var(--green); border-color: rgba(200,255,61,.35); }
.download-actions .primary-download { background: var(--green); border-color: var(--green); color: #080b08; }
.download-actions .primary-download:hover { color: #080b08; background: #d5ff68; }
.download-actions button:disabled { display: none; }

footer { width: min(1080px, calc(100% - 40px)); margin: 68px auto 0; padding: 30px 0 45px; display: flex; justify-content: space-between; gap: 40px; border-top: 1px solid var(--line); color: #99a39f; font-size: 10px; line-height: 1.6; }
footer > div { display: flex; flex-direction: column; flex: 0 0 auto; }
footer strong { color: #aeb6b2; font-size: 10px; }
footer p { max-width: 650px; margin: 0; text-align: right; }

@media (max-width: 900px) {
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .result-layout { grid-template-columns: 1fr; }
  .exposure-rows { max-height: 340px; }
  .download-card { align-items: flex-start; flex-direction: column; }
  .download-actions { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .site-header, main, footer { width: min(100% - 24px, 1080px); }
  .site-header { height: 64px; }
  .hero { padding: 66px 0 44px; }
  .hero h1 { font-size: 44px; }
  .hero-copy { font-size: 15px; }
  .trust-row { display: none; }
  .panel { padding: 22px 18px; border-radius: 14px; }
  .panel-heading { gap: 12px; }
  .template-row, .run-row, .results-heading { align-items: stretch; flex-direction: column; }
  .file-button { text-align: center; }
  .control-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .run-button { width: 100%; }
  .engine-note { align-items: flex-start; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid article { min-height: 100px; }
  .download-actions { width: 100%; }
  .download-actions button { flex: 1 1 calc(50% - 7px); }
  footer { flex-direction: column; }
  footer p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Primary metric (pool-relative P(top 1%) ± SE) vs. secondary synthetic-field diagnostics. */
th.secondary, td.secondary { color: #7e8884; }
th.secondary { font-weight: 600; }
td:nth-child(6) { color: var(--green); font-weight: 700; }
.control .static-value { height: 44px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #0d1113; color: var(--muted); }
