:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172744;
  background: #f3f6fc;
  color-scheme: light;
  font-synthesis: none;
  --ink: #172744;
  --muted: #536580;
  --border: #dbe3f1;
  --paper: #fcfdff;
  --blue: #2b55af;
  --ice: #b7d7ff;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
body:has(dialog[open]) { overflow: hidden; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #3d67c6; outline-offset: 3px; }

.container { width: min(100% - 32px, 600px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner, .calendar-top, .month-dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-inner { min-height: 78px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -.025em;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--ice);
  font-size: 29px;
  line-height: 1;
}
.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0;
}
.today, .arrows button, .close-months {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}
.today { padding: 0 15px; }

main { padding-block: 22px 44px; }
.calendar {
  padding: clamp(10px, 3vw, 16px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--paper);
}
.calendar-top { padding: 0 2px 10px; }
.month-control {
  display: grid;
  gap: 3px;
  min-height: 44px;
  padding: 3px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: start;
  font-weight: 750;
  letter-spacing: -.02em;
}
.month-action { color: var(--blue); font-size: .72rem; font-weight: 650; letter-spacing: 0; }
.month-action span { margin-inline-start: 2px; }
.arrows { display: flex; gap: 6px; }
.arrows button, .close-months {
  width: 44px;
  padding: 0 0 3px;
  font-size: 25px;
  line-height: 1;
}
.week, .month-weekdays, .month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
.day, .month-day {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  min-width: 0;
  min-height: 48px;
  padding: 4px 0 12px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
  transition: background-color 150ms, color 150ms;
}
.day { min-height: 62px; gap: 3px; }
.day-name { font-size: clamp(10px, 3vw, 12px); color: var(--muted); }
.day-number { font-size: clamp(16px, 4.5vw, 20px); font-weight: 750; }
:is(.day, .month-day)[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--blue); }
:is(.day, .month-day).has-class::after {
  content: "";
  position: absolute;
  bottom: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
}
:is(.day, .month-day)[aria-pressed="true"] { background: var(--ink); color: #fff; }
.day[aria-pressed="true"] .day-name { color: #c9dcfc; }
:is(.day, .month-day)[aria-pressed="true"]::after { background: var(--ice); }

.agenda { margin-top: clamp(24px, 6vw, 36px); }
.agenda-heading { margin: 0 2px 14px; }
.date-label { margin: 0 0 4px; color: var(--blue); font-size: .85rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(27px, 7vw, 38px); letter-spacing: -.05em; line-height: 1.05; }
.class-card, .empty {
  min-height: 240px;
  border-radius: 25px;
}
.class-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(23px, 6vw, 38px);
  background: linear-gradient(130deg, #162a53, #234687);
  color: #f5f8ff;
  box-shadow: 0 12px 28px #16346d26;
}
.class-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 270px;
  height: 270px;
  right: -146px;
  top: -125px;
  border: 1px solid #b7d7ff35;
  border-radius: 50%;
  box-shadow: 0 0 0 28px #b7d7ff11, 0 0 0 56px #b7d7ff0b, 0 0 0 84px #b7d7ff08;
  pointer-events: none;
}
.class-card h2 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.25rem, 10vw, 4rem);
  font-weight: 750;
  letter-spacing: -.06em;
  line-height: 1;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.class-details {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px 22px;
}
.room, .class-hours { display: grid; gap: 4px; }
.room {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--ice);
  color: var(--ink);
}
.class-hours { padding-block: 8px; }
.class-details span { font-size: .72rem; font-weight: 700; }
.class-hours span { color: #c9dcfc; }
.room strong, .class-hours time {
  font-size: clamp(1.02rem, 4.2vw, 1.25rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--border);
  background: var(--paper);
  text-align: center;
}
.empty h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.025em; }
.empty p { margin: 0; color: var(--muted); line-height: 1.45; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: #e5eeff;
  color: var(--blue);
  font-size: 21px;
}
#class-list > * { animation: appear 180ms ease-out both; }
@keyframes appear { from { opacity: .5; transform: translateY(4px); } }

.class-nav { display: flex; gap: 8px; margin-top: 14px; }
.class-nav button {
  flex: 1;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  font-size: .85rem;
  font-weight: 750;
}
#next-class { border-color: #a1c4f6; background: var(--ice); }
.class-nav button:disabled { opacity: .45; }

dialog {
  width: min(100% - 32px, 520px);
  max-width: none;
  height: min(780px, 88dvh);
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px #142b5742;
}
dialog[open] { display: flex; flex-direction: column; animation: appear 180ms ease-out both; }
dialog::backdrop { background: #10214299; }
.month-dialog-header { padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.month-dialog-title h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.04em; }
.month-weekdays { margin-top: 14px; color: var(--muted); text-align: center; font-size: .76rem; }
#months {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 0 16px;
  scroll-padding-block: 12px;
}
#months:focus-visible { outline-offset: -3px; }
.month { padding-block: 16px; }
.month + .month { border-top: 1px solid var(--border); }
.month h3 { margin: 0 0 9px 4px; font-size: 1rem; letter-spacing: -.02em; }
.month-day { font-weight: 650; }
.month-day.has-class { font-weight: 800; }

@media (max-width: 520px) {
  dialog {
    width: 100%;
    height: 88dvh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }
  #months { padding-bottom: env(safe-area-inset-bottom); }
}
@media (hover: hover) {
  .today:hover, .arrows button:hover, .month-control:hover, .close-months:hover,
  :is(.day, .month-day)[aria-pressed="false"]:hover, .class-nav button:enabled:hover {
    background: #ecf2ff;
  }
  #next-class:enabled:hover { background: #cde3ff; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
