/* FIRE 0.13 · a smaller masthead and the four growth levers within reach.
   Load last. No fixed viewport heights: narrow screens and enlarged text scroll. */
html, body { margin: 0; padding: 0; }
body { min-height: 100svh; }
#app { display: block; margin: 0; padding: 0; }
.app-header {
  height: auto;
  min-height: 68px;
  padding: calc(7px + env(safe-area-inset-top, 0px)) max(18px, calc((100vw - 1232px) / 2)) 7px;
  gap: 14px;
  margin-top: 0;
}
.app-header .fire-identity { gap: 8px; }
.app-header .fire-identity__emblem { width: 36px; height: 36px; flex-basis: 36px; }
.app-header .fire-identity__type { gap: 1px; }
.app-header .fire-identity__title { font-size: 36px; line-height: .98; letter-spacing: .075em; }
.app-header .fire-identity__subtitle { font-size: 10px; letter-spacing: 0; line-height: 1.25; }
.header-fire-number {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 10px;
  border: 1px solid #f1dbb628;
  border-radius: 10px;
  background: #fff4de09;
  color: #fff4de;
  text-align: left;
  line-height: 1.15;
}
.header-fire-number small { font-size: 10px; line-height: 1.25; color: #e7d9c3; white-space: nowrap; }
.header-fire-number strong { font-size: 18px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.header-fire-number:hover { background: #fff4de13; border-color: #f1dbb656; }
.app-header .header-actions { gap: 5px; }
.learning-level-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid #f1dbb635;
  border-radius: 10px;
  background: #fff4de07;
  color: #fff4de;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}
.learning-level-badge:hover { border-color: #f1dbb677; background: #fff4de13; }
.app-header .header-actions .icon-button { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 10px; }
.header-fire-number:focus-visible,
.learning-level-badge:focus-visible { outline: 3px solid #ffc887; outline-offset: 2px; }
.profile-settings form,
.fire-goal-estimator { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.profile-settings form > label,
.fire-goal-estimator > label { font-size: 13px; line-height: 1.45; color: var(--theme-ink, #264b3e); }
.profile-settings input,
.fire-goal-estimator input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #b5c5b4;
  border-radius: 10px;
  background: var(--theme-panel, #fffdf7);
  color: var(--theme-ink, #264b3e);
  font-size: 18px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.profile-settings .actions,
.fire-goal-estimator + .actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
.profile-settings .actions > button,
.fire-goal-estimator > button { min-height: 44px; }
.profile-settings .actions .text-button { text-align: left; }
#learning-level-settings { scroll-margin-top: 16px; }
#learning-level-settings > .subtext { margin-top: 10px; line-height: 1.6; }
.learning-level-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 12px; }
.learning-level-options button { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; min-height: 100px; padding: 15px 12px; border: 1px solid #bac8b6; border-radius: 12px; background: var(--theme-panel, #fffdf7); color: var(--theme-ink, #264b3e); text-align: left; }
.learning-level-options button strong { font-size: 14px; line-height: 1.3; }
.learning-level-options button small { font-size: 12px; line-height: 1.5; }
.learning-level-options button[aria-pressed=true] { border: 2px solid var(--theme-accent, #a46c33); padding: 14px 11px; box-shadow: inset 0 0 0 2px #b98a4520; }
.learning-level-options button[aria-pressed=true] strong:after { content: " ✓"; color: var(--theme-accent, #a46c33); }
.fire-goal-estimator .primary { align-self: flex-start; }
.fire-goal-estimator [data-fire-estimate]:not(:empty) { margin-top: 6px; padding: 17px; border: 1px solid #c1ccb8; border-radius: 12px; background: var(--theme-panel, #f6f8ed); }
.fire-goal-estimator [data-fire-estimate] strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fire-goal-estimator [data-fire-estimate] p { margin-top: 9px; }
.fire-goal-estimator [data-fire-estimate] button { min-height: 44px; margin-top: 13px; }
.beginner-tip { display: flex; align-items: flex-start; gap: 16px; max-width: 1160px; margin: 24px auto 0; padding: 16px 18px; border: 1px solid #c7d1bf; border-left: 3px solid var(--theme-accent, #b78043); border-radius: 12px; background: var(--theme-panel, #f9faf2); color: var(--theme-ink, #264b3e); }
.beginner-tip > div { flex: 1; min-width: 0; }
.beginner-tip strong { font-size: 13px; line-height: 1.45; }
.beginner-tip p { margin-top: 6px; font-size: 13px; line-height: 1.6; }
.beginner-tip > button { flex: 0 0 44px; min-width: 44px; min-height: 44px; margin: -7px -9px -7px 0; padding: 8px; font-size: 24px; line-height: 1; color: var(--theme-ink, #264b3e); }
.grow-controls-followup { display: flex; justify-content: flex-end; margin-top: 5px; }
.grow-controls-followup .grow-limit-link { min-height: 36px; text-align: right; }

/* Theme-wide heading rules must not turn the welcome card's text dark. */
.hero-card-mini { background: var(--theme-hero, #123e2d); color: #fff4df; }
.hero-card-mini :is(h1, h2, h3, strong) { color: #fff4df !important; }
.hero-card-mini p { color: #ebe3d1; }

/* Every lever has the same label, value, rail and endpoint slots. Native
   unit selectors retain a 44px hit height without making only that box taller. */
.grow-control-grid { align-items: stretch; }
.grow-control { display: grid; grid-template-rows: minmax(28px, auto) 50px 48px auto auto; align-content: start; }
.grow-control-label { min-height: 28px; margin: 0; align-items: center; }
.grow-value-field { height: 50px; min-height: 50px; padding: 0 7px; align-items: center; }
.grow-value-number { min-height: 48px; align-items: center; }
.grow-value-number input { min-height: 44px; padding-top: 0; padding-bottom: 0; }
.grow-value-field > .grow-unit { height: 44px; min-height: 44px; padding-top: 4px; padding-bottom: 4px; }
.grow-control .safe-slider { height: 44px; margin: 4px 0 0; }
.grow-control .safe-slider-rail { top: 19px; }
.grow-control .safe-slider-thumb { top: 6px; }
.grow-range-ends { min-height: 16px; margin-top: 0; align-items: flex-start; }
@supports (grid-template-rows: subgrid) {
  .grow-control-grid { row-gap: 0; grid-auto-rows: max-content; }
  .grow-control { grid-row: span 5; grid-template-rows: subgrid; row-gap: 0; padding-bottom: 10px; }
}

/* Keep save/apply controls beside the numbers, with one compact row that
   wraps instead of shrinking the labels on a narrow phone. */
.grow-plan-status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin: 12px 0 10px; padding-top: 10px; padding-bottom: 8px; border-top: 1px solid #cbd4c3; border-bottom: 0; }
.grow-plan-status-copy { min-width: 0; flex: 1 1 130px; color: var(--theme-ink, #264b3e); }
.grow-plan-status-copy strong { font-size: 13px; line-height: 1.3; }
.grow-plan-status-copy small { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; }
.grow-plan-status-actions { display: flex; flex: 0 1 auto; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 3px 8px; }
.grow-plan-status-actions button { min-height: 44px; min-width: 44px; font-size: 12px; line-height: 1.3; padding: 7px 9px; }
.plan-starting-editor { margin-top: 17px; }
.plan-starting-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.plan-starting-editor-grid > * { min-width: 0; }
.plan-starting-editor label { font-size: 13px; line-height: 1.4; }
.plan-starting-editor input, .plan-starting-editor select { min-width: 0; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #b5c5b4; border-radius: 9px; background: var(--theme-panel, #fffdf7); color: var(--theme-ink, #264b3e); font-size: 16px; }
.plan-starting-editor .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-starting-editor .actions button { min-height: 44px; }

/* Give the added goal and experience controls room on smaller laptops/tablets. */
@media (min-width: 851px) and (max-width: 1120px) {
  .app-header { flex-wrap: wrap; gap: 6px 14px; }
  .app-header .header-fire-number { margin-right: auto; }
  .app-header .desktop-nav { order: 3; flex: 1 0 100%; justify-content: center; margin-left: 0; gap: 6px; }
  .app-header .desktop-nav .nav-button { min-height: 44px; padding: 9px 14px; }
}

@media (max-width: 850px) {
  .app-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    min-height: calc(54px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(10px, env(safe-area-inset-right, 0px)) 4px max(10px, env(safe-area-inset-left, 0px));
    gap: 7px;
    align-items: center;
  }
  .app-header .desktop-nav { display: none; }
  .app-header .brand-lockup { min-height: 44px; flex: 0 0 auto; max-width: 100%; }
  .app-header .fire-identity { gap: 5px; }
  .app-header .fire-identity__emblem { width: 28px; height: 32px; flex-basis: 28px; }
  .app-header .fire-identity__type { gap: 2px; }
  .app-header .fire-identity__title { font-size: 30px; letter-spacing: .07em; }
  .app-header .fire-identity__subtitle { font-size: 9px; line-height: 1.2; }
  .app-header .header-fire-number { width: auto; flex: 1 1 80px; max-width: 185px; padding: 3px 7px; gap: 2px; }
  .app-header .header-fire-number small { font-size: 9px; }
  .app-header .header-fire-number strong { font-size: 16px; line-height: 1.2; letter-spacing: -.3px; }
  .app-header .header-actions { margin-left: 0; gap: 2px; }
  .app-header .learning-level-badge { padding: 4px 5px; font-size: 10px; }
  .app-header .header-actions .icon-button { width: 44px; height: 44px; }
  .app-header .header-actions .icon-button svg { width: 18px; height: 18px; }
  .content { padding-top: 8px; }
}

@media (max-width: 390px) and (min-width: 351px) {
  .app-header { gap: 4px; padding-right: max(8px, env(safe-area-inset-right, 0px)); padding-left: max(8px, env(safe-area-inset-left, 0px)); }
  .app-header .fire-identity { gap: 3px; }
  .app-header .fire-identity__emblem { width: 23px; height: 29px; flex-basis: 23px; }
  .app-header .fire-identity__title { font-size: 28px; }
  .app-header .fire-identity__subtitle { font-size: 8.5px; }
  .app-header .header-fire-number { padding-right: 5px; padding-left: 5px; }
  .app-header .header-fire-number strong { font-size: 15px; }
  .app-header .learning-level-badge { font-size: 9.5px; padding-right: 4px; padding-left: 4px; }
}

/* Retain the full goal and legible controls on very narrow screens. */
@media (max-width: 350px) {
  .app-header { gap: 5px 8px; padding-top: env(safe-area-inset-top, 0px); padding-bottom: 4px; }
  .app-header .brand-lockup { order: 0; flex-shrink: 1; }
  .app-header .header-actions { order: 1; margin-left: auto; }
  .app-header .header-fire-number { order: 2; flex: 1 0 100%; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; max-width: none; padding: 7px 10px; }
  .app-header .header-fire-number small { font-size: 11px; }
  .app-header .header-fire-number strong { font-size: 17px; }
  .app-header .fire-identity__subtitle { white-space: normal; }
}

@media (max-width: 700px) {
  .grow-intro { margin-bottom: 9px; }
  .grow-intro .grow-eyebrow { font-size: 10px; line-height: 1.3; letter-spacing: .5px; margin-bottom: 4px; }
  .grow-intro h1 { font-size: clamp(25px, 6.5vw, 31px); margin-top: 0; line-height: 1.08; }
  .grow-mode-switch { margin-bottom: 10px; padding: 3px; }
  .grow-mode-switch button { min-height: 44px; padding: 6px 8px; line-height: 1.25; }
  .grow-result { padding: 12px 14px 10px; }
  .grow-result-kicker { margin-bottom: 5px; font-size: 10px; line-height: 1.3; letter-spacing: .9px; }
  .grow-result .grow-amount { font-size: clamp(36px, 10.5vw, 46px); line-height: 1.06; }
  .grow-result > .money-companion { margin-top: 5px !important; font-size: 11px !important; line-height: 1.4 !important; }
  .grow-horizon { margin-top: 5px; gap: 3px 8px; font-size: 16px; line-height: 1.25; }
  .grow-horizon > span { font-size: 11px; }
  .grow-result-meta { margin-top: 6px; gap: 7px; }
  .grow-result-meta .grow-dollar-badge { font-size: 10px; padding: 4px 6px; }
  .grow-life-result-link { min-height: 44px; padding: 4px 8px; }
  .grow-life-result-link span { font-size: 10px; }
  .grow-life-result-link strong { font-size: 11px; }
  .grow-result:not(:has(.grow-target-answer)) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; column-gap: 7px; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-result-kicker { grid-column: 1 / -1; grid-row: 1; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-amount { grid-column: 1; grid-row: 2; align-self: center; }
  .grow-result:not(:has(.grow-target-answer)) > .money-companion { grid-column: 1 / -1; grid-row: 3; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-horizon { grid-column: 2; grid-row: 2; align-self: center; justify-content: flex-end; max-width: 100px; font-size: 14px; line-height: 1.2; text-align: right; margin: 0; gap: 2px 4px; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-horizon > span { width: 100%; font-size: 11px; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-result-meta { grid-column: 1 / -1; grid-row: 4; }
  .grow-result:not(:has(.grow-target-answer)) > .grow-comparison { grid-column: 1 / -1; grid-row: 5; }
  .grow-inputs { padding: 10px 12px 14px; }
  .grow-control-grid { column-gap: 12px; }
  .grow-control-label { min-height: 28px; margin-bottom: 0; }
  .grow-control-label > label { font-size: 12px; line-height: 1.25; }
  .grow-value-field { min-height: 50px; height: 50px; padding: 0 6px; }
  .grow-value-number { min-height: 48px; }
  .grow-value-field > .grow-unit { min-height: 44px; height: 44px; }
  .grow-control .safe-slider { height: 44px; margin-top: 4px; margin-bottom: 0; }
  .grow-control .safe-slider-rail { top: 19px; }
  .grow-control .safe-slider-thumb { top: 6px; }
  .grow-range-ends { margin-top: 0; font-size: 10px; line-height: 1.2; }
  .grow-control-note { margin-top: 3px; font-size: 11px; line-height: 1.3; }
  .grow-limit-link { margin-top: 2px; min-height: 32px; font-size: 10px; }
  .grow-controls-followup { margin-top: 3px; }
  .grow-controls-followup .grow-limit-link { min-height: 44px; margin-top: 0; font-size: 11px; }
  .grow-start-presets { margin-top: 12px; padding-top: 10px; }
  .grow-target-answer { gap: 3px; margin-top: 10px; }
  .grow-target-answer strong { font-size: 26px; }
  .grow-link-explanation { margin-top: 10px; }
  .grow-goal-entry { padding: 10px 14px; gap: 7px; }
  .grow-goal-entry .text-button { min-height: 44px; }
  .learning-level-options { grid-template-columns: 1fr; gap: 8px; }
  .learning-level-options button { min-height: 76px; gap: 4px; padding: 13px 14px; }
  .learning-level-options button[aria-pressed=true] { padding: 12px 13px; }
  .profile-settings .actions { align-items: stretch; flex-direction: column; }
  .profile-settings .actions > button { justify-content: center; }
  .beginner-tip { padding: 14px; gap: 9px; }
  .grow-plan-status-row { gap: 4px 9px; margin-bottom: 8px; padding-bottom: 5px; }
  .grow-plan-status-actions button { font-size: 11px; padding-right: 7px; padding-left: 7px; }
}

/* Reflow over squeezing numbers when browser text or viewport space is tight. */
@media (max-width: 350px) {
  .grow-control-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .grow-value-number input { font-size: 20px; }
  .grow-mode-switch button { font-size: 11px; }
  .plan-starting-editor-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (forced-colors: active) {
  .header-fire-number, .learning-level-badge { color: ButtonText; background: ButtonFace; border-color: ButtonText; }
  .header-fire-number small { color: ButtonText; }
  .hero-card-mini { color: CanvasText; background: Canvas; border: 1px solid CanvasText; }
  .hero-card-mini :is(h1, h2, h3, strong) { color: CanvasText !important; }
  .hero-card-mini p { color: CanvasText; }
}
