/* 溟濛课表 · 样式
   Material 3 配色，按 iPhone 的刘海/底部横条做了安全区适配，深浅色跟随系统。 */

:root {
  --primary: #6750A4;
  --on-primary: #FFFFFF;
  --primary-container: #EADDFF;
  --on-primary-container: #21005D;
  --secondary-container: #E8DEF8;
  --on-secondary-container: #1D192B;
  --surface: #FEF7FF;
  --surface-container: #F3EDF7;
  --surface-container-high: #ECE6F0;
  --on-surface: #1D1B20;
  --on-surface-variant: #49454F;
  --outline: #79747E;
  --outline-variant: #CAC4D0;
  --error: #B3261E;
  --on-error: #FFFFFF;
  --scrim: rgba(0, 0, 0, .32);
  --shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 2px 8px rgba(0, 0, 0, .06);
  --radius: 16px;
  --radius-lg: 24px;
  --c1: #D7E3FF; --on-c1: #001B3D;
  --c2: #E8DEF8; --on-c2: #1D192B;
  --c3: #FFEAD6; --on-c3: #3A2000;
  --c4: #D5EBD8; --on-c4: #0A2E0C;
  --c5: #FFE3E3; --on-c5: #3A0A0A;
  --c6: #D9F2E6; --on-c6: #06301F;
  --c7: #E6E0F8; --on-c7: #1E1240;
  --c8: #FDF0D5; --on-c8: #3A2A00;
  /* 周视图按节次时段配色：上午 / 下午 / 晚上 */
  --am-bg: #D7E3FF; --am-fg: #001B3D; --am-soft: #F1F6FF;
  --pm-bg: #FFEAD6; --pm-fg: #3A2000; --pm-soft: #FFF8F0;
  --eve-bg: #E8DEF8; --eve-fg: #1D192B; --eve-soft: #F7F3FE;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #D0BCFF;
    --on-primary: #381E72;
    --primary-container: #4F378B;
    --on-primary-container: #EADDFF;
    --secondary-container: #4A4458;
    --on-secondary-container: #E8DEF8;
    --surface: #141218;
    --surface-container: #211F26;
    --surface-container-high: #2B2930;
    --on-surface: #E6E1E5;
    --on-surface-variant: #CAC4D0;
    --outline: #938F99;
    --outline-variant: #49454F;
    --error: #F2B8B5;
    --on-error: #601410;
    --c1: #1B3A5C; --on-c1: #D7E3FF;
    --c2: #332D41; --on-c2: #E8DEF8;
    --c3: #46331C; --on-c3: #FFDDB8;
    --c4: #1E3A22; --on-c4: #BFE3C4;
  --c5: #5A2E2E; --on-c5: #FFDAD6;
  --c6: #1E4436; --on-c6: #B8EED6;
  --c7: #3A3157; --on-c7: #E6E0F8;
  --c8: #4A3B18; --on-c8: #FDF0D5;
    --am-bg: #1B3A5C; --am-fg: #D7E3FF; --am-soft: #16283C;
    --pm-bg: #46331C; --pm-fg: #FFDDB8; --pm-soft: #2C2113;
    --eve-bg: #332D41; --eve-fg: #E8DEF8; --eve-soft: #221F2B;
  }
}

:root[data-theme="dark"] {
  --primary: #D0BCFF;
  --on-primary: #381E72;
  --primary-container: #4F378B;
  --on-primary-container: #EADDFF;
  --secondary-container: #4A4458;
  --on-secondary-container: #E8DEF8;
  --surface: #141218;
  --surface-container: #211F26;
  --surface-container-high: #2B2930;
  --on-surface: #E6E1E5;
  --on-surface-variant: #CAC4D0;
  --outline: #938F99;
  --outline-variant: #49454F;
  --error: #F2B8B5;
  --on-error: #601410;
  --c1: #1B3A5C; --on-c1: #D7E3FF;
  --c2: #332D41; --on-c2: #E8DEF8;
  --c3: #46331C; --on-c3: #FFDDB8;
  --c4: #1E3A22; --on-c4: #BFE3C4;
  --c5: #5A2E2E; --on-c5: #FFDAD6;
  --c6: #1E4436; --on-c6: #B8EED6;
  --c7: #3A3157; --on-c7: #E6E0F8;
  --c8: #4A3B18; --on-c8: #FDF0D5;
  --am-bg: #1B3A5C; --am-fg: #D7E3FF; --am-soft: #16283C;
  --pm-bg: #46331C; --pm-fg: #FFDDB8; --pm-soft: #2C2113;
  --eve-bg: #332D41; --eve-fg: #E8DEF8; --eve-soft: #221F2B;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--surface);
  color: var(--on-surface);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { position: fixed; inset: 0; overflow: hidden; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- 整体布局 */

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--safe-top);
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  min-height: 52px;
}

.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .2px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--on-surface);
  flex: 0 0 auto;
}
.icon-btn:active { background: var(--surface-container-high); }
.icon-btn[disabled] { opacity: .35; }

/* 顶栏「星期几 · 日期」，整块可点 -> 弹星期选择 */
.weekbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px 8px;
}

.week-head {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.week-head:active { background: var(--surface-container-high); }
.week-head .line1 { display: flex; align-items: center; gap: 4px; font-size: 18px; font-weight: 600; }
.week-head .line1 .caret {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--primary);
}
.week-head .line2 { font-size: 12px; color: var(--on-surface-variant); }

/* 今日 / 周视图 分段控件 */
.viewtoggle {
  display: flex;
  margin: 0 12px 10px;
  padding: 3px;
  gap: 3px;
  background: var(--surface-container-high);
  border-radius: 999px;
}
.viewtoggle button {
  flex: 1;
  padding: 8px 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface-variant);
  transition: background .15s ease, color .15s ease;
}
.viewtoggle button.active { background: var(--primary-container); color: var(--on-primary-container); }
/* 设置面板里的「自动 / 手动」开关：沿用上面那套外观，只去掉外边距 */
.viewtoggle.in-field { margin: 6px 0 0; }

/* 下一节课 */
.next-card {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 12px 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
}
.next-card .label { font-size: 13px; font-weight: 700; white-space: nowrap; }
.next-card .text { flex: 1; font-size: 14px; }

/* 列表区 */
main.view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.hidden { display: none; }

.course-list { padding: 0 12px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 8px; }

.course-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}
.course-card .row1 { display: flex; align-items: baseline; gap: 8px; }
.course-card .name { font-size: 16px; font-weight: 600; }
.course-card .when { margin-left: auto; font-size: 12px; opacity: .8; white-space: nowrap; }
.course-card .row2 { font-size: 13px; opacity: .85; }
.course-card.ongoing { outline: 2px solid currentColor; outline-offset: -2px; }

/* 今日列表的卡片按课程轮换配色（周视图是按节次时段配色，两者用途不同） */
.course-card.c1 { background: var(--c1); color: var(--on-c1); }
.course-card.c2 { background: var(--c2); color: var(--on-c2); }
.course-card.c3 { background: var(--c3); color: var(--on-c3); }
.course-card.c4 { background: var(--c4); color: var(--on-c4); }

.badge { display: inline-block; padding: 1px 6px; border-radius: 999px; font-size: 11px; background: rgba(0, 0, 0, .10); }
.course-card .badge { background: rgba(0, 0, 0, .10); }

/* 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 32px;
  text-align: center;
  color: var(--on-surface-variant);
}
.empty .big { font-size: 44px; opacity: .5; }
.empty .title { font-size: 17px; font-weight: 600; color: var(--on-surface); }
.empty .hint { font-size: 14px; line-height: 1.6; }
.empty button.link { color: var(--primary); font-weight: 600; padding: 8px 12px; border-radius: 999px; }

/* 周视图 */
#viewWeek { overflow: auto; }
.weekgrid { display: grid; grid-template-columns: 34px repeat(7, 1fr); gap: 1px; padding: 0 8px calc(96px + var(--safe-bottom)); min-width: 320px; }
.wg-head { position: sticky; top: 0; z-index: 2; background: var(--surface-container); padding: 6px 0; text-align: center; font-size: 12px; font-weight: 600; }
.wg-head .d { color: var(--on-surface-variant); font-weight: 400; font-size: 11px; }
.wg-head.today { color: var(--primary); }
.wg-period { background: var(--surface-container); font-size: 11px; color: var(--on-surface-variant); text-align: center; padding: 6px 0; }
.wg-cell { min-height: 46px; background: var(--surface-container); border-radius: 6px; padding: 3px; }
.wg-cell.today { background: color-mix(in srgb, var(--primary) 14%, var(--surface-container)); }

/* 按节次时段配色：上午 / 下午 / 晚上 */
.wg-period.band-am { background: var(--am-soft); }
.wg-period.band-pm { background: var(--pm-soft); }
.wg-period.band-eve { background: var(--eve-soft); }
.wg-cell.band-am { background: var(--am-soft); }
.wg-cell.band-pm { background: var(--pm-soft); }
.wg-cell.band-eve { background: var(--eve-soft); }
.wg-cell.band-am.today { background: color-mix(in srgb, var(--primary) 16%, var(--am-soft)); }
.wg-cell.band-pm.today { background: color-mix(in srgb, var(--primary) 16%, var(--pm-soft)); }
.wg-cell.band-eve.today { background: color-mix(in srgb, var(--primary) 16%, var(--eve-soft)); }

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 2px 14px 8px;
  font-size: 12px;
  color: var(--on-surface-variant);
}
.legend .item { display: flex; align-items: center; gap: 5px; }
.legend .dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend .dot.am { background: var(--am-bg); border: 1px solid var(--am-fg); }
.legend .dot.pm { background: var(--pm-bg); border: 1px solid var(--pm-fg); }
.legend .dot.eve { background: var(--eve-bg); border: 1px solid var(--eve-fg); }

.wg-block {
  width: 100%;
  height: 100%;
  min-height: 40px;
  padding: 3px 4px;
  border-radius: 6px;
  font-size: 10.5px;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.wg-block.band-am { background: var(--am-bg); color: var(--am-fg); }
.wg-block.band-pm { background: var(--pm-bg); color: var(--pm-fg); }
.wg-block.band-eve { background: var(--eve-bg); color: var(--eve-fg); }
.wg-block .n { font-weight: 600; }
.wg-block .r { opacity: .8; font-size: 9.5px; }

/* FAB */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(20px + var(--safe-bottom));
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.fab:active { transform: scale(.96); }

/* ------------------------------------------------------------------ 底部面板 */

.backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 40;
  opacity: 0;
  animation: fade .18s ease forwards;
}
@keyframes fade { to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-container);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: var(--safe-bottom);
  animation: slideup .22s cubic-bezier(.2, .8, .2, 1);
  overscroll-behavior: contain;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet .handle { flex: 0 0 auto; width: 36px; height: 4px; border-radius: 2px; background: var(--outline-variant); margin: 8px auto 4px; }
.sheet .sheet-title { flex: 0 0 auto; padding: 6px 20px 10px; font-size: 18px; font-weight: 600; }
.sheet .sheet-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 12px; }

.sheet-list { display: flex; flex-direction: column; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 12px;
  border-radius: 12px;
  text-align: left;
  font-size: 16px;
}
.sheet-item:active { background: var(--surface-container-high); }
.sheet-item .ic { width: 24px; text-align: center; opacity: .8; }
.sheet-item .grow { flex: 1; }
.sheet-item .sub { font-size: 12px; color: var(--on-surface-variant); }
.sheet-item.danger { color: var(--error); }
.sheet-item.checked { color: var(--primary); font-weight: 600; }
.sheet-sep { height: 1px; background: var(--outline-variant); margin: 6px 12px; }

.detail-row { display: flex; gap: 12px; padding: 8px 12px; font-size: 15px; }
.detail-row .k { width: 56px; flex: 0 0 auto; color: var(--on-surface-variant); }
.detail-row .v { flex: 1; word-break: break-all; }

.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 4px 4px; }
.btn {
  flex: 1;
  min-width: 96px;
  padding: 13px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  background: var(--surface-container-high);
  color: var(--on-surface);
}
.btn:active { opacity: .8; }
.btn { text-decoration: none; }   /* 「下载安装包」是一颗 <a> 按钮，去掉下划线 */
.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.danger { color: var(--error); }
.btn.ghost { background: transparent; color: var(--primary); }

.field { padding: 8px 4px; }
.field label { display: block; font-size: 13px; color: var(--on-surface-variant); margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=number], .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  color: var(--on-surface);
  appearance: none;
}
.field .help { font-size: 12px; color: var(--on-surface-variant); margin-top: 6px; line-height: 1.5; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--outline-variant);
  font-size: 14px;
  background: transparent;
}
.chip.on { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; font-weight: 600; }

/* 校园地图 */
.map-wrap { position: relative; }
.map-img-wrap {
  border-radius: 12px;
  overflow: auto;
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  max-height: 62dvh;
  touch-action: pinch-zoom;
}
.map-img-wrap img { display: block; max-width: 100%; height: auto; }
.map-zoom img { max-width: none; width: 190%; }
.map-tip { font-size: 12px; color: var(--on-surface-variant); margin: 8px 4px; line-height: 1.6; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 90;
  max-width: 86vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--on-surface);
  color: var(--surface);
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
  animation: fade .18s ease;
}

.preview-count { font-size: 15px; padding: 10px 12px; }
.preview-count b { color: var(--primary); font-size: 18px; }

/* --------------------------- 导入时「你是哪个班」下面的手勾列表 */
.import-tags {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--outline-variant);
  border-radius: 12px;
  padding: 6px 12px;
  margin: 4px 0 8px;
  background: var(--surface);
}
.import-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 14px;
  cursor: pointer;
}
.import-tag input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--primary);
}

/* ------------------------------------------------ 教学视频 / 支持作者 */
.video-wrap { margin: 4px 0 10px; }
.video-wrap video {
  width: 100%;
  display: block;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.support-note { text-align: center; margin: 6px 0 12px; }
.support-note p { margin: 2px 0; font-size: 15px; line-height: 1.6; }
.support-photo {
  display: block;
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 16px;
  margin: 0 auto 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.support-qr {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto 8px;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.video-wrap iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  border: 0;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tip a { color: var(--primary); }

/* 下载安装包：分块并行下载的进度条 */
.dl-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--outline-variant);
  overflow: hidden;
  margin: 14px 0 12px;
}
.dl-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary);
  transition: width .18s ease;
}
.dl-main { font-size: 16px; font-weight: 600; margin: 2px 0; }
.dl-sub { font-size: 12.5px; color: var(--on-surface-variant); margin: 2px 0; }

/* 教学视频：封面 + 播放按钮（点击后才加载 B站 iframe） */
.video-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.video-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* ---------------- 节次时间编辑器（整屏） ---------------- */
.sheet.full {
  top: 0;
  max-height: 100dvh;
  height: 100dvh;
  border-radius: 0;
  padding-top: var(--safe-top);
}
.sheet.full .handle { visibility: hidden; }

.pedit-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 16px 4px 6px;
}
.pedit-hint {
  font-size: 12px;
  line-height: 1.7;
  color: var(--on-surface-variant);
  white-space: pre-wrap;
  margin: 6px 4px 4px;
}
.pedit-note {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin: 10px 4px 4px;
  line-height: 1.6;
}
.pedit-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 4px 12px 10px;
  margin: 4px 0;
}
.pedit-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
.pedit-field .pedit-label { flex: 1 1 auto; min-width: 0; font-size: 14px; }
.pedit-field input {
  width: 45%;
  max-width: 140px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 8px 10px;
  text-align: right;
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  background: var(--surface-container);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.pedit-field input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.pedit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.pedit-actions .btn { flex: 1; min-width: 120px; }

.pedit-rows {
  background: var(--surface);
  border-radius: 14px;
  padding: 4px 10px;
  margin: 4px 0;
}
.pedit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--outline-variant);
}
.pedit-row:last-child { border-bottom: 0; }
.pedit-row .pedit-n { flex: 0 0 auto; width: 42px; font-size: 13px; color: var(--on-surface-variant); }
.pedit-row .pedit-dash { flex: 0 0 auto; color: var(--on-surface-variant); }
.pedit-row input[type=text] {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  padding: 7px 4px;
  text-align: center;
  border: 1px solid var(--outline-variant);
  border-radius: 10px;
  background: var(--surface-container);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.pedit-row input[type=text]:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.pedit-lock {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.pedit-lock input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }

/* 网页版没有原生弹窗，自己搭一个 */
.dialog-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface-container);
  border-radius: var(--radius-lg);
  padding: 18px 18px 8px;
  box-shadow: var(--shadow);
}
.dialog-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.dialog-text { font-size: 14px; line-height: 1.7; color: var(--on-surface-variant); white-space: pre-wrap; }

/* ---------------- 更新日志 ---------------- */
.log-item {
  border-left: 3px solid var(--primary);
  padding: 2px 0 2px 10px;
  margin: 14px 4px 0;
}
.log-item:first-child { margin-top: 6px; }
.log-head { display: flex; align-items: baseline; gap: 8px; }
.log-head .log-v { font-size: 18px; font-weight: 700; color: var(--primary); }
.log-head .log-d { font-size: 12px; color: var(--on-surface-variant); }
.log-title { font-size: 14px; font-weight: 600; margin-top: 2px; }
.log-list { margin: 6px 0 0; padding-left: 18px; }
.log-list li { font-size: 14px; line-height: 1.65; margin: 4px 0; color: var(--on-surface); }

/* ---------------- 隐藏后台：网站访问数据面板 ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 6px 4px 10px;
}
.stat-cell {
  background: var(--surface-container);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
}
.stat-cell .stat-v { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1.15; }
.stat-cell .stat-k { font-size: 12px; color: var(--on-surface-variant); margin-top: 3px; }

.stat-meta {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.7;
  padding: 0 6px 4px;
}

.stat-sec { margin: 12px 0 4px; }
.stat-sec .stat-h {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin: 0 6px 6px;
}
.stat-line {
  display: flex;
  gap: 10px;
  padding: 6px;
  font-size: 14px;
  border-bottom: 1px solid var(--outline-variant);
}
.stat-line:last-child { border-bottom: 0; }
.stat-line .stat-n {
  flex: 0 0 auto;
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--primary);
}
.stat-line .stat-t { flex: 1; min-width: 0; word-break: break-all; }
.stat-empty { font-size: 13px; color: var(--on-surface-variant); padding: 4px 6px; }
.stat-note {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.6;
  padding: 6px;
}
.stat-note.warn { color: var(--error); }

.stat-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 110px;
  padding: 4px 6px 0;
}
.stat-col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.stat-bar {
  background: var(--primary);
  opacity: .72;
  border-radius: 2px 2px 0 0;
}
.stat-bar.peak { opacity: 1; background: #E8734A; }
.stat-col .stat-lab {
  flex: 0 0 auto;
  height: 14px;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

/* 周视图左侧：节次号 + 起止时间（1.30） */
.wg-period { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.wg-period .p { font-size: 12px; font-weight: 600; }
.wg-period .t { font-size: 9px; opacity: .75; line-height: 1.1; text-align: center; }

/* 周视图课块按课程配色（不再是上午/下午一个色） */
.wg-block { background: var(--c1); color: var(--on-c1); }
.wg-block.c1 { background: var(--c1); color: var(--on-c1); }
.wg-block.c2 { background: var(--c2); color: var(--on-c2); }
.wg-block.c3 { background: var(--c3); color: var(--on-c3); }
.wg-block.c4 { background: var(--c4); color: var(--on-c4); }
.wg-block.c5 { background: var(--c5); color: var(--on-c5); }
.wg-block.c6 { background: var(--c6); color: var(--on-c6); }
.wg-block.c7 { background: var(--c7); color: var(--on-c7); }
.wg-block.c8 { background: var(--c8); color: var(--on-c8); }
