:root {
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #20313a;
  --muted: #66757d;
  --paper: #fffdf7;
  --page: #f7f1e3;
  --blue: #2b6f89;
  --blue-dark: #1f5368;
  --blue-soft: #e8f4f8;
  --green: #397150;
  --green-soft: #e4f3e8;
  --red: #9b4033;
  --line: #d9d5c9;
  --yellow: #f2c94c;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { min-width: 700px; background: var(--page); color: var(--ink); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }

.calendar-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.calendar-shell.is-practice { grid-template-rows: minmax(0, 1fr); }
.calendar-shell.is-practice .calendar-workspace { grid-row: 1; }

.profile-summary { display: flex; align-items: center; gap: 11px; padding-top: 6px; font-size: 16px; font-weight: 800; }
.quiet-button { min-height: 43px; padding: 7px 13px; border: 2px solid #a9bcc2; border-radius: 11px; background: white; color: var(--blue-dark); font-weight: 800; }

.calendar-intro {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
  padding: 20px 24px 26px;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 5px 18px rgb(69 67 57 / 11%);
}
.calendar-intro-heading h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
}
.calendar-activity-choice {
  display: grid;
  width: min(430px, 78%);
  min-height: 0;
  place-self: stretch center;
  place-content: center;
  justify-items: center;
  padding: 25px;
  border: 3px solid #a8c1ca;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff 0%, #edf7fa 100%);
  box-shadow: 0 5px 16px rgb(43 111 137 / 12%);
  color: var(--ink);
  text-align: center;
}
.calendar-activity-choice strong {
  margin-top: 12px;
  color: var(--blue-dark);
  font-size: clamp(25px, 3.3vw, 36px);
}
.calendar-activity-choice > span:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 750;
}
.calendar-choice-icon { font-size: clamp(72px, 10vw, 104px); line-height: 1; }

.calendar-workspace {
  display: grid;
  grid-template-rows: minmax(380px, 1.05fr) minmax(280px, .95fr);
  gap: 12px;
  min-height: 0;
}

.month-card, .question-card {
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 5px 18px rgb(69 67 57 / 11%);
}

.month-card { display: grid; grid-template-rows: auto auto minmax(0, 1fr); padding: 12px 18px 11px; }
.month-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 0 3px 6px; }
.month-heading-main { display: flex; align-items: end; gap: 18px; }
.calendar-activities-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 2px solid #a9bcc2;
  border-radius: 11px;
  background: white;
  color: var(--blue-dark);
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}
.eyebrow { margin: 0 0 3px; color: var(--blue-dark); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.month-heading h2 { margin: 0; font-size: clamp(27px, 3.2vw, 36px); line-height: 1; }
.save-note { max-width: 230px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; text-align: right; }

.weekday-row, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { column-gap: clamp(10px, 2vw, 24px); margin-bottom: 2px; border-bottom: 1px solid #e7e4dc; }
.weekday-name {
  display: grid;
  min-height: 27px;
  place-items: center;
  border-radius: 8px 8px 0 0;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .04em;
}
.weekday-name.is-hint { background: #ffe99a; color: #5d4512; }

.month-grid {
  grid-template-rows: repeat(6, minmax(40px, 1fr));
  column-gap: clamp(10px, 2vw, 24px);
  row-gap: 2px;
  min-height: 0;
}
.calendar-day {
  display: grid;
  grid-template-rows: minmax(21px, auto) minmax(18px, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 2px 4px 3px;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  background: transparent;
}
.calendar-day.is-adjacent { color: #a4aaa8; }
.calendar-day.is-today {
  background: #edf7fa;
  box-shadow: 0 3px 10px rgb(43 111 137 / 14%);
  color: var(--blue-dark);
}
.day-number {
  grid-row: 2;
  align-self: start;
  font-size: clamp(17px, 2.1vw, 22px);
  font-weight: 900;
  line-height: 1;
}
.day-marker {
  grid-row: 1;
  align-self: end;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
  min-height: 21px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #d7edf4;
  color: var(--blue-dark);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.day-marker.is-yesterday { background: #eee8f7; color: #654d8b; }
.day-marker.is-tomorrow { background: #e1f1e5; color: #356d49; }
.day-marker.is-today {
  min-height: 34px;
  padding: 3px 13px;
  background: #cfe9f2;
  font-size: 13px;
}
.day-marker-icon { font-size: 18px; }
.day-marker.is-today .day-marker-icon { font-size: 28px; }

.question-card { display: flex; flex-direction: column; justify-content: flex-start; padding: 12px 22px; }
.calendar-journey {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-bottom: 8px;
}
.journey-step { height: 9px; border-radius: 99px; background: #d2d9da; }
.journey-step.is-complete { background: var(--green); }
.journey-step.is-current { background: var(--blue); box-shadow: 0 0 0 3px #cce5ed; }

.today-sentence,
.calendar-question { font-size: clamp(27px, 3.5vw, 36px); font-weight: 850; line-height: 1.1; }
.today-sentence { margin: 0 0 8px; color: var(--blue-dark); }
#calendar-answer-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 14px; }
.calendar-question { min-width: 0; min-height: 0; margin: 0; }
#calendar-answer {
  display: inline-block;
  width: 3.2em;
  min-width: 0;
  min-height: 0;
  padding: 0 .12em .04em;
  border: 0;
  border-bottom: 4px solid #6f8d97;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
}
#calendar-answer.is-weekday { width: 7.2em; }
#calendar-answer.is-wrong { border-color: #c46c5d; background: #fff1ee; color: var(--red); }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 125px;
  min-height: 52px;
  padding: 9px 19px;
  border-radius: 15px;
  font-size: 19px;
  font-weight: 850;
  text-decoration: none;
}
.primary-button { border: 0; background: var(--blue); box-shadow: 0 3px 0 var(--blue-dark); color: white; }
.secondary-button { border: 2px solid var(--blue); background: white; color: var(--blue-dark); }
.calendar-feedback { min-height: 24px; margin: 5px 0 0; color: var(--muted); font-size: 18px; font-weight: 800; }
.calendar-feedback.is-wrong { color: var(--red); }
.calendar-feedback.is-correct { color: var(--green); }

.question-card.is-weather .today-sentence,
.question-card.is-weather .calendar-feedback { display: none; }
.weather-step { display: grid; grid-template-rows: auto auto auto auto; min-height: 0; text-align: center; }
.weather-step h2 { margin: 1px 0 8px; font-size: clamp(27px, 3.5vw, 36px); }
.weather-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.weather-choice { min-height: 58px; padding: 5px; border: 2px solid #bdc8ca; border-radius: 14px; background: white; color: var(--ink); }
.weather-choice span, .weather-choice strong { display: block; }
.weather-choice span { margin-bottom: 3px; font-size: 25px; line-height: 1; }
.weather-choice strong { font-size: 14px; }
.weather-choice.is-selected { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue); }
.weather-done { width: min(260px, 100%); min-height: 48px; margin: 7px auto 0; }

.calendar-finish { text-align: center; }
.finish-icon { font-size: 42px; }
.calendar-finish h2 { margin: 2px 0; font-size: 34px; }
.calendar-finish p { margin: 0 0 10px; color: var(--muted); font-size: 18px; font-weight: 750; }
.finish-actions { display: flex; justify-content: center; gap: 12px; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.rotate-message { display: none; }

@media (max-height: 700px) and (orientation: landscape) {
  .calendar-shell { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(7px, env(safe-area-inset-bottom)); }
  .calendar-workspace { grid-template-rows: minmax(340px, 1.05fr) minmax(270px, .95fr); gap: 9px; }
  .month-card { padding: 8px 15px; }
  .month-heading { padding-bottom: 3px; }
  .month-heading-main { gap: 10px; }
  .calendar-activities-link { min-height: 38px; padding: 5px 9px; font-size: 12px; }
  .month-heading h2 { font-size: 25px; }
  .weekday-name { min-height: 23px; font-size: 11px; }
  .day-number { font-size: 17px; }
  .month-grid { grid-template-rows: repeat(6, minmax(35px, 1fr)); }
  .calendar-day { grid-template-rows: minmax(19px, auto) minmax(16px, 1fr); }
  .day-marker { min-height: 19px; padding: 1px 5px; font-size: 7px; }
  .day-marker-icon { font-size: 16px; }
  .day-marker.is-today { min-height: 30px; padding: 0 7px; font-size: 9px; }
  .day-marker.is-today .day-marker-icon { font-size: 27px; }
  .calendar-intro { gap: 8px; padding: 12px 18px 16px; }
  .calendar-intro-heading h2 { font-size: 29px; }
  .calendar-activity-choice { padding: 16px; }
  .calendar-choice-icon { font-size: 66px; }
  .question-card { padding: 9px 18px; }
  .calendar-journey { margin-bottom: 6px; }
  .today-sentence, .calendar-question { font-size: 27px; }
  .today-sentence { margin-bottom: 5px; }
  .calendar-feedback { min-height: 21px; margin-top: 3px; }
  .weather-step h2 { margin-bottom: 5px; font-size: 27px; }
  .weather-choice { min-height: 50px; padding: 3px; }
  .weather-choice span { margin-bottom: 1px; font-size: 20px; }
  .weather-done { min-height: 45px; margin-top: 5px; }
}

@media (max-width: 900px) and (orientation: landscape) {
  .weekday-row, .month-grid { column-gap: 8px; }
  .day-marker { padding-right: 5px; padding-left: 5px; font-size: 8px; }
  .profile-summary { font-size: 13px; }
}

@media (orientation: portrait) {
  .rotate-message { display: grid; position: fixed; z-index: 300; inset: 0; place-items: center; padding: 28px; background: var(--page); }
  .rotate-card { display: grid; justify-items: center; gap: 14px; max-width: 420px; padding: 32px; border-radius: 24px; background: var(--paper); box-shadow: 0 6px 22px rgb(69 67 57 / 14%); font-size: 20px; text-align: center; }
  .rotate-card strong { font-size: 28px; }
  .rotate-icon { color: var(--blue); font-size: 54px; line-height: 1; }
}
