:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --navy: #14213d;
  --blue: #244d8f;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --orange: #e75b2d;
  --orange-soft: #fff0e8;
  --green: #16775c;
  --line: #ddd8cd;
  --shadow: 0 10px 30px rgba(20, 33, 61, 0.08);
}

* { box-sizing: border-box; }

html { background: var(--cream); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -5%, rgba(231, 91, 45, 0.15), transparent 28rem),
    var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, label, summary { -webkit-tap-highlight-color: transparent; }

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.1rem 1.25rem;
  color: white;
  background: var(--navy);
}

.eyebrow, .section-kicker {
  margin: 0 0 0.18rem;
  color: var(--orange);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1, h2, p { margin-top: 0; }
.app-header h1 { margin-bottom: 0.25rem; font-size: clamp(1.55rem, 7vw, 2.25rem); line-height: 1.15; }
.summary { margin: 0; color: #cbd5e1; font-size: 0.84rem; }

.status-badge {
  flex: 0 0 auto;
  margin-top: 0.15rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  color: #e2e8f0;
  font-size: 0.68rem;
  font-weight: 700;
}
.status-badge.offline { color: #ffe0a3; border-color: #ffe0a3; }

main { width: min(100%, 42rem); margin: 0 auto; padding: 1rem 0.8rem calc(2rem + env(safe-area-inset-bottom)); }

.panel, .exercise-card, .copy-panel {
  margin-bottom: 0.85rem;
  border: 1px solid rgba(221, 216, 205, .9);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.panel { padding: 1rem; }
.intro-panel { border-top: 4px solid var(--orange); }

.date-day-row { display: grid; grid-template-columns: 1fr 5.4rem; gap: 1rem; align-items: end; }
.day-mark { display: grid; place-items: center; align-content: center; min-height: 4.65rem; border-radius: 14px; color: white; background: var(--blue); }
.day-mark span { font-size: .62rem; letter-spacing: .16em; }
.day-mark strong { font-size: 2rem; line-height: 1; }

.priority-note { margin: 1rem 0 .65rem; padding: .75rem .85rem; border-left: 4px solid var(--orange); background: var(--orange-soft); font-weight: 700; }
.privacy-note { margin: 0; color: var(--muted); font-size: .78rem; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.55rem .2rem .7rem; }
.inset-heading { margin: 0 0 .8rem; }
.section-heading h2 { margin: 0; font-size: 1.12rem; line-height: 1.25; }
.section-help { color: var(--muted); font-size: .72rem; }

.exercise-card { overflow: hidden; }
.exercise-details summary { display: grid; grid-template-columns: 2rem 1fr auto; gap: .7rem; align-items: center; min-height: 4.5rem; padding: .8rem; cursor: pointer; list-style: none; }
.exercise-details summary::-webkit-details-marker { display: none; }
.exercise-order { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; color: white; background: var(--navy); font-weight: 800; }
.exercise-heading-text { min-width: 0; }
.exercise-name { display: block; font-size: .96rem; }
.exercise-plan { display: block; margin-top: .12rem; color: var(--muted); font-size: .73rem; }
.details-hint { color: var(--blue); font-size: .68rem; font-weight: 700; }
.exercise-details[open] .details-hint::after { content: " ▲"; }
.exercise-details:not([open]) .details-hint::after { content: " ▼"; }
.tips-list { margin: 0; padding: .15rem 1.3rem .9rem 3.55rem; color: #3f4a5f; font-size: .82rem; }
.tips-list li + li { margin-top: .38rem; }

.set-checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; padding: .75rem .8rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.set-checks label, .check-pills label, .segmented label, .reason-options label { position: relative; cursor: pointer; }
.set-checks input, .check-pills input, .segmented input, .reason-options input { position: absolute; opacity: 0; pointer-events: none; }
.set-checks span { display: grid; place-items: center; min-height: 3rem; border: 1.5px solid #c8c3b9; border-radius: 12px; background: white; font-weight: 800; }
.set-checks input:checked + span { color: white; border-color: var(--green); background: var(--green); }
.set-checks input:checked + span::before { content: "✓ "; }

.skip-row { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .65rem .8rem; color: var(--muted); font-size: .7rem; }
.reason-options { display: flex; gap: .3rem; }
.reason-options span { display: block; padding: .3rem .45rem; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; background: white; }
.reason-options input:checked + span { color: white; border-color: var(--orange); background: var(--orange); }

.chest-fields { grid-template-columns: 1fr 1fr; gap: .7rem; padding: .7rem .8rem .85rem; border-top: 1px solid var(--line); background: #f7f9fc; }
.chest-fields:not([hidden]) { display: grid; }

.field { display: grid; gap: .35rem; margin-top: .8rem; }
.field > span, .plain-fieldset legend { color: #424b5d; font-size: .76rem; font-weight: 700; }
.compact-field { margin-top: 0; }
input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 2.85rem;
  padding: .65rem .72rem;
  border: 1.5px solid #c8c3b9;
  border-radius: 11px;
  color: var(--ink);
  background: white;
}
textarea { min-height: 6.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36, 77, 143, .18); border-color: var(--blue); }

.plain-fieldset { margin: .35rem 0 1rem; padding: 0; border: 0; }
.plain-fieldset legend { margin-bottom: .48rem; }
.check-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: .48rem; }
.check-pills span, .segmented span { display: grid; place-items: center; min-height: 2.85rem; border: 1.5px solid #c8c3b9; border-radius: 11px; background: white; font-weight: 700; }
.check-pills input:checked + span, .segmented input:checked + span { color: white; border-color: var(--blue); background: var(--blue); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: .48rem; }
.rest-fieldset { margin-top: 1.2rem; margin-bottom: 0; }
.sr-label { margin-top: 0; }
.sr-label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.copy-panel { padding: 1.05rem; color: white; border-color: var(--navy); background: var(--navy); }
.copy-panel h2 { margin-bottom: .25rem; font-size: 1.25rem; }
.copy-panel p { color: #cbd5e1; font-size: .8rem; }
.section-kicker.light { color: #ff9b70; }
.primary-button { width: 100%; min-height: 3.5rem; border: 0; border-radius: 13px; color: white; background: var(--orange); font-weight: 800; box-shadow: 0 8px 22px rgba(231,91,45,.25); cursor: pointer; }
.primary-button:active { transform: translateY(1px); }
.text-button { display: block; margin: .7rem auto 0; border: 0; color: #dbeafe; background: transparent; text-decoration: underline; cursor: pointer; }
.report-preview { margin: .8rem 0 0; padding: .8rem; border-radius: 10px; color: #e2e8f0; background: #0a1226; white-space: pre-wrap; font: inherit; font-size: .78rem; }
.copy-status { min-height: 1.3em; margin: .7rem 0 0 !important; text-align: center; color: #ffd6c4 !important; font-weight: 700; }
.footer-note { margin: 1.2rem .5rem 0; color: var(--muted); text-align: center; font-size: .72rem; }

@media (min-width: 40rem) {
  .app-header { padding-left: max(calc((100vw - 42rem) / 2 + .8rem), 1.1rem); padding-right: max(calc((100vw - 42rem) / 2 + .8rem), 1.1rem); }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button, .set-checks span, .segmented span, .check-pills span { transition: transform .12s ease, background-color .16s ease, border-color .16s ease; }
}
