:root {
  --bg: #011a02;
  --panel: rgba(6, 31, 7, 0.9);
  --panel-border: rgba(183, 238, 74, 0.16);
  --ink: #e0feca;
  --muted: #c1ff72;
  --accent: #b7ee4a;
  --accent-strong: #e5ff9b;
  --accent-soft: rgba(46, 82, 0, 0.85);
  --sun: #ff9b21;
  --danger: #ff5757;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  --structure-domain-one: #7ab000;
  --structure-domain-two: #b8c8ff;
  --structure-fad: #ff8a1e;
  --structure-anchor: #ff5757;
  --structure-sbr: #f0d84f;
  --structure-asa: #d22dff;
  --structure-support: #2e96ff;
  --structure-mutations: #57d9ff;
  --shell-gutter: 32px;
  --page-padding-top: 40px;
  --page-padding-bottom: 56px;
  --panel-radius-size: 28px;
  --panel-padding-size: 24px;
  --hero-gap-size: 24px;
  --hero-margin-bottom-size: 28px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(183, 238, 74, 0.14), transparent 24%),
    radial-gradient(circle at bottom right, rgba(255, 87, 87, 0.12), transparent 22%),
    linear-gradient(180deg, #001101 0%, #011a02 100%);
}

.page-shell {
  width: min(1180px, calc(100% - var(--shell-gutter)));
  margin: 0 auto;
  padding: var(--page-padding-top) 0 var(--page-padding-bottom);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--hero-gap-size);
  align-items: start;
  justify-items: stretch;
  margin-bottom: var(--hero-margin-bottom-size);
}

.hero-copy {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 18px;
}

.hero-copy.panel,
.hero-card.panel {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  justify-self: stretch;
}

.eyebrow,
.kicker,
.hero-card-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero-text {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  text-align: justify;
  white-space: normal;
  overflow-wrap: anywhere;
}

.hero-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  align-items: flex-start;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(46, 82, 0, 0.78);
  border: 1px solid rgba(183, 238, 74, 0.16);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.hero-card,
.panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius-size);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  display: grid;
  gap: 12px;
  align-self: stretch;
  align-content: start;
  background:
    linear-gradient(135deg, rgba(7, 37, 8, 0.98), rgba(20, 54, 11, 0.88)),
    var(--panel);
}

.hero .panel-heading {
  margin-bottom: 0;
}

.hero .panel-heading h1,
.hero-card .panel-heading strong {
  margin: 0;
}

.hero-card .panel-heading strong {
  display: block;
}

.hero .panel-heading .eyebrow,
.hero-card-label {
  display: inline-block;
  margin-bottom: 10px;
}

.hero-card strong {
  font-size: 1.35rem;
  line-height: 1.2;
  text-wrap: balance;
}

.hero-card-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
  text-align: justify;
}

.hero-card-image {
  width: min(100%, 280px);
  max-height: 280px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 20px;
  border: 1px solid rgba(183, 238, 74, 0.22);
  background: rgba(1, 24, 0, 0.78);
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.1fr);
  gap: 22px;
}

.summary-panel {
  grid-column: 1 / -1;
}

.preview-panel {
  grid-column: 1 / -1;
}

.annotations-panel {
  grid-column: 1 / -1;
}

.data-panel {
  grid-column: 1 / -1;
}

.strategy-panel {
  grid-column: 1 / -1;
}

.panel {
  padding: var(--panel-padding-size);
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.4rem;
  text-wrap: pretty;
}

.panel-intro {
  margin: -6px 0 20px;
  color: var(--muted);
  line-height: 1.65;
}

.hero .panel-intro.hero-text,
.hero-card-text {
  margin: 0;
  text-align: justify;
  hyphens: auto;
}

.field,
.toggle {
  display: grid;
  gap: 10px;
}

.field span,
.toggle span {
  font-size: 0.96rem;
  font-weight: 500;
}

.field input[type="text"] {
  width: 100%;
  border: 1px solid rgba(183, 238, 74, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(7, 35, 8, 0.9);
}

.field select {
  width: 100%;
  border: 1px solid rgba(183, 238, 74, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: rgba(7, 35, 8, 0.9);
}

.field input[type="file"] {
  width: 100%;
  border: 1px dashed rgba(183, 238, 74, 0.28);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--muted);
  background: rgba(7, 35, 8, 0.78);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.color-field input {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
}

.toggle-row {
  display: grid;
  gap: 12px;
  margin: 10px 0 24px;
}

.toggle {
  grid-template-columns: 20px 1fr;
  align-items: center;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(46, 82, 0, 0.44);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.source-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(4, 25, 5, 0.78);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.source-toggle {
  background: rgba(46, 82, 0, 0.34);
}

.upload-field {
  margin-top: 4px;
}

.upload-group.is-hidden {
  display: none;
}

.status-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
}

.results-list {
  display: grid;
  gap: 10px;
}

.empty-block {
  padding: 18px;
  border-radius: 18px;
  background: rgba(46, 82, 0, 0.3);
  color: var(--muted);
  line-height: 1.6;
}

.result-card {
  display: grid;
  gap: 6px;
  text-align: left;
  border-radius: 18px;
  padding: 16px;
  background: rgba(7, 35, 8, 0.86);
  color: var(--ink);
  box-shadow: none;
}

.result-card span {
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  color: #011a02;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 26px rgba(183, 238, 74, 0.16);
}

.secondary {
  color: var(--ink);
  background: rgba(255, 87, 87, 0.16);
  border: 1px solid rgba(255, 87, 87, 0.18);
}

.viewer-canvas {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(183, 238, 74, 0.14), transparent 32%),
    linear-gradient(180deg, #011101 0%, #021b03 100%);
  border: 1px solid rgba(183, 238, 74, 0.14);
}

.viewer-status-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.viewer-mode-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(46, 82, 0, 0.82);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.viewer-canvas-element {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.viewer-canvas-element:active {
  cursor: grabbing;
}

.viewer-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: rgba(247, 246, 240, 0.82);
  line-height: 1.6;
}

.viewer-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.viewer-diagnostics {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(6, 31, 7, 0.84);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.viewer-diagnostics-heading {
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

.viewer-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.viewer-diagnostic-item {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(46, 82, 0, 0.38);
}

.viewer-diagnostic-item span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.viewer-diagnostic-item strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.35;
}

.script-preview {
  margin: 0;
  min-height: 520px;
  overflow: auto;
  border-radius: 22px;
  padding: 18px;
  background: #011101;
  color: #e0feca;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.6;
}

.story-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.story-card,
.application-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(7, 35, 8, 0.84);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.story-card {
  background:
    linear-gradient(180deg, rgba(46, 82, 0, 0.72), rgba(7, 35, 8, 0.9));
}

.story-card-kicker {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.story-card strong,
.application-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1rem;
  line-height: 1.4;
}

.story-card p,
.application-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  text-align: justify;
}

.inline-card strong {
  display: inline;
  margin-bottom: 0;
  margin-right: 8px;
}

.inline-card p {
  text-align: justify;
}

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

.summary-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric {
  padding: 18px;
  border-radius: 20px;
  background: rgba(7, 35, 8, 0.86);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.empty-metric {
  background: rgba(46, 82, 0, 0.3);
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  font-size: 1.35rem;
}

.report-block {
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(46, 82, 0, 0.78), rgba(7, 35, 8, 0.92));
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.report-block h3 {
  margin: 0 0 10px;
}

.report-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.annotation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.annotation-item {
  position: relative;
  padding: 18px;
  border-radius: 20px;
  background: rgba(7, 35, 8, 0.84);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.annotation-item-wide {
  grid-column: span 2;
}

.annotation-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

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

.annotation-item-muted {
  background: rgba(46, 37, 0, 0.4);
}

.annotation-swatch {
  display: inline-flex;
  width: 12px;
  height: 12px;
  margin-bottom: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(6, 31, 7, 0.84);
}

.annotation-swatch-domain-one {
  background: var(--structure-domain-one);
}

.annotation-swatch-domain-two {
  background: var(--structure-domain-two);
}

.annotation-swatch-fad {
  background: var(--structure-fad);
}

.annotation-swatch-anchor {
  background: var(--structure-anchor);
}

.annotation-swatch-sbr {
  background: var(--structure-sbr);
}

.annotation-swatch-asa {
  background: var(--structure-asa);
}

.annotation-swatch-support {
  background: var(--structure-support);
}

.annotation-swatch-mutations {
  background: var(--structure-mutations);
}

.data-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  margin-bottom: 18px;
}

.dataset-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dataset-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(7, 35, 8, 0.86);
  border: 1px solid rgba(183, 238, 74, 0.08);
}

.dataset-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.dataset-tag,
.dataset-source {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.dataset-tag {
  background: rgba(46, 82, 0, 0.78);
}

.dataset-source {
  background: rgba(255, 87, 87, 0.18);
}

.dataset-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.dataset-card p {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.55;
}

.dataset-card p:last-child {
  margin-bottom: 0;
}

.dataset-insight {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(183, 238, 74, 0.08);
}

.report-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.report-list li + li {
  margin-top: 8px;
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(46, 82, 0, 0.78);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: stretch;
  }

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

  .hero-copy,
  .hero-card {
    width: 100%;
  }

  .hero-card {
    justify-self: stretch;
  }

  .hero-text {
    max-width: none;
  }

  .hero h1 {
    max-width: 12ch;
  }

  .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .story-grid,
  .annotation-grid {
    grid-template-columns: 1fr;
  }

  .application-grid,
  .data-toolbar,
  .dataset-results,
  .viewer-diagnostics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .hero-copy.panel,
  .hero-card.panel {
    width: 100%;
    max-width: 42rem;
    margin-inline: auto;
  }
}

@media (max-width: 640px) {
  :root {
    --shell-gutter: 16px;
    --page-padding-top: max(12px, env(safe-area-inset-top, 0px));
    --page-padding-bottom: 32px;
    --panel-radius-size: 22px;
    --panel-padding-size: 20px;
    --hero-gap-size: 12px;
    --hero-margin-bottom-size: 16px;
  }

  .page-shell {
    width: min(1180px, calc(100% - var(--shell-gutter)));
  }

  .hero-copy.panel,
  .hero-card.panel {
    border: 1px solid var(--panel-border);
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .hero .panel-heading,
  .hero-pill-row {
    width: 100%;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(2.45rem, 12vw, 3.35rem);
    line-height: 1;
  }

  .hero-text,
  .hero-card-text {
    font-size: 0.94rem;
    line-height: 1.72;
  }

  .hero .panel-intro.hero-text,
  .hero-card-text {
    max-width: none;
    text-align: justify;
    text-align-last: justify;
    text-justify: inter-word;
  }

  .hero .panel-heading .eyebrow,
  .kicker,
  .hero-card-label {
    margin-bottom: 8px;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
  }

  .hero-pill-row {
    gap: 8px;
  }

  .hero-pill {
    max-width: 100%;
    justify-content: flex-start;
    padding: 7px 11px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .hero-card {
    width: 100%;
    gap: 10px;
  }

  .hero-card strong {
    font-size: 1.1rem;
    line-height: 1.28;
  }

  .hero-card-image {
    width: min(100%, 220px);
    max-height: 220px;
  }

  .hero-card-text {
    max-width: none;
  }

  .hero .panel-heading {
    display: grid;
    gap: 0;
  }

  .panel-heading {
    margin-bottom: 16px;
  }

  .panel-heading h2 {
    font-size: 1.22rem;
    line-height: 1.22;
  }

  .panel-intro {
    margin-bottom: 16px;
    font-size: 0.95rem;
    line-height: 1.68;
  }

  .field-grid,
  .summary-cards,
  .story-grid,
  .application-grid,
  .annotation-grid {
    grid-template-columns: 1fr;
  }

  .annotation-item-wide {
    grid-column: span 1;
  }

  .script-preview {
    min-height: 420px;
    font-size: 0.84rem;
  }

  .viewer-canvas {
    min-height: 400px;
  }
}

@media (max-width: 480px) {
  .hero-pill-row {
    display: flex;
    flex-wrap: wrap;
  }

  .hero-pill {
    width: auto;
  }
}

@media (max-width: 420px) {
  :root {
    --shell-gutter: 12px;
    --page-padding-top: max(8px, env(safe-area-inset-top, 0px));
    --page-padding-bottom: 24px;
    --panel-radius-size: 20px;
    --panel-padding-size: 18px;
    --hero-gap-size: 10px;
    --hero-margin-bottom-size: 12px;
  }

  .page-shell {
    width: min(1180px, calc(100% - var(--shell-gutter)));
  }

  .hero h1 {
    max-width: 7.4ch;
    font-size: clamp(2.15rem, 11.2vw, 2.85rem);
    line-height: 0.97;
  }

  .hero-text {
    margin-top: 8px;
    max-width: 33ch;
    font-size: 0.91rem;
    line-height: 1.68;
  }

  .hero-card-text {
    max-width: 33ch;
  }

  .hero-pill-row {
    gap: 7px;
    margin-top: 2px;
  }

  .hero-pill {
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: normal;
    text-wrap: balance;
  }

  .hero-card-label {
    font-size: 0.66rem;
  }

  .hero-card strong {
    max-width: 12ch;
    font-size: 1.02rem;
  }

  .hero-card-image {
    width: min(100%, 196px);
    max-height: 196px;
    border-radius: 18px;
  }

  .hero-card-text {
    font-size: 0.9rem;
    line-height: 1.66;
  }
}

@media (max-width: 360px) {
  :root {
    --shell-gutter: 10px;
    --panel-padding-size: 16px;
  }

  .page-shell {
    width: min(1180px, calc(100% - var(--shell-gutter)));
  }

  .hero h1 {
    font-size: clamp(2rem, 10.6vw, 2.45rem);
  }

  .hero-text,
  .hero-card-text {
    font-size: 0.88rem;
  }

  .hero-pill {
    font-size: 0.74rem;
  }
}
