:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #e6ecf5;
  --text: #1c2a3a;
  --muted: #7c8ba1;
  --accent: #4f8cff;
  --accent-soft: #eaf1ff;
  --shadow: 0 12px 32px rgba(24, 48, 92, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

/* 作者样式里的 display 会盖掉浏览器默认的 [hidden] { display: none }，
   这里显式兜底，保证 el.hidden = true 真的隐藏元素 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(48rem 32rem at 8% -10%, #dfe9ff 0%, transparent 60%),
    radial-gradient(40rem 28rem at 96% 0%, #e6f6ff 0%, transparent 55%),
    radial-gradient(36rem 26rem at 50% 110%, #eef0ff 0%, transparent 60%);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

/* ---------------- 顶部 ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #5b95ff, #7bb6ff 60%, #9ad6ff);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(79, 140, 255, 0.35);
  flex: none;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  margin: 0 6px;
  opacity: 0.55;
}

.topbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f1f5fc;
  color: #5a6b85;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.chip-action {
  background: var(--accent-soft);
  color: #2f6bd8;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chip-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(79, 140, 255, 0.25);
}

/* ---------------- 周次栏 ---------------- */

.weekbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(24, 48, 92, 0.05);
  backdrop-filter: blur(10px);
}

.arrow {
  width: 34px;
  height: 34px;
  flex: none;
  border: 0;
  border-radius: 11px;
  background: #eef3fb;
  color: #3d5170;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.arrow:hover:not(:disabled) {
  background: #dfe9fa;
  transform: translateY(-1px);
}

.arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.week-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  flex: none;
}

.week-info strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.week-info span {
  font-size: 12px;
  color: var(--muted);
}

.week-pills {
  display: flex;
  -webkit-mask-image: linear-gradient(to right, #000 94%, transparent);
  mask-image: linear-gradient(to right, #000 94%, transparent);
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.week-pills::-webkit-scrollbar {
  display: none;
}

.week-pills button {
  border: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f0f4fb;
  color: #5a6b85;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.week-pills button:hover {
  background: #e4ecf9;
}

.week-pills button.is-active {
  background: linear-gradient(135deg, #5b95ff, #7bb6ff);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 14px rgba(79, 140, 255, 0.32);
}

.week-pills button.is-now:not(.is-active) {
  color: #2f6bd8;
  background: #e8f0ff;
}

/* ---------------- 课表 ---------------- */

.board {
  position: relative;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.board-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.grid {
  display: grid;
  grid-template-columns: var(--cols, 88px repeat(7, minmax(118px, 1fr)));
  grid-auto-rows: minmax(54px, auto);
  gap: 6px;
  min-width: 920px;
}

.cell {
  border-radius: 10px;
}

.cell-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: #f7faff;
  border: 1px solid #edf2fa;
  color: #46587a;
}

.cell-head .wd {
  font-size: 13px;
  font-weight: 600;
}

.cell-head .dt {
  font-size: 11px;
  color: var(--muted);
}

.cell-head.is-today {
  background: linear-gradient(160deg, #eef5ff, #e4efff);
  border-color: #cfe0ff;
  color: #2f6bd8;
}

.cell-head.is-today .dt {
  color: #5187e0;
}

.cell-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f7faff;
  border: 1px solid #edf2fa;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.cell-time {
  position: sticky;
  left: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  background: #fbfcff;
  border: 1px solid #f0f4fa;
  color: #5a6b85;
}

.cell-time b {
  font-size: 12px;
  font-weight: 600;
}

.cell-time span {
  font-size: 10.5px;
  color: #93a1b6;
  font-variant-numeric: tabular-nums;
}

.cell-slot {
  background: #fcfdff;
  border: 1px solid #f2f5fb;
}

.cell-slot.is-today {
  background: #f7faff;
  border-color: #e8f0fd;
}

.course {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px 7px 11px;
  border-radius: 10px;
  border-left: 3px solid var(--c-line, #9bb8e8);
  background: var(--c-bg, #eef4ff);
  color: var(--c-text, #24384f);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: rise 0.35s ease both;
}

.course::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.course:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 60, 110, 0.14);
}

.course b {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course .teacher {
  font-size: 11px;
  opacity: 0.78;
}

.course .room {
  font-size: 10.5px;
  opacity: 0.62;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 54px 0 48px;
  color: var(--muted);
}

.board-empty span {
  font-size: 30px;
  filter: saturate(0.4);
}

.board-empty p {
  margin: 0;
  font-size: 13px;
}

/* ---------------- 底部 ---------------- */

.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.foot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #56c08d;
  box-shadow: 0 0 0 3px rgba(86, 192, 141, 0.15);
}

.foot-sep {
  opacity: 0.5;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 760px) {
  .page {
    padding: 14px 12px 28px;
  }

  .topbar {
    flex-wrap: wrap;
  }

  .topbar-side {
    margin-left: auto;
  }

  .chip-label {
    display: none;
  }

  .grid {
    --cols: 74px repeat(7, minmax(104px, 1fr));
  }

  .topbar {
    padding: 14px 16px;
    border-radius: 16px;
  }

  .brand-text p {
    max-width: 48vw;
  }

  .chip#chip-updated {
    display: none;
  }

  .weekbar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .week-info {
    flex: 1;
  }

  .week-pills {
    flex-basis: 100%;
    order: 5;
    padding: 2px 0 0;
  }

  .week-info {
    min-width: 92px;
  }

  .board {
    padding: 10px;
    border-radius: 16px;
  }

  .grid {
    grid-auto-rows: minmax(58px, auto);
    min-width: 800px;
  }

  .brand-text h1 {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
