:root {
  color-scheme: light;
  --bg: #f3f5ef;
  --surface: #ffffff;
  --surface-soft: #f7f8f4;
  --text: #17231e;
  --muted: #617069;
  --subtle: #8b9791;
  --line: #dfe5df;
  --primary: #2d6b57;
  --primary-deep: #1e5141;
  --primary-soft: #dfeee7;
  --fab-bg: #1e5141;
  --fab-hover: #2d6b57;
  --accent: #d6a763;
  --accent-soft: #f5ead9;
  --shadow-sm: 0 8px 24px rgba(35, 65, 52, 0.07);
  --shadow-lg: 0 24px 70px rgba(26, 46, 37, 0.2);
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --ease: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 100% 0%, rgba(213, 234, 221, 0.72), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(45, 107, 87, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  transform: translateY(-150%);
  border-radius: 10px;
  background: var(--text);
  color: white;
  padding: 10px 14px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 16px max(112px, calc(env(safe-area-inset-bottom) + 96px));
}

.hero {
  padding: 12px 4px 24px;
}

.hero__eyebrow,
.hero__title-row,
.section-heading,
.week-panel,
.week-picker__header,
.dialog__header,
.course-card__meta,
.overview__day,
.footer {
  display: flex;
  align-items: center;
}

.hero__eyebrow {
  gap: 8px;
  color: var(--primary-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hero__mark {
  width: 18px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.hero__title-row {
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}

.hero__code,
.hero__direction,
.section-heading__kicker,
.notice-card__label,
.course-card__time,
.course-card__weeks,
.footer p {
  margin: 0;
}

.hero__code {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h1,
h2,
.course-card__title,
.overview__name {
  margin: 0;
  letter-spacing: -0.025em;
}

h1 {
  margin-top: 3px;
  font-size: clamp(2rem, 10vw, 3.3rem);
  line-height: 1.06;
}

.hero__direction {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.today-button {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 48px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(45, 107, 87, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 15px;
  color: var(--primary-deep);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--ease), border-color var(--ease), opacity var(--ease);
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.today-button:hover,
.week-arrow:hover,
.week-picker__close:hover,
.dialog__close:hover {
  background: var(--primary-soft);
}

.today-button:active,
.week-arrow:active,
.date-button:active,
.week-option:active,
.legend-button:active {
  opacity: 0.68;
}

.today-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.week-panel {
  position: relative;
  z-index: 20;
  justify-content: space-between;
  border: 1px solid rgba(45, 107, 87, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  padding: 9px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.week-arrow,
.week-picker__close,
.dialog__close {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  transition: background-color var(--ease), opacity var(--ease);
}

.week-arrow:disabled {
  cursor: default;
  opacity: 0.25;
}

.week-summary {
  min-width: 0;
  min-height: 54px;
  flex: 1;
  border: 0;
  border-radius: 16px;
  background: transparent;
  padding: 5px 10px;
  cursor: pointer;
}

.week-summary__title,
.week-summary__range {
  display: block;
  text-align: center;
}

.week-summary__title {
  font-size: 1.05rem;
  font-weight: 800;
}

.week-summary__range {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.week-picker {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  left: 0;
  z-index: 40;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow-lg);
}

.week-picker[hidden],
.dialog-backdrop[hidden],
.now-card[hidden],
.notice-card[hidden] {
  display: none;
}

.week-picker__header {
  justify-content: space-between;
  padding: 0 0 10px 6px;
  font-size: 0.9rem;
  font-weight: 800;
}

.week-picker__close,
.dialog__close {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.week-option {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), opacity var(--ease);
}

.week-option[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.date-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin: 18px -2px 0;
}

.date-button {
  min-width: 0;
  min-height: 68px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  padding: 8px 2px;
  transition: background-color var(--ease), color var(--ease), opacity var(--ease), box-shadow var(--ease);
}

.date-button__weekday,
.date-button__day {
  display: block;
  text-align: center;
}

.date-button__weekday {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.date-button__day {
  margin-top: 6px;
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.date-button[aria-selected="true"] {
  background: var(--primary);
  color: white;
  box-shadow: 0 9px 22px rgba(45, 107, 87, 0.24);
}

.date-button[aria-selected="true"] .date-button__weekday {
  color: rgba(255, 255, 255, 0.76);
}

.date-button.is-today:not([aria-selected="true"]) .date-button__day::after {
  display: block;
  width: 4px;
  height: 4px;
  margin: 4px auto -8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.schedule-section,
.overview,
.notice-card {
  margin-top: 34px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.section-heading--compact {
  margin-bottom: 14px;
}

.section-heading__kicker {
  color: var(--primary);
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.section-heading h2 {
  margin-top: 3px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.course-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--primary-soft);
  padding: 6px 11px;
  color: var(--primary-deep);
  font-size: 0.75rem;
  font-weight: 800;
}

.course-list {
  display: grid;
  gap: 12px;
}

.course-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 30, 0.06);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 17px 17px 17px 21px;
  box-shadow: var(--shadow-sm);
}

.course-card::before {
  position: absolute;
  top: 17px;
  bottom: 17px;
  left: 0;
  width: 5px;
  border-radius: 0 999px 999px 0;
  background: var(--course-color, var(--primary));
  content: "";
}

.course-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.course-card__time {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.course-card__clock {
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.course-card__title {
  margin-top: 3px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.course-card__period {
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.course-card__divider {
  height: 1px;
  margin: 13px 0 11px;
  background: var(--line);
}

.course-card__meta {
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.course-card__meta + .course-card__meta {
  margin-top: 7px;
}

.course-card__meta svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--primary);
}

.course-card__weeks {
  margin-top: 12px;
  color: var(--subtle);
  font-size: 0.7rem;
  font-weight: 600;
}

.empty-state {
  border: 1px dashed #cbd5ce;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
  padding: 34px 20px;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-state h3,
.empty-state p {
  margin: 0;
}

.empty-state h3 {
  font-size: 1rem;
}

.empty-state p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
}

.overview__list {
  overflow: hidden;
  border: 1px solid rgba(23, 35, 30, 0.06);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.overview__day {
  min-height: 62px;
  gap: 14px;
  padding: 12px 16px;
}

.overview__day + .overview__day {
  border-top: 1px solid var(--line);
}

.overview__date {
  width: 42px;
  flex: 0 0 auto;
  text-align: center;
}

.overview__weekday,
.overview__number {
  display: block;
}

.overview__weekday {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.overview__number {
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.overview__courses {
  min-width: 0;
  flex: 1;
}

.overview__name {
  overflow: hidden;
  font-size: 0.83rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview__name + .overview__name {
  margin-top: 3px;
}

.overview__empty {
  color: var(--subtle);
  font-size: 0.8rem;
}

.overview__badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid rgba(177, 122, 52, 0.14);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  padding: 18px;
}

.notice-card__icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.68);
  color: #9a6829;
}

.notice-card__label {
  color: #86602f;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.notice-card h2 {
  margin-top: 3px;
  font-size: 1rem;
}

.notice-card p:last-child {
  margin: 5px 0 0;
  color: #715632;
  font-size: 0.78rem;
}

.footer {
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding: 20px 4px 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.legend-button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0 6px;
  color: var(--primary-deep);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
}

.now-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: var(--fab-bg);
  padding: 0 18px;
  color: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(30, 81, 65, 0.3);
  transition: background-color var(--ease), opacity var(--ease), box-shadow var(--ease);
}

.now-fab:hover,
.now-fab[aria-expanded="true"] {
  background: var(--fab-hover);
  box-shadow: 0 17px 38px rgba(30, 81, 65, 0.38);
}

.now-fab:active,
.now-card__refresh:active {
  opacity: 0.72;
}

.now-card {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 72px));
  z-index: 80;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 120px);
  overflow: auto;
  border: 1px solid rgba(45, 107, 87, 0.13);
  border-radius: 24px;
  background: var(--surface);
  padding: 17px;
  box-shadow: var(--shadow-lg);
  animation: now-card-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.now-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.now-card__header p,
.now-card__header h2,
.now-report__eyebrow,
.now-report__title,
.now-report__summary,
.now-report__empty-title,
.now-report__empty-copy {
  margin: 0;
}

.now-card__header p {
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.now-card__header h2 {
  margin-top: 2px;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.now-card__close {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 14px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: background-color var(--ease), opacity var(--ease);
}

.now-card__close:hover {
  background: var(--primary-soft);
}

.now-card__body {
  margin-top: 13px;
}

.now-report__status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: var(--primary-soft);
  padding: 0 10px;
  color: var(--primary-deep);
  font-size: 0.69rem;
  font-weight: 800;
}

.now-report__status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.now-report__checked {
  color: var(--subtle);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.now-report__status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.now-report__status[data-kind="in-class"]::before {
  box-shadow: 0 0 0 4px rgba(45, 107, 87, 0.12);
}

.now-report__status[data-kind="break"] {
  background: var(--accent-soft);
  color: #8a5b22;
}

.now-report__eyebrow {
  margin-top: 13px;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.now-report__title {
  margin-top: 4px;
  font-size: 1.22rem;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.now-report__meta-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.now-report__meta {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 0.78rem;
}

.now-report__meta svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--primary);
}

.now-report__summary {
  margin-top: 13px;
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 11px 12px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 650;
}

.now-report__notice {
  margin-top: 9px;
  border-radius: 14px;
  background: var(--accent-soft);
  padding: 10px 12px;
  color: #745222;
  font-size: 0.72rem;
}

.now-report__empty {
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 22px 16px;
  text-align: center;
}

.now-report__empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 11px;
  place-items: center;
  border-radius: 15px;
  background: var(--primary-soft);
  color: var(--primary);
}

.now-report__empty-title {
  font-size: 0.95rem;
}

.now-report__empty-copy {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
}

.now-card__refresh {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: transparent;
  color: var(--primary-deep);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  transition: background-color var(--ease), opacity var(--ease);
}

.now-card__refresh:hover {
  background: var(--primary-soft);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 23, 18, 0.5);
  padding-top: env(safe-area-inset-top);
}

.dialog {
  width: min(100%, 720px);
  max-height: min(82dvh, 620px);
  overflow: auto;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheet-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.dialog__handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #ccd4ce;
}

.dialog__header {
  justify-content: space-between;
}

.dialog__header h2 {
  font-size: 1.25rem;
}

.legend-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px;
}

.legend-symbol {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 900;
}

.legend-list strong,
.legend-list small {
  display: block;
}

.legend-list strong {
  font-size: 0.86rem;
}

.legend-list small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.7rem;
}

body.has-dialog {
  overflow: hidden;
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes now-card-in {
  from {
    transform: translateY(10px) scale(0.98);
    opacity: 0;
  }
}

@media (min-width: 560px) {
  .app-shell {
    padding-right: 28px;
    padding-left: 28px;
  }

  .date-strip {
    gap: 10px;
  }

  .course-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .empty-state {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .app-shell {
    width: min(100%, 1020px);
  }

  .schedule-section,
  .overview {
    margin-top: 40px;
  }

  .dialog {
    border-radius: 28px;
    margin-bottom: 5vh;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101713;
    --surface: #18211d;
    --surface-soft: #202b26;
    --text: #f0f5f1;
    --muted: #a9b7b0;
    --subtle: #88978f;
    --line: #324039;
    --primary: #86c5a9;
    --primary-deep: #a9dbc4;
    --primary-soft: #273f34;
    --fab-bg: #2f6a54;
    --fab-hover: #3c8066;
    --accent: #dbb87e;
    --accent-soft: #392e20;
    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.18);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.52);
  }

  body {
    background:
      radial-gradient(circle at 100% 0%, rgba(42, 86, 67, 0.4), transparent 34rem),
      var(--bg);
  }

  .week-panel,
  .today-button {
    background: rgba(24, 33, 29, 0.88);
  }

  .course-card {
    border-color: rgba(255, 255, 255, 0.05);
  }

  .notice-card {
    border-color: rgba(219, 184, 126, 0.2);
  }

  .notice-card__label,
  .notice-card p:last-child {
    color: #e0bd82;
  }

  .notice-card__icon {
    background: rgba(255, 255, 255, 0.07);
    color: #e0bd82;
  }

  .now-report__status[data-kind="break"],
  .now-report__notice {
    color: #e4bf84;
  }
}

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