@font-face {
  font-family: "Tenor Sans";
  src: url("assets/fonts/TenorSans-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-wght.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fffdf9;
  --cream: #f7f1e8;
  --cream-deep: #efe4d4;
  --ink: #1b1712;
  --muted: #675f55;
  --line: #d9cbb7;
  --line-strong: #bca98e;
  --gold: #a87933;
  --gold-deep: #7d5620;
  --terracotta: #b8753f;
  --sage: #728b76;
  --sage-soft: #e4ece4;
  --rose-soft: #f6e7e1;
  --danger: #8c3f32;
  --shadow: 0 18px 50px rgb(63 46 27 / 0.09);
  --radius: 18px;
  --radius-small: 11px;
  --content-width: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 16px/1.65 "Manrope", system-ui, sans-serif;
  overflow-wrap: anywhere;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--gold-deep); }
img { max-width: 100%; }

h1, h2, h3 {
  margin: 0;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  line-height: 1.15;
}

h1 { font-size: clamp(2rem, 5vw, 4.35rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.35rem); }
h3 { font-size: clamp(1.18rem, 2vw, 1.55rem); }
p { margin: 0 0 1em; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus { top: 12px; }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.mobile-only { display: none; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 16px clamp(18px, 3vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 253 249 / 0.96);
}

.topbar__brand,
.topbar__actions,
.brand-footer__identity,
.brand-footer__link,
.dialog__heading,
.dialog__actions,
.step-actions,
.status-actions,
.field-actions {
  display: flex;
  align-items: center;
}

.topbar__brand { min-width: 0; gap: 13px; }
.topbar__actions { justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.topbar__logo { width: 52px; height: 52px; object-fit: contain; }
.topbar__title { margin: 0; font: 400 1.24rem/1.1 "Tenor Sans", Georgia, serif; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold-deep);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  line-height: 1.35;
  text-transform: uppercase;
}

.button,
.icon-button,
.day-button,
.step-button,
.choice-button,
.body-region-button {
  border: 1px solid transparent;
  cursor: pointer;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: 0.46; transform: none; }
.button--primary { background: var(--ink); color: var(--paper); }
.button--quiet { border-color: var(--line); background: var(--paper); color: var(--ink); }
.button--danger { border-color: #d6aaa0; background: var(--rose-soft); color: var(--danger); }

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
}

.save-status {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.global-notice {
  margin: 14px clamp(18px, 3vw, 46px) 0;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper);
  color: var(--muted);
}

.workspace {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  flex: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 62px);
  padding: clamp(26px, 4vw, 58px) clamp(18px, 4vw, 64px) 70px;
}

.sidebar {
  min-width: 0;
  align-self: start;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-gutter: stable;
}

.sidebar__intro { margin-bottom: 24px; }
.sidebar__intro h2 { margin-bottom: 9px; }
.progress-track { height: 5px; border-radius: 99px; background: var(--cream-deep); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 250ms ease; }

.day-navigation { display: grid; gap: 24px; }
.week-group { display: grid; gap: 7px; }
.week-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; }
.week-heading h3 { font-size: 1rem; }
.week-heading span { color: var(--muted); font-size: 0.75rem; }

.day-button {
  min-height: 49px;
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.day-button:hover { background: rgb(255 253 249 / 0.7); }
.day-button.is-active { background: var(--paper); border-color: var(--line); box-shadow: 0 8px 24px rgb(58 40 20 / 0.06); }
.day-button.is-locked { color: var(--muted); cursor: not-allowed; }
.day-button__number { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 0.74rem; }
.day-button__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; font-weight: 650; }
.day-button__status { color: var(--sage); text-align: center; }

.pdf-library {
  margin: 0 0 28px;
  padding: 19px 0 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.pdf-library h3 { font-size: 1.05rem; }
.pdf-library__intro { margin: 7px 0 14px; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.pdf-part-list { display: grid; gap: 7px; }

.pdf-part {
  min-height: 54px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.pdf-part.is-available { background: var(--paper); }
.pdf-part.is-available:hover { border-color: var(--sage); }
.pdf-part.is-locked { color: var(--muted); }
.pdf-part__symbol { color: var(--sage); font-size: 1.15rem; text-align: center; }
.pdf-part__copy { min-width: 0; display: grid; line-height: 1.3; }
.pdf-part__copy strong { font-size: 0.78rem; }
.pdf-part__copy span { color: var(--muted); font-size: 0.7rem; }
.pdf-part__state { color: var(--sage); font-size: 0.68rem; font-weight: 700; white-space: nowrap; }

.sidebar__privacy {
  margin-top: 28px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
.sidebar__privacy strong { color: var(--ink); }
.sidebar__privacy p { margin: 5px 0 0; }

.main-stage { min-width: 0; }
.state-view { min-height: 56vh; display: grid; justify-items: center; align-content: center; text-align: center; padding: 50px 20px; }
.state-view img { margin-bottom: 17px; }
.state-view p:not(.eyebrow) { max-width: 600px; color: var(--muted); }
.state-view .button { margin-top: 10px; }

.day-view { width: 100%; max-width: var(--content-width); }
.day-header { margin-bottom: 27px; }
.day-header__meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 13px; }
.tag { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.tag--safety { border-color: #d9ac9d; background: var(--rose-soft); color: var(--danger); }
.day-header h1 { max-width: 18ch; }
.day-header__technique { margin: 12px 0 0; color: var(--gold-deep); font-weight: 700; }

.step-navigation {
  margin: 0 0 32px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
}

.step-button {
  width: 100%;
  min-height: 44px;
  padding: 8px;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.step-button.is-active { border-color: var(--gold); color: var(--ink); }
.step-button.is-complete::before { content: "✓ "; color: var(--sage); }

.step-content { min-height: 420px; }
.step-panel { display: grid; gap: 27px; }
.section-heading { max-width: 720px; }
.section-heading h2 { margin-bottom: 9px; }
.section-heading p { color: var(--muted); }

.hero-grid,
.practice-grid,
.form-grid,
.dialogue-grid,
.media-grid,
.body-map-layout {
  display: grid;
  gap: 22px;
}

.hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(250px, 0.75fr); align-items: start; }
.practice-grid { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr); align-items: start; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dialogue-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.body-map-layout { grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.2fr); align-items: start; }

.paper-card {
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.paper-card h3 { margin-bottom: 12px; }
.paper-card > :last-child { margin-bottom: 0; }
.content-quote {
  padding: 12px 0 12px 16px;
  border-left: 3px solid var(--gold);
  color: var(--muted);
}

.meaning-card { border-left: 4px solid var(--gold); }
.question-card { background: var(--sage-soft); border-color: #bdcdbf; box-shadow: none; }
.safety-card { background: var(--rose-soft); border-color: #dbb7ad; box-shadow: none; }
.support-card { background: var(--sage-soft); border-color: #b8c9ba; box-shadow: none; }

.day-image {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  background: var(--cream-deep);
  object-fit: cover;
  box-shadow: var(--shadow);
}
.day-image--portrait { aspect-ratio: 2 / 3; }
.day-image--square { aspect-ratio: 1; object-fit: contain; }
.image-caption { margin: 8px 4px 0; color: var(--muted); font-size: 0.74rem; }

.instruction-list { margin: 0; padding: 0; display: grid; gap: 13px; list-style: none; counter-reset: steps; }
.instruction-list li { position: relative; padding: 4px 0 4px 47px; counter-increment: steps; }
.instruction-list li::before { content: counter(steps); position: absolute; left: 0; top: 0; width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold-deep); font-weight: 750; }

.field-group { min-width: 0; }
.field-group > label,
.field-label,
.dialog label { display: block; margin-bottom: 7px; font-weight: 750; }
.field-hint { margin: -2px 0 9px; color: var(--muted); font-size: 0.8rem; }

input[type="text"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  outline: none;
  background: var(--paper);
  color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgb(168 121 51 / 0.28); outline-offset: 2px; }

.repeatable { display: grid; gap: 14px; }
.repeatable-row { position: relative; display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.repeatable-row__number { color: var(--gold-deep); font-size: 0.78rem; font-weight: 800; }
.repeatable-row__remove { position: absolute; right: 9px; top: 7px; width: 38px; height: 38px; }
.field-actions { gap: 9px; flex-wrap: wrap; }

.check-list,
.choice-list { display: grid; gap: 9px; }
.check-option { min-height: 47px; display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--paper); }
.check-option input { width: 19px; height: 19px; margin-top: 2px; accent-color: var(--gold-deep); }

.choice-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice-button { min-height: 48px; padding: 10px 12px; border-color: var(--line); border-radius: var(--radius-small); background: var(--paper); color: var(--ink); }
.choice-button.is-selected { border-color: var(--gold); background: #faf1df; }
.custom-option { padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-small); }
.custom-option.is-selected { border-color: var(--gold); background: #faf1df; }

.dialogue-card { padding: 19px; border-top: 2px solid var(--gold); background: var(--paper); }
.dialogue-card h3 { font-size: 1.18rem; }

.body-map {
  min-height: 430px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--paper), #f4eadc);
}
.body-map svg { width: min(100%, 270px); height: auto; overflow: visible; }
.body-map__outline { fill: #f2e3d0; stroke: var(--line-strong); stroke-width: 2; }
.body-map__zone { fill: rgb(255 253 249 / 0.82); stroke: var(--gold); stroke-width: 2; cursor: pointer; transition: fill 150ms ease; }
.body-map__zone[data-value="warm"] { fill: #e8b276; }
.body-map__zone[data-value="tense"] { fill: #cb806b; }
.body-map__zone[data-value="quiet"] { fill: #a8c0aa; }
.body-map__zone[data-value="numb"] { fill: #b4bec6; }
.body-map__zone[data-value="storm"] { fill: #aa8093; }
.body-map__zone[data-value="clear"] { fill: #ecdca2; }
.body-region-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.body-region-button { min-height: 48px; padding: 9px 10px; border-color: var(--line); border-radius: var(--radius-small); background: var(--paper); color: var(--ink); text-align: left; }
.body-region-button strong, .body-region-button span { display: block; }
.body-region-button span { color: var(--muted); font-size: 0.72rem; }

.drawing-shell { display: grid; gap: 12px; }
.drawing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.drawing-canvas-wrap { position: relative; min-height: 480px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--paper); touch-action: none; }
.drawing-canvas-wrap canvas { width: 100%; height: 480px; display: block; touch-action: none; cursor: crosshair; }
.drawing-prompt { position: absolute; inset: 18px; display: grid; place-items: center; pointer-events: none; color: rgb(103 95 85 / 0.32); font: 400 clamp(1.4rem, 4vw, 2.7rem)/1.2 "Tenor Sans", Georgia, serif; text-align: center; }

.status-actions { align-items: stretch; gap: 10px; flex-wrap: wrap; }
.status-actions .button { flex: 1 1 170px; border-radius: var(--radius-small); }
.status-actions .button.is-selected { border-color: var(--gold); background: #f8edda; color: var(--ink); }

.step-actions { justify-content: space-between; gap: 15px; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }

.brand-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 64px);
  border-top: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.035em;
}
.brand-footer__identity { min-width: 0; gap: 9px; white-space: nowrap; }
.brand-footer__divider { color: var(--line-strong); font-weight: 400; }
.brand-footer__link { flex: 0 0 auto; color: var(--ink); text-decoration: none; font: inherit; white-space: nowrap; }
.brand-footer__link:hover span { text-decoration: underline; text-underline-offset: 3px; }

.dialog {
  width: min(620px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgb(38 26 13 / 0.2);
}
.dialog::backdrop { background: rgb(27 23 18 / 0.46); backdrop-filter: blur(3px); }
.dialog form { padding: 25px; }
.dialog__heading { justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.dialog__actions { align-items: stretch; gap: 9px; flex-wrap: wrap; margin-top: 20px; }
.dialog__actions > * { flex: 1 1 150px; }

.toast {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
}

@media (max-width: 1100px) {
  .topbar { align-items: flex-start; }
  .workspace { grid-template-columns: 250px minmax(0, 1fr); gap: 28px; }
  .hero-grid, .practice-grid { grid-template-columns: 1fr; }
  .hero-grid .day-image { max-height: 600px; object-fit: cover; }
}

@media (max-width: 820px) {
  .mobile-only { display: inline-flex; }
  .topbar { align-items: center; padding: 12px 14px; }
  .topbar__logo { width: 43px; height: 43px; }
  .topbar__brand .eyebrow { display: none; }
  .topbar__actions .button--quiet, .save-status { display: none; }
  .topbar__actions .button { min-height: 44px; padding-inline: 13px; }
  .workspace { display: block; padding: 24px 16px 52px; }
  .sidebar { display: none; position: static; max-height: none; overflow: visible; margin: 0 0 24px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
  .sidebar.is-open { display: block; }
  .mobile-daybar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
  .mobile-daybar label { flex: 0 0 auto; font-size: 0.78rem; font-weight: 750; }
  .mobile-daybar select { min-height: 44px; padding-block: 8px; }
  .main-stage, .day-view { width: 100%; }
  .day-header h1 { max-width: none; }
  .step-navigation { margin-bottom: 24px; gap: 2px; }
  .step-button { padding-inline: 3px; font-size: 0.72rem; }
  .form-grid, .dialogue-grid, .media-grid, .body-map-layout { grid-template-columns: 1fr; }
  .body-map { min-height: 380px; }
  .drawing-canvas-wrap, .drawing-canvas-wrap canvas { min-height: 420px; height: 420px; }
  .brand-footer { align-items: flex-start; flex-direction: column; gap: 7px; font-size: clamp(0.6rem, 2.4vw, 0.64rem); }
  .brand-footer__identity { max-width: 100%; gap: 6px; white-space: nowrap; }
  .toast { right: 12px; bottom: 12px; }
}

@media (max-width: 480px) {
  .topbar__title { font-size: 1rem; }
  .topbar__actions { gap: 5px; }
  #desktop-link-button { font-size: 0; width: 44px; padding: 0; }
  #desktop-link-button::before { content: "↗"; font-size: 1.1rem; }
  .paper-card { padding: 19px 16px; }
  .step-navigation { grid-template-columns: repeat(4, 1fr); }
  .step-button { white-space: normal; }
  .body-region-list { grid-template-columns: 1fr; }
  .step-actions .button { min-width: 92px; }
  .brand-footer { padding-block: 14px; }
}

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

@media print {
  .topbar, .sidebar, .mobile-daybar, .step-navigation, .step-actions { display: none !important; }
  .workspace { display: block; padding: 0; }
  .day-view { max-width: none; }
  .brand-footer { break-inside: avoid; }
}
