:root {
  --bg: #eef5fb;
  --surface: #ffffff;
  --surface-soft: #f7fbff;
  --text: #0c1b3a;
  --muted: #5d6c86;
  --blue: #1375d1;
  --blue-soft: #e4f2ff;
  --green: #32c783;
  --cyan: #36d8c5;
  --yellow: #f6c945;
  --orange: #f59e0b;
  --red: #ef4444;
  --border: #dce7f2;
  --route-color: #1375d1;
  --route-accent: #36d8c5;
  --shadow: 0 22px 65px rgba(18, 45, 84, 0.11);
  --line: rgba(19, 117, 209, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(145deg, #f7fbff 0%, #eef5fb 42%, #f8fbf6 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 16px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  color: var(--text);
  font-size: 1.42rem;
  font-weight: 900;
  line-height: 1.05;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #35d38e, #2db8d4);
  color: white;
  font-size: 0.78rem;
  box-shadow: inset 0 -10px 18px rgba(0, 73, 96, 0.16);
}

.brand-mark svg {
  width: 50px;
  height: 50px;
  fill: white;
}

.sidebar-section h2,
.side-card h2,
.panel h2 {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.route-selector {
  display: grid;
  gap: 10px;
}

.route-card,
.usage-card,
.impact-card,
.button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.route-card {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  text-align: left;
}

.route-card:hover,
.usage-card:hover,
.impact-card:hover,
.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 34px rgba(15, 48, 86, 0.1);
}

.route-card.active,
.usage-card.active {
  border-color: color-mix(in srgb, var(--route-color) 70%, white);
  background: linear-gradient(135deg, #ffffff, color-mix(in srgb, var(--route-color) 10%, white));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--route-color) 34%, transparent), 0 15px 36px rgba(19, 117, 209, 0.12);
}

.route-card strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.25;
}

.route-card small,
.usage-card small,
.impact-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.route-icon,
.usage-icon,
.bubble-icon,
.fact-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.95), transparent 35%),
    color-mix(in srgb, var(--route-color) 12%, white);
  color: var(--route-color);
}

.route-icon,
.usage-icon {
  width: 48px;
  height: 48px;
  box-shadow: inset 0 0 0 1px rgba(19, 117, 209, 0.08);
}

.route-icon svg,
.bubble-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.topnav svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.usage-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-card,
.panel,
.experience-card,
.compare-section,
.method-hero,
.method-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.side-card {
  padding: 18px;
}

.side-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.side-card a {
  display: inline-flex;
  margin-top: 14px;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.side-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 12px;
}

.mini-metrics > div {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mini-metrics span,
.comparison-strip span,
.energy-flow span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.mini-metrics strong {
  display: block;
  margin-top: 5px;
  font-size: 0.95rem;
}

.pill,
.status-badge,
.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(50, 199, 131, 0.25);
  border-radius: 999px;
  background: rgba(50, 199, 131, 0.12);
  color: #116c49;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.warning,
.pill.warning,
.source-badge.estimation {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.14);
  color: #875500;
}

.status-badge.muted,
.pill {
  border-color: var(--border);
  background: #f8fbff;
  color: var(--muted);
}

.source-badge.calcul_direct,
.source-badge.confidence,
.source-badge.estimation_calcul {
  border-color: rgba(19, 117, 209, 0.25);
  background: rgba(19, 117, 209, 0.1);
  color: #11558e;
}

.mix-chart {
  display: grid;
  gap: 8px;
}

.mix-updated-at {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.mix-updated-at span {
  font-weight: 750;
}

.mix-row {
  display: grid;
  grid-template-columns: 74px minmax(46px, 1fr) 78px;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.76rem;
}

.mix-row strong {
  justify-self: end;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eff6;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  animation: growBar 700ms ease both;
}

.workspace {
  min-width: 0;
  padding: 0 18px 34px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 28px;
  min-height: 78px;
  background: rgba(238, 245, 251, 0.82);
  backdrop-filter: blur(18px);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.topnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 10px;
  color: var(--text);
  font-weight: 850;
  text-decoration: none;
}

.topnav svg {
  width: 24px;
  height: 24px;
  padding: 2px;
  border-radius: 7px;
  background: transparent;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.topnav a.active {
  color: var(--blue);
}

.topnav a:hover svg,
.topnav a.active svg {
  background: rgba(19, 117, 209, 0.1);
  transform: translateY(-1px);
}

.topnav a.active::after {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
  content: "";
}

main {
  display: grid;
  gap: 14px;
}

.experience-card {
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
}

.experience-head {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(380px, 520px) minmax(250px, 320px);
  gap: 20px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.22rem;
}

.route-pill {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  width: min(100%, 520px);
  min-height: 82px;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--route-color) 13%, white), #f7fbff);
}

.bubble-icon {
  width: 48px;
  height: 48px;
  color: var(--route-color);
}

.route-pill span:last-child,
.impact-card span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.route-pill strong,
.impact-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 1rem;
}

.route-pill .path-label,
.route-card .path-label {
  display: inline-flex;
}

.impact-card {
  display: grid;
  grid-template-columns: 54px 1fr 22px;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 14px;
  text-align: left;
}

.leaf-icon {
  color: var(--green);
  background: rgba(50, 199, 131, 0.13);
}

.leaf-icon svg {
  fill: rgba(50, 199, 131, 0.16);
  stroke: currentColor;
}

.chevron {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.journey-scene {
  margin-top: 4px;
  min-height: 0;
}

.stage-composer {
  position: relative;
  min-height: 335px;
  padding: 6px 22px 14px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 70%, rgba(53, 201, 131, 0.12), transparent 46%),
    linear-gradient(180deg, #ffffff 0%, #f8fcff 70%, #eef7ff 100%);
}

.stage-composer::before {
  position: absolute;
  right: 5%;
  bottom: 76px;
  left: 5%;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(79, 196, 135, 0.2), rgba(246, 201, 69, 0.16));
  filter: blur(4px);
  content: "";
}

.cutout-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(var(--stage-count, 5), minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 190px;
}

.cutout-stage {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
  transform: translateY(var(--slope-y, 0px));
  animation: cutoutIn 520ms ease both;
  animation-delay: var(--delay);
}

.cutout-card {
  display: grid;
  width: min(100%, 220px);
  height: 165px;
  place-items: end center;
  border-radius: 8px;
  transition: transform 200ms ease, filter 200ms ease;
}

.cutout-stage:hover .cutout-card {
  transform: translateY(-10px) scale(1.03);
  filter: drop-shadow(0 22px 20px rgba(27, 68, 105, 0.16));
}

.cutout-card img {
  width: 100%;
  max-height: 165px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 16px rgba(27, 68, 105, 0.12));
}

.cutout-stage.is-node .cutout-card {
  align-items: center;
}

.stage-node-icon {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--route-color) 22%, white);
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, color-mix(in srgb, var(--route-color) 14%, white) 100%);
  color: var(--route-color);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.65), 0 22px 40px rgba(27, 68, 105, 0.12);
}

.stage-node-icon svg {
  width: 68px;
  height: 68px;
}

.kwh-serpent {
  position: absolute;
  z-index: 1;
  right: 5.5%;
  bottom: 78px;
  left: 5.5%;
  height: 64px;
  pointer-events: none;
}

.kwh-serpent i,
.kwh-serpent b {
  position: absolute;
  right: 0;
  left: 0;
  display: block;
  height: 18px;
  border-radius: 999px;
  content: "";
  transform: skewY(-2deg);
  transform-origin: center;
}

.kwh-serpent i {
  top: 24px;
  background: linear-gradient(90deg, var(--route-color), var(--route-accent), #f6c945);
  box-shadow: 0 0 24px color-mix(in srgb, var(--route-accent) 55%, transparent);
}

.kwh-serpent b {
  top: 24px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.95) 0 14px,
      transparent 14px 44px
    );
  background-size: 44px 18px;
  mix-blend-mode: screen;
  animation: serpentDash 1.45s linear infinite;
}

.kwh-serpent span {
  position: absolute;
  top: calc(14px + var(--slope-y, 0px));
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 5px solid white;
  border-radius: 50%;
  background: var(--route-accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--route-accent) 20%, transparent), 0 10px 28px rgba(27, 68, 105, 0.16);
  transform: translateX(-50%);
  animation: pulseDot 1.35s ease-in-out infinite;
}

.journey-stats {
  position: absolute;
  z-index: 2;
  right: 5.5%;
  bottom: 32px;
  left: 5.5%;
  display: grid;
  grid-template-columns: repeat(var(--step-count, 5), 1fr);
  gap: 14px;
  margin: 0;
}

.journey-stats > div {
  display: grid;
  gap: 5px;
  justify-items: center;
  min-height: 58px;
  text-align: center;
  transform: translateY(var(--slope-y, 0px));
}

.journey-stats span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--route-color) 15%, white);
  color: #0d4f8a;
  font-weight: 850;
}

.journey-stats strong {
  font-size: 0.86rem;
}

.path-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.path-chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: color-mix(in srgb, var(--route-color) 72%, var(--muted));
  opacity: 0.9;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(270px, 1fr) minmax(250px, 0.82fr);
  gap: 14px;
}

.panel,
.compare-section {
  padding: 22px;
}

.panel-head,
.section-head.split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

.energy-flow {
  display: grid;
  grid-template-columns: 150px 1fr 150px;
  gap: 18px;
  align-items: center;
  min-height: 150px;
}

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

.flow-stack {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 72px;
  border-radius: 8px;
}

.flow-stack span {
  position: relative;
  display: block;
  background: linear-gradient(135deg, color-mix(in srgb, var(--route-color) 20%, white), color-mix(in srgb, var(--route-accent) 22%, white));
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%);
  animation: flowSegmentPulse 2.6s ease-in-out infinite;
}

.flow-stack span:first-child {
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
}

.flow-stack span:nth-child(2) { animation-delay: 120ms; }
.flow-stack span:nth-child(3) { animation-delay: 240ms; }
.flow-stack span:nth-child(4) { animation-delay: 360ms; }
.flow-stack span:nth-child(5) { animation-delay: 480ms; }

.flow-stack::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.7) 45%, transparent 72%);
  content: "";
  mix-blend-mode: screen;
  transform: translateX(-120%);
  animation: flowGlint 2.6s ease-in-out infinite;
  pointer-events: none;
}

.energy-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #0e9b6f;
}

.energy-caption span {
  color: #ef4565;
}

.tooltip-trigger {
  position: relative;
  cursor: help;
  text-decoration: underline dotted rgba(239, 69, 101, 0.45);
  text-underline-offset: 3px;
}

.tooltip-trigger::after {
  position: absolute;
  z-index: 8;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(320px, 70vw);
  padding: 10px 12px;
  border: 1px solid rgba(19, 117, 209, 0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(18, 45, 84, 0.16);
  color: var(--text);
  content: attr(data-tooltip);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.tooltip-trigger:hover::after,
.tooltip-trigger:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.loss-details {
  display: grid;
  gap: 13px;
  margin-top: 22px;
}

.loss-row {
  display: grid;
  grid-template-columns: 1fr 86px 72px 52px;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
}

.loss-row strong,
.loss-row em {
  font-style: normal;
  text-align: right;
}

.loss-row i {
  display: block;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9f0f6;
}

.loss-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.loss-row.total {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 900;
}

.fact-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: start;
  margin-top: 24px;
}

.fact-icon {
  width: 64px;
  height: 64px;
  background: #ffec96;
  color: #0d4f8a;
}

.fact-icon svg {
  width: 50px;
  height: 50px;
  fill: rgba(246, 201, 69, 0.34);
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fact-row p {
  margin: 0;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.5;
}

.compare-section {
  margin-top: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

input {
  width: 92px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 900;
}

.custom-form-card,
.custom-summary-card {
  border-style: dashed;
  background:
    radial-gradient(circle at 16% 18%, color-mix(in srgb, var(--route-accent) 14%, transparent), transparent 35%),
    #ffffff;
}

.custom-form-card {
  align-content: start;
  min-height: 152px;
}

.custom-usage-fields {
  display: grid;
  gap: 5px;
  width: 100%;
}

.custom-usage-fields label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.custom-usage-fields input {
  width: 100%;
  min-height: 30px;
  padding: 0 7px;
}

.custom-form-card .button {
  width: 100%;
  min-height: 36px;
}

.custom-summary-card {
  cursor: pointer;
  padding-right: 44px;
}

.icon-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-close:hover {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--red);
  transform: scale(1.06);
}

.icon-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.usage-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 6px;
  justify-items: start;
  min-height: 128px;
  padding: 12px;
  text-align: left;
}

.usage-card.has-cutout {
  min-height: 152px;
  padding-top: 74px;
}

.usage-card.large-use {
  min-height: 164px;
  background:
    radial-gradient(circle at 75% 20%, color-mix(in srgb, var(--route-color) 10%, transparent), transparent 42%),
    #ffffff;
}

.usage-cutout {
  position: absolute;
  top: 2px;
  right: 8px;
  width: min(62%, 128px);
  height: 72px;
  object-fit: contain;
  object-position: right top;
  filter: drop-shadow(0 16px 14px rgba(27, 68, 105, 0.14));
  transition: transform 180ms ease;
}

.usage-card.has-cutout:hover .usage-cutout {
  transform: translateY(-4px) scale(1.04);
}

.usage-card.has-cutout .usage-icon {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  width: 38px;
  height: 38px;
  background: rgba(232, 243, 255, 0.86);
  backdrop-filter: blur(8px);
}

.usage-label {
  min-height: 30px;
  font-weight: 900;
  line-height: 1.2;
}

.usage-card strong {
  font-size: 1.18rem;
}

.usage-card small {
  font-size: 0.76rem;
  line-height: 1.25;
}

.comparison-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.comparison-strip > div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.comparison-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
}

.method-note {
  margin: 8px 0 28px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.method-note a {
  color: var(--blue);
  font-weight: 850;
  text-decoration: none;
}

.small-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Sources page */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 10px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--border);
  background: rgba(248, 251, 255, 0.92);
  backdrop-filter: blur(14px);
}

.site-header .brand {
  min-height: 58px;
  font-size: 1.06rem;
}

.site-header .brand-mark {
  width: 48px;
  height: 48px;
}

.site-header .brand-mark svg {
  width: 42px;
  height: 42px;
}

.method-page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0;
}

.method-hero,
.method-section {
  margin-bottom: 20px;
  padding: 24px;
}

.method-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 1;
}

.method-status {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

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

.formula-grid > div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

code {
  display: inline-block;
  padding: 4px 6px;
  border-radius: 6px;
  background: #eef4fb;
  color: #174d89;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: normal;
}

.plain-list {
  display: grid;
  gap: 10px;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

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

.source-list article {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.source-list h3 {
  margin: 12px 0 8px;
}

.source-list p {
  color: var(--muted);
  line-height: 1.5;
}

@keyframes growBar {
  from {
    width: 0;
  }
}

@keyframes flowSegmentPulse {
  0%, 100% {
    filter: saturate(1);
    transform: translateY(0);
  }
  45% {
    filter: saturate(1.35) brightness(1.04);
    transform: translateY(-2px);
  }
}

@keyframes flowGlint {
  0%, 18% {
    transform: translateX(-120%);
    opacity: 0;
  }
  38%, 62% {
    opacity: 0.72;
  }
  82%, 100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

@keyframes pulseDot {
  0%, 100% {
    transform: translateX(-50%) translateY(0) scale(0.92);
    opacity: 0.72;
  }
  50% {
    transform: translateX(-50%) translateY(-4px) scale(1.08);
    opacity: 1;
  }
}

@keyframes cutoutIn {
  from {
    opacity: 0;
    transform: translateY(calc(var(--slope-y, 0px) + 14px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(var(--slope-y, 0px)) scale(1);
  }
}

@keyframes cutoutInFlat {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes serpentDash {
  to {
    background-position: 44px 0;
  }
}

@media (max-width: 1220px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .experience-head,
  .insight-grid {
    grid-template-columns: 1fr 1fr;
  }

  .impact-card,
  .fact-panel {
    grid-column: 1 / -1;
  }

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

  .cutout-card {
    height: 150px;
  }

  .cutout-card img {
    max-height: 150px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .workspace {
    padding: 0 10px 28px;
  }

  .brand {
    min-height: 56px;
    font-size: 1.08rem;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand-mark svg {
    width: 40px;
    height: 40px;
  }

  .sidebar-section h2,
  .side-card h2,
  .panel h2 {
    margin-bottom: 10px;
    font-size: 0.78rem;
  }

  .route-selector {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(218px, 72vw);
    grid-template-columns: none;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 1px 2px 8px;
    scroll-snap-type: inline proximity;
  }

  .route-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    min-height: 66px;
    padding: 10px;
    scroll-snap-align: start;
  }

  .route-icon,
  .usage-icon {
    width: 42px;
    height: 42px;
  }

  .route-icon svg,
  .usage-icon svg {
    width: 24px;
    height: 24px;
  }

  .route-card strong {
    font-size: 0.9rem;
  }

  .route-card small,
  .usage-card small,
  .impact-card small {
    font-size: 0.74rem;
  }

  .side-card {
    padding: 14px;
  }

  .topbar {
    position: sticky;
    top: 0;
    align-items: stretch;
    justify-content: flex-start;
    gap: 8px;
    min-height: 0;
    margin: 0 -10px;
    padding: 8px 10px 10px;
  }

  .topnav {
    width: 100%;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 3px;
    scroll-snap-type: inline proximity;
  }

  .topnav a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    scroll-snap-align: start;
  }

  .topnav a.active {
    border-color: rgba(19, 117, 209, 0.28);
    background: rgba(228, 242, 255, 0.96);
  }

  .topnav a.active::after {
    display: none;
  }

  .topnav svg {
    width: 22px;
    height: 22px;
  }

  .topbar .status-badge {
    width: 100%;
    justify-content: flex-start;
  }

  .experience-head,
  .insight-grid,
  .energy-flow,
  .comparison-strip,
  .formula-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

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

  input {
    width: 100%;
  }

  .experience-card {
    padding: 16px;
  }

  .experience-head {
    gap: 12px;
  }

  h1 {
    font-size: clamp(2rem, 10vw, 2.55rem);
  }

  .subtitle {
    font-size: 1rem;
  }

  .route-pill {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .impact-card {
    grid-template-columns: 44px minmax(0, 1fr) 18px;
    gap: 10px;
    min-height: 70px;
    padding: 11px;
    border-radius: 8px;
  }

  .bubble-icon {
    width: 40px;
    height: 40px;
  }

  .bubble-icon svg {
    width: 23px;
    height: 23px;
  }

  .route-pill span:last-child,
  .impact-card span:last-child {
    font-size: 0.8rem;
  }

  .route-pill strong,
  .impact-card strong {
    font-size: 0.92rem;
  }

  .stage-composer {
    --mobile-stage-width: clamp(118px, 34vw, 152px);
    min-height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 14px;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
  }

  .stage-composer::before {
    display: none;
  }

  .cutout-row {
    display: flex;
    gap: 8px;
    min-width: 100%;
    min-height: 116px;
    align-items: end;
  }

  .cutout-stage {
    flex: 0 0 var(--mobile-stage-width);
    justify-items: center;
    transform: none;
    animation-name: cutoutInFlat;
    scroll-snap-align: center;
  }

  .cutout-card {
    width: 100%;
    height: 104px;
    place-items: center;
  }

  .cutout-card img {
    max-height: 104px;
  }

  .kwh-serpent {
    display: none;
  }

  .journey-stats {
    display: flex;
    gap: 8px;
    position: static;
    right: auto;
    bottom: auto;
    left: auto;
    min-width: 100%;
    margin-top: 6px;
  }

  .journey-stats > div {
    flex: 0 0 var(--mobile-stage-width);
    min-height: 52px;
    transform: none;
  }

  .journey-stats span {
    min-height: 24px;
    padding: 3px 10px;
    font-size: 0.76rem;
  }

  .journey-stats strong {
    font-size: 0.74rem;
    line-height: 1.25;
  }

  .panel,
  .compare-section {
    padding: 16px;
  }

  .energy-flow {
    gap: 10px;
    min-height: 0;
  }

  .flow-stack {
    min-height: 50px;
  }

  .fact-row {
    grid-template-columns: 48px 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .fact-icon {
    width: 48px;
    height: 48px;
  }

  .fact-icon svg {
    width: 38px;
    height: 38px;
  }

  .method-page {
    width: min(100% - 20px, 1180px);
    padding: 24px 0;
  }

  .method-hero,
  .method-section {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .usage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .workspace {
    padding-right: 8px;
    padding-left: 8px;
  }

  .panel-head,
  .section-head.split,
  .energy-caption {
    display: grid;
  }

  .journey-scene {
    min-height: 0;
  }

  .stage-composer {
    --mobile-stage-width: 122px;
    padding: 12px;
  }

  .cutout-card {
    height: 92px;
  }

  .cutout-card img {
    max-height: 92px;
  }

  .mini-metrics {
    gap: 8px;
  }

  .mix-row {
    grid-template-columns: 64px minmax(44px, 1fr) max-content;
    gap: 6px;
    font-size: 0.72rem;
  }

  .mix-row strong {
    justify-self: start;
    font-size: 0.68rem;
  }

  .energy-flow {
    text-align: left;
  }

  .energy-flow strong {
    font-size: 1.15rem;
  }

  .energy-caption {
    gap: 8px;
    font-size: 0.86rem;
  }

  .loss-row {
    grid-template-columns: minmax(0, 1fr) 74px 48px;
    gap: 7px 9px;
    font-size: 0.82rem;
  }

  .loss-row i {
    grid-column: 1 / -1;
    height: 8px;
  }

  .loss-row em {
    font-size: 0.78rem;
  }

  .usage-card {
    min-height: 112px;
    padding: 10px;
  }

  .usage-card.has-cutout {
    min-height: 132px;
    padding-top: 62px;
  }

  .usage-card.large-use {
    min-height: 138px;
  }

  .usage-cutout {
    top: 0;
    right: 5px;
    width: min(68%, 96px);
    height: 58px;
  }

  .usage-card.has-cutout .usage-icon {
    top: 8px;
    left: 8px;
    width: 34px;
    height: 34px;
  }

  .usage-label {
    min-height: 32px;
    font-size: 0.86rem;
  }

  .usage-card strong {
    font-size: 1.05rem;
  }

  .usage-card small {
    font-size: 0.68rem;
  }

  .custom-form-card {
    min-height: 136px;
  }

  .custom-usage-fields label {
    grid-template-columns: 1fr;
    gap: 3px;
    font-size: 0.68rem;
  }

  .custom-usage-fields input {
    min-height: 28px;
  }

  .comparison-strip {
    gap: 8px;
  }

  .comparison-strip > div {
    padding: 12px;
  }

  .comparison-strip strong {
    font-size: 1.12rem;
  }

  .site-header {
    display: grid;
    gap: 10px;
    padding: 8px 10px 10px;
  }

  .site-header .topnav {
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .method-hero h1 {
    font-size: clamp(2rem, 12vw, 2.8rem);
  }

  table {
    min-width: 640px;
  }
}

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

  .topnav a {
    padding: 0 9px;
    font-size: 0.9rem;
  }

  .stage-composer {
    --mobile-stage-width: 116px;
  }
}

@media (hover: none) {
  .route-card:hover,
  .usage-card:hover,
  .impact-card:hover,
  .button:hover {
    transform: none;
    box-shadow: none;
  }

  .cutout-stage:hover .cutout-card {
    transform: none;
    filter: none;
  }

  .usage-card.has-cutout:hover .usage-cutout {
    transform: none;
  }
}
