:root,
html[data-theme="light"] {
  --paper: #ffffff;
  --ink: #101114;
  --muted: #62666f;
  --line: #c9cbd0;
  --soft: #f4f5f3;
  --teal: #009f93;
  --coral: #ff493d;
  --yellow: #f4c400;
  --cobalt: #1456d9;
  --green: #087d50;
  --shadow: 8px 8px 0 rgba(16, 17, 20, 0.08);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101114;
    --ink: #f4f5f3;
    --muted: #a7abb4;
    --line: #3a3d45;
    --soft: #1a1c22;
    --teal: #009f93;
    --coral: #ff493d;
    --yellow: #f4c400;
    --cobalt: #6f93ea;
    --green: #3dba7a;
    --shadow: 8px 8px 0 rgba(244, 245, 243, 0.06);
    color-scheme: dark;
  }
}

html[data-theme="dark"] {
  --paper: #101114;
  --ink: #f4f5f3;
  --muted: #a7abb4;
  --line: #3a3d45;
  --soft: #1a1c22;
  --teal: #009f93;
  --coral: #ff493d;
  --yellow: #f4c400;
  --cobalt: #6f93ea;
  --green: #3dba7a;
  --shadow: 8px 8px 0 rgba(244, 245, 243, 0.06);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, ui-sans-serif, system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--yellow);
  transform: translate(-2px, -2px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.is-scoring:disabled,
.primary-action.is-scoring:disabled {
  cursor: wait;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 18px 24px;
}

.topbar {
  position: relative;
  min-height: 350px;
  display: grid;
  align-items: center;
  margin: 0 -18px;
  border-bottom: 1px solid var(--ink);
  padding: 34px max(40px, calc((100vw - 1404px) / 2 + 18px));
  background-color: var(--paper);
  background-image: url("assets/decision-field.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(540px, 46%);
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  font-weight: 900;
  line-height: 0.86;
}

h1 span {
  display: block;
}

.hero-tagline {
  margin-bottom: 25px;
  font-size: 1.2rem;
  font-weight: 800;
}

.status-chip {
  width: fit-content;
  min-width: 150px;
  border-bottom: 2px solid var(--ink);
  padding: 8px 0;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.status-chip::before {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 8px;
  background: var(--muted);
  content: "";
}

.status-chip[data-state="ok"]::before {
  background: var(--teal);
}

.status-chip[data-state="busy"]::before {
  background: var(--yellow);
}

.status-chip[data-state="error"]::before {
  background: var(--coral);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 22.5rem) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 14px;
  align-items: start;
  padding-top: 14px;
}

.form-panel {
  grid-column: 1;
  grid-row: 1;
}

.history-panel {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

.result-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.panel {
  min-width: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
}

.panel-bar {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.panel-bar h2,
.panel-bar strong {
  margin: 0;
  font-size: inherit;
}

.panel-bar span {
  color: #d9dadd;
  font-weight: 700;
}

.panel-content {
  padding: 20px;
}

.form-panel {
  position: static;
}

.form-content {
  display: grid;
  gap: 15px;
}

.field-group,
.control-block {
  display: grid;
  gap: 7px;
}

label,
.control-label {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.control-label {
  margin: 0;
}

textarea,
input[type="text"],
input[type="number"],
input:not([type]) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 11px;
  font-size: 0.86rem;
  outline: none;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.4;
}

textarea:focus,
input:focus {
  border-color: var(--ink);
}

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

.control-grid label {
  display: grid;
  gap: 7px;
}

.range-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.range-label output {
  min-width: 24px;
  background: var(--teal);
  color: var(--paper);
  text-align: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  overflow: hidden;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  text-align: center;
}

.segmented label:last-child {
  border-right: 0;
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--cobalt);
  outline-offset: -3px;
}

.segmented input:checked + label {
  background: var(--ink);
  color: var(--paper);
}

.button-row {
  display: grid;
  grid-template-columns: 1.25fr 0.7fr 0.7fr;
  gap: 10px;
  border-top: 1px solid var(--ink);
  padding-top: 15px;
}

.primary-action {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--paper);
  font-size: 0.9rem;
}

.primary-action:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--ink);
}

.form-feedback {
  min-height: 17px;
}

.form-feedback p {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
}

.form-feedback p:empty {
  display: none;
}

.form-error {
  color: #b42318;
}

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

.result-content {
  padding: 0 20px 20px;
}

.score-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 160px;
  border-bottom: 1px solid var(--ink);
  padding: 20px 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--coral);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-header h2 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  line-height: 1.15;
}

.score-range {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

.score-tools {
  display: grid;
  grid-template-columns: 100px auto;
  align-items: center;
  gap: 12px;
}

.score-tools .memo-actions {
  grid-column: 1 / -1;
}

.score-tools button {
  min-height: 36px;
  padding: 0 12px;
}

.score-tools button[data-state="set"] {
  border-color: var(--teal);
  background: var(--teal);
  color: var(--paper);
  cursor: default;
  opacity: 1;
}

.score-ring {
  --score: 0;
  width: 100px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 59%, transparent 60%),
    conic-gradient(var(--teal) calc(var(--score) * 1%), var(--soft) 0);
}

.score-ring span {
  font-size: 2rem;
  font-weight: 900;
}

.summary {
  max-width: 920px;
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.evidence-note {
  margin: 0 0 14px;
  border-left: 5px solid var(--yellow);
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.signal-row {
  display: flex;
  min-height: 22px;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.signal-row span {
  border-bottom: 2px solid var(--teal);
  padding: 3px 1px;
  color: var(--ink);
  font-size: 0.66rem;
  font-weight: 800;
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.metric {
  min-width: 0;
  display: grid;
  gap: 7px;
  border-right: 1px solid var(--line);
  padding: 14px 12px;
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  min-height: 28px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.metric strong {
  font-size: 1.7rem;
}

.meter {
  height: 4px;
  overflow: hidden;
  background: #e4e5e7;
}

.meter i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--teal);
  transition: width 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.metric[data-metric="evidence"] .meter i {
  background: var(--yellow);
}

.metric[data-metric="risk"] .meter i {
  background: var(--coral);
}

.comparison-section,
.experiment-section,
.result-columns {
  border-bottom: 1px solid var(--ink);
  padding: 18px 0;
}

.comparison-heading,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.comparison-heading h3,
.section-heading h3,
.lever-section h3 {
  margin-bottom: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.comparison-context {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.comparison-score {
  min-width: 54px;
  border: 1px solid var(--ink);
  padding: 9px 11px;
  background: var(--soft);
  font-size: 1.1rem;
  text-align: center;
}

.comparison-score[data-status="improved"] {
  background: var(--teal);
  color: var(--paper);
}

.comparison-score[data-status="worsened"] {
  background: var(--coral);
  color: var(--paper);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.comparison-grid > div {
  display: grid;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 10px 8px 0;
}

.comparison-grid > div:last-child {
  border-right: 0;
}

.comparison-grid span,
.comparison-grid small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
}

.comparison-grid strong {
  font-size: 1.05rem;
}

.comparison-grid [data-status="improved"] strong,
.comparison-grid [data-status="improved"] small {
  color: var(--green);
}

.comparison-grid [data-status="worsened"] strong,
.comparison-grid [data-status="worsened"] small {
  color: #b42318;
}

.lever-section,
.impact-section {
  min-width: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--ink);
}

.lever-section {
  display: grid;
  align-content: start;
  gap: 18px;
}

.lever-section p:last-child {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

.lever-context {
  display: grid;
  gap: 6px;
  border-left: 5px solid var(--yellow);
  padding-left: 11px;
}

.lever-context strong {
  color: var(--teal);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.lever-context span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

.impact-section {
  padding-left: 0;
}

.impact-list {
  display: grid;
}

.impact-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.impact-item:first-child {
  border-top-color: var(--ink);
}

.impact-rank {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.66rem;
  font-weight: 900;
}

.impact-item:nth-child(2) .impact-rank {
  background: var(--coral);
}

.impact-item:nth-child(3) .impact-rank {
  background: var(--cobalt);
}

.impact-copy {
  min-width: 0;
}

.impact-copy strong,
.impact-copy span {
  display: block;
}

.impact-copy strong {
  font-size: 0.78rem;
}

.impact-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.impact-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--teal);
}

.impact-score strong {
  font-size: 1rem;
}

.impact-score small {
  color: var(--muted);
  font-size: 0.6rem;
}

.scenario-section,
.sensitivity-section,
.ladder-section,
.flip-section,
.week-plan-section {
  border-bottom: 1px solid var(--ink);
  padding: 18px 0;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.scenario-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  border-right: 1px solid var(--line);
  padding: 12px;
}

.scenario-card:last-child {
  border-right: 0;
}

.scenario-card > span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-card > strong {
  color: var(--teal);
  font-size: 2rem;
  line-height: 0.9;
}

.scenario-card[data-delta="down"] > strong {
  color: var(--coral);
}

.scenario-card[data-delta="flat"] > strong {
  color: var(--ink);
}

.scenario-card em {
  color: var(--ink);
  font-size: 0.74rem;
  font-style: normal;
  font-weight: 800;
}

.scenario-card p,
.scenario-card li,
.scenario-card .detail,
.scenario-card .scenario-changes {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.36;
}

.scenario-card p,
.scenario-card ul,
.scenario-card .detail,
.scenario-card .scenario-changes {
  margin: 0;
}

.scenario-card ul {
  padding-left: 16px;
}

.scenario-card .scenario-changes {
  display: grid;
  gap: 3px;
}

.week-plan-meta {
  min-width: 86px;
  padding: 8px 10px;
  background: var(--teal);
  color: var(--paper);
  font-size: 0.76rem;
  text-align: center;
}

.week-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.week-block {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-content: start;
  min-height: 112px;
  border-right: 1px solid var(--line);
  padding: 12px;
}

.week-block:last-child {
  border-right: 0;
}

.week-block strong {
  color: var(--teal);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.week-block span {
  width: 34px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.68rem;
  font-weight: 900;
}

.week-block p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.38;
}

.week-checkpoint {
  margin: 10px 0 0;
  border-left: 5px solid var(--yellow);
  padding-left: 11px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.42;
}

.memo-actions {
  display: flex;
  gap: 7px;
}

.memo-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.68rem;
}

.experiment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.experiment-grid > div {
  min-height: 108px;
  display: grid;
  align-content: start;
  gap: 7px;
  border-right: 1px solid var(--line);
  padding: 12px;
}

.experiment-grid > div:last-child {
  border-right: 0;
}

.experiment-grid strong {
  color: var(--teal);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.experiment-grid span {
  font-size: 0.78rem;
  line-height: 1.4;
}

.result-columns {
  display: grid;
  gap: 18px;
}

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

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

.result-columns > div + div {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.result-columns h3 {
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.stack-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.74rem;
  line-height: 1.42;
}

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

.stop-list li::marker {
  color: var(--coral);
}

.timeline-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  font-size: 0.74rem;
  list-style: none;
}

.timeline-list li {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 9px;
  line-height: 1.4;
}

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

.history-panel {
  min-width: 0;
}

.history-heading button {
  min-height: 24px;
  border-color: var(--paper);
  padding: 0 10px;
  background: transparent;
  color: var(--paper);
  font-size: 0.64rem;
}

.history-list {
  display: grid;
  min-height: 58px;
}

.history-item {
  position: relative;
  min-height: 58px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}

.history-item:last-child {
  border-bottom: 0;
}

.history-item:hover:not(:disabled) {
  background: var(--soft);
  transform: none;
}

.history-item span {
  width: 46px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 900;
}

.history-item span {
  grid-row: 1 / span 2;
}

.history-item strong {
  grid-column: 2;
  grid-row: 1;
}

.history-item small {
  grid-column: 2;
  grid-row: 2;
}

.history-item em {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.history-item strong,
.history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item strong {
  font-size: 0.76rem;
}

.history-item small {
  color: var(--muted);
  font-size: 0.7rem;
}

.history-item em {
  justify-self: end;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.history-item em[data-direction="up"] {
  color: var(--green);
}

.history-item em[data-direction="down"] {
  color: #b42318;
}

.empty-state {
  margin: 0;
  padding: 20px;
  color: var(--muted);
  font-size: 0.76rem;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--ink);
  margin-top: 14px;
  padding: 14px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.app-footer a {
  color: var(--ink);
  font-weight: 800;
}

.result-panel[data-ready="true"] .score-header,
.result-panel[data-ready="true"] .meter-grid,
.result-panel[data-ready="true"] .strategy-grid,
.result-panel[data-ready="true"] .scenario-section,
.result-panel[data-ready="true"] .sensitivity-section,
.result-panel[data-ready="true"] .ladder-section,
.result-panel[data-ready="true"] .flip-section,
.result-panel[data-ready="true"] .week-plan-section,
.result-panel[data-ready="true"] .experiment-section {
  animation: reveal 360ms ease both;
}

.result-panel[data-ready="true"] .meter-grid {
  animation-delay: 50ms;
}

.result-panel[data-ready="true"] .strategy-grid {
  animation-delay: 100ms;
}

.result-panel[data-ready="true"] .scenario-section {
  animation-delay: 150ms;
}

.result-panel[data-ready="true"] .sensitivity-section {
  animation-delay: 175ms;
}

.result-panel[data-ready="true"] .week-plan-section {
  animation-delay: 200ms;
}

.go-nogo {
  margin: 0 0 8px;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.go-nogo-reason {
  margin: 8px 0 0;
  max-width: 46rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.go-nogo[data-decision="GO"] {
  color: var(--green);
}

.go-nogo[data-decision="CONDITIONAL"] {
  color: var(--cobalt);
}

.go-nogo[data-decision="NO-GO"] {
  color: var(--coral);
}

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

.sensitivity-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.sensitivity-row p,
.sensitivity-row .detail {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.sensitivity-row[data-delta="up"] strong {
  color: var(--green);
}

.sensitivity-row[data-delta="down"] strong {
  color: var(--coral);
}

.ladder-list,
.flip-list {
  display: grid;
  gap: 10px;
}

.ladder-rung,
.flip-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
}

.ladder-rung em,
.flip-row p,
.flip-row .detail {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: normal;
}

.ladder-rung[data-current="true"] {
  border-color: var(--ink);
}

.ladder-rung[data-decision="GO"] strong,
.flip-row[data-decision="GO"] strong {
  color: var(--green);
}

.ladder-rung[data-decision="NO-GO"] strong,
.flip-row[data-decision="NO-GO"] strong {
  color: var(--coral);
}

.result-panel[data-ready="true"] .experiment-section {
  animation-delay: 250ms;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(280px, 20rem) minmax(0, 1fr);
  }

  .primary-results,
  .moves-lists,
  .scenario-grid,
  .week-plan-grid {
    grid-template-columns: 1fr;
  }

  .result-columns > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-top: 14px;
    padding-left: 0;
  }

  .scenario-card,
  .week-block {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scenario-card:last-child,
  .week-block:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding-inline: 10px;
  }

  .topbar {
    min-height: 310px;
    margin-inline: -10px;
    padding: 28px 20px;
    background-position: 62% center;
    background-size: auto 100%;
  }

  .hero-copy {
    width: 58%;
  }

  h1 {
    font-size: clamp(2.4rem, 12vw, 3.6rem);
  }

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

  .form-panel,
  .history-panel,
  .result-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .form-panel {
    position: static;
  }

  .history-item {
    grid-template-columns: 46px minmax(0, 1fr) 40px;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 280px;
    background-position: left center;
  }

  .hero-copy {
    width: 86%;
    max-width: 300px;
  }

  h1 {
    font-size: clamp(2.2rem, 14vw, 3rem);
  }

  .hero-tagline {
    max-width: 210px;
    font-size: 0.95rem;
  }

  .panel-content {
    padding: 14px;
  }

  .result-content {
    padding-top: 0;
  }

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

  .control-grid label:last-child {
    grid-column: 1 / -1;
  }

  .button-row {
    grid-template-columns: 1fr 0.72fr 0.72fr;
  }

  .score-header {
    align-items: start;
    flex-direction: column;
  }

  .score-header h2 {
    font-size: 1.35rem;
  }

  .score-tools {
    width: 100%;
    grid-template-columns: 90px 1fr;
  }

  .score-ring {
    width: 90px;
  }

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

  .metric {
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric:last-child {
    grid-column: 1 / -1;
    border-bottom: 0;
  }

  .comparison-heading,
  .section-heading,
  .app-footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  .comparison-grid > div {
    border-bottom: 1px solid var(--line);
  }

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

  .memo-actions button {
    min-width: 0;
    padding-inline: 5px;
  }

  .experiment-grid,
  .secondary-results {
    grid-template-columns: 1fr;
  }

  .experiment-grid > div {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .experiment-grid > div:last-child {
    border-bottom: 0;
  }

  .history-item {
    grid-template-columns: 52px minmax(0, 1fr) 42px;
  }

  .history-item small {
    grid-column: 2 / 4;
    grid-row: 2;
  }

  .history-item em {
    grid-column: 3;
    grid-row: 1;
  }

  .timeline-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.theme-toggle {
  min-height: 34px;
  padding: 0 12px;
  background: var(--paper);
}

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

.sample-chips button {
  min-height: 32px;
  padding: 0 10px;
  background: var(--soft);
  font-size: 0.68rem;
}

.result-tabs {
  margin-top: 8px;
}

.tab-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--ink);
}

.tab-list [role="tab"] {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--ink);
  background: var(--paper);
  font-size: 0.74rem;
}

.tab-list [role="tab"]:last-child {
  border-right: 0;
}

.tab-list [role="tab"][aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}

.tab-list [role="tab"]:hover:not(:disabled) {
  background: var(--yellow);
  color: var(--ink);
  transform: none;
}

.tab-list [role="tab"][aria-selected="true"]:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
}

.tab-panel {
  padding-top: 4px;
}

.decision-hero {
  min-width: 0;
}

.impact-item,
.scenario-card,
.sensitivity-row,
.ladder-rung,
.flip-row {
  width: 100%;
  min-height: 0;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
}

.impact-item:hover:not(:disabled),
.scenario-card:hover:not(:disabled),
.sensitivity-row:hover:not(:disabled),
.ladder-rung:hover:not(:disabled),
.flip-row:hover:not(:disabled) {
  background: var(--soft);
  transform: none;
}

.impact-action,
.impact-meta {
  display: block;
}

.impact-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.moves-lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  border-top: 1px solid var(--ink);
  padding: 18px 0;
}

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

.meter {
  background: var(--line);
}

html[data-theme="dark"] .panel-bar span {
  color: #8d9098;
}

html[data-theme="dark"] .form-error,
html[data-theme="dark"] .comparison-grid [data-status="worsened"] strong,
html[data-theme="dark"] .comparison-grid [data-status="worsened"] small,
html[data-theme="dark"] .history-item em[data-direction="down"] {
  color: #ff8b82;
}

@media (max-width: 820px) {
  .tab-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tab-list [role="tab"]:nth-child(2) {
    border-right: 0;
  }

  .tab-list [role="tab"]:nth-child(1),
  .tab-list [role="tab"]:nth-child(2) {
    border-bottom: 1px solid var(--ink);
  }
}

.empty-cta {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px dashed var(--ink);
  background: var(--soft);
}

.empty-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.empty-cta button {
  justify-self: start;
  background: var(--yellow);
}

.score-mix {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.score-mix-bars {
  display: grid;
  gap: 6px;
}

.score-mix-bars div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  font-size: 0.72rem;
}

.score-mix-bars i {
  display: block;
  height: 8px;
  background: var(--teal);
}

.history-spark {
  display: block;
  width: calc(100% - 24px);
  height: 48px;
  margin: 8px 12px 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

@media print {
  .topbar,
  .form-panel,
  .history-panel,
  .app-footer,
  .theme-toggle,
  .memo-actions,
  .sample-chips,
  .toast,
  .skip-link,
  .empty-cta,
  .tab-list {
    display: none !important;
  }

  .result-tabs .tab-panel {
    display: block !important;
  }

  .workspace {
    display: block;
  }
}

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