/* 简约焕新：统一留白、层级与交互，保留所有既有 DOM 契约 */
/* 设计令牌（01-visual-direction §2.1）：全站唯一事实来源，组件规则只引用 var()/color-mix */
:root {
  /* Apple light（stylekit apple）：苹果灰画布 + 白卡 + 松绿唯一强调色，大量留白 + 轻阴影 */
  --bg: #f5f5f7;
  --card: #ffffff;
  --fill: #f5f5f7;
  --fill-strong: #e8e8ed;
  --text: #1d1d1f;
  --sub: #86868b;
  --faint: #aeaeb2;
  --muted: #86868b;
  --line: #d2d2d7;
  --line-strong: #c7c7cc;
  --accent: #1d7a5c;
  --accent-hover: #17624a;
  --accent-soft: rgba(29, 122, 92, 0.10);
  --accent-faint: #5aa88a;
  --accent-ink: #ffffff;
  --detection: #1d7a5c;
  --cinnabar: #1d7a5c;
  --cinnabar-soft: rgba(29, 122, 92, 0.10);
  --gilt: #1d7a5c;
  --hero: #ffffff;
  --hero-2: #f5f5f7;
  --hero-text: #1d1d1f;
  --hero-sub: #86868b;
  --hero-gilt: #1d7a5c;
  /* Apple 语义色：绿/红只表达状态，小面积 */
  --ok: #34c759;
  --ok-soft: rgba(52, 199, 89, 0.12);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, 0.12);
  --fail: #ff3b30;
  --fail-soft: rgba(255, 59, 48, 0.12);
  --radius-s: 12px;
  --radius: 12px;
  --radius-l: 24px;
  --radius-xl: 24px;
  --shadow: var(--shadow-1);
  --shadow-1: 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 20px 40px rgba(0, 0, 0, 0.08);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, 0.16);
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --font-serif: "Instrument Serif", Georgia, "Songti SC", "STSong", "Noto Serif SC", serif;
  --font-text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", sans-serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}
::selection {
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  color: var(--text);
}
button, input, select, textarea { font-family: inherit; }
button {
  min-height: 38px;
  padding: 8px 15px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--card);
  font-weight: 500;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
button:hover { opacity: 1; border-color: var(--detection); background: var(--fill-strong); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--detection);
  outline-offset: 2px;
}
button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: none;
}
button.primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); }
button.small { min-height: 33px; padding: 6px 12px; font-size: 12px; }
input, select, textarea {
  min-height: 42px;
  padding: 9px 12px;
  border-color: var(--line);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--line-strong);
  outline: 2px solid var(--detection);
  outline-offset: 2px;
  background: var(--bg);
  box-shadow: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="checkbox"] { min-height: 0; box-shadow: none; }
.field > span { color: var(--sub); font-size: 12px; }
.hint { color: var(--sub); line-height: 1.75; }
.wrap {
  width: 100%;
  max-width: 1160px;
  padding: 30px 28px 64px;
}
#app > header {
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding: 0;
}
h1 {
  font-family: var(--font-serif);
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.brand-cn {
  margin-left: 10px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--sub);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  vertical-align: 5px;
}
.header-sub { margin-top: 5px; font-size: 12px; }
.header-right { gap: 8px; flex-wrap: wrap; }
#userBox {
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--sub);
  font-family: var(--font-mono);
  font-size: 12px;
}
#syncBtn { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
#syncBtn:hover { background: var(--accent-hover); }
#logoutBtn { background: transparent; }
.statusbar {
  gap: 6px 18px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  color: var(--sub);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
}
nav {
  top: 12px;
  gap: 4px;
  margin: 0 0 24px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sub);
  font-size: 13px;
  font-weight: 500;
}
nav button:hover { border: 0; background: var(--fill-strong); color: var(--text); }
nav button.active {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent);
}
@keyframes section-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
#app > section:not(.hidden) { animation: section-enter 0.22s ease-out; }
.card, .today-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card h2 { margin-bottom: 14px; font-family: var(--font-serif); font-size: 20px; font-weight: 400; letter-spacing: 0; }
.card > .hint { margin-bottom: 18px; }
.day-head, .today-card .day-head {
  margin-bottom: 2px;
  padding-bottom: 22px;
  border-bottom-color: var(--line);
}
.section-kicker { margin-bottom: 7px; color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 400; letter-spacing: 0.14em; }
.day-head .date, .today-card .day-head .date { font-family: var(--font-serif); font-size: 30px; font-weight: 400; letter-spacing: -0.01em; }
.day-meta { gap: 10px; }
#todayCount { font-size: 12px; }
.course-row { gap: 26px; padding: 22px 0; border-top-color: var(--line); }
.course-row:hover .course-name { color: var(--accent); }
.course-time { flex-basis: 138px; }
.course-time .range { font-size: 15px; font-weight: 650; }
.course-time .sections { margin-top: 4px; }
.course-name { font-size: 16px; font-weight: 620; transition: color 0.15s ease; }
.course-meta { margin-top: 5px; line-height: 1.65; }
.empty { --empty-pad: 54px; }
.source-card { border-color: var(--line); border-radius: var(--radius-l); background: var(--card); }
.source-card-head { padding-bottom: 12px; }
.week-nav { margin-bottom: 18px; padding: 0; }
.week-nav .label { font-family: var(--font-serif); font-size: 18px; font-weight: 400; }
.week-grid { overflow: hidden; border-color: var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.mini-course, .mini-course.tone-0, .mini-course.tone-1, .mini-course.tone-2, .mini-course.tone-3, .mini-course.tone-4 {
  padding: 9px;
  border-left-width: 3px;
  border-radius: 7px;
  box-shadow: none;
}
/* 课程色板（01 §2.3）：松绿主调 + 四个大地色系邻近色 */
.mini-course.tone-0 { border-left-color: #4E7B74; background: #DEEAE7; }
.mini-course.tone-1 { border-left-color: #5E7490; background: #E2E8F1; }
.mini-course.tone-2 { border-left-color: #66689A; background: #E6E7F2; }
.mini-course.tone-3 { border-left-color: #7D6E80; background: #ECE8EF; }
.mini-course.tone-4 { border-left-color: #6B826F; background: #E4EDE5; }
.mini-course .t, .mini-course .r { color: var(--sub); }
.sheet-panel { border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-3); }

/* 桌面增强（≥901px）：从已清理的死皮肤移植的有效规则 */
.exam-date .dow { margin-top: 4px; }
@media (min-width: 901px) {
  .week-grid { min-width: 0; }
  .today-card { padding: 31px 32px; }
  .today-card .day-head .date { font-size: 34px; }
  #todayCount { margin-top: 13px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 11px; }
}

/* 登录：更清晰的产品层级 */
.auth-screen { padding: 52px 32px; }
.auth-layout { max-width: 1020px; grid-template-columns: minmax(0, 1fr) 410px; gap: 100px; }
/* 中等屏压缩间距，避免 intro 列被挤压（P2-1） */
@media (max-width: 1100px) { .auth-layout { gap: 44px; } }
.auth-eyebrow { margin-bottom: 20px; color: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 400; letter-spacing: 0.24em; }
.auth-title { font-family: var(--font-serif); font-size: 60px; font-weight: 400; letter-spacing: -0.02em; line-height: 1.02; }
.auth-title span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-family: var(--font-mono); font-size: 12px; vertical-align: 12px; }
.auth-intro-sub { max-width: 420px; margin-top: 22px; font-size: 16px; line-height: 1.9; }
.auth-features { margin-top: 44px; border-top-color: var(--line); }
.auth-features > div { padding: 16px 0; border-bottom-color: var(--line); }
.auth-features dt { color: var(--accent); font-weight: 600; }
.auth-card { padding: 34px; border-color: var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-2); }
.auth-sub { color: var(--sub); }
.auth-tabs { gap: 4px; padding: 4px; border-radius: var(--radius-l); background: var(--fill); }
.auth-tabs button { min-height: 36px; padding: 7px 10px; border: 0; border-radius: 9px; }
.auth-tabs button:hover { border: 0; background: color-mix(in srgb, var(--card) 60%, transparent); }
.auth-tabs button.primary { border: 0; background: var(--card); color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.auth-form button.primary { min-height: 44px; margin-top: 3px; }

@media (max-width: 720px) {
  .wrap { padding: 20px 15px 42px; }
  #app > header {
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
  }
  .brand-lockup { min-width: 0; }
  .brand-lockup > div { min-width: 0; }
  .header-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  h1 { font-size: 27px; }
  .brand-cn { vertical-align: 4px; }
  .header-right {
    width: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .header-right button.small { padding: 5px 8px; }
  #userBox { display: none; }
  .statusbar { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  nav { top: 8px; gap: 3px; margin-bottom: 18px; padding: 5px; border-radius: 999px; }
  nav button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .card, .today-card { padding: 21px; border-radius: var(--radius-l); }
  .day-head .date, .today-card .day-head .date { font-size: 25px; }
  .course-row { gap: 16px; padding: 19px 0; }
  .course-time { flex-basis: 106px; }
  .sheet-panel { border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .auth-screen { padding: 30px 20px; }
  .auth-layout { max-width: 440px; }
  .auth-title { font-size: 43px; }
  .auth-title span { vertical-align: 8px; }
  .auth-intro-sub { margin: 14px auto 0; font-size: 13px; }
  .auth-card { margin-top: 28px; padding: 27px; border-radius: var(--radius-xl); }
}
@media (max-width: 480px) {
  .wrap { padding-right: 12px; padding-left: 12px; }
  .header-sub { font-size: 11px; }
  .brand-cn { display: none; }
  .header-right .badge { display: none; }
  .card, .today-card { padding: 18px; }
  .tomorrow-card { padding: 16px 18px; }
  .day-head { align-items: flex-start; }
  .course-time { flex-basis: 88px; }
  .course-time .range { font-size: 13px; }
  .course-name { font-size: 15px; }
  .auth-screen { padding: 25px 16px; }
  .auth-eyebrow { margin-bottom: 14px; }
  .auth-card { padding: 23px 20px; }
}
/* 下一节课直达条 */
.next-class {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 16px 0 2px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-l);
  background: var(--accent-soft);
  text-align: left;
}
.next-class:hover { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.next-class .nc-main { flex: 1; min-width: 0; }
.next-class .nc-kicker { color: var(--accent); font-size: 10px; font-weight: 650; letter-spacing: 0.1em; }
.next-class .nc-name {
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-class .nc-meta { margin-top: 2px; color: var(--sub); font-size: 12px; }
.next-class .nc-count { flex: 0 0 auto; text-align: right; }
.next-class .nc-count b {
  display: block;
  color: var(--accent);
  font-size: 24px;
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.next-class .nc-count span { color: var(--sub); font-size: 10px; }
.next-class .nc-arrow { flex: 0 0 auto; color: var(--sub); font-size: 14px; }

/* 周课表：只在「没课」的时段提供加日程（有课的时间不需要） */
#nav button svg { display: none; }
.week-cell .wc-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.week-cell .wc-free {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 0;
  padding: 5px 4px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--sub);
  font-size: 10px;
  font-weight: 500;
  opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}
.week-cell:hover .wc-free,
.wc-free:hover { opacity: 1; }
/* 触屏无 hover：空格子按钮常显，不再半透明（P1-4） */
@media (hover: none) {
  .week-cell .wc-free { opacity: 1; }
}
.wc-free:hover { border-color: var(--accent); background: var(--card); color: var(--accent); }
.wc-free span { font-size: 9px; }


/* 考试倒计时 */
.exam-countdown { flex: 0 0 auto; align-self: center; text-align: right; }
.exam-countdown b {
  display: block;
  color: var(--accent);
  font: 650 28px/1 var(--font-num);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.exam-countdown span { display: block; margin-top: 4px; color: var(--sub); font-size: 10px; letter-spacing: 0.04em; }
.exam-countdown.urgent b { color: var(--warn); }

/* 移动端底部标签栏 */
@media (max-width: 720px) {
  #nav {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 45;
    display: flex;
    gap: 0;
    margin: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: color-mix(in srgb, var(--card) 94%, transparent);
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--text) 8%, transparent);
  }
  #nav button {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 46px;
    padding: 4px 0;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }
  #nav button svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  #nav button.active { background: var(--accent-soft); box-shadow: none; }
  .wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .next-class { gap: 10px; padding: 12px 13px; }
  .next-class .nc-name { font-size: 15px; }
  .next-class .nc-count b { font-size: 21px; }
  .exam-countdown b { font-size: 24px; }
}

/* 外观切换：跟随系统 / 浅色 / 深色 */
.theme-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-choice button { min-width: 88px; }
.theme-choice button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
