:root {
  --bg: #081523;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --panel-border: rgba(12, 40, 68, 0.12);
  --ink: #11314b;
  --ink-strong: #0a2033;
  --muted: #567089;
  --teal: #0e7490;
  --cyan: #0ea5e9;
  --foam: #d9f4fb;
  --sand: #d89d5b;
  --red: #ef4444;
  --green: #0f766e;
  --shadow: 0 22px 56px rgba(7, 21, 35, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: 1460px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(14, 165, 233, 0.22), transparent 30%),
    radial-gradient(circle at 82% 14%, rgba(216, 157, 91, 0.14), transparent 32%),
    linear-gradient(160deg, #081523 0%, #0d2439 36%, #12324d 100%);
}

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

button {
  cursor: pointer;
}

.site-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--container));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(209, 239, 252, 0.82);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
  padding: 34px;
  border-radius: 32px;
  background:
    linear-gradient(150deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%),
    linear-gradient(120deg, rgba(12,40,68,0.84) 0%, rgba(10,72,93,0.84) 100%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 28px 64px rgba(6, 18, 29, 0.28);
  backdrop-filter: blur(16px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.hero-copy h1 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.4rem, 3vw, 4.1rem);
  line-height: 0.98;
  color: #f6fbff;
}

.hero-copy p {
  margin: 0;
  max-width: 60ch;
  font-size: 1.14rem;
  line-height: 1.65;
  color: rgba(235, 248, 255, 0.8);
}

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

.hero-highlights span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ecfbff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.hero-stage {
  position: relative;
  min-height: 360px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.hero-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-metric-panel {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.hero-metric-panel article {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 12px 28px rgba(7, 21, 35, 0.14);
}

.hero-metric-panel strong {
  display: block;
  margin-top: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  color: var(--ink-strong);
}

.hero-metric-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.metric-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.workflow-panel,
.analysis-panel,
.knowledge-card,
.panel-card,
.plot-card {
  background: var(--panel);
  border-radius: var(--radius-xl);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.workflow-panel {
  position: sticky;
  top: 22px;
  padding: 24px;
}

.analysis-panel {
  padding: 24px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h2,
.module-header h2,
.section-header h3,
.knowledge-card h3 {
  margin: 4px 0 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink-strong);
}

.panel-header h2 {
  font-size: 1.55rem;
}

.workflow-list {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 22px 0;
  padding: 0;
}

.workflow-list li {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(14, 116, 144, 0.06);
  border: 1px solid rgba(14, 116, 144, 0.08);
}

.workflow-list strong {
  font-size: 0.93rem;
  color: var(--teal);
}

.workflow-list span,
.panel-block p,
.panel-card p,
.knowledge-card p,
.module-card span:last-child {
  color: var(--muted);
  line-height: 1.55;
}

.panel-block + .panel-block {
  margin-top: 18px;
}

.mini-note {
  padding: 16px;
  border-radius: 16px;
  background: rgba(216, 157, 91, 0.12);
  border: 1px solid rgba(216, 157, 91, 0.22);
}

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

.module-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  text-align: left;
  border-radius: 20px;
  border: 1px solid rgba(12, 40, 68, 0.1);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86) 0%, rgba(246, 251, 255, 0.98) 100%);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.module-card:hover,
.module-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.34);
  box-shadow: 0 16px 30px rgba(14, 116, 144, 0.12);
}

.module-card strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.08rem;
  color: var(--ink-strong);
}

.module-short {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
}

.status-banner {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid transparent;
}

.status-banner strong {
  font-size: 1rem;
}

.status-info {
  background: rgba(14, 116, 144, 0.08);
  border-color: rgba(14, 116, 144, 0.16);
}

.status-success {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.16);
}

.status-warning {
  background: rgba(216, 157, 91, 0.13);
  border-color: rgba(216, 157, 91, 0.24);
}

.status-error {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.18);
}

.module-shell {
  display: grid;
  gap: 22px;
}

.module-header {
  padding: 2px 4px 0;
}

.module-header p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 74ch;
  line-height: 1.6;
}

.module-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel-card {
  padding: 22px;
}

.section-header {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.section-header p {
  margin: 0;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(12, 40, 68, 0.12);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink-strong);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(14, 116, 144, 0.45);
  box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.12);
  transform: translateY(-1px);
}

textarea {
  min-height: 192px;
  resize: vertical;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.93rem;
  line-height: 1.62;
}

.button-row,
.action-stack,
.plot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row {
  margin-top: 8px;
}

.primary-button,
.ghost-button {
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #0e7490 0%, #0ea5e9 100%);
  box-shadow: 0 12px 24px rgba(14, 116, 144, 0.2);
}

.ghost-button {
  color: var(--ink-strong);
  background: rgba(12, 40, 68, 0.05);
  border-color: rgba(12, 40, 68, 0.08);
}

.primary-button:hover,
.ghost-button:hover,
.module-card:hover {
  transform: translateY(-1px);
}

.small-button {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.feedback-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(14, 116, 144, 0.06);
  border: 1px solid rgba(14, 116, 144, 0.12);
}

.feedback-panel strong {
  display: block;
  margin-bottom: 6px;
}

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

.metric-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(242, 248, 252, 0.96) 100%);
  border: 1px solid rgba(12, 40, 68, 0.08);
}

.metric-card span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--teal);
}

.metric-card strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  color: var(--ink-strong);
}

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

.equation-card .math-block,
.substitution-block,
.report-method {
  padding: 16px;
  border-radius: 18px;
  background: rgba(12, 40, 68, 0.04);
  border: 1px solid rgba(12, 40, 68, 0.08);
}

.math-block {
  margin-bottom: 14px;
}

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

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

.plot-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.plot-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.plot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.plot-card-header .section-header {
  margin-bottom: 0;
}

.plot-card-header .section-header p {
  max-width: 44ch;
}

.plot-actions {
  justify-content: flex-end;
  align-items: flex-start;
  flex-shrink: 0;
  min-width: fit-content;
}

.plot-surface {
  min-height: 380px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(12, 40, 68, 0.08);
  background:
    linear-gradient(180deg, rgba(250,252,254,1) 0%, rgba(244,248,251,1) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.plot-surface .js-plotly-plot,
.plot-surface .plot-container,
.plot-surface .svg-container {
  width: 100% !important;
  height: 100% !important;
}

.placeholder-card {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.file-drop {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(12, 40, 68, 0.18);
  background: rgba(255,255,255,0.62);
}

.file-drop input {
  padding: 12px;
  background: rgba(255,255,255,0.8);
}

.table-scroll {
  overflow-x: auto;
}

.table-scroll.is-bounded {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(12, 40, 68, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.table-summary {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--muted);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.96rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(12, 40, 68, 0.08);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--ink-strong);
  font-weight: 700;
  background: rgba(12, 40, 68, 0.04);
}

.table-scroll.has-sticky-header .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(240, 246, 250, 0.98);
  backdrop-filter: blur(8px);
}

.report-slot {
  margin-top: 16px;
}

.report-sheet {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 22px;
  background: var(--panel-strong);
  border: 1px solid rgba(12, 40, 68, 0.1);
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.report-header h3 {
  margin: 6px 0 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.7rem;
  color: var(--ink-strong);
}

.report-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.report-meta {
  min-width: 180px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(12, 40, 68, 0.04);
  border: 1px solid rgba(12, 40, 68, 0.08);
}

.report-meta span {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
}

.report-section {
  display: grid;
  gap: 12px;
}

.report-section h4 {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink-strong);
}

.report-figures {
  display: grid;
  gap: 16px;
}

.report-figure {
  margin: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(12, 40, 68, 0.04);
  border: 1px solid rgba(12, 40, 68, 0.08);
}

.report-figure img {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(12, 40, 68, 0.08);
}

.report-figure figcaption {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.report-note {
  margin: 0;
  color: var(--muted);
}

.knowledge-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.knowledge-card {
  padding: 22px;
}

.knowledge-card .reference-list {
  margin-top: 8px;
}

.site-footer {
  margin-top: 26px;
  padding: 22px 26px;
  text-align: center;
  color: rgba(235, 248, 255, 0.78);
}

.site-footer p {
  margin: 0;
}

.math-inline {
  font-weight: 700;
  color: var(--ink-strong);
}

@media (max-width: 1200px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .workflow-panel {
    position: static;
  }

  .module-grid,
  .metric-grid,
  .knowledge-strip,
  .plot-grid.three-up {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(calc(100% - 20px), var(--container));
    padding-top: 12px;
  }

  .hero,
  .module-grid-two,
  .plot-grid,
  .knowledge-strip,
  .module-grid,
  .field-grid,
  .metric-grid,
  .hero-metric-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .hero-stage {
    min-height: 320px;
  }

  .analysis-panel,
  .workflow-panel,
  .panel-card,
  .knowledge-card {
    padding: 18px;
  }

  .plot-card-header {
    flex-direction: column;
  }

  .plot-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .report-header {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .button-row,
  .action-stack,
  .plot-actions {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .hero-copy p {
    font-size: 1rem;
  }
}

body.print-report-mode * {
  visibility: hidden !important;
}

body.print-report-mode .report-sheet,
body.print-report-mode .report-sheet * {
  visibility: visible !important;
}

body.print-report-mode .report-sheet {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  max-width: none;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
}

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

  .report-sheet {
    border: none;
    box-shadow: none;
  }
}
