:root {
  --bg: #070809;
  --surface: #0d0f10;
  --surface-strong: #121416;
  --line: #2a2d30;
  --line-soft: #1b1e20;
  --text: #f4f4f1;
  --muted: #a3a5a8;
  --ember: #ff3b18;
  --ember-deep: #b4210f;
  --gold: #f6b936;
  --teal: #22d4be;
  --focus: #f8c662;
  --radius: 8px;
  --content: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 390px;
  min-height: 100dvh;
  overflow: auto;
  background: #17191b;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.iphone-shell {
  position: relative;
  width: 390px;
  min-width: 390px;
  max-width: 390px;
  height: 844px;
  min-height: 844px;
  max-height: 844px;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  border: 1px solid #35383b;
  border-radius: 44px;
  background: var(--bg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  margin: max(0px, calc((100dvh - 844px) / 2)) auto;
  scrollbar-width: none;
}

.iphone-shell::-webkit-scrollbar {
  display: none;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
  white-space: normal;
}

h1,
h2,
p,
span,
strong,
label,
output,
button {
  overflow-wrap: anywhere;
}

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

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(7, 8, 9, 0.94);
  padding: 0 max(24px, calc((100vw - var(--content)) / 2));
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 800;
}

.brand svg {
  width: 25px;
  height: 25px;
  color: var(--ember);
  filter: drop-shadow(0 0 9px rgba(255, 59, 24, 0.46));
  stroke-width: 2;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 650;
}

.nav-link svg {
  width: 18px;
  height: 18px;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.profile-button {
  width: 36px;
  height: 36px;
  border: 1px solid #8f5c25;
  border-radius: 50%;
  background: #26170d;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.restart-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.restart-button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.restart-button svg {
  width: 18px;
  height: 18px;
}

.recovery-app {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
}

.recovery-context {
  border-bottom: 1px solid var(--line-soft);
  padding: 15px 0 16px;
}

.context-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.context-head > span {
  color: #777b7f;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

#recovery-outcome {
  max-width: 62%;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 750;
  text-align: right;
}

.context-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.context-fields label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.context-fields select,
.context-fields input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.8rem;
}

.context-fields select:focus-visible,
.context-fields input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.demo-switcher {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.demo-switcher > span {
  color: #777b7f;
  font-size: 0.74rem;
  font-weight: 750;
  text-transform: uppercase;
}

.state-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(108px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.state-tabs button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.state-tabs button:last-child {
  border-right: 0;
}

.state-tabs button:hover {
  background: #111315;
  color: var(--text);
}

.state-tabs button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.state-tabs button:disabled:hover {
  background: transparent;
  color: var(--muted);
}

.state-tabs button[aria-selected="true"] {
  background: #18130a;
  color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.state-tabs svg {
  width: 17px;
  height: 17px;
}

.recovery-stage {
  position: relative;
  display: flex;
  min-height: 402px;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.hero-copy {
  position: relative;
  z-index: 3;
  width: min(52%, 610px);
  padding: 40px 0 36px;
}

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

h1 {
  max-width: 590px;
  margin-bottom: 22px;
  font-size: clamp(2.45rem, 5vw, 4.75rem);
  font-weight: 780;
  line-height: 1.03;
  letter-spacing: 0;
}

.streak-display {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-height: 72px;
}

.streak-display strong {
  color: var(--gold);
  font-size: clamp(3.2rem, 6vw, 5.4rem);
  font-weight: 720;
  line-height: 0.95;
  text-shadow: 0 0 24px rgba(246, 185, 54, 0.18);
}

.streak-display span {
  color: #cacacd;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 500;
}

.streak-track,
.score-track {
  position: relative;
  overflow: visible;
  height: 10px;
  border: 1px solid #33373a;
  border-radius: 999px;
  background: #202326;
}

.streak-track {
  width: min(520px, 100%);
  margin: 17px 0 19px;
}

#streak-fill,
#score-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(246, 185, 54, 0.28);
  transition: width 320ms ease;
}

#streak-fill {
  background: var(--ember);
}

.track-feather {
  position: absolute;
  top: 50%;
  left: 0;
  width: 38px;
  height: 38px;
  color: #ffd87a;
  filter: drop-shadow(0 0 8px rgba(246, 185, 54, 0.75));
  transform: translate(-62%, -53%) rotate(-14deg);
  transition: left 320ms ease;
}

#recovery-subtitle {
  max-width: 510px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.phase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.phase-row strong {
  font-size: 1.12rem;
  font-weight: 650;
}

.phase-row strong span {
  color: var(--gold);
}

.phase-dots {
  display: flex;
  align-items: center;
  gap: 14px;
}

.phase-dots i {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid #5a5e62;
  border-radius: 50%;
  background: var(--bg);
}

.phase-dots i + i::before {
  position: absolute;
  top: 7px;
  right: 17px;
  width: 15px;
  height: 2px;
  background: #45494d;
  content: "";
}

.phase-dots i.complete,
.phase-dots i.active {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 13px rgba(246, 185, 54, 0.45);
}

.phase-dots i.active {
  transform: scale(1.16);
}

.phoenix-art {
  position: absolute;
  inset: 0 -3% 0 30%;
  z-index: 1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 92%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 18%, #000 92%, transparent 100%);
}

.phoenix-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 61% 50%;
  opacity: 0.84;
  transition: opacity 240ms ease, filter 240ms ease;
}

body[data-state="spark"] .phoenix-art img {
  opacity: 0.52;
  filter: saturate(0.78) brightness(0.78);
}

body[data-state="warp"] .phoenix-art img {
  opacity: 0.9;
  filter: none;
}

body[data-state="freeze"] .phoenix-art img {
  opacity: 0.9;
  filter: none;
}

.progress-band {
  padding: 24px 0 0;
}

.progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.progress-head h2 {
  margin-bottom: 4px;
  font-size: 1.08rem;
  line-height: 1.2;
}

.progress-head p {
  margin-bottom: 0;
  color: #7f8387;
  font-size: 0.84rem;
}

#score-display {
  color: var(--gold);
  font-size: 1.02rem;
  white-space: normal;
}

.score-track {
  height: 7px;
  margin-top: 15px;
  overflow: hidden;
  border: 0;
}

.activity-content {
  margin-top: 10px;
}

.warp-reclaimed {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px 9px;
  font-size: 0.78rem;
  white-space: normal;
}

.warp-reclaimed strong {
  color: var(--teal);
  font-weight: 750;
}

.warp-reclaimed span {
  color: #777f82;
  font-weight: 650;
}

.warp-trajectory {
  border-top: 1px solid var(--line-soft);
  padding: 14px 0 12px;
}

.warp-trajectory-head,
.warp-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.warp-trajectory-head span,
.warp-axis {
  color: var(--muted);
  font-size: 0.72rem;
}

.warp-trajectory-head strong {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--teal);
  font-size: 0.78rem;
  text-align: right;
}

.warp-trajectory-head strong small {
  margin-top: 2px;
  color: #747b7e;
  font-size: 0.68rem;
  font-weight: 650;
}

.warp-trajectory svg {
  display: block;
  width: 100%;
  height: 96px;
  margin-top: 6px;
  overflow: visible;
}

.warp-curve-base,
.warp-curve-progress,
.warp-curve-preview {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.warp-curve-base {
  stroke: #353a3e;
  stroke-width: 3;
}

.warp-curve-progress {
  stroke: var(--teal);
  stroke-width: 4;
  filter: drop-shadow(0 0 6px rgba(34, 212, 190, 0.45));
}

.warp-curve-preview {
  stroke: var(--teal);
  stroke-width: 3;
  stroke-dasharray: 4 5;
  opacity: 0.42;
}

.warp-curve-point {
  fill: var(--gold);
  stroke: var(--bg);
  stroke-width: 3;
}

.warp-curve-preview-point {
  fill: var(--teal);
  stroke: var(--bg);
  stroke-width: 2;
  opacity: 0.48;
}

.warp-day-slider {
  width: 100%;
  height: 20px;
  margin: -8px 0 1px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.warp-day-slider::-webkit-slider-runnable-track {
  height: 2px;
  background: #34383c;
}

.warp-day-slider::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -8px;
  appearance: none;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}

.warp-day-slider::-moz-range-track {
  height: 2px;
  background: #34383c;
}

.warp-day-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--teal);
}

.warp-axis {
  margin-top: 2px;
}

.activity-list {
  border-top: 1px solid var(--line-soft);
}

.activity-task {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 0 16px;
}

.activity-task-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
}

.activity-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #5e271f;
  border-radius: var(--radius);
  color: var(--ember);
}

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

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

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

.activity-copy .activity-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.activity-copy .activity-title-line strong {
  margin-bottom: 0;
  color: var(--text);
}

.activity-copy strong {
  margin-bottom: 3px;
  font-size: 0.94rem;
  font-weight: 720;
}

.activity-copy span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: normal;
}

.activity-points {
  display: flex;
  min-width: 70px;
  flex-direction: column;
  color: var(--gold);
  text-align: right;
}

.activity-points strong {
  font-size: 0.78rem;
  white-space: nowrap;
}

.activity-points span {
  color: var(--muted);
  font-size: 0.66rem;
}

.activity-task.complete .activity-icon {
  border-color: #14635b;
  color: var(--teal);
}

.activity-task.complete .activity-points,
.activity-task.complete .activity-points span {
  color: var(--teal);
}

.activity-task.unavailable {
  opacity: 0.46;
}

.activity-controls {
  margin: 12px 0 0 53px;
}

.info-button {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.info-button:hover,
.info-button[aria-expanded="true"] {
  color: var(--teal);
}

.info-button svg {
  width: 17px;
  height: 17px;
}

.binary-task-button {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 720;
  line-height: 1.3;
}

.binary-task-button.complete {
  border-color: #1b776d;
  background: #0d2826;
  color: var(--teal);
}

.binary-task-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.criteria-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.criterion,
.single-counter-row {
  min-width: 0;
}

.criterion > span,
.single-counter-row > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.counter-control {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.counter-control button {
  display: grid;
  width: 32px;
  height: 36px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.counter-control button:hover:not(:disabled) {
  color: var(--gold);
}

.counter-control button:disabled {
  color: #4a4e52;
  cursor: not-allowed;
}

.counter-control button svg {
  width: 15px;
  height: 15px;
}

.counter-control strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.76rem;
  text-align: center;
}

.single-counter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.8fr);
  gap: 12px;
  align-items: center;
}

.single-counter-row > span {
  margin-bottom: 0;
}

.qualifying-actions {
  margin-top: 10px;
  border-left: 2px solid var(--teal);
  background: #0b1515;
  padding: 9px 10px;
}

.qualifying-actions strong,
.qualifying-actions span {
  display: block;
}

.qualifying-actions strong {
  margin-bottom: 3px;
  color: var(--teal);
  font-size: 0.72rem;
}

.qualifying-actions span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.freeze-mode-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.freeze-mode-switcher button {
  min-height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.freeze-mode-switcher button:last-child {
  border-right: 0;
}

.freeze-mode-switcher button[aria-pressed="true"] {
  background: #0d1b1d;
  color: #8fe8dc;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.freeze-mode-switcher button:disabled {
  color: #55595d;
  cursor: not-allowed;
}

.freeze-earn-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
  padding: 13px 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.freeze-earn-meta strong {
  color: var(--teal);
  font-size: 0.8rem;
}

.freeze-rule {
  margin: 12px 0 0;
  color: #74787c;
  font-size: 0.74rem;
  line-height: 1.45;
}

.freeze-planner {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr) minmax(0, 1fr);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.planner-field {
  min-height: 98px;
  border-right: 1px solid var(--line-soft);
  padding: 17px 20px 17px 0;
}

.planner-field + .planner-field {
  padding-left: 20px;
}

.planner-field:last-child {
  border-right: 0;
}

.planner-field span,
.planner-field strong {
  display: block;
}

.planner-field span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.planner-field strong {
  font-size: 1rem;
}

.duration-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-button:disabled {
  border-color: var(--line-soft);
  color: #55595d;
  cursor: not-allowed;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.action-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 22px;
  align-items: center;
  min-height: 92px;
  border-top: 1px solid var(--line-soft);
  margin-top: 22px;
}

.legacy-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legacy-stat svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.legacy-stat strong {
  color: var(--gold);
  font-size: 0.98rem;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.3;
}

.primary-action {
  min-width: 290px;
  border: 1px solid #ff6848;
  background: var(--ember);
  color: white;
  padding: 12px 26px;
  box-shadow: 0 10px 28px rgba(255, 59, 24, 0.18);
}

.primary-action:hover:not(:disabled) {
  background: #ff4f2e;
}

.primary-action:disabled {
  border-color: #34373a;
  background: #1b1e20;
  color: #777b7f;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-action {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px;
  text-align: left;
}

.secondary-action:hover {
  color: var(--text);
}

.secondary-action svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.demo-day-jump {
  border-top: 1px solid var(--line-soft);
  padding: 17px 0 30px;
}

.day-jump-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 12px;
}

.day-jump-head > span {
  color: #777b7f;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

.day-jump-head strong {
  color: var(--teal);
  font-size: 0.78rem;
  text-align: right;
}

.day-jump-controls {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 9px;
  align-items: end;
}

.day-jump-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

.day-jump-button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.day-jump-button:disabled {
  color: #55595d;
  cursor: not-allowed;
}

.day-jump-button svg {
  width: 18px;
  height: 18px;
}

.day-jump-button.previous svg {
  transform: rotate(180deg);
}

.day-jump-field {
  display: block;
  min-width: 0;
}

.day-jump-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
}

.day-jump-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.82rem;
}

.scenario-flags {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 15px;
}

.scenario-flags-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 9px;
}

.scenario-flags-head > span {
  color: #777b7f;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

#scenario-impact {
  max-width: 66%;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 750;
  text-align: right;
}

.scenario-toggle-list {
  border-top: 1px solid var(--line-soft);
}

.scenario-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.scenario-toggle-copy strong,
.scenario-toggle-copy small {
  display: block;
}

.scenario-toggle-copy strong {
  margin-bottom: 3px;
  font-size: 0.88rem;
}

.scenario-toggle-copy small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.scenario-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  border: 1px solid #4b4f53;
  border-radius: 999px;
  background: #1b1e20;
  transition: border-color 160ms ease, background 160ms ease;
}

.toggle-track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8a8e92;
  transition: left 160ms ease, background 160ms ease;
}

.scenario-toggle input:checked + .toggle-track {
  border-color: var(--teal);
  background: #0d3835;
}

.scenario-toggle input:checked + .toggle-track i {
  left: 23px;
  background: #9af1e5;
}

.scenario-toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.warp-settings {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 15px;
}

.warp-settings-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
  margin-bottom: 10px;
}

.warp-settings-head > span {
  color: #777b7f;
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
}

#warp-duration-result {
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 750;
  text-align: right;
}

.warp-setting-row {
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
}

.warp-setting-row > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

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

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

.warp-segmented button {
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--muted);
  padding: 7px 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.25;
  white-space: normal;
}

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

.warp-segmented button[aria-pressed="true"] {
  background: #0d3835;
  color: #9af1e5;
  box-shadow: inset 0 0 0 1px var(--teal);
}

.warp-segmented button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--focus);
  outline-offset: -3px;
}

.warp-equation-detail {
  margin: 11px 0 0;
  color: #85898d;
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.warp-equation-editor {
  border-top: 1px solid var(--line-soft);
  padding-top: 11px;
}

.warp-equation-editor > label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.warp-equation-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.warp-equation-input-row input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
}

.warp-equation-input-row input:focus-visible {
  border-color: var(--teal);
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.warp-equation-input-row input[aria-invalid="true"] {
  border-color: var(--ember);
}

.warp-equation-input-row input:disabled {
  color: #666a6e;
  cursor: not-allowed;
}

.warp-equation-input-row button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
}

.warp-equation-input-row button:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.warp-equation-input-row button:disabled {
  color: #55595d;
  cursor: not-allowed;
}

.warp-equation-input-row button svg {
  width: 17px;
  height: 17px;
}

.warp-equation-variables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.warp-equation-variables span {
  color: #85898d;
  font-size: 0.68rem;
  line-height: 1.4;
}

.warp-equation-variables strong {
  color: var(--teal);
}

.warp-equation-error {
  margin: 7px 0 0;
  color: #ff896f;
  font-size: 0.7rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: max(16px, calc((100vw - 390px) / 2 + 16px));
  bottom: max(16px, calc((100dvh - 844px) / 2 + 16px));
  z-index: 30;
  max-width: min(390px, calc(100vw - 44px));
  border: 1px solid #3a3e41;
  border-radius: var(--radius);
  background: #171a1c;
  color: var(--text);
  padding: 13px 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.42);
  font-size: 0.88rem;
  line-height: 1.45;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* The demo always renders as a single iPhone-sized product surface. */
.iphone-shell .topbar {
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  min-height: 60px;
  padding: 0 18px;
}

.iphone-shell .topbar nav {
  display: none;
}

.iphone-shell .recovery-app {
  width: calc(100% - 24px);
}

.iphone-shell .demo-switcher {
  display: block;
  min-height: auto;
  padding: 14px 0;
}

.iphone-shell .demo-switcher > span {
  display: block;
  margin-bottom: 9px;
}

.iphone-shell .state-tabs {
  grid-template-columns: repeat(4, 1fr);
}

.iphone-shell .state-tabs button {
  min-height: 50px;
  gap: 4px;
  flex-direction: column;
  font-size: 0.67rem;
}

.iphone-shell .state-tabs button span {
  max-width: 68px;
  line-height: 1.15;
  white-space: normal;
}

.iphone-shell .recovery-stage {
  display: grid;
  grid-template-rows: 218px auto;
}

.iphone-shell .phoenix-art {
  position: relative;
  inset: auto;
  grid-row: 1;
  width: 100%;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 76%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 76%, transparent 100%);
}

.iphone-shell .phoenix-art img {
  object-position: 63% 49%;
}

.iphone-shell .hero-copy {
  grid-row: 2;
  width: 100%;
  padding: 2px 0 28px;
}

.iphone-shell h1 {
  max-width: 100%;
  margin-bottom: 18px;
  font-size: 2.25rem;
}

.iphone-shell .streak-display {
  min-height: 60px;
}

.iphone-shell .streak-display strong {
  font-size: 3.45rem;
}

.iphone-shell .streak-display span {
  font-size: 1.05rem;
}

.iphone-shell .progress-head {
  align-items: flex-start;
}

.iphone-shell .activity-controls {
  margin-left: 0;
}

.iphone-shell .phase-row {
  justify-content: space-between;
}

.iphone-shell .freeze-planner,
.iphone-shell .action-bar {
  grid-template-columns: 1fr;
}

.iphone-shell .planner-field,
.iphone-shell .planner-field + .planner-field {
  min-height: auto;
  border-right: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 15px 0;
}

.iphone-shell .planner-field:last-child {
  border-bottom: 0;
}

.iphone-shell .action-bar {
  gap: 10px;
  padding: 18px 0 24px;
}

.iphone-shell .primary-action {
  grid-row: 1;
  width: 100%;
  min-width: 0;
}

.iphone-shell .legacy-stat {
  grid-row: 2;
  justify-content: center;
}

.iphone-shell .secondary-action {
  grid-row: 3;
  justify-self: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 850px) {
  .topbar {
    grid-template-columns: 1fr auto;
    min-height: 60px;
    padding: 0 18px;
  }

  .topbar nav {
    display: none;
  }

  .recovery-app {
    width: min(100% - 30px, var(--content));
  }

  .demo-switcher {
    display: block;
    min-height: auto;
    padding: 14px 0;
  }

  .demo-switcher > span {
    display: block;
    margin-bottom: 9px;
  }

  .state-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .state-tabs button {
    min-height: 50px;
    gap: 4px;
    flex-direction: column;
    font-size: 0.67rem;
  }

  .recovery-stage {
    display: grid;
    grid-template-rows: 245px auto;
  }

  .phoenix-art {
    position: relative;
    inset: auto;
    grid-row: 1;
    width: 100%;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 76%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 76%, transparent 100%);
  }

  .phoenix-art img {
    object-position: 63% 49%;
  }

  .hero-copy {
    grid-row: 2;
    width: 100%;
    padding: 2px 0 28px;
  }

  h1 {
    max-width: 620px;
    font-size: clamp(2.25rem, 10vw, 3.75rem);
  }

  .freeze-planner {
    grid-template-columns: 1fr;
  }

  .planner-field,
  .planner-field + .planner-field {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 15px 0;
  }

  .planner-field:last-child {
    border-bottom: 0;
  }

  .action-bar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px 0 24px;
  }

  .primary-action {
    grid-row: 1;
    width: 100%;
    min-width: 0;
  }

  .legacy-stat {
    grid-row: 2;
    justify-content: center;
  }

  .secondary-action {
    grid-row: 3;
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .recovery-app {
    width: min(100% - 24px, var(--content));
  }

  .state-tabs button span {
    max-width: 68px;
    line-height: 1.15;
    white-space: normal;
  }

  .recovery-stage {
    grid-template-rows: 218px auto;
  }

  h1 {
    margin-bottom: 18px;
    font-size: 2.25rem;
  }

  .streak-display {
    min-height: 60px;
  }

  .streak-display strong {
    font-size: 3.45rem;
  }

  .streak-display span {
    font-size: 1.05rem;
  }

  .progress-head {
    align-items: flex-start;
  }

  .activity-controls {
    margin-left: 0;
  }

  .phase-row {
    justify-content: space-between;
  }
}

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