:root {
  --ink: #18242d;
  --ink-soft: #3f505c;
  --muted: #71808a;
  --line: #dce3e6;
  --line-strong: #c8d2d7;
  --canvas: #f3f6f6;
  --paper: #ffffff;
  --surface-soft: #f8faf9;
  --accent: #3333ff;
  --accent-dark: #2525c7;
  --accent-soft: #eeeeff;
  --teal: #3333ff;
  --teal-soft: #eeeeff;
  --gold: #c9952d;
  --hero: #171d4b;
  --hero-border: #2c387d;
  --hero-kicker: #a7adff;
  --hero-copy: #c3c9e2;
  --shadow: 0 10px 28px rgba(24, 36, 45, 0.07);
  --radius: 8px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #eef0ff;
  --ink-soft: #c2c8df;
  --muted: #929bb7;
  --line: #2c3453;
  --line-strong: #465174;
  --canvas: #0e1224;
  --paper: #171d35;
  --surface-soft: #1d2440;
  --accent: #3333ff;
  --accent-dark: #8b8bff;
  --accent-soft: #222655;
  --teal: #5555ff;
  --teal-soft: #202452;
  --gold: #d5ad4d;
  --hero: #10163d;
  --hero-border: #3d49a9;
  --hero-kicker: #a7adff;
  --hero-copy: #c2c8e0;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(51, 51, 255, 0.35);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 3px;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-kicker,
.section-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
  line-height: 1.3;
}

.brand-kicker {
  color: var(--accent);
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: 0.02em;
}

.header-actions,
.week-navigation,
.load-status {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 18px;
}

.header-link {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.header-link:hover {
  color: var(--accent-dark);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 21px;
  line-height: 1;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.icon-button:active {
  transform: scale(0.95);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.main-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px 40px 28px;
}

.semester-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 36px;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--hero-border);
  border-radius: var(--radius);
  color: #f7fbfa;
  background: var(--hero);
  box-shadow: var(--shadow);
}

.banner-copy {
  padding: 30px 32px 28px;
}

.banner-copy .section-kicker {
  color: var(--hero-kicker);
}

.banner-copy h1 {
  max-width: 700px;
  margin: 8px 0 5px;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 740;
  letter-spacing: 0;
  line-height: 1.2;
}

.banner-date {
  margin: 0;
  color: var(--hero-copy);
  font-size: 14px;
}

.semester-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(124px, 1fr));
  min-width: 430px;
  padding: 24px 24px 24px 0;
}

.metric-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 20px;
  border-left: 1px solid rgba(231, 243, 241, 0.18);
}

.metric-item-accent {
  color: #b9bcff;
}

.metric-label {
  color: var(--hero-copy);
  font-size: 12px;
}

.metric-item strong {
  color: inherit;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.metric-item small {
  color: var(--hero-copy);
  font-size: 12px;
  font-weight: 500;
}

.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.week-navigation {
  gap: 8px;
}

.control-button {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  font-size: 25px;
}

.week-select-wrap {
  position: relative;
  display: inline-flex;
}

.week-select-wrap select {
  min-width: 116px;
  height: 36px;
  padding: 0 32px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  font-weight: 700;
  appearance: none;
}

.week-select-wrap select:hover {
  border-color: var(--teal);
}

.select-chevron {
  position: absolute;
  top: 5px;
  right: 10px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  pointer-events: none;
  transform: rotate(180deg);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-left: 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 13px;
  font-weight: 700;
  transition: background-color 160ms ease, color 160ms ease;
}

.text-button:hover {
  color: #ffffff;
  background: var(--teal);
}

.button-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.load-status {
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.status-indicator.success {
  background: var(--teal);
}

.status-indicator.error {
  background: var(--accent);
}

.today-panel {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.today-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px 16px;
}

.today-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-width: 0;
}

.today-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.today-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 15px;
  font-weight: 750;
}

.today-heading h2 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.today-meta {
  display: grid;
  gap: 2px;
  text-align: right;
}

.today-meta strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.today-meta span {
  color: var(--muted);
  font-size: 11px;
}

.theme-toggle {
  --theme-icon-path-light: url("../img/theme-light.svg");
  --theme-icon-path-dark: url("../img/theme-dark.svg");
  --theme-icon-path-system: url("../img/theme-system.svg");
  position: relative;
  display: inline-grid;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease,
    transform 160ms ease;
}

.theme-toggle::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.theme-toggle[data-mode="light"]::before {
  -webkit-mask-image: var(--theme-icon-path-light);
  mask-image: var(--theme-icon-path-light);
}

.theme-toggle[data-mode="dark"]::before {
  -webkit-mask-image: var(--theme-icon-path-dark);
  mask-image: var(--theme-icon-path-dark);
}

.theme-toggle[data-mode="system"]::before {
  -webkit-mask-image: var(--theme-icon-path-system);
  mask-image: var(--theme-icon-path-system);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.today-course-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 24px 20px;
}

.today-course {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #c4c7ff;
  border-radius: 6px;
  color: var(--ink);
  background: var(--teal-soft);
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.today-course:hover {
  border-color: var(--teal);
  box-shadow: 0 7px 18px rgba(24, 36, 45, 0.1);
  transform: translateY(-1px);
}

.today-course.tone-coral {
  border-color: #c4c7ff;
  background: #f0f0ff;
}

.today-course.tone-gold {
  border-color: #ead59e;
  background: #fff6df;
}

.today-course.tone-blue {
  border-color: #c7d3e3;
  background: #edf2f9;
}

.today-course.tone-ink {
  border-color: #ced4d7;
  background: #edf0f1;
}

.today-time {
  display: grid;
  gap: 1px;
  min-width: 50px;
  padding-right: 11px;
  border-right: 1px solid rgba(24, 36, 45, 0.14);
}

.today-time strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.today-time span {
  color: var(--muted);
  font-size: 10px;
}

.today-course-copy {
  min-width: 0;
}

.today-course-copy strong,
.today-course-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-course-copy strong {
  margin-bottom: 3px;
  font-size: 13px;
}

.today-course-copy span {
  color: var(--ink-soft);
  font-size: 10px;
}

.today-course-copy span:last-child {
  margin-top: 3px;
  color: var(--muted);
}

.today-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  text-align: center;
}

.today-timeline {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 4px 8px 2px;
}

.today-axis {
  position: relative;
  height: 54px;
  margin: 0 8px;
}

.today-axis-track {
  position: absolute;
  top: 29px;
  right: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}

.today-axis-range {
  position: absolute;
  z-index: 1;
  top: 23px;
  min-width: 8px;
  height: 14px;
  border-radius: 4px;
  opacity: 0.9;
}

.today-axis-range.tone-teal {
  background: var(--accent);
}

.today-axis-range.tone-coral {
  background: #6f70ff;
}

.today-axis-range.tone-gold {
  background: #c9952d;
}

.today-axis-range.tone-blue {
  background: #637fc2;
}

.today-axis-range.tone-ink {
  background: #66717a;
}

.today-axis-node {
  position: absolute;
  z-index: 2;
  top: 30px;
  display: grid;
  justify-items: center;
  transform: translate(-50%, -50%);
}

.today-axis-dot {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.today-axis-node strong {
  position: absolute;
  bottom: 14px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.schedule-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 18px;
}

.panel-heading h2 {
  margin: 5px 0 0;
  font-size: 21px;
  font-weight: 740;
  letter-spacing: 0;
  line-height: 1.25;
}

.panel-date {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.schedule-scroll {
  height: auto;
  overflow: visible;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-grid {
  --period-count: 1;
  display: grid;
  grid-template-columns: minmax(72px, 88px) repeat(7, minmax(0, 1fr));
  grid-template-rows: 74px repeat(var(--period-count), minmax(104px, 1fr));
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 100%;
  background: var(--surface-soft);
}

.corner-cell,
.day-header,
.time-cell,
.day-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.corner-cell {
  position: sticky;
  z-index: 7;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.day-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface-soft);
  text-align: center;
}

.day-header.today {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.day-name {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.day-header.today .day-name {
  color: var(--accent-dark);
}

.day-date {
  color: var(--muted);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
}

.day-header.today .day-date {
  color: var(--accent);
}

.time-cell {
  position: sticky;
  z-index: 4;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 10px 8px;
  background: var(--surface-soft);
}

.period-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.period-time {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.day-cell {
  min-width: 0;
  background: var(--paper);
}

.day-cell:nth-of-type(7n) {
  border-right: 0;
}

.course-card {
  position: relative;
  z-index: 2;
  min-width: 0;
  margin: 7px;
  padding: 12px 11px 10px;
  overflow: hidden;
  border: 1px solid transparent;
  border-left: 4px solid var(--teal);
  border-radius: 6px;
  color: var(--ink);
  background: var(--teal-soft);
  box-shadow: 0 3px 10px rgba(24, 36, 45, 0.05);
  text-align: left;
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.course-card:hover {
  z-index: 3;
  border-color: var(--teal);
  box-shadow: 0 8px 16px rgba(24, 36, 45, 0.12);
  transform: translateY(-1px);
}

.course-card:focus-visible {
  z-index: 3;
}

.conflict-card {
  border-style: dashed;
}

.conflict-badge {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin: -3px 0 7px;
  padding: 2px 5px;
  border-radius: 3px;
  color: #ffffff;
  background: var(--accent-dark);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.2;
}

.course-card.tone-coral {
  border-left-color: var(--accent);
  background: #f0f0ff;
}

.course-card.tone-coral:hover {
  border-color: var(--accent);
}

.course-card.tone-gold {
  border-left-color: var(--gold);
  background: #fff6df;
}

.course-card.tone-gold:hover {
  border-color: var(--gold);
}

.course-card.tone-blue {
  border-left-color: #587aa8;
  background: #edf2f9;
}

.course-card.tone-blue:hover {
  border-color: #587aa8;
}

.course-card.tone-ink {
  border-left-color: #4b5961;
  background: #edf0f1;
}

.course-card.tone-ink:hover {
  border-color: #4b5961;
}

.course-name {
  display: -webkit-box;
  margin-bottom: 7px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.course-room,
.course-teacher {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-room::before {
  margin-right: 4px;
  color: var(--muted);
  content: "@";
  font-weight: 700;
}

.course-teacher::before {
  margin-right: 4px;
  color: var(--muted);
  content: "/";
  font-weight: 700;
}

.course-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgba(24, 36, 45, 0.12);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.course-meta span:last-child {
  font-weight: 700;
}

.empty-state {
  display: flex;
  grid-column: 1 / -1;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
  background: var(--paper);
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(1360px, calc(100% - 80px));
  margin: 0 auto;
  padding: 0 0 26px;
  color: var(--muted);
  font-size: 11px;
}

.course-dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(24, 36, 45, 0.22);
}

.course-dialog::backdrop {
  background: rgba(18, 31, 37, 0.42);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading h2 {
  margin: 5px 0 0;
  font-size: 22px;
  line-height: 1.3;
}

.dialog-close {
  flex: 0 0 auto;
  border-radius: 6px;
  font-size: 24px;
}

#dialogContent {
  padding: 20px 24px 24px;
}

.detail-list {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.conflict-summary {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.conflict-list {
  display: grid;
  gap: 10px;
}

.conflict-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
}

.conflict-item-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.conflict-item-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.conflict-item-heading span {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.conflict-item-time,
.conflict-item-details,
.conflict-item-note {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
}

.conflict-item-details,
.conflict-item-note {
  color: var(--muted);
}

.conflict-item-note {
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .site-header {
    padding: 0 24px;
  }

  .main-content {
    padding: 24px 24px 24px;
  }

  .semester-banner {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .semester-metrics {
    min-width: 0;
    padding: 0 20px 22px;
  }

  .metric-item:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .site-footer {
    width: calc(100% - 48px);
  }

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

  .schedule-grid {
    grid-template-columns: 64px repeat(7, minmax(0, 1fr));
    grid-template-rows: 68px repeat(var(--period-count), minmax(124px, 1fr));
  }

  .course-card {
    margin: 5px 4px;
    padding: 9px 7px 8px;
  }

  .course-name {
    font-size: 12px;
  }

  .course-room,
  .course-teacher {
    font-size: 9px;
  }
}

@media (max-width: 620px) {
  .site-header {
    min-height: 68px;
    padding: 0 16px;
  }

  .brand-kicker,
  .header-link {
    display: none;
  }

  .header-link-home {
    display: inline;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .main-content {
    padding: 16px 12px 20px;
  }

  .today-panel {
    margin-top: 12px;
    border-radius: 6px;
  }

  .today-heading {
    align-items: center;
    gap: 12px;
    padding: 16px 14px 13px;
  }

  .today-title-wrap {
    gap: 9px;
  }

  .today-mark {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .today-heading h2 {
    font-size: 18px;
  }

  .today-heading-actions {
    max-width: 64%;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .theme-toggle::before {
    width: 18px;
    height: 18px;
  }

  .today-meta {
    max-width: 100%;
    min-width: 0;
  }

  .today-meta strong {
    white-space: nowrap;
  }

  .today-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .today-course-list {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 0 14px 14px;
  }

  .today-timeline {
    display: none;
  }

  .today-course {
    gap: 9px;
    padding: 10px;
  }

  .today-time {
    min-width: 48px;
    padding-right: 9px;
  }

  .semester-banner {
    border-radius: 6px;
  }

  .banner-copy {
    padding: 22px 20px 20px;
  }

  .banner-copy h1 {
    margin-top: 7px;
    font-size: 25px;
  }

  .banner-date {
    font-size: 12px;
  }

  .semester-metrics {
    grid-template-columns: auto auto auto;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    padding: 0 14px 18px;
    column-gap: 8px;
  }

  .metric-item {
    min-width: 0;
    padding: 0 12px;
  }

  .metric-label {
    font-size: 10px;
    line-height: 1.25;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  .metric-item strong {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .metric-item small {
    display: none;
  }

  .control-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    min-width: 0;
    margin-top: 12px;
    padding: 12px;
  }

  .week-navigation {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .week-select-wrap {
    min-width: 0;
  }

  .week-select-wrap select {
    min-width: 0;
    width: 100%;
  }

  .text-button {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    margin-left: 0;
    padding: 0 9px;
  }

  .load-status {
    min-height: 20px;
    justify-content: center;
  }

  .schedule-panel {
    margin-top: 12px;
    border-radius: 6px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 18px 16px 14px;
  }

  .panel-heading h2 {
    font-size: 18px;
  }

  .panel-date {
    padding: 0;
    text-align: left;
  }

  .schedule-scroll {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .schedule-grid {
    grid-template-columns: 44px repeat(7, minmax(0, 1fr));
    grid-template-rows: 56px repeat(var(--period-count), 50px);
    width: 100%;
    min-width: 0;
  }

  .day-header {
    padding: 4px 1px;
  }

  .day-name {
    font-size: 9px;
    line-height: 1.15;
  }

  .day-date {
    font-size: 10px;
  }

  .time-cell {
    align-items: center;
    padding: 5px 1px;
    text-align: center;
  }

  .period-label {
    font-size: 8px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .period-time {
    max-width: 100%;
    font-size: 6px;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .course-card {
    margin: 3px 2px;
    padding: 7px 3px 6px;
    border-left-width: 2px;
    border-radius: 4px;
    box-shadow: none;
    text-align: center;
  }

  .course-name {
    display: block;
    margin-bottom: 5px;
    font-size: 9px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-all;
    -webkit-line-clamp: unset;
  }

  .course-room {
    display: none;
  }

  .course-teacher {
    display: block;
    font-size: 7px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .course-teacher::before {
    margin-right: 1px;
  }

  .course-meta {
    display: block;
    margin-top: 4px;
    padding-top: 4px;
    font-size: 7px;
    line-height: 1.2;
  }

  .course-meta span:first-child {
    display: none;
  }

  .course-meta span:last-child {
    display: block;
    overflow-wrap: anywhere;
  }

  .conflict-badge {
    min-height: 13px;
    margin: -2px 0 4px;
    padding: 1px 2px;
    font-size: 6px;
    line-height: 1.1;
  }

  .site-footer {
    width: calc(100% - 24px);
    flex-direction: column;
    gap: 4px;
    padding-bottom: 20px;
  }

  .dialog-heading {
    padding: 20px 18px 15px;
  }

  #dialogContent {
    padding: 18px 18px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

html[data-theme="dark"] .today-course,
html[data-theme="dark"] .course-card {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.16);
}

html[data-theme="dark"] .today-course.tone-coral,
html[data-theme="dark"] .course-card.tone-coral {
  border-color: #5559d6;
  background: #25285e;
}

html[data-theme="dark"] .today-course.tone-gold,
html[data-theme="dark"] .course-card.tone-gold {
  border-color: #78642e;
  background: #302a1c;
}

html[data-theme="dark"] .today-course.tone-blue,
html[data-theme="dark"] .course-card.tone-blue {
  border-color: #4e6192;
  background: #202b4a;
}

html[data-theme="dark"] .today-course.tone-ink,
html[data-theme="dark"] .course-card.tone-ink {
  border-color: #4f5b69;
  background: #252b36;
}

html[data-theme="dark"] .today-time {
  border-color: rgba(238, 240, 255, 0.16);
}

html[data-theme="dark"] .course-meta {
  border-color: rgba(238, 240, 255, 0.14);
}

html[data-theme="dark"] .conflict-item {
  background: #252343;
}

html[data-theme="dark"] .course-dialog::backdrop {
  background: rgba(4, 6, 18, 0.68);
}
