:root {
  --bg: #141210;
  --bg-elevated: #1c1916;
  --bg-card: #221e1a;
  --bg-card-hover: #2a251f;
  --cream: #f3ead7;
  --cream-muted: #c4b8a0;
  --cream-dim: #8a8070;
  --amber: #d4a24c;
  --amber-soft: #e8c078;
  --amber-glow: rgba(212, 162, 76, 0.18);
  --line: rgba(243, 234, 215, 0.08);
  --success: #7dba7a;
  --radius: 14px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --max: 720px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--cream);
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 162, 76, 0.09), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(212, 162, 76, 0.04), transparent);
}

button, input { font: inherit; color: inherit; }

a { color: var(--amber-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.15rem 4rem;
  min-height: 100dvh;
}

/* Header */
.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  font-family: var(--font);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cream);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.brand span { color: var(--amber); }

.nav-link {
  background: none;
  border: none;
  color: var(--cream-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
}
.nav-link:hover { color: var(--amber); }

/* Overhead */
.overhead {
  font-family: var(--font);
  font-size: clamp(1.15rem, 4.2vw, 1.45rem);
  line-height: 1.4;
  color: var(--cream);
  text-align: center;
  padding: 1.35rem 1.1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--bg-elevated), var(--bg-card));
  box-shadow: 0 0 0 1px var(--amber-glow);
}

.overhead em {
  font-style: italic;
  color: var(--amber-soft);
}

/* Search */
.search-wrap { margin-bottom: 1.25rem; position: relative; }

.search-wrap input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--cream);
  outline: none;
}
.search-wrap input:focus {
  border-color: rgba(212, 162, 76, 0.45);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.search-wrap input::placeholder { color: var(--cream-dim); }

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cream-dim);
  pointer-events: none;
  font-size: 0.95rem;
}

/* Sections */
.section-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 1.75rem 0 0.75rem;
  font-weight: 600;
}

/* Cards */
.course-list, .path-list { display: flex; flex-direction: column; gap: 0.75rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.card:hover, .card:focus-visible {
  background: var(--bg-card-hover);
  border-color: rgba(212, 162, 76, 0.28);
  outline: none;
}
.card:active { transform: scale(0.995); }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.75rem;
  color: var(--cream-dim);
  margin-bottom: 0.4rem;
}
.card-meta .pill {
  color: var(--amber);
  background: var(--amber-glow);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}

.card h3 {
  font-family: var(--font);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  color: var(--cream);
}

.card p.tagline {
  font-size: 0.92rem;
  color: var(--cream-muted);
}

.path-card .path-courses {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--cream-dim);
}
.path-progress {
  margin-top: 0.7rem;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.path-progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-soft));
  border-radius: 999px;
  transition: width 0.3s;
}

/* Length picker */
.length-screen h2, .course-view h2, .complete-screen h2 {
  font-family: var(--font);
  font-size: 1.55rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.subhead {
  color: var(--cream-muted);
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
}

.length-options { display: flex; flex-direction: column; gap: 0.7rem; }

.length-btn {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.length-btn:hover, .length-btn.recommended {
  border-color: rgba(212, 162, 76, 0.4);
}
.length-btn.recommended {
  background: linear-gradient(135deg, rgba(212,162,76,0.12), var(--bg-card));
}
.length-btn strong {
  display: block;
  font-family: var(--font);
  font-size: 1.08rem;
  margin-bottom: 0.2rem;
}
.length-btn .rec {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--amber);
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  font-family: var(--sans);
  font-weight: 600;
}
.length-btn span.desc {
  display: block;
  color: var(--cream-muted);
  font-size: 0.88rem;
}

.back-btn {
  background: none;
  border: none;
  color: var(--cream-muted);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
  padding: 0;
}
.back-btn:hover { color: var(--amber); }

/* Progress */
.progress-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem;
  gap: 1.2rem;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-screen p { color: var(--cream-muted); font-family: var(--font); font-size: 1.1rem; }

/* Summary view */
.attr-bar {
  font-size: 0.78rem;
  color: var(--cream-dim);
  padding: 0.75rem 0.9rem;
  border-left: 2px solid var(--amber);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0 1.4rem;
  line-height: 1.45;
}

.tts-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.btn-primary, .btn-ghost {
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
}
.btn-primary {
  background: var(--amber);
  color: #1a1510;
}
.btn-primary:hover { background: var(--amber-soft); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--cream-muted);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }

.speed-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--cream-dim);
}
.speed-wrap input[type="range"] {
  width: 90px;
  accent-color: var(--amber);
}

.summary-section {
  margin-bottom: 1.6rem;
}
.summary-section h3 {
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--amber);
  margin-bottom: 0.55rem;
  letter-spacing: 0.02em;
}
.summary-section .intro {
  color: var(--cream-muted);
  margin-bottom: 0.9rem;
  font-size: 1.02rem;
}
.summary-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.summary-section li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--cream);
  font-size: 0.98rem;
}
.summary-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.week-block {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.55rem;
}
.week-block h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  color: var(--cream);
}
.week-block ul { gap: 0.3rem; }
.week-block li { font-size: 0.88rem; color: var(--cream-muted); }

.mark-done {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.9rem;
  font-size: 1rem;
}

/* Complete */
.complete-screen {
  text-align: center;
  padding: 2.5rem 0.5rem;
}
.complete-icon {
  font-size: 2.4rem;
  margin-bottom: 0.8rem;
  color: var(--amber);
}
.complete-screen h2 { margin-bottom: 0.6rem; }
.complete-screen p {
  color: var(--cream-muted);
  margin-bottom: 1.6rem;
  font-size: 1.05rem;
}
.complete-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 320px;
  margin: 0 auto;
}
.complete-actions button { width: 100%; padding: 0.85rem; }

.hidden { display: none !important; }

.empty {
  text-align: center;
  color: var(--cream-dim);
  padding: 2rem 1rem;
  font-size: 0.95rem;
}

footer.site-foot {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  color: var(--cream-dim);
  text-align: center;
  line-height: 1.5;
}

@media (min-width: 600px) {
  .app { padding: 2rem 1.5rem 4rem; }
  .brand { font-size: 1.65rem; }
}

/* Narrative prose */
.summary-section p.prose {
  color: var(--cream);
  font-size: 1.05rem;
  line-height: 1.7;
  font-family: var(--font);
  margin: 0;
}
.summary-section.recap ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.summary-section.recap li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--cream-muted);
  font-size: 0.95rem;
}
.summary-section.recap li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 50;
}
.modal.hidden { display: none !important; }
.modal-card {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid rgba(212, 162, 76, 0.35);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.modal-card h2 {
  font-family: var(--font);
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
}
.modal-sub {
  color: var(--cream-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
  line-height: 1.45;
}
.field-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.35rem;
}
#diploma-name {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  margin-bottom: 1rem;
  outline: none;
}
#diploma-name:focus {
  border-color: rgba(212, 162, 76, 0.5);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* Diploma */
.diploma-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  justify-content: center;
}
.diploma {
  background: #f7f0e1;
  color: #2a2418;
  border-radius: 8px;
  padding: 0.65rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
.diploma-border {
  border: 3px solid #c9a24a;
  padding: 0.45rem;
  background: linear-gradient(135deg, #faf6ec, #f3ead7 40%, #faf6ec);
}
.diploma-inner {
  border: 1px solid rgba(168, 130, 55, 0.45);
  padding: 1.6rem 1.35rem 1.35rem;
  text-align: center;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
.diploma-issuer {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: #8a6a28;
  margin-bottom: 0.55rem;
}
.diploma-heading {
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  color: #1f1a12;
  margin-bottom: 0.85rem;
  font-weight: 600;
}
.diploma-presented, .diploma-achieved {
  color: #5c5346;
  font-size: 0.95rem;
  font-style: italic;
}
.diploma-name {
  font-size: clamp(1.55rem, 5.5vw, 2.35rem);
  color: #1a1510;
  margin: 0.45rem 0 0.65rem;
  border-bottom: 1px solid rgba(168, 130, 55, 0.55);
  display: inline-block;
  min-width: 55%;
  padding: 0 0.75rem 0.2rem;
  font-weight: 600;
}
.diploma-path {
  font-size: clamp(1.15rem, 3.8vw, 1.45rem);
  color: #8a6a28;
  margin: 0.35rem 0 1rem;
  font-weight: 600;
}
.diploma-courses-label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a6a28;
  margin-bottom: 0.45rem;
}
.diploma-courses {
  list-style: none;
  text-align: left;
  max-width: 34rem;
  margin: 0 auto 1.15rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.diploma-courses li {
  font-size: 0.88rem;
  color: #3a3226;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px dotted rgba(168, 130, 55, 0.35);
}
.diploma-courses strong {
  color: #8a6a28;
  margin-right: 0.35rem;
}
.diploma-footer-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.85rem;
}
.diploma-meta-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6a28;
}
.diploma-meta {
  font-size: 0.85rem;
  color: #2a2418;
  margin-top: 0.15rem;
}
.diploma-seal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px double #c9a24a;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background: radial-gradient(circle at 35% 30%, #f0d78a, #c9a24a 55%, #8a6a28);
  color: #fff8e7;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  box-shadow: inset 0 0 0 4px rgba(255,248,231,0.25);
}
.diploma-disclaimer {
  font-size: 0.68rem;
  line-height: 1.45;
  color: #6b6254;
  max-width: 36rem;
  margin: 0.5rem auto 0.35rem;
}
.diploma-issued {
  font-size: 0.75rem;
  color: #8a6a28;
  letter-spacing: 0.06em;
  margin-top: 0.25rem;
}

body.diploma-mode .app {
  max-width: 920px;
}

@media print {
  @page {
    size: letter landscape;
    margin: 0.45in;
  }
  body {
    background: #fff !important;
    background-image: none !important;
    color: #000;
  }
  body * { visibility: hidden; }
  #view-diploma, #view-diploma * { visibility: visible; }
  #view-diploma {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
  }
  .no-print, .topbar, .modal { display: none !important; }
  .app { max-width: none; padding: 0; margin: 0; }
  .diploma {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    width: 100%;
    min-height: auto;
  }
  .diploma-border { padding: 0.35in; }
  .diploma-inner { padding: 0.35in 0.45in; }
  .diploma-heading { font-size: 28pt; }
  .diploma-name { font-size: 26pt; }
  .diploma-path { font-size: 16pt; }
  .diploma-courses li { font-size: 10.5pt; }
  .diploma-disclaimer { font-size: 8pt; }
}
