:root {
  color-scheme: dark;
  --bg: #10121a;
  --bg-soft: #171a25;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.095);
  --text: #f5f3ea;
  --muted: #b8b4a7;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #ffcc66;
  --accent-2: #92e6d3;
  --danger: #ff8c8c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 204, 102, 0.18), transparent 30rem),
    radial-gradient(circle at 80% 10%, rgba(146, 230, 211, 0.16), transparent 26rem),
    linear-gradient(135deg, #0c0e14 0%, var(--bg) 58%, #15111c 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button { cursor: pointer; }

.shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 46px;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.72rem;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 5.8rem);
  letter-spacing: -0.08em;
}

h2 {
  font-size: 1.25rem;
}

.hero-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

.status-card {
  min-width: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  align-content: center;
}

.status-card small {
  color: var(--muted);
}

.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 24px var(--accent-2);
}

.notice {
  border: 1px solid rgba(255, 204, 102, 0.35);
  background: rgba(255, 204, 102, 0.09);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: #fff5d8;
  margin-bottom: 20px;
}

.guide-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.guide-strip article,
.lab-grid article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  padding: 15px;
}

.guide-strip span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(146, 230, 211, 0.16);
  color: var(--accent-2);
  font-weight: 900;
  margin-bottom: 10px;
}

.guide-strip strong,
.lab-grid strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.guide-strip p,
.lab-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
}

.grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.05fr) minmax(360px, 0.94fr);
  gap: 18px;
  align-items: start;
}

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

.panel-subtitle {
  margin: 8px 0 0;
  color: rgba(245, 243, 234, 0.62);
  font-size: 0.88rem;
  line-height: 1.45;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row.three {
  grid-template-columns: 0.8fr 1fr 1fr;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

label small {
  color: rgba(245, 243, 234, 0.56);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea { resize: vertical; }

.calculator-preview,
.calculator-lab {
  border: 1px dashed rgba(146, 230, 211, 0.36);
  border-radius: 18px;
  margin: 4px 0 18px;
  padding: 14px;
  background: rgba(146, 230, 211, 0.045);
}

.calculator-preview legend,
.calculator-lab legend {
  padding: 0 8px;
  color: var(--accent-2);
  font-weight: 850;
}

.calculator-preview[disabled] {
  opacity: 0.72;
}

.calculator-preview small,
.calculator-lab small {
  color: rgba(245, 243, 234, 0.62);
  line-height: 1.45;
}

.calculator-lab .lab-note {
  color: rgba(245, 243, 234, 0.72);
  margin: 0 0 12px;
  line-height: 1.45;
}

.calculator-output {
  min-height: 170px;
  max-height: 360px;
  overflow: auto;
  margin: 12px 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.28);
  color: rgba(245, 243, 234, 0.84);
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.45;
}

.lab-actions {
  margin-top: 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(146, 230, 211, 0.7);
  box-shadow: 0 0 0 3px rgba(146, 230, 211, 0.12);
}

.section-title {
  margin: 18px 0 10px;
  color: var(--accent);
  font-weight: 800;
}

.chip-grid,
.channel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.channel-grid {
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 8px 11px;
  user-select: none;
}

.chip input {
  width: auto;
  accent-color: var(--accent);
}

.primary-btn,
.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
}

.primary-btn {
  background: linear-gradient(135deg, rgba(255, 204, 102, 0.9), rgba(146, 230, 211, 0.86));
  color: #141414;
  font-weight: 850;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.preset-actions {
  align-items: center;
}

.preset-select {
  min-width: 240px;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
}

.bodygraph {
  min-height: 650px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    radial-gradient(circle at 50% 20%, rgba(146, 230, 211, 0.08), transparent 22rem);
  overflow: hidden;
}

.bodygraph svg {
  width: 100%;
  height: auto;
  display: block;
}

.center-shape {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(245, 243, 234, 0.36);
  stroke-width: 2;
  transition: 0.2s ease;
}

.center-shape.defined {
  fill: rgba(255, 204, 102, 0.72);
  stroke: rgba(255, 244, 206, 0.96);
}

.channel-line {
  stroke: rgba(245, 243, 234, 0.18);
  stroke-width: 11;
  stroke-linecap: round;
}

.channel-line.active {
  stroke: rgba(146, 230, 211, 0.82);
  filter: drop-shadow(0 0 8px rgba(146, 230, 211, 0.35));
}

.channel-label,
.center-label,
.gate-label {
  fill: var(--text);
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(16, 18, 26, 0.75);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.channel-label {
  font-size: 12px;
  fill: rgba(245, 243, 234, 0.72);
}

.center-label { font-size: 13px; }

.gate-label {
  font-size: 11px;
  fill: var(--accent-2);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  margin-top: 14px;
  font-size: 0.9rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-box {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(245, 243, 234, 0.48);
  background: rgba(255, 255, 255, 0.1);
}

.legend-box.defined { background: var(--accent); }

.legend-line {
  width: 28px;
  height: 4px;
  border-radius: 99px;
  background: rgba(245, 243, 234, 0.28);
}

.legend-line.active { background: var(--accent-2); }

.report-output {
  display: grid;
  gap: 13px;
}

.report-block {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 18px;
  padding: 14px;
}

.report-block h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--accent);
}

.report-block p,
.report-block li {
  color: var(--muted);
  line-height: 1.58;
}

.report-block p + p {
  margin-top: 9px;
}

.report-meta {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 10px;
  padding: 5px 9px;
  border: 1px solid rgba(146, 230, 211, 0.26);
  border-radius: 999px;
  color: var(--accent-2) !important;
  background: rgba(146, 230, 211, 0.06);
  font-size: 0.78rem;
  font-weight: 800;
}

.report-block p { margin: 0; }

.report-block ul {
  margin: 0;
  padding-left: 19px;
}

.muted { color: var(--muted); }

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(146, 230, 211, 0.34);
  border-radius: 999px;
  background: rgba(146, 230, 211, 0.08);
  color: var(--accent-2);
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 800;
}

.lab-panel {
  margin-top: 18px;
}

.lab-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.import-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}


.validation-console {
  border: 1px solid rgba(255, 204, 102, 0.28);
  border-radius: 18px;
  margin: 14px 0;
  padding: 14px;
  background: rgba(255, 204, 102, 0.045);
}

.validation-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
}

.validation-head strong {
  color: var(--accent);
}

.validation-head p {
  margin: 4px 0 0;
  color: rgba(245, 243, 234, 0.68);
  line-height: 1.45;
}

.validation-output {
  min-height: 150px;
  max-height: 360px;
  overflow: auto;
  margin: 12px 0 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.32);
  color: rgba(245, 243, 234, 0.84);
  white-space: pre-wrap;
  font-size: 0.86rem;
}

@media (max-width: 1180px) {
  .guide-strip,
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .bodygraph {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .hero,
  .panel-head,
  .field-row,
  .field-row.three {
    grid-template-columns: 1fr;
    display: grid;
  }

  h1 { font-size: 3rem; }

  .shell {
    width: min(100vw - 20px, 1500px);
    padding-top: 16px;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  .hero,
  .notice,
  .form-panel,
  .guide-strip,
  .lab-panel,
  .button-row,
  .import-box,
  .primary-btn,
  .ghost-btn {
    display: none !important;
  }

  .shell,
  .grid {
    width: auto;
    display: block;
    padding: 0;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 18px;
    break-inside: avoid;
  }
}

.beta-summary {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  border: 1px solid rgba(146, 230, 211, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(146, 230, 211, 0.08), rgba(255, 204, 102, 0.06)),
    rgba(255, 255, 255, 0.045);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.beta-summary h2 {
  margin-bottom: 8px;
}

.beta-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.beta-metrics {
  min-width: 320px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.beta-metrics span {
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  color: var(--muted);
  text-align: center;
}

.beta-metrics strong {
  color: var(--accent-2);
  font-size: 1.55rem;
}

@media (max-width: 900px) {
  .beta-summary {
    display: grid;
  }

  .beta-metrics {
    min-width: 0;
    grid-template-columns: 1fr;
  }
}

.custom-location-wrap {
  margin-top: 12px;
}

#calcBirthDate::placeholder {
  letter-spacing: .02em;
}

.lab-access-box {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 22px;
  padding: 18px;
  margin: 18px 0;
  background: rgba(255,255,255,0.045);
}

.lab-access-box legend {
  padding: 0 8px;
  color: var(--gold);
  font-weight: 800;
}

.lab-login-actions {
  align-self: end;
}

.lab-status-pill {
  align-self: end;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 12px 14px;
  min-height: 44px;
  color: var(--muted);
  background: rgba(0,0,0,0.18);
  font-size: 13px;
}

.lab-status-pill.unlocked {
  color: #cfffdf;
  border-color: rgba(116, 255, 169, 0.35);
}

.lab-status-pill.locked {
  color: #ffd2d2;
  border-color: rgba(255, 116, 116, 0.35);
}

/* v0.3.4 public polish / owner cockpit visibility */
.admin-only,
.admin-gate {
  display: none !important;
}

body.private-route.admin-authenticated .admin-only {
  display: block !important;
}

body.private-route.admin-authenticated button.admin-only,
body.private-route.admin-authenticated .ghost-btn.admin-only,
body.private-route.admin-authenticated .primary-btn.admin-only {
  display: inline-flex !important;
}

body.private-route.admin-authenticated .button-row.admin-only,
body.private-route.admin-authenticated .preset-actions.admin-only {
  display: flex !important;
}

body.private-route .admin-gate {
  display: block !important;
}

body:not(.private-route) .preset-actions,
body:not(.private-route) #runComparePresetBtn,
body:not(.private-route) .validation-console,
body:not(.admin-authenticated) .preset-actions,
body:not(.admin-authenticated) #runComparePresetBtn,
body:not(.admin-authenticated) .validation-console {
  display: none !important;
}

.public-summary {
  border-color: rgba(146, 230, 211, 0.28);
}

.admin-gate {
  border-style: dashed;
  background: rgba(255, 204, 102, 0.055);
}

body.private-route .admin-gate:not(.admin-authenticated) {
  animation: privateGateGlow 1.8s ease-out 1;
}

@keyframes privateGateGlow {
  0% { box-shadow: 0 0 0 rgba(255, 204, 102, 0); }
  45% { box-shadow: 0 0 32px rgba(255, 204, 102, 0.18); }
  100% { box-shadow: 0 0 0 rgba(255, 204, 102, 0); }
}


/* v0.3.5 public/admin cleanup */
.admin-login-panel {
  margin-top: 18px;
}

.admin-login-row {
  align-items: end;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px 4px 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-entry-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.24);
}

.admin-entry-link:hover {
  color: var(--text);
  border-bottom-color: rgba(255, 255, 255, 0.55);
}

body:not(.private-route):not(.admin-authenticated) .admin-login-panel {
  display: none !important;
}

body:not(.admin-authenticated) .public-info-panel.admin-only {
  display: none !important;
}

@media (max-width: 720px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* v0.3.6 private-route cockpit guard
   Admin tools stay off the public homepage even if the owner is already logged in.
   Open /admin, /private, #admin or #private to see the cockpit. */
body:not(.private-route) .admin-only,
body:not(.private-route) .validation-console,
body:not(.private-route) .preset-actions,
body:not(.private-route) #runComparePresetBtn,
body:not(.private-route) #referencePresetSelect,
body:not(.private-route) #loadExampleBtn {
  display: none !important;
}

body:not(.private-route) .admin-gate {
  display: none !important;
}


/* v0.3.7 private entry gate
   /private is the only private entry route. Before authentication it behaves like a door,
   not like the public table with a password box attached. */
body.private-route:not(.admin-authenticated) .hero,
body.private-route:not(.admin-authenticated) .notice,
body.private-route:not(.admin-authenticated) .public-summary,
body.private-route:not(.admin-authenticated) .guide-strip,
body.private-route:not(.admin-authenticated) main.grid,
body.private-route:not(.admin-authenticated) .public-info-panel,
body.private-route:not(.admin-authenticated) .site-footer {
  display: none !important;
}

body.private-route:not(.admin-authenticated) .shell {
  max-width: 760px;
}

body.private-route:not(.admin-authenticated) .admin-login-panel {
  margin-top: clamp(36px, 10vh, 96px);
}
