:root {
  color-scheme: light;
  --ink: #482739;
  --muted: #6f4a60;
  --rose: #8f3860;
  --rose-deep: #77304f;
  --rose-wash: #f9e8ef;
  --surface: #fffaf9;
  --line: #ead0d8;
  --shadow: 0 12px 28px #80415c12;
  --display: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, #f1cddb 0%, #faebf1 48%, #f8eff5 100%);
  accent-color: var(--rose);
  font-family: system-ui, sans-serif;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { width: min(100% - 1.5rem, 66rem); margin: clamp(.75rem, 3vw, 2rem) auto; }
a { color: var(--rose-deep); text-underline-offset: .2em; }
h1, h2, p { margin: 0; }
h2 { color: var(--rose-deep); font: 600 clamp(1.25rem, 3vw, 1.65rem)/1.15 var(--display); }
section, aside { min-width: 0; }
section[id] { scroll-margin-top: 1rem; }

.brand-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(.55rem, 4vw, 2.25rem);
  border: 1px solid #e8bbc8;
  border-radius: 1.45rem;
  padding: clamp(.85rem, 3.4vw, 2.35rem);
  background: radial-gradient(ellipse at top right, #f4c8d9, transparent 72%), #fceaf0;
  box-shadow: var(--shadow), inset 0 1px #fff;
}
.brand-copy p { margin-bottom: .55rem; color: var(--rose-deep); font-size: .7rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.brand-copy h1 { color: var(--ink); font: 600 clamp(1.4rem, 4.6vw, 3.45rem)/1.05 var(--display); letter-spacing: -.04em; }
.brand-copy em { color: var(--rose); font-weight: 400; }
.brand-logo {
  display: block;
  width: clamp(7rem, 29vw, 15rem);
  height: auto;
}
.site-header nav {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: .25rem;
  margin-block: .75rem 1rem;
  padding: .25rem;
  border: 1px solid var(--line);
  border-radius: .95rem;
  background: #fff9fbe0;
}
.site-header nav a { display: grid; place-items: center; min-height: 2.75rem; padding: .35rem; text-align: center; font-size: .85rem; font-weight: 680; text-decoration: none; border-radius: .7rem; }
.site-header nav a:hover { background: var(--rose-wash); }
.site-header nav .nav-primary { color: #fff; background: var(--rose); }
.site-header nav .nav-primary:hover { background: var(--rose-deep); }

.tracker-layout { display: grid; grid-template-areas: "affirmation" "calendar" "overview"; gap: .8rem; }
.affirmation {
  grid-area: affirmation;
  align-self: start;
  display: grid;
  gap: .3rem;
  padding: .8rem 1rem;
  border: 1px solid #e9becb;
  border-left: 3px solid #bf7d83;
  border-radius: .95rem;
  background: linear-gradient(115deg, #f9dfeb, #fff1ed);
  box-shadow: var(--shadow);
}
.affirmation h2 { font: 750 .66rem/1.3 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.affirmation p { color: #66374b; font: italic clamp(1.04rem, 2.3vw, 1.35rem)/1.25 var(--display); }
.calendar, .cycle, #check-in, #history { border: 1px solid var(--line); border-radius: 1.2rem; background: var(--surface); box-shadow: var(--shadow); padding: clamp(.65rem, 2.5vw, 1.4rem); }
.cycle { grid-area: overview; align-self: start; }
.cycle h2 { margin-block: .35rem; }
.cycle p { color: var(--muted); font-size: .85rem; }
#cycle-strip { display: flex; gap: .15rem; margin: .65rem 0; }
#cycle-strip span { flex: 1; height: .3rem; border-radius: 1rem; background: #edd3df; }
#cycle-strip .current { background: var(--rose); }

.calendar { grid-area: calendar; }
.calendar-head { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .35rem; margin-bottom: .75rem; }
.calendar-head h2 { font-size: clamp(1.2rem, 4.5vw, 2rem); text-align: center; }
.calendar-head button { min-height: 2.75rem; padding: .25rem .48rem; border: 1px solid #e4bfcf; background: #f9e8ef; color: var(--rose-deep); font-size: .75rem; }
.calendar-head button:hover:enabled { background: #f6dce8; }
.symptom-filter { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--muted); font-size: .75rem; }
.symptom-filter select { width: auto; max-width: 100%; min-height: 2.75rem; padding: .25rem .45rem; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: clamp(.17rem, .75vw, .44rem); text-align: center; }
.weekdays { margin: .75rem 0 .35rem; color: var(--muted); font-size: .7rem; font-weight: 650; }
.calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .1rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: .25rem .12rem .45rem;
  border: 1px solid #eddae3;
  border-radius: .55rem;
  background: var(--phase-fill, #f8ebf0);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 680;
}
.calendar-day:disabled { opacity: 1; }
.calendar-day[aria-current=date] { border-color: #b97691; }
.calendar-day[aria-pressed=true], .calendar-day[aria-pressed=true]:hover { background: var(--rose); color: #fff; box-shadow: 0 0 0 2px #d197ae; border-color: var(--rose); }
.calendar-day:hover:enabled { background: var(--phase-fill, #fae0eb); }
[data-phase=menstrual] { --phase-fill: #f6cddd; }
[data-phase=follicular] { --phase-fill: #e9ecdf; }
[data-phase=ovulation] { --phase-fill: #f8dfcd; }
[data-phase=luteal] { --phase-fill: #edddf1; }
.calendar-symptom { display: block; overflow-wrap: anywhere; border-radius: .22rem; border-left: 2px solid #ae7165; background: #fff9f8; color: #592c3e; font-size: clamp(.6rem, 1.6vw, .77rem); line-height: 1.15; padding: .1rem .04rem; }
.calendar-symptom[data-severity=moderate] { border-color: #ab5565; }
.calendar-symptom[data-severity=severe], .calendar-symptom[data-severity=extreme] { color: #fff; background: #77364d; border-color: #77364d; }
.calendar-day[data-mark=check]::after,.calendar-key .key-check::before { content: ""; display: inline-block; width: .36rem; height: .36rem; border-radius: 50%; background: #547453; }
.calendar-day[data-mark=check]::after { position: absolute; bottom: .12rem; left: calc(50% - .18rem); }
.calendar-day[aria-pressed=true][data-mark=check]::after { background: #fff; }
.calendar-key, .phase-key { display: flex; flex-wrap: wrap; gap: .32rem .6rem; margin-top: .7rem; font-size: .73rem; color: var(--muted); }
.calendar-key .key-check::before, .calendar-key .cycle-marker, .phase-key .cycle-marker { margin-right: .32rem; vertical-align: middle; }
.phase-key > span { border-radius: 1rem; background: var(--phase-fill); padding: .2rem .48rem; color: var(--ink); }
.cycle-marker { display: inline-block; position: relative; width: .65rem; height: .65rem; flex: none; }
.cycle-marker-period { width: .55rem; height: .55rem; border-radius: 70% 0 70% 70%; background: currentColor; transform: rotate(-45deg); }
.cycle-marker-ovulation { border: 1.5px solid currentColor; border-radius: 50%; }
.cycle-marker-ovulation::after { content: ""; position: absolute; inset: 25%; border-radius: 50%; background: currentColor; }
.calendar-day .cycle-marker { align-self: center; margin-block: .12rem; }
.cycle-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .75rem; }
#selected-date { font-size: .86rem; font-weight: 680; }
.cycle-note, .selected-symptoms, #day-one-status { color: var(--muted); font-size: .78rem; margin: .45rem 0 0; }
.calendar-ready .calendar-preview-note, html:not(.calendar-ready) .requires-script, #status:empty, #day-one-status:empty { display: none; }

#check-in, #history { margin-top: .9rem; }
#check-in h2, #history h2 { margin-bottom: .8rem; }
.grid, #symptoms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .6rem; }
#symptoms { margin-block: .75rem 1rem; }
label { display: grid; gap: .27rem; margin: .3rem 0 .6rem; font-size: .85rem; font-weight: 650; min-width: 0; }
label > span { display: inline; }
.symptom { margin: 0; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .75rem; background: #fff7fa; }
.symptom-label { font-weight: 700; }
input:not([type=range]), select, textarea { width: 100%; min-width: 0; min-height: 2.75rem; padding: .45rem .5rem; border: 1px solid #c49aad; border-radius: .55rem; color: var(--ink); background: #fff; font: 400 1rem/1.25 system-ui, sans-serif; }
button { border: 0; border-radius: .65rem; background: var(--rose); color: #fff; min-height: 2.75rem; padding: .45rem .7rem; font: 650 .84rem/1.15 system-ui, sans-serif; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button:hover:enabled { background: var(--rose-deep); }
:focus-visible { outline: 2px solid #85345b; outline-offset: 3px; }
.daily-habits { min-width: 0; border: 1px solid var(--line); border-radius: .75rem; padding: .55rem .7rem; }
.daily-habits legend { color: var(--rose-deep); font-weight: 700; padding: 0 .25rem; }
details { border-top: 1px solid var(--line); margin-top: .65rem; padding: .55rem 0; }
summary { color: var(--rose-deep); font-size: .84rem; font-weight: 680; cursor: pointer; }
details p { white-space: pre-wrap; margin: .55rem 0; }
details button { margin-right: .4rem; }
#save-instructions, #status, #overview, footer { color: var(--muted); font-size: .82rem; }
#save-instructions, #status { margin-top: .45rem; }
#export { margin-block: .55rem .25rem; }
footer { padding: 1rem .45rem; }
footer p + p { margin-top: .45rem; }

@media (min-width: 48rem) {
  .tracker-layout { grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "calendar affirmation" "calendar overview"; gap: 1rem; }
  .calendar-day { min-height: 3.45rem; }
  .site-header nav { max-width: 30rem; }
}
@media (max-width: 23rem) {
  body { width: calc(100% - 1rem); }
  .brand-copy h1 { font-size: 1.25rem; }
  .brand-logo { width: 7rem; }
  .calendar-head h2 { font-size: 1.06rem; }
  .calendar-head button { padding-inline: .35rem; }
}
