@charset "UTF-8";

:root {
  color-scheme: light;
  --color-brand: #b081b7;
  --color-canvas: #d6ebe7;
  --color-text: #303b39;
  --color-text-muted: #52615c;
  --color-action: #75507c;
  --color-action-hover: #603c67;
  --color-accent: #875d8e;
  --color-on-action: #ffffff;
  --color-line: rgba(91, 104, 98, .19);
  --color-control-border: #6f8078;
  --color-success: #326347;
  --color-warning: #855022;
  --color-danger: #9b363e;
  --surface-glass: rgba(255, 255, 255, .32);
  --surface-data: #f8fcfa;
  --surface-option: #ffffff40;
  --surface-selected: #eee5f1;
  --surface-dialog: #f5f8f3;
  --surface-warning: #faf0e5;
  --surface-danger: #fbeaec;
  --heat-0: #f1f5f3;
  --heat-1: #e4eeea;
  --heat-2: #cfe1d9;
  --heat-3: #acc8bc;
  --heat-4: var(--color-action);
  --font-body: "Microsoft JhengHei", "PingFang TC", "Heiti TC", sans-serif;
  --font-display: "Bahnschrift", "Aptos", "Microsoft JhengHei", sans-serif;
  --radius-card: 28px;
  --radius-input: 8px;
  --radius-pill: 999px;
  --shadow-glass: 0 18px 50px #5445600d, inset 0 2px 2px #fff,
    inset 1px 0 1px #ffffffcc, inset 0 -1px 2px #b081b73b;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-text);
  background:
    linear-gradient(118deg, transparent 20%, #ffffff9c 33%, #ffffff20 34%, transparent 52%),
    linear-gradient(35deg, #cce6df 5%, #d6ebe7 28%, #f1f6ef 49%, #d9c5dd80 72%, #c8e3dc 100%);
  background-attachment: fixed;
}
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  max-width: 100%;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--color-action);
  color: var(--color-on-action);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition: background 150ms, border-color 150ms;
}
button:hover:not(:disabled) { background: var(--color-action-hover); }
button:disabled {
  background: #e1e8e3;
  border-color: #e1e8e3;
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.secondary {
  background: #ffffff99;
  border-color: var(--color-control-border);
  color: var(--color-action);
}
.secondary:hover:not(:disabled) { background: var(--surface-selected); }
a { color: var(--color-action); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 5px; }
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button > svg, .brand > svg, .search-field > svg { pointer-events: none; }
.icon-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  flex-shrink: 0;
  padding: 0;
  background: #ffffff99;
  border: 1px solid var(--color-control-border);
  border-radius: 50%;
  color: var(--color-action);
}
.icon-button:hover:not(:disabled) { background: var(--surface-selected); }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-input);
  background: #ffffffc9;
  color: var(--color-text);
  font-size: 14px;
}
input::placeholder { color: var(--color-text-muted); opacity: 1; }
select { cursor: pointer; }
select.has-value { border-color: var(--color-action); background: var(--surface-selected); }
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.35; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.5; }
h3 { font-size: 17px; font-weight: 700; }
strong { font-weight: 700; }
.skip-link {
  position: absolute;
  top: 12px;
  left: 20px;
  z-index: 10;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-action);
  color: var(--color-on-action);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  max-width: 1200px;
  margin-inline: auto;
  padding: 12px 40px;
  border-bottom: 1px solid var(--color-line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: var(--color-text);
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
}
.brand > svg { color: var(--color-action); }
nav { display: flex; flex-wrap: wrap; gap: 8px; }
nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
}
nav a:hover { background: #ffffff70; color: var(--color-action); }
main { max-width: 1200px; margin-inline: auto; padding: 0 40px 48px; }
.page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 32px 0 24px;
}
#semester, .page-meta, #snapshot-position {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}
.page-meta { font-size: 13px; color: var(--color-text-muted); }
.notice {
  margin-bottom: 16px;
  padding: 16px 20px;
  border: 1px solid var(--color-line);
  border-radius: 16px;
  background: var(--surface-data);
  font-size: 14px;
}
.notice.error { background: var(--surface-danger); color: var(--color-danger); border-color: #be737a; }
#load-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
#load-actions .caption { margin: 0; }
.observation-panel, .filter-panel {
  background: var(--surface-data);
  border: 1px solid #ffffffd9;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-glass);
}
.observation-panel {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(0, 1.5fr) auto;
  align-items: center;
  gap: 16px 24px;
  padding: 20px 24px;
}
.observation-panel > a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 14px;
}
.snapshot-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.snapshot-controls input {
  min-height: 44px;
  width: 100%;
  min-width: 48px;
  flex: 1;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--color-action);
}
#snapshot-position { white-space: nowrap; color: var(--color-text-muted); font-size: 13px; }
.data-notes { margin: 8px 0 16px; font-size: 13px; color: var(--color-text-muted); }
summary { cursor: pointer; }
.data-notes > summary {
  display: list-item;
  width: fit-content;
  min-height: 44px;
  padding: 10px 4px;
  color: var(--color-action);
}
.data-notes > p { max-width: 900px; margin: 0 0 8px; }
.data-notes .caption { margin: 12px 0 16px; overflow-wrap: anywhere; }
.filter-panel {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
}
.filter-panel > button { align-self: end; }
.filter-panel > p { grid-column: 1 / -1; font-size: 13px; color: var(--color-text-muted); }
.search-field { display: flex; position: relative; min-width: 0; }
.search-field > svg { position: absolute; left: 14px; top: 14px; color: var(--color-text-muted); }
.search-field input { padding-left: 44px; border-radius: 18px; }
.section { padding-top: 40px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 20px;
}
.scope-tag { font-size: 12px; color: var(--color-text-muted); }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0 0 24px; }
.metric { min-width: 0; padding: 12px 20px; border-left: 1px solid var(--color-line); }
.metric:first-child { padding-left: 0; border-left: 0; }
.metric p { font-size: 13px; color: var(--color-text-muted); }
.metric strong {
  display: block;
  margin: 4px 0;
  color: var(--color-action);
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.metric small { display: block; font-size: 12px; color: var(--color-text-muted); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card {
  min-width: 0;
  padding: 24px;
  border: 1px solid #ffffffd9;
  border-radius: var(--radius-card);
  background: var(--surface-data);
}
.caption { margin: 8px 0 16px; font-size: 12px; color: var(--color-text-muted); }
.subheading { margin-top: 24px; }
.bar-list { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}
button.bar-row { min-height: 44px; }
button.bar-row:hover:not(:disabled) { background: #edf2ee; }
button.bar-row[aria-pressed="true"] { background: var(--surface-selected); border-color: var(--color-action); }
.bar-label { min-width: 0; overflow-wrap: anywhere; }
.selection-label {
  display: block;
  margin-top: 2px;
  color: var(--color-action);
  font-size: 12px;
  font-weight: 600;
}
.bar-track { height: 8px; background: #e4ece7; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--color-action); border-radius: 4px; }
.bar-count { font-family: var(--font-display); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 24px 0; font-size: 14px; color: var(--color-text-muted); }
.table-scroll, .chart-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th { font-weight: 600; color: var(--color-text-muted); }
th, td { padding: 12px; border-bottom: 1px solid var(--color-line); vertical-align: top; }
.heat-table { min-width: 550px; margin: 16px 0; text-align: center; }
.heat-table th, .heat-table td { padding: 4px; border: 0; vertical-align: middle; }
.heat-table th { font-size: 13px; }
.heat-table button {
  display: block;
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 2px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.heat-table button:hover { filter: brightness(.96); }
.heat-table button[aria-pressed="true"] {
  border-color: var(--color-action);
  box-shadow: inset 0 0 0 1px var(--surface-data);
}
.heat-table .selection-label { color: inherit; font-family: var(--font-body); }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.table-toolbar > p { font-size: 13px; color: var(--color-text-muted); }
.table-toolbar label { flex-shrink: 0; min-width: 170px; }
.table-toolbar h3 + .caption { margin-bottom: 0; }
.course-table { min-width: 780px; }
.course-table th { background: #edf3ef; }
.course-table td:first-child { width: 30%; }
.course-link, .text-button {
  justify-content: flex-start;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--color-action);
  text-align: left;
  font-size: 14px;
}
.course-link:hover:not(:disabled), .text-button:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.course-id { display: block; margin-top: 4px; color: var(--color-text-muted); font-size: 12px; overflow-wrap: anywhere; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; margin-top: 24px; }
#page-label { font-size: 13px; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-block;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e6efe8;
  color: var(--color-success);
  font-size: 12px;
}
.pill.removed { background: var(--surface-warning); color: var(--color-warning); }
.changes-card { margin-top: 20px; }
.change-list { max-height: 480px; overflow: auto; }
.change-entry {
  display: block;
  width: 100%;
  padding: 16px 8px;
  border: 0;
  border-bottom: 1px solid var(--color-line);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  text-align: left;
  font-size: 14px;
}
.change-entry:hover:not(:disabled) { background: #edf2ee; }
.change-entry small { display: block; margin-top: 8px; font-size: 12px; color: var(--color-text-muted); }
.quality-card { margin-top: 40px; }
.quality-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.quality-item { min-width: 0; }
.quality-item strong { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 400; font-variant-numeric: tabular-nums; }
.quality-item span { font-size: 12px; color: var(--color-text-muted); }
.trend-svg { display: block; width: 100%; min-width: 440px; height: auto; margin-top: 12px; stroke: none; }
.trend-svg text { font-family: var(--font-display); font-size: 16px; fill: var(--color-text-muted); }
.trend-svg .line { fill: none; stroke: var(--color-action); stroke-width: 2.5; }
.trend-svg .axis { stroke: var(--color-line); stroke-width: 1; }
.trend-svg .point { fill: var(--color-action); stroke: var(--surface-data); stroke-width: 1.5; cursor: pointer; }
.trend-svg .point.selected { fill: var(--color-action-hover); stroke: var(--color-action-hover); stroke-width: 3; }
.trend-list { margin-top: 12px; font-size: 12px; }
.trend-list > summary { width: fit-content; min-height: 44px; padding: 10px 0; color: var(--color-action); }
.trend-list .table-scroll { max-height: 260px; }
.trend-list table { min-width: 400px; }
.trend-list td { font-size: 13px; }
footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 1200px;
  margin-inline: auto;
  padding: 24px 40px;
  border-top: 1px solid var(--color-line);
  color: var(--color-text-muted);
  font-size: 12px;
}
footer a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
dialog {
  width: 780px;
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 40px);
  padding: 28px;
  border: 1px solid #ffffffd9;
  border-radius: var(--radius-card);
  background: var(--surface-dialog);
  color: var(--color-text);
  box-shadow: var(--shadow-glass);
  overflow: auto;
}
dialog::backdrop { background: #243f3955; backdrop-filter: blur(9px); }
.dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.dialog-toolbar > span { font-size: 13px; color: var(--color-text-muted); }
dialog h2 { font-size: 25px; }
dialog .course-id { font-size: 14px; }
dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px 20px; margin: 28px 0; font-size: 14px; }
dt { color: var(--color-text-muted); }
dd { min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-events { max-height: 360px; margin-top: 16px; overflow: auto; }
.detail-event { padding: 16px 0; border-top: 1px solid var(--color-line); font-size: 14px; }
.detail-event p { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-event a { display: inline-flex; align-items: center; min-height: 44px; font-size: 12px; }
.data-warning { margin-top: 16px; padding: 12px 16px; border-radius: 8px; background: var(--surface-warning); color: var(--color-warning); font-size: 13px; }

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .observation-panel, .filter-panel {
    background: linear-gradient(135deg, #ffffff70, #ffffff08 48%, #b081b711), var(--surface-glass);
    backdrop-filter: blur(32px) saturate(165%);
    -webkit-backdrop-filter: blur(32px) saturate(165%);
  }
  dialog {
    background: #f5f8f3ed;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
}

@media (max-width: 1000px) {
  .filter-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .search-label { grid-column: span 2; }
  .observation-panel { grid-template-columns: minmax(0, 1fr) auto; }
  .snapshot-controls { grid-column: 1 / -1; grid-row: 2; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 0; }
  .metric:nth-child(4) { border-left: 0; padding-left: 0; }
}
@media (max-width: 800px) {
  main { padding-inline: 24px; }
  .masthead, footer { padding-inline: 24px; }
  .chart-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  main { padding-inline: 20px; }
  .masthead { min-height: 64px; padding: 8px 20px; gap: 8px; }
  .brand { font-size: 15px; gap: 8px; }
  nav { gap: 0; }
  nav a { padding-inline: 8px; font-size: 13px; }
  .page-heading { padding: 24px 0 20px; }
  h1 { font-size: 25px; }
  h2 { font-size: 22px; }
  .filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px; }
  .search-label { grid-column: 1 / -1; }
  .observation-panel { padding: 20px; gap: 12px; }
  .snapshot-controls { flex-wrap: wrap; }
  #snapshot-position { width: 100%; text-align: center; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 8px 12px; }
  .metric:nth-child(odd) { padding-left: 0; border-left: 0; }
  .metric:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--color-line); }
  .metric strong { font-size: 32px; }
  .section { padding-top: 32px; }
  .section-heading { margin-bottom: 16px; gap: 8px 16px; }
  .card { padding: 20px; }
  .bar-row { gap: 8px; grid-template-columns: minmax(0, 45%) minmax(0, 1fr) 36px; padding-inline: 4px; }
  .table-toolbar { flex-wrap: wrap; align-items: flex-start; }
  .table-toolbar label { width: 100%; }
  .pagination { gap: 8px; }
  .pagination button { padding-inline: 14px; }
  .quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  footer { padding: 20px; }
  dialog { padding: 20px; }
  dl { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 380px) {
  .masthead { flex-direction: column; align-items: flex-start; }
  nav { width: 100%; justify-content: space-between; }
  .observation-panel { grid-template-columns: minmax(0, 1fr); }
  .snapshot-controls { grid-row: auto; }
  .observation-panel > a { width: fit-content; }
  .filter-panel { padding: 16px; gap: 12px; }
  .pagination { justify-content: space-between; }
  #page-label { order: -1; width: 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
