@font-face {
  font-family: "Bricolage Grotesque";
  src: url("./assets/fonts/BricolageGrotesque-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("./assets/fonts/BricolageGrotesque-Bold.ttf") format("truetype");
  font-weight: 700;
}

@font-face {
  font-family: "Red Hat Mono";
  src: url("./assets/fonts/RedHatMono-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Red Hat Mono";
  src: url("./assets/fonts/RedHatMono-Bold.ttf") format("truetype");
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --ink: #061826;
  --ink-2: #092b38;
  --blue: #0b5a7a;
  --teal: #0aa6a6;
  --cyan: #4bdcff;
  --green: #37df8d;
  --amber: #f5ab40;
  --red: #ff7468;
  --paper: #f2fbf8;
  --mist: #cfe5e5;
  --steel: #86aeb8;
  --line: rgba(155, 230, 236, 0.2);
  --panel: rgba(8, 32, 46, 0.86);
  --panel-soft: rgba(241, 250, 238, 0.94);
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(158deg, rgba(10, 166, 166, 0.18) 0%, rgba(10, 166, 166, 0) 34%),
    linear-gradient(155deg, #061826 0%, #082b39 42%, #f2fbf8 42.1%, #e8f4ee 100%);
  background-size: auto;
  color: var(--paper);
  font-family: "Bricolage Grotesque", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

a {
  color: inherit;
}

::selection {
  background: var(--green);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.site-shell {
  min-height: 100vh;
}

.site-top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(75, 220, 255, 0.18);
  background: rgba(6, 24, 38, 0.88);
  backdrop-filter: blur(18px);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(75, 220, 255, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(55, 223, 141, 0.9), rgba(75, 220, 255, 0.72)),
    linear-gradient(90deg, var(--ink), var(--blue));
  box-shadow: 0 14px 38px rgba(34, 223, 141, 0.2);
  color: var(--ink);
  font-family: "Red Hat Mono", monospace;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand small {
  color: var(--steel);
  font-family: "Red Hat Mono", monospace;
  font-size: 0.72rem;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-tab,
.step-button,
.template-button,
.action-button,
.icon-button {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  transform: translateY(0) scale(1);
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.nav-tab::after,
.step-button::after,
.template-button::after,
.action-button::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  opacity: 0;
  transform: translateX(-120%);
  transition: opacity 180ms ease, transform 520ms ease;
}

.nav-tab:hover,
.step-button:hover,
.template-button:hover,
.action-button:hover,
.icon-button:hover {
  transform: translateY(-2px) scale(1.01);
}

.nav-tab:active,
.step-button:active,
.template-button:active,
.action-button:active,
.icon-button:active {
  transform: translateY(0) scale(0.98);
}

.nav-tab:hover::after,
.step-button:hover::after,
.template-button:hover::after,
.action-button:hover::after {
  opacity: 1;
  transform: translateX(120%);
}

.nav-tab {
  flex: 0 0 auto;
  border: 1px solid rgba(75, 220, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--mist);
  padding: 0 13px;
  white-space: nowrap;
}

.nav-tab.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.ui-icon {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.ui-icon::before,
.ui-icon::after {
  position: absolute;
  content: "";
  border-color: currentColor;
}

.ui-icon-calc::before {
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.ui-icon-calc::after {
  left: 5px;
  right: 5px;
  top: 5px;
  bottom: 2px;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.ui-icon-info::before {
  inset: 2px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon-info::after {
  left: 7px;
  top: 6px;
  width: 2px;
  height: 7px;
  background: currentColor;
  box-shadow: 0 -4px 0 currentColor;
}

.ui-icon-database::before {
  left: 2px;
  right: 2px;
  top: 2px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.ui-icon-database::after {
  left: 2px;
  right: 2px;
  top: 5px;
  bottom: 2px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.ui-icon-route::before {
  left: 2px;
  top: 2px;
  width: 4px;
  height: 4px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 9px 9px 0 -1px currentColor;
}

.ui-icon-route::after {
  left: 6px;
  top: 7px;
  width: 7px;
  height: 4px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(18deg);
}

.ui-icon-check::before {
  left: 3px;
  top: 8px;
  width: 5px;
  height: 9px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(40deg);
}

.ui-icon-spark::before {
  left: 7px;
  top: 0;
  width: 2px;
  height: 17px;
  background: currentColor;
}

.ui-icon-spark::after {
  left: 0;
  top: 7px;
  width: 17px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.ui-icon-trash::before {
  left: 4px;
  right: 4px;
  top: 6px;
  bottom: 2px;
  border: 2px solid currentColor;
  border-top: 0;
}

.ui-icon-trash::after {
  left: 3px;
  right: 3px;
  top: 3px;
  border-top: 2px solid currentColor;
  box-shadow: 4px -2px 0 -1px currentColor;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 22px 46px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(420px, 1fr);
  gap: 28px;
  align-items: stretch;
  min-height: 520px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px 0;
}

.hero h1,
.read-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 5.6rem;
  line-height: 0.9;
}

.hero p,
.read-hero p {
  max-width: 720px;
  margin: 28px 0 0;
  color: var(--mist);
  font-size: 1.16rem;
  line-height: 1.65;
}

.hero-actions,
.button-cluster,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 30px;
}

.action-button {
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
}

.action-primary {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: var(--ink);
  box-shadow: 0 18px 40px rgba(55, 223, 141, 0.22);
}

.action-secondary {
  border-color: rgba(75, 220, 255, 0.34);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
}

.action-quiet {
  border-color: rgba(255, 116, 104, 0.3);
  background: rgba(255, 116, 104, 0.08);
  color: #ffd6d2;
}

.canvas-stage {
  position: relative;
  min-height: 460px;
  border: 1px solid rgba(75, 220, 255, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(6, 24, 38, 0.9), rgba(8, 58, 68, 0.88)),
    url("./assets/blue-flame-ledger.png") center / cover;
  box-shadow: var(--shadow);
}

.canvas-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 460px;
}

.canvas-readout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(242, 251, 248, 0.2);
  background: linear-gradient(180deg, rgba(6, 24, 38, 0), rgba(6, 24, 38, 0.74));
  padding-top: 18px;
}

.canvas-readout strong {
  color: var(--green);
  font-family: "Red Hat Mono", monospace;
  font-size: 1.75rem;
}

.canvas-readout span {
  color: var(--mist);
  text-align: right;
}

.workflow-shell {
  margin-top: 28px;
}

.step-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.step-button {
  border: 1px solid rgba(75, 220, 255, 0.2);
  background: rgba(6, 24, 38, 0.78);
  color: var(--mist);
  padding: 12px;
  font-weight: 700;
}

.step-button span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: rgba(75, 220, 255, 0.12);
  color: var(--cyan);
  font-family: "Red Hat Mono", monospace;
}

.step-button.is-active {
  background: var(--paper);
  color: var(--ink);
}

.step-button.is-active span {
  background: var(--ink);
  color: var(--green);
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.workspace-panel,
.result-panel,
.read-hero,
.definition,
.factor-item,
.pathway,
.mrv-group,
.report-pack,
.sources,
.split-section > div,
.gas-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  min-width: 0;
}

.workspace-panel,
.result-panel,
.read-hero,
.sources,
.gas-table-wrap,
.report-pack {
  padding: 22px;
}

.result-panel {
  position: sticky;
  top: 92px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2,
.result-lockup h2,
.read-hero h1,
.pathway h2,
.mrv-group h2,
.sources h2,
.gas-table-wrap h2 {
  margin: 0;
}

.section-heading h2 {
  font-size: 2rem;
}

.section-heading p,
.ledger-note span,
.result-lockup p,
.factor-item p,
.factor-item small,
.pathway p,
.sources small,
.gas-table-wrap p,
.mrv-group li,
.clean-list li,
.process-list li {
  color: var(--mist);
  line-height: 1.6;
}

.template-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.template-button {
  width: 100%;
  border: 1px solid rgba(75, 220, 255, 0.22);
  background: rgba(75, 220, 255, 0.08);
  color: var(--paper);
  padding: 0 14px;
  white-space: nowrap;
}

.form-grid,
.row-controls,
.deduction-grid,
.result-matrix,
.definition-grid,
.factor-controls {
  display: grid;
  gap: 14px;
}

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

.row-controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 16px;
}

.field,
.adjust-field {
  display: grid;
  gap: 7px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span,
.adjust-field span {
  color: var(--steel);
  font-family: "Red Hat Mono", monospace;
  font-size: 0.78rem;
}

.field input,
.field select,
.field textarea,
.adjust-field input {
  width: 100%;
  min-height: 43px;
  border: 1px solid rgba(75, 220, 255, 0.25);
  border-radius: 8px;
  background: rgba(242, 251, 248, 0.92);
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.adjust-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(55, 223, 141, 0.18);
  outline: none;
}

.ledger-note {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  border: 1px solid rgba(55, 223, 141, 0.24);
  border-radius: 8px;
  background: rgba(55, 223, 141, 0.08);
  padding: 15px;
}

.row-list {
  display: grid;
  gap: 12px;
}

.row-editor {
  border: 1px solid rgba(75, 220, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.row-editor.is-focused {
  border-color: rgba(55, 223, 141, 0.44);
  box-shadow: 0 0 0 1px rgba(75, 220, 255, 0.16), 0 16px 34px rgba(55, 223, 141, 0.08);
}

.row-editor summary {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  cursor: pointer;
  padding: 0 16px;
}

.row-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-side {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 10px;
  font-family: "Red Hat Mono", monospace;
  font-size: 0.78rem;
  font-weight: 700;
}

.row-side-baseline,
.bar-amber,
.metric-amber {
  color: var(--amber);
}

.row-side-project,
.bar-cyan,
.metric-cyan {
  color: var(--cyan);
}

.row-side-leakage,
.bar-red,
.metric-red {
  color: var(--red);
}

.row-side-removal,
.bar-green,
.metric-green {
  color: var(--green);
}

.row-side-inventory,
.bar-blue,
.metric-blue {
  color: #a7e6ff;
}

.row-audit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-top: 1px solid rgba(75, 220, 255, 0.14);
  padding: 12px 16px 16px;
}

code,
.mini-ledger dd,
.bar-line strong,
.metric strong {
  font-family: "Red Hat Mono", monospace;
}

code {
  color: #d8f9ff;
  overflow-wrap: anywhere;
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid rgba(255, 116, 104, 0.34);
  background: rgba(255, 116, 104, 0.12);
  color: #ffd6d2;
}

.formula-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.formula-strip span,
.status-chip {
  border-radius: 8px;
  background: rgba(75, 220, 255, 0.12);
  color: var(--cyan);
  font-family: "Red Hat Mono", monospace;
  font-size: 0.78rem;
  padding: 7px 9px;
}

.formula-strip strong {
  margin-left: auto;
  color: var(--green);
}

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

.adjust-field {
  border: 1px solid rgba(75, 220, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
}

.adjust-field strong {
  color: var(--green);
  font-family: "Red Hat Mono", monospace;
}

.deduction-ladder {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.deduction-ladder div,
.mini-ledger div,
.bar-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.deduction-ladder div {
  min-height: 48px;
  border-bottom: 1px solid rgba(75, 220, 255, 0.14);
}

.deduction-ladder span,
.mini-ledger dt,
.bar-line span {
  color: var(--steel);
}

.deduction-ladder strong {
  font-family: "Red Hat Mono", monospace;
}

.ladder-final {
  border: 1px solid rgba(55, 223, 141, 0.34);
  border-radius: 8px;
  background: rgba(55, 223, 141, 0.1);
  padding: 0 14px;
}

.result-matrix {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 102px;
  border: 1px solid rgba(75, 220, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--steel);
  font-size: 0.84rem;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.12rem;
}

.result-lockup h2 {
  margin-top: 16px;
  color: var(--green);
  font-family: "Red Hat Mono", monospace;
  font-size: 2.25rem;
  line-height: 1.05;
}

.bar-stack,
.mini-ledger,
.panel-actions {
  margin-top: 22px;
}

.bar-stack {
  display: grid;
  gap: 13px;
}

.bar-line {
  grid-template-columns: 74px minmax(0, 1fr);
}

.bar-line strong {
  grid-column: 2;
  color: var(--paper);
  font-size: 0.85rem;
}

.bar-line div {
  height: 12px;
  border-radius: 8px;
  background: rgba(242, 251, 248, 0.11);
  overflow: hidden;
}

.bar-line i {
  display: block;
  height: 100%;
  border-radius: 8px;
  background: currentColor;
}

.mini-ledger {
  display: grid;
  gap: 12px;
}

.mini-ledger dd {
  margin: 0;
  color: var(--paper);
}

.panel-actions .action-button {
  flex: 1 1 140px;
}

.audit-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid rgba(75, 220, 255, 0.18);
  border-radius: 8px;
}

.audit-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.audit-table th,
.audit-table td {
  border-bottom: 1px solid rgba(75, 220, 255, 0.13);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  background: rgba(75, 220, 255, 0.08);
  color: var(--cyan);
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 10px;
  border: 1px dashed rgba(75, 220, 255, 0.34);
  border-radius: 8px;
  padding: 26px;
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.reading-page {
  display: grid;
  gap: 20px;
}

.read-hero {
  padding: 46px;
}

.definition-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.definition,
.factor-item,
.pathway,
.mrv-group,
.split-section > div {
  padding: 20px;
}

.definition h2,
.factor-item h2 {
  margin: 0;
  color: var(--paper);
  font-size: 1.28rem;
}

.definition p {
  color: var(--mist);
  line-height: 1.65;
}

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

.clean-list,
.process-list,
.mrv-group ul,
.pathway ol {
  margin: 18px 0 0;
  padding-left: 1.15rem;
}

.clean-list li,
.process-list li,
.mrv-group li,
.pathway li {
  margin-top: 10px;
}

.sources h2,
.gas-table-wrap h2 {
  font-size: 1.7rem;
}

.source-list,
.factor-grid,
.pathway-grid,
.mrv-grid,
.gas-grid {
  display: grid;
  gap: 14px;
}

.source-list {
  margin-top: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-list a {
  display: grid;
  gap: 8px;
  min-height: 110px;
  border: 1px solid rgba(75, 220, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.source-list a:hover {
  border-color: rgba(55, 223, 141, 0.5);
  background: rgba(55, 223, 141, 0.08);
  transform: translateY(-2px);
}

.source-list span {
  color: var(--paper);
  font-weight: 700;
}

.factor-controls {
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: end;
}

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

.factor-item {
  display: grid;
  gap: 14px;
}

.factor-item > div > span {
  color: var(--cyan);
  font-family: "Red Hat Mono", monospace;
  font-size: 0.78rem;
}

.factor-item dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.factor-item dt,
.factor-item small,
.gas-grid small {
  color: var(--steel);
}

.factor-item dd {
  margin: 4px 0 0;
  font-family: "Red Hat Mono", monospace;
}

.gas-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.gas-grid article {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(75, 220, 255, 0.16);
  border-radius: 8px;
  padding: 14px;
}

.gas-grid span {
  color: var(--green);
  font-family: "Red Hat Mono", monospace;
}

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

.pathway {
  display: grid;
  gap: 16px;
}

.pathway header {
  display: grid;
  gap: 6px;
}

.pathway strong {
  color: var(--green);
  line-height: 1.5;
}

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

.report-pack .button-cluster {
  margin-top: 18px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  border-top: 1px solid rgba(75, 220, 255, 0.2);
  padding: 24px 22px 38px;
  color: var(--ink);
}

.site-footer span:first-child {
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  border: 1px solid rgba(55, 223, 141, 0.5);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 18px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

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

  .result-panel {
    position: static;
  }

  .definition-grid,
  .factor-grid,
  .mrv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body {
    background:
      linear-gradient(180deg, rgba(10, 166, 166, 0.18) 0%, rgba(10, 166, 166, 0) 34%),
      linear-gradient(180deg, #061826 0%, #082b39 52%, #f2fbf8 52.1%, #e8f4ee 100%);
    background-size: auto;
  }

  .top-inner {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .page {
    padding: 20px 12px 34px;
  }

  .hero {
    min-height: auto;
    gap: 16px;
  }

  .hero-copy {
    padding: 34px 0 12px;
  }

  .hero h1,
  .read-hero h1 {
    font-size: 3.1rem;
    line-height: 0.96;
  }

  .canvas-stage,
  .canvas-stage canvas {
    min-height: 360px;
  }

  .canvas-readout {
    align-items: start;
    flex-direction: column;
  }

  .canvas-readout span {
    text-align: left;
  }

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

  .section-heading-row {
    flex-direction: column;
  }

  .form-grid,
  .row-controls,
  .deduction-grid,
  .result-matrix,
  .definition-grid,
  .factor-controls,
  .factor-grid,
  .source-list,
  .pathway-grid,
  .mrv-grid,
  .gas-grid,
  .split-section {
    grid-template-columns: 1fr;
  }

  .row-editor summary {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .formula-strip strong {
    margin-left: 0;
  }

  .read-hero {
    padding: 28px 18px;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero h1,
  .read-hero h1 {
    font-size: 2.45rem;
  }

  .brand strong {
    font-size: 0.92rem;
  }

  .nav-tab,
  .action-button,
  .hero-actions .action-button,
  .panel-actions .action-button {
    width: 100%;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .template-strip {
    display: grid;
    overflow: visible;
  }

  .template-button {
    width: auto;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .nav-tab:hover,
  .step-button:hover,
  .template-button:hover,
  .action-button:hover,
  .icon-button:hover,
  .source-list a:hover {
    transform: none;
  }
}

@media print {
  .site-top,
  .hero-actions,
  .step-rail,
  .panel-actions,
  .button-cluster,
  .toast {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #111827;
  }

  .page,
  .hero,
  .calculator-grid {
    display: block;
  }

  .workspace-panel,
  .result-panel,
  .read-hero,
  .definition,
  .factor-item,
  .pathway,
  .mrv-group,
  .report-pack,
  .sources,
  .split-section > div,
  .gas-table-wrap {
    break-inside: avoid;
    box-shadow: none;
    color: #111827;
    background: #ffffff;
  }
}
