:root {
  --paper: #FDFCF7;
  --band: #E3EDE0;
  --band-light: #EEF3EB;
  --ink: #1F2E27;
  --forest: #3D6B52;
  --mustard: #B98B2A;
  --brick: #A1402C;
  --muted: #55625B;
  --font-serif: Source Serif 4, Source Serif Pro, Iowan Old Style, Palatino Linotype, Palatino, Georgia, serif;
  --font-mono: ui-monospace, SF Mono, Cascadia Code, Consolas, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

header {
  margin-bottom: 2.5rem;
}

h1 {
  font-weight: 600;
  font-size: 1.875rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-weight: 500;
  font-size: 1.25rem;
  margin: 0 0 1rem;
}

.intro {
  margin: 0;
  max-width: 55ch;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--forest);
  margin: 0 0 0.5rem;
}

button {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

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

button:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--forest);
  color: var(--paper);
  border-color: var(--forest);
}

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

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--band);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--band);
  border-color: var(--ink);
}

.btn-large {
  font-size: 1.0625rem;
  padding: 0.8rem 1.75rem;
}

.btn-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-text:hover:not(:disabled) {
  color: var(--ink);
  background: none;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}

input[type="number"],
select {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  width: 100%;
  max-width: 320px;
  transition: border-color 0.15s ease;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--forest);
}

input[type="number"].invalid {
  border-color: var(--brick);
}

.field-error {
  color: var(--brick);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}

.step-hint {
  color: var(--forest);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}

/* ---------- Info tips (small explainer icons) ---------- */

.info-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.3rem;
}

.info-tip-btn {
  width: 15px;
  height: 15px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1;
  cursor: help;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.info-tip-btn:hover,
.info-tip-btn:focus-visible,
.info-tip.open .info-tip-btn {
  border-color: var(--forest);
  color: var(--forest);
}

.info-tip-bubble {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  max-width: 60vw;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  padding: 0.6rem 0.7rem;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  z-index: 30;
}

.info-tip-bubble::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--ink);
}

.info-tip:hover .info-tip-bubble,
.info-tip-btn:focus-visible ~ .info-tip-bubble,
.info-tip.open .info-tip-bubble {
  display: block;
}

/* ---------- Landing screen ---------- */

#screen-landing {
  padding-top: 4rem;
}

#screen-landing h1 {
  font-size: 2.25rem;
  max-width: 14ch;
}

#screen-landing #start-btn {
  margin-top: 2.5rem;
  display: block;
}

.landing-note {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--forest);
  margin: 0.75rem 0 0;
}

.sample-ledger {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 1.25rem 0;
  margin-top: 2.5rem;
  opacity: 0.85;
}

/* ---------- Wizard ---------- */

#screen-wizard {
  padding-top: 3.5rem;
}

.wizard-progress {
  max-width: 480px;
  margin: 0 auto 2rem;
}

.wizard-progress-track {
  height: 3px;
  background: var(--band);
}

.wizard-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--forest);
  transition: width 0.3s ease;
}

.wizard-progress-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--forest);
  margin: 0.6rem 0 0;
}

.wizard-card {
  max-width: 480px;
  margin: 0 auto;
  border: 1px solid var(--ink);
  background: var(--paper);
  padding: 2.5rem 2rem;
}

.step-question {
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.35;
  margin: 0 0 1.5rem;
}

.step-field {
  margin-bottom: 1.25rem;
}

.step-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--forest);
  margin-bottom: 0.5rem;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--band);
}

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

#step-content.step-anim {
  animation: step-in 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  #step-content.step-anim {
    animation: none;
  }
}

/* ---------- Semester list (one page, quick toggles) ---------- */

.semester-list {
  margin: 0 0 1rem;
}

.semester-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--ink);
}

.semester-row:last-child {
  border-bottom: 1px solid var(--ink);
}

.semester-row .sem-label {
  font-family: var(--font-serif);
  font-size: 0.95rem;
}

.flag-toggle {
  display: flex;
  border: 1px solid var(--ink);
  flex-shrink: 0;
}

.flag-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-right: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.flag-btn:last-child {
  border-right: none;
}

.flag-btn:hover:not(.active) {
  background: var(--band);
}

.flag-btn.active {
  background: var(--forest);
  color: var(--paper);
}

@media (max-width: 480px) {
  .semester-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ---------- Model picker (descriptive cards) ---------- */

.model-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.model-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid var(--ink);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.model-option:hover {
  background: var(--band);
}

.model-option.selected {
  background: var(--band);
  border-color: var(--forest);
}

.model-option input[type="radio"] {
  margin-top: 0.3rem;
  accent-color: var(--forest);
  flex-shrink: 0;
}

.model-option-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.model-name {
  font-family: var(--font-serif);
  font-weight: 500;
}

.model-desc {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1.5;
}

/* ---------- Requirement checklist (its own wizard step) ---------- */

.step-subtext {
  font-size: 0.9rem;
  opacity: 0.75;
  margin: -0.75rem 0 1.25rem;
}

#requirement-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

#requirement-checklist li {
  border-top: 1px solid var(--ink);
}

#requirement-checklist li:last-child {
  border-bottom: 1px solid var(--ink);
}

#requirement-checklist .checklist-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
}

#requirement-checklist .status-group {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

#requirement-checklist .status-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--forest);
  cursor: pointer;
  white-space: nowrap;
}

#requirement-checklist input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--forest);
  flex-shrink: 0;
  cursor: pointer;
}

#requirement-checklist .req-name {
  flex: 1;
  font-family: var(--font-serif);
}

#requirement-checklist .req-difficulty {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--forest);
  white-space: nowrap;
}

#requirement-checklist li.done .req-name {
  text-decoration: line-through;
  opacity: 0.6;
}

/* ---------- Landing sample ledger (decorative, unrelated to plan screen) ---------- */

.semester-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.semester-head .label {
  font-family: var(--font-serif);
  font-size: 1.1rem;
}

.bar-track {
  height: 10px;
  background: var(--band);
  margin: 0.6rem 0 0.8rem;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--forest);
  transition: width 0.4s ease;
}

.band-items {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.band-items li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
}

.band-items li::before {
  content: "·";
  margin-right: 0.5rem;
}

footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ink);
  font-size: 0.875rem;
  opacity: 0.7;
}

footer p {
  margin: 0;
}

/* ---------- Plan screen: horizontal card timeline ---------- */

body.plan-active {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.plan-active > footer {
  display: none;
}

#screen-plan {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

#screen-plan[hidden] {
  display: none;
}

.plan-header {
  flex: none;
  padding: 40px 40px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px 32px;
}

.plan-header-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-header-left h1 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}

.plan-summary {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
}

.plan-summary .brick {
  color: var(--brick);
}

.plan-nav-btns {
  display: flex;
  gap: 10px;
}

.plan-nav-btn {
  width: 40px;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.plan-nav-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.plan-scroller {
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  scroll-snap-type: x proximity;
  scroll-padding: 0 40px;
  overscroll-behavior: contain;
}

.plan-track {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 28px 40px 32px;
  width: max-content;
  min-height: 100%;
  box-sizing: border-box;
}

.plan-spine-bg,
.plan-spine-fill {
  position: absolute;
  left: 40px;
  right: 40px;
  top: 40px;
  height: 1px;
}

.plan-spine-bg {
  background: var(--band);
}

.plan-spine-fill {
  background: var(--ink);
  width: 0%;
}

.plan-column {
  flex: none;
  width: 272px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-snap-align: start;
}

.plan-marker {
  height: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.plan-dot {
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.4), background-color 0.25s ease;
}

.plan-dot.current {
  border-color: var(--forest);
  background: var(--forest);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--forest);
}

.plan-dot.gap {
  border-style: dashed;
}

.plan-column:hover .plan-dot {
  background: var(--ink);
  transform: scale(1.3);
}

.plan-column:hover .plan-dot.current {
  background: var(--forest);
}

.plan-year-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--forest);
  background: var(--paper);
  padding-right: 6px;
}

.plan-year-label.brick {
  color: var(--brick);
}

.plan-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ink);
  background: var(--paper);
  transform: translate(0, 0);
  box-shadow: 0 0 0 var(--ink);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.25s ease;
}

.plan-card:hover {
  transform: translate(-4px, -4px);
  box-shadow: 6px 6px 0 var(--ink);
}

.plan-card.current {
  background: var(--band);
}

.plan-card.current:hover {
  box-shadow: 6px 6px 0 var(--forest);
}

.plan-card.gap {
  border-style: dashed;
  opacity: 0.6;
}

.plan-card-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.plan-term {
  font-family: var(--font-serif);
  font-size: 1.4375rem;
  line-height: 1.2;
}

.plan-card.gap .plan-term {
  font-style: italic;
}

.plan-ratio-wrap {
  display: inline-flex;
  align-items: center;
  flex: none;
}

.plan-ratio {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.plan-bar-track {
  height: 8px;
  background: var(--band);
  overflow: hidden;
  display: flex;
  gap: 2px;
  transition: box-shadow 0.2s ease;
}

.plan-card.current .plan-bar-track,
.plan-card.gap .plan-bar-track {
  background: transparent;
}

.plan-bar-segment {
  height: 100%;
  width: 0%;
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease, opacity 0.2s ease;
}

.plan-tag {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.875rem;
  min-height: 18px;
  margin: 0;
  transition: color 0.2s ease;
}

.plan-slots {
  display: flex;
  flex-direction: column;
}

.plan-slot {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 8px 18px;
  box-sizing: border-box;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.plan-slot:not(:first-child) {
  border-top: 1px solid var(--band);
}

.plan-slot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.plan-slot-warning {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--brick);
  margin: 0;
}

.plan-slot-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.plan-slot-code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-height: 14px;
}

.plan-slot-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.25;
  text-wrap: pretty;
}

.plan-slot-name.empty {
  font-style: italic;
  color: var(--muted);
}

.plan-slot-name.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-slot-credits {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plan-card-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.plan-footer {
  flex: none;
  padding: 18px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.plan-footer-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.plan-footer-copyright {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 480px) {
  .plan-header {
    padding: 24px 20px 16px;
  }

  .plan-header-left h1 {
    font-size: 1.75rem;
  }

  .plan-track {
    padding: 24px 20px 28px;
  }

  .plan-spine-bg,
  .plan-spine-fill {
    left: 20px;
    right: 20px;
  }

  .plan-column {
    width: 230px;
  }

  .plan-footer {
    padding: 14px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (max-width: 480px) {
  body {
    padding: 2rem 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .wizard-card {
    padding: 1.5rem 1.25rem;
  }

  #requirement-checklist .checklist-row {
    flex-wrap: wrap;
  }

  #requirement-checklist .req-difficulty {
    margin-left: auto;
  }
}
