/* ============================================================
   Qin的学习手账 · 手账风设计系统
   米白纸底 + 焦糖暖棕 + 柔橙粉，像一本摊开的纸质手账
   ============================================================ */

:root {
  --paper: #F7F1E6;
  --paper-deep: #F2E9D8;
  --card: #FFFDF7;
  --ink: #4A3A2C;
  --ink-soft: #7A6A57;
  --ink-faint: #94826C;
  --caramel: #A96A3B;
  --caramel-deep: #8A5A2B;
  --caramel-light: #C08A4E;
  --peach: #F5C9A8;
  --peach-deep: #EFAF82;
  --pink: #E8A9A4;
  --pink-deep: #DE8A7E;
  --sage: #9DBA97;
  --honey: #E5B44F;
  --terra: #E07856;
  --line: #E7DAC2;
  --line-soft: #F0E6D3;
  --sticky: #FCF0C9;
  --danger: #B04A34;

  /* 手账字体：马善政毛笔字（笔画饱满好辨认）为主，楷体兜底；
     早期用的 Zhi Mang Xing / Long Cang 笔画太细，小字号看不清 */
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-hand: "Ma Shan Zheng", "Kaiti SC", "KaiTi", "STKaiti", cursive;
  --font-note: "Kaiti SC", "KaiTi", "STKaiti", "Ma Shan Zheng", cursive;

  --shadow-card: 0 1px 0 rgba(233, 218, 195, .9), 0 10px 26px rgba(150, 110, 60, .08);
  --shadow-pop: 0 4px 0 rgba(138, 90, 43, .18), 0 14px 34px rgba(150, 110, 60, .16);
  --radius-card: 20px 18px 22px 16px;
  --topbar-h: 64px;
  --bottomnav-h: 62px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* hidden 属性必须压倒类上的 display 声明 */
[hidden] { display: none !important; }

/* 键盘焦点可见性（企业级无障碍）：仅键盘导航时显示清晰焦点环 */
:focus-visible {
  outline: 2.5px solid var(--caramel-light);
  outline-offset: 2px;
  border-radius: 6px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

/* 细腻滚动条，贴合纸质质感 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(169, 106, 59, .22);
  border-radius: 999px;
  border: 2.5px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: rgba(169, 106, 59, .4); }
* { scrollbar-width: thin; scrollbar-color: rgba(169, 106, 59, .28) transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.62 0 0 0 0 0.54 0 0 0 0 0.42 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  font-size: 15.5px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--peach); color: var(--caramel-deep); }

a { color: var(--caramel); text-decoration: none; }
a:hover { color: var(--caramel-deep); }

.hand { font-family: var(--font-hand); font-weight: 400; letter-spacing: .02em; }
.note { font-family: var(--font-note); }

.icon { vertical-align: -4px; flex: none; }

/* ---------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 clamp(14px, 4vw, 36px);
  background: rgba(247, 241, 230, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; color: var(--caramel-deep); }
.brand-sun { display: grid; place-items: center; animation: sun-spin 24s linear infinite; }
@keyframes sun-spin { to { transform: rotate(360deg); } }
.brand-name { font-size: 25px; line-height: 1; color: var(--caramel-deep); }

.topnav { display: flex; gap: 4px; margin-left: auto; }
.topnav a {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  color: var(--ink-soft); font-weight: 700; font-size: 14.5px;
  transition: all .18s ease;
}
.topnav a:hover { color: var(--caramel); background: rgba(245, 201, 168, .22); }
.topnav a.active {
  color: #FFF8EE;
  background: linear-gradient(180deg, var(--caramel-light), var(--caramel));
  box-shadow: 0 2px 0 var(--caramel-deep);
}
.topnav a.active .icon { color: #FFF8EE; }

.topbar-gear {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; color: var(--ink-soft);
  border: 1.5px solid var(--line); background: var(--card);
  transition: all .18s ease;
}
.topbar-gear:hover { color: var(--caramel); border-color: var(--peach-deep); transform: rotate(30deg); }

/* ---------------------------------------------------------- 底部导航（移动端） */
.bottomnav { display: none; }

/* ---------------------------------------------------------- 页面骨架 */
.page {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 26px clamp(14px, 4vw, 28px) 40px;
}

.footer {
  padding: 22px 16px 26px;
  text-align: center;
  border-top: 1.5px dashed var(--line);
  color: var(--ink-faint);
  font-size: 13px;
}
.footer-slogan { display: block; font-size: 19px; color: var(--caramel-light); margin-bottom: 2px; }
.footer-meta { letter-spacing: .04em; }

/* ---------------------------------------------------------- 卡片与胶带 */
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.tape {
  position: absolute; top: -11px; left: 50%;
  width: 88px; height: 22px;
  transform: translateX(-50%) rotate(-2deg);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .28) 0 5px, rgba(255, 255, 255, 0) 5px 10px),
    rgba(240, 190, 148, .55);
  border-left: 1px dashed rgba(255, 255, 255, .6);
  border-right: 1px dashed rgba(255, 255, 255, .6);
  border-radius: 2px;
  pointer-events: none;
}
.tape-c { width: 64px; height: 18px; }

/* ---------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px;
  border: none; border-radius: 999px;
  font-family: var(--font-body); font-weight: 800; font-size: 15px;
  color: #FFF8EE;
  background: linear-gradient(180deg, var(--caramel-light), var(--caramel));
  box-shadow: 0 3px 0 var(--caramel-deep), 0 8px 18px rgba(150, 100, 50, .18);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--caramel-deep); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-ghost {
  color: var(--caramel);
  background: var(--card);
  border: 1.5px solid var(--peach-deep);
  box-shadow: 0 2px 0 rgba(239, 175, 130, .5);
}
.btn-ghost:hover { background: #FDF3E7; }
.btn-ghost:active { box-shadow: 0 0 0 rgba(239, 175, 130, .5); }

.btn-warm {
  background: linear-gradient(180deg, var(--pink), var(--pink-deep));
  box-shadow: 0 3px 0 #C26B60, 0 8px 18px rgba(222, 138, 126, .25);
}
.btn-warm:active { box-shadow: 0 1px 0 #C26B60; }

.btn-danger-ghost {
  color: #A03A26;
  border-color: #D98876;
  background: #FBEEE9;
  box-shadow: 0 2px 0 rgba(166, 61, 42, .28);
}
.btn-danger-ghost:hover { background: #F8E2D9; color: #8C3018; }
.btn-danger-ghost:active { box-shadow: 0 0 0 rgba(166, 61, 42, .28); }

.btn-small { padding: 7px 14px; font-size: 13.5px; box-shadow: 0 2px 0 var(--caramel-deep), 0 5px 12px rgba(150, 100, 50, .15); }
.btn-big { padding: 14px 30px; font-size: 17px; }
.btn-go { padding: 9px 18px; font-size: 14px; }

.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 248, 238, .4); border-top-color: #FFF8EE;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: none; border-radius: 10px;
  background: transparent; color: var(--ink-faint);
  cursor: pointer; transition: all .15s ease;
}
.icon-btn:hover { color: var(--caramel); background: rgba(245, 201, 168, .25); }
/* 删除图标静止时即可见（不再只有 hover 才显形），深砖红在米白底上约 5:1 */
.icon-btn.danger { color: #B04A34; }
.icon-btn.danger:hover { color: #8C3018; background: #F7E3DC; }

/* ---------------------------------------------------------- 表单 */
.field { display: block; margin-bottom: 16px; }
.field-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 17px; color: var(--caramel);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  font-family: var(--font-body); font-size: 15.5px; color: var(--ink);
  background: #FFFEFB;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--peach-deep);
  box-shadow: 0 0 0 3px rgba(245, 201, 168, .3);
}

.styled-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23A96A3B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px !important;
  cursor: pointer;
}

/* 弹窗内的并排字段：datetime-local 等内容较宽，一律改竖排两行，避免挤在一起 */
.form-row { display: grid; grid-template-columns: 1fr; gap: 0; }
.field-inline { display: flex; align-items: center; gap: 10px; margin-bottom: 0; }
.field-inline .field-label { margin-bottom: 0; white-space: nowrap; }
.field-inline input, .field-inline select { width: auto; min-width: 150px; }

/* 分段选择器 */
.seg {
  display: inline-flex; gap: 4px;
  background: var(--paper-deep);
  border: 1.5px solid var(--line);
  border-radius: 999px; padding: 4px;
}
.seg-item {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-body); font-weight: 800; font-size: 14.5px;
  color: var(--ink-soft); background: transparent; cursor: pointer;
  transition: all .18s ease;
}
.seg-item:hover { color: var(--caramel); }
.seg-item.active {
  color: #FFF8EE;
  background: linear-gradient(180deg, var(--caramel-light), var(--caramel));
  box-shadow: 0 2px 0 var(--caramel-deep);
}
.seg-mode { margin: 4px auto 26px; display: flex; width: max-content; }
.seg-view { margin: 0 0 20px; display: flex; width: max-content; }

/* 颜色选择 */
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid transparent; cursor: pointer;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .06);
  transition: transform .15s ease;
}
.color-dot:hover { transform: scale(1.12); }
.color-dot.active { border-color: var(--ink); transform: scale(1.15); }

/* 小标签 */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 11px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  background: var(--paper-deep); color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  white-space: nowrap;
}
.prio-high { background: #FBE3DC; color: #C05B41; border-color: #F2C7BC; }
.prio-mid { background: #FBF0D2; color: #A5761B; border-color: #F0DFA8; }
.prio-low { background: #E7F0E4; color: #5F8559; border-color: #CFE0CB; }

.course-dot {
  width: 12px; height: 12px; border-radius: 50%;
  display: inline-block; flex: none;
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .08);
}
.course-dot.sm { width: 8px; height: 8px; }
.course-dot.lg { width: 15px; height: 15px; }

/* 进度条 */
.progress {
  height: 14px; border-radius: 999px;
  background: var(--paper-deep);
  border: 1.5px solid var(--line);
  overflow: hidden;
}
.progress.slim { height: 8px; border-width: 1px; }
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: repeating-linear-gradient(45deg, var(--peach-deep) 0 8px, var(--pink-deep) 8px 16px);
  transition: width .5s cubic-bezier(.22, 1, .36, 1);
  position: relative;
}
.progress > i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0));
}

/* ---------------------------------------------------------- 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: rgba(74, 58, 44, .32);
  backdrop-filter: blur(3px);
  padding: 18px;
  animation: mask-in .2s ease;
}
@keyframes mask-in { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  animation: pop-in .28s cubic-bezier(.22, 1.4, .36, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.92) translateY(14px); }
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border: none; border-radius: 50%;
  background: var(--paper-deep); color: var(--ink-soft);
  display: grid; place-items: center; cursor: pointer;
  transition: all .15s ease;
}
.modal-close:hover { color: var(--danger); background: #F9E8E4; }
.modal-title { font-size: 26px; color: var(--caramel-deep); margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------------------------------------------------------- 轻提示 */
.toast-wrap {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  font-weight: 700; font-size: 14.5px; color: var(--caramel-deep);
  animation: toast-in .35s cubic-bezier(.22, 1.4, .36, 1);
}
.toast.leaving { animation: toast-out .3s ease forwards; }
.toast .icon { color: var(--sage); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.95); } }

/* ---------------------------------------------------------- 页面标题 */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-title { font-size: 32px; color: var(--caramel-deep); line-height: 1.2; }
.page-sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); display: inline-block; margin-bottom: 4px; }
.back-link:hover { color: var(--caramel); }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 0 14px;
}
.section-head h2 { font-size: 24px; color: var(--caramel-deep); }
.section-more { font-size: 13.5px; font-weight: 700; }

/* 空状态 */
.empty-card, .empty-inline {
  text-align: center; padding: 34px 20px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-card);
  background: rgba(255, 253, 247, .6);
}
.empty-title { font-size: 21px; color: var(--caramel-light); margin-top: 8px; }
.empty-sub { color: var(--ink-faint); font-size: 13.5px; margin-top: 4px; }
.span-all { grid-column: 1 / -1; }

/* 骨架屏 / 加载占位 */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--paper-deep);
  border-radius: 10px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 253, 247, .7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* 页面级加载遮罩（首屏数据未就绪时） */
.page-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px 0; color: var(--ink-faint); font-size: 14.5px;
}
.page-loading .spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(169, 106, 59, .2); border-top-color: var(--caramel);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   登录页 · 日落天空 + 手账贴纸卡片
   ============================================================ */
.login-body {
  display: block;
  min-height: 100vh;
  background: linear-gradient(168deg, #FFE9D2 0%, #FCD9B6 30%, #F8BF9E 52%, #EFA3A8 74%, #D992AB 100%);
  overflow-x: hidden;
}

.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }

.sky-sun {
  position: absolute; width: 330px; height: 330px;
  right: -70px; top: -80px;
  animation: sun-float 9s ease-in-out infinite;
  filter: drop-shadow(0 0 46px rgba(255, 220, 160, .85));
}
@keyframes sun-float { 50% { transform: translateY(14px) scale(1.03); } }

.sky-cloud { position: absolute; width: 170px; opacity: .9; }
.sky-cloud.c1 { left: 8%; top: 13%; animation: cloud-drift 26s linear infinite; }
.sky-cloud.c2 { left: 62%; top: 24%; width: 120px; animation: cloud-drift 34s linear infinite reverse; }
.sky-cloud.c3 { left: 30%; top: 40%; width: 95px; opacity: .5; animation: cloud-drift 44s linear infinite; }
@keyframes cloud-drift {
  from { transform: translateX(-16vw); }
  to { transform: translateX(116vw); }
}

.sky-bird { position: absolute; width: 44px; }
.sky-bird.b1 { left: 20%; top: 18%; animation: bird-fly 18s linear infinite; }
.sky-bird.b2 { left: 20%; top: 26%; width: 32px; animation: bird-fly 24s linear infinite 3s; }
@keyframes bird-fly {
  from { transform: translateX(-10vw) translateY(0); }
  50% { transform: translateX(50vw) translateY(-24px); }
  to { transform: translateX(110vw) translateY(6px); }
}

.sky-star {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #FFF6E2; opacity: .9;
  box-shadow: 0 0 8px rgba(255, 246, 226, .9);
  animation: twinkle 3.2s ease-in-out infinite;
}
.sky-star.s1 { left: 12%; top: 8%; }
.sky-star.s2 { left: 84%; top: 44%; animation-delay: 1.1s; }
.sky-star.s3 { left: 46%; top: 5%; animation-delay: 2.2s; }
@keyframes twinkle { 50% { opacity: .25; transform: scale(.6); } }

.sky-hill {
  position: absolute; left: -8%; right: -8%; bottom: -90px; height: 300px;
  background: radial-gradient(60% 100% at 30% 100%, #F7D9B8 0%, transparent 70%),
    radial-gradient(55% 100% at 75% 100%, #F2C6A6 0%, transparent 72%);
  border-radius: 50% 50% 0 0;
  opacity: .85;
}

.login-wrap {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 18px;
  gap: 26px;
}

.login-head { text-align: center; }
.login-title {
  font-size: clamp(44px, 8vw, 62px);
  color: #FFF6E6;
  text-shadow: 0 2px 0 #D98F6E, 0 5px 18px rgba(180, 100, 70, .35);
  letter-spacing: .04em;
}
.login-sub {
  font-size: clamp(18px, 3vw, 22px);
  color: #8A5A3B;
  margin-top: 4px;
  opacity: .92;
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  padding: 44px 34px 26px;
  background:
    repeating-linear-gradient(180deg, transparent 0 34px, rgba(210, 190, 160, .28) 34px 35px),
    linear-gradient(180deg, #FFFEFB, #FFF9EC);
  background-attachment: local;
  border: 1.5px solid #EBD9BC;
  border-radius: 24px 20px 26px 18px;
  box-shadow: 0 4px 0 rgba(190, 150, 105, .28), 0 24px 60px rgba(150, 90, 60, .22);
}
/* 左侧装订线 */
.login-card::before {
  content: ""; position: absolute; left: 26px; top: 14px; bottom: 14px;
  width: 1.5px; background: rgba(226, 148, 148, .5);
}
.login-card::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 60px rgba(233, 200, 155, .18);
  pointer-events: none;
}

.tape-l, .tape-r { top: -12px; }
.tape-l { left: 22px; transform: rotate(-24deg); }
.tape-r { left: auto; right: 22px; transform: rotate(19deg); }
.tape-dot {
  position: absolute; top: 8px; right: 12px;
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(226, 148, 148, .55);
}

.login-form .field { margin-bottom: 18px; }
.login-form .field-label { font-size: 18px; }
.login-form input {
  background: transparent;
  border: none;
  border-bottom: 2px dashed #D9C4A5;
  border-radius: 0;
  padding: 8px 4px;
  font-size: 16px;
}
.login-form input:focus {
  border-bottom-color: var(--caramel);
  box-shadow: none;
  background: rgba(255, 244, 224, .5);
}

.btn-login {
  width: 100%;
  margin-top: 10px;
  padding: 13px;
  font-size: 17.5px;
  font-family: var(--font-hand);
  letter-spacing: .12em;
}

.login-error {
  margin: 4px 0 8px;
  font-size: 17px;
  color: #B0574A;
  background: var(--sticky);
  border-radius: 10px;
  padding: 6px 14px;
  transform: rotate(-.6deg);
  box-shadow: 0 2px 8px rgba(150, 110, 60, .15);
}

.login-card.shake { animation: shake .45s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.login-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 12px;
  border-top: 1.5px dashed var(--line);
}
.hint { font-size: 16px; color: var(--ink-faint); }
.login-cat { animation: cat-bob 3.4s ease-in-out infinite; }
@keyframes cat-bob { 50% { transform: translateY(-4px) rotate(-4deg); } }

.login-foot {
  font-size: 17px; color: rgba(138, 90, 59, .75);
  letter-spacing: .14em;
}

/* ============================================================
   仪表盘
   ============================================================ */
.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px;
}
.dash-greet { font-size: 34px; color: var(--caramel-deep); line-height: 1.15; }
.dash-date { color: var(--ink-soft); font-size: 14px; font-weight: 700; margin-top: 2px; }
.dash-doodle { animation: sparkle-spin 7s ease-in-out infinite; }
@keyframes sparkle-spin { 50% { transform: rotate(18deg) scale(1.08); } }

.today-card { text-align: center; padding: 26px 20px 22px; }
.today-label { font-size: 20px; color: var(--caramel); }
.today-num {
  font-size: clamp(52px, 9vw, 68px);
  line-height: 1.15;
  color: var(--caramel-deep);
  text-shadow: 0 2px 0 rgba(233, 200, 155, .5);
}
.today-sub { color: var(--ink-faint); font-size: 13.5px; margin: 2px 0 16px; }

.dash-timer-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
  background: linear-gradient(180deg, #FFF7E4, #FFF1D8);
  border-color: #F0D9AC;
}
.dash-timer-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--terra);
  box-shadow: 0 0 0 0 rgba(224, 120, 86, .5);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(224, 120, 86, 0); } 100% { box-shadow: 0 0 0 0 rgba(224, 120, 86, 0); } }
.dash-timer-status { font-size: 18px; color: var(--caramel); }
.dash-timer-clock { font-family: var(--font-hand); font-size: 30px; color: var(--caramel-deep); }
.dash-timer-owner { color: var(--ink-soft); font-size: 13.5px; font-weight: 700; }

.stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-top: 18px; margin-bottom: 20px;
}
.stat-row-4 { grid-template-columns: repeat(4, 1fr); }
.mini-card { text-align: center; padding: 18px 14px; }
.mini-label { font-size: 16px; color: var(--caramel); }
.mini-num { font-size: 21px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.mini-num.hand { font-size: 27px; color: var(--caramel-deep); font-weight: 400; }

.dash-section { margin-top: 8px; }

.goal-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.goal-card { padding: 18px 18px 16px; }
.goal-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.goal-type {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 800; color: var(--caramel);
  background: #FBF0DC; border-radius: 999px; padding: 3px 11px;
}
.goal-due-flag {
  font-size: 15px; color: #B0574A;
  background: var(--sticky); border-radius: 8px; padding: 1px 9px;
  transform: rotate(-2deg);
}
.goal-overdue { border-color: #EFC9A8; background: linear-gradient(180deg, #FFFBF2, #FFF6E8); }
.goal-title { font-weight: 800; font-size: 15.5px; margin-bottom: 10px; }
.goal-meta { font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.goal-actions { position: absolute; top: 10px; right: 8px; display: flex; gap: 2px; }

.list-card { padding: 8px 12px; }

/* ============================================================
   课程页
   ============================================================ */
.course-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.course-card {
  display: block; color: var(--ink);
  padding: 20px 18px 16px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.course-card:hover {
  color: var(--ink); transform: translateY(-3px) rotate(-.4deg);
  box-shadow: var(--shadow-pop);
}
.course-card-top { display: flex; align-items: center; gap: 10px; }
.course-name { font-size: 18px; font-weight: 800; }
.course-note { color: var(--ink-soft); font-size: 13.5px; margin: 8px 0 10px; }
.course-stats {
  display: flex; gap: 14px; flex-wrap: wrap;
  color: var(--ink-soft); font-size: 13px; font-weight: 700;
}
.course-stats .icon { color: var(--caramel-light); }
.course-goals { margin-top: 12px; display: grid; gap: 5px; }
.courses-total { text-align: center; font-size: 17px; color: var(--caramel-light); margin-top: 22px; }

/* 课程排序按钮（卡片右上角，hover 显形） */
.course-sort {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 1px;
  opacity: 0; transition: opacity .15s ease;
}
.course-card:hover .course-sort,
.course-grid.list-mode .course-sort { opacity: 1; }
.course-sort .icon-btn { width: 26px; height: 26px; }
.course-sort .icon-btn .icon { vertical-align: -3px; }

/* 列表视图：卡片变紧凑横排行 */
.course-grid.list-mode { grid-template-columns: 1fr; gap: 10px; }
.course-grid.list-mode .course-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.course-grid.list-mode .course-card:hover { transform: translateX(3px) rotate(0deg); }
.course-grid.list-mode .tape { display: none; }
/* 列表模式下排序按钮回到文档流内，避免和右侧统计重叠 */
.course-grid.list-mode .course-sort {
  position: static; opacity: 1;
  margin-left: 4px; flex: none;
}
.course-grid.list-mode .course-card-top { flex: none; max-width: 34%; gap: 8px; }
.course-grid.list-mode .course-name {
  font-size: 15.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.course-grid.list-mode .course-note {
  flex: 1; margin: 0; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.course-grid.list-mode .course-stats { margin-left: auto; flex: none; gap: 12px; }
.course-grid.list-mode .course-goals { display: none; }
.course-grid.list-mode .course-card.dragging { opacity: .45; }
.course-grid.list-mode .course-card.drop-target { border-top: 2.5px solid var(--peach-deep); }

/* 课程详情 */
.course-summary {
  display: flex; align-items: center; gap: clamp(16px, 4vw, 44px);
  flex-wrap: wrap;
  padding: 22px 24px;
}
.course-summary-item { min-width: 90px; }
.course-summary .btn-go { margin-left: auto; }

.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px;
  border-bottom: 1.5px dashed var(--line-soft);
}
.task-row:last-child { border-bottom: none; }
.task-row.dragging { opacity: .45; }
.task-row.drop-target { border-top: 2.5px solid var(--peach-deep); }

.task-drag {
  display: grid; place-items: center; gap: 1px;
  color: var(--ink-faint); cursor: grab;
  padding: 4px 2px; border-radius: 8px;
}
.task-drag:hover { color: var(--caramel); background: rgba(245, 201, 168, .2); }
.task-drag .icon { display: block; }

.task-check {
  width: 26px; height: 26px; flex: none;
  border: 2px solid var(--peach-deep); border-radius: 9px;
  background: #FFFEFB; color: transparent;
  display: grid; place-items: center; cursor: pointer;
  transition: all .18s ease;
}
.task-check:hover { border-color: var(--caramel); transform: scale(1.08); }
.task-check.done {
  background: linear-gradient(180deg, var(--sage), #7FA37B);
  border-color: #7FA37B; color: #FFFDF5;
}
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: 15px; word-break: break-all; }
.task-done { text-decoration: line-through; color: var(--ink-faint); }
.task-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.due-soon { background: #FBE3DC; color: #C05B41; border-color: #F2C7BC; }
.task-arrows { display: flex; gap: 2px; }

/* ============================================================
   计时页
   ============================================================ */
.timer-page { max-width: 560px; margin: 0 auto; }

.timer-stage {
  position: relative;
  width: min(340px, 82vw);
  margin: 0 auto 26px;
  aspect-ratio: 1;
}
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg {
  fill: none; stroke: #EFE3CC; stroke-width: 16;
}
.ring-fg {
  fill: none; stroke: url(#ringGrad); stroke-width: 16;
  stroke-linecap: round;
  stroke-dasharray: 879.6;
  stroke-dashoffset: 879.6;
  transition: stroke-dashoffset .5s cubic-bezier(.22, 1, .36, 1);
  filter: drop-shadow(0 2px 6px rgba(222, 138, 126, .35));
}
.ring-dots {
  fill: none; stroke: #D9C4A5; stroke-width: 3;
  stroke-dasharray: 1.5 11; opacity: .55;
}

.timer-face {
  position: absolute; inset: 12%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 2px;
}
.timer-status { font-size: 21px; color: var(--caramel); }
.timer-clock {
  font-size: clamp(56px, 13vw, 72px);
  line-height: 1.05;
  color: var(--caramel-deep);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(233, 200, 155, .5);
}
.timer-owner {
  font-size: 13.5px; font-weight: 800; color: var(--ink-soft);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.timer-hint { font-size: 12.5px; color: var(--ink-faint); }

.timer-stage.running .timer-status { color: var(--pink-deep); animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .55; } }

.timer-doodles { position: absolute; inset: 0; pointer-events: none; }
.td { position: absolute; opacity: .8; }
.td-1 { top: -6px; right: 8%; animation: td-float 4.5s ease-in-out infinite; }
.td-2 { bottom: 6%; left: -10px; animation: td-float 5.5s ease-in-out infinite .8s; }
.td-3 { top: 12%; left: -12px; animation: td-float 6.5s ease-in-out infinite .4s; }
@keyframes td-float { 50% { transform: translateY(-8px) rotate(10deg); } }

.timer-picker { margin-bottom: 16px; }
.timer-countdown { margin-bottom: 16px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip {
  padding: 7px 15px;
  border: 1.5px solid var(--peach-deep); border-radius: 999px;
  background: #FFFEFB; color: var(--caramel);
  font-family: var(--font-body); font-weight: 800; font-size: 14px;
  cursor: pointer; transition: all .15s ease;
}
.chip:hover { background: #FDF3E7; transform: translateY(-1px); }
.chip.active {
  background: linear-gradient(180deg, var(--caramel-light), var(--caramel));
  color: #FFF8EE; border-color: transparent;
  box-shadow: 0 2px 0 var(--caramel-deep);
}

.timer-actions {
  display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 6px;
}
.timer-foot-note { text-align: center; font-size: 15px; color: var(--ink-faint); margin-top: 22px; }

/* 结束备注弹窗 */
.modal-stop { text-align: center; max-width: 360px; }
.stop-modal-num { font-size: 54px; color: var(--caramel-deep); line-height: 1.1; }
.stop-modal-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 14px; }
.stop-note-input {
  width: 100%; text-align: center;
  font-family: var(--font-body); font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px;
  background: #FFFEFB;
}
.stop-note-input:focus { outline: none; border-color: var(--peach-deep); box-shadow: 0 0 0 3px rgba(245, 201, 168, .3); }
.modal-stop .modal-actions { justify-content: center; }

/* 倒计时完成庆祝 */
.celebrate {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: center;
  background: rgba(74, 58, 44, .35);
  backdrop-filter: blur(4px);
  padding: 18px;
  animation: mask-in .25s ease;
}
.celebrate-card {
  text-align: center; max-width: 340px; width: 100%;
  padding: 34px 26px 24px;
  animation: pop-in .45s cubic-bezier(.22, 1.5, .36, 1);
}
.celebrate-doodles { position: absolute; inset: 0; pointer-events: none; }
.cd { position: absolute; color: var(--honey); font-size: 18px; animation: cd-pop 1.6s ease-in-out infinite; }
.cd1 { top: 8%; left: 12%; }
.cd2 { top: 14%; right: 10%; animation-delay: .25s; }
.cd3 { bottom: 18%; left: 8%; animation-delay: .5s; }
.cd4 { bottom: 10%; right: 14%; animation-delay: .75s; }
.cd5 { top: 40%; left: 3%; animation-delay: 1s; }
.cd6 { top: 46%; right: 4%; animation-delay: 1.25s; }
@keyframes cd-pop { 50% { transform: scale(1.5) rotate(30deg); opacity: .6; } }
.celebrate-title { font-size: 40px; color: var(--caramel-deep); }
.celebrate-num { font-size: 44px; color: var(--pink-deep); margin: 4px 0; }
.celebrate-sub { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }
.celebrate-card .modal-actions { justify-content: center; }

/* ============================================================
   记录页
   ============================================================ */
.filter-bar {
  display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  padding: 18px 20px 14px;
  margin-bottom: 22px;
}
.filter-actions { display: flex; gap: 8px; margin-left: auto; }

.date-stamp {
  display: inline-block;
  font-size: 19px; color: var(--caramel);
  border: 1.5px dashed var(--peach-deep);
  border-radius: 999px;
  padding: 2px 16px;
  margin: 18px 0 10px;
  background: rgba(255, 253, 247, .7);
  transform: rotate(-.8deg);
}

.record-card {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: transform .15s ease;
}
.record-card:hover { transform: translateX(3px); }
.record-time {
  display: flex; align-items: center; gap: 5px;
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 14.5px; color: var(--ink);
  white-space: nowrap;
}
.record-arrow { color: var(--peach-deep); }
.record-main { flex: 1; min-width: 0; }
.record-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.course-pill { background: #FBF0DC; color: #8A5A2B; border-color: #F0DFA8; }
.task-pill { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dur-pill { background: #FBE9E4; color: #B0574A; border-color: #F2CFC4; }
.record-note { font-family: var(--font-note); font-size: 16.5px; color: var(--ink-soft); margin-top: 4px; word-break: break-all; }
.record-actions { display: flex; gap: 2px; margin-left: auto; }

.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-top: 20px; flex-wrap: wrap;
}
.page-info { font-size: 13.5px; color: var(--ink-faint); font-weight: 700; }
.page-btn { text-decoration: none; }

/* ============================================================
   统计页
   ============================================================ */
.chart-card { margin-bottom: 24px; padding: 22px 20px 16px; }
.chart-title { font-size: 22px; color: var(--caramel-deep); margin-bottom: 12px; }
.chart-box { position: relative; height: 300px; }
.donut-wrap {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.donut-box { width: 260px; height: 260px; flex: none; }
.donut-legend { list-style: none; flex: 1; min-width: 200px; display: grid; gap: 10px; }
.donut-legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.donut-legend .lg-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.donut-legend .lg-name { font-weight: 800; }
.donut-legend .lg-val { color: var(--ink-soft); margin-left: auto; font-variant-numeric: tabular-nums; }
.chart-fallback { text-align: center; color: var(--ink-faint); font-size: 13.5px; padding: 30px 0; }

.insight-card {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px; padding: 16px 20px;
  background: linear-gradient(180deg, #FFF9EC, #FFF6E4);
  border-color: #F0DFA8;
}
.insight-icon { color: var(--honey); display: grid; place-items: center; }
.insight-text { font-size: 19px; color: #8A5A2B; line-height: 1.5; }

/* ============================================================
   设置页
   ============================================================ */
.settings-card { max-width: 560px; margin-bottom: 20px; padding: 24px 26px 20px; }
.settings-title { font-size: 25px; color: var(--caramel-deep); }
.settings-sub { color: var(--ink-soft); font-size: 13.5px; margin: 2px 0 16px; }
.settings-form .modal-actions { margin-top: 4px; }

.about-list { list-style: none; display: grid; gap: 12px; margin: 14px 0 4px; }
.about-list li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.about-list .icon { color: var(--caramel-light); }

.settings-soon {
  margin-top: 16px; padding: 14px 16px;
  background: var(--sticky);
  border-radius: 14px;
  transform: rotate(-.4deg);
}
.soon-title { font-size: 18px; color: #A5761B; }
.soon-sub { font-size: 13px; color: var(--ink-soft); }

.settings-logout { text-align: center; margin-top: 26px; }

/* ============================================================
   响应式 · 移动端
   ============================================================ */
@media (max-width: 760px) {
  body { font-size: 15px; padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); }

  .topbar { padding: 0 14px; gap: 10px; }
  .brand-name { font-size: 21px; }
  .topnav { display: none; }
  .topbar-gear { margin-left: auto; }

  .bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 253, 247, .94);
    backdrop-filter: blur(12px);
    border-top: 1.5px solid var(--line);
  }
  .bottomnav a {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    font-size: 11px; font-weight: 800; color: var(--ink-faint);
    transition: color .15s ease;
  }
  .bottomnav a.active { color: var(--caramel); }
  .bottomnav .nav-timer {
    position: relative;
  }
  .bottomnav .nav-timer .icon {
    background: linear-gradient(180deg, var(--caramel-light), var(--caramel));
    color: #FFF8EE;
    border-radius: 50%;
    padding: 7px;
    width: 40px; height: 40px;
    box-shadow: 0 3px 0 var(--caramel-deep);
    margin-top: -14px;
  }
  .bottomnav .nav-timer.active .icon {
    background: linear-gradient(180deg, var(--pink), var(--pink-deep));
    box-shadow: 0 3px 0 #C26B60;
  }
  .bottomnav .nav-timer span { margin-top: 1px; }

  .page { padding: 20px 14px 30px; }
  .page-title { font-size: 27px; }
  .footer { padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }

  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat-row-4 { grid-template-columns: repeat(2, 1fr); }
  .mini-card { padding: 13px 8px; }
  .mini-num { font-size: 18px; }
  .mini-num.hand { font-size: 23px; }

  .goal-list { grid-template-columns: 1fr; }
  .course-grid { grid-template-columns: 1fr; }
  .course-summary { gap: 18px; }
  .course-summary .btn-go { margin-left: 0; width: 100%; }

  .filter-bar { gap: 12px; }
  .filter-bar .field-inline { width: 100%; }
  .filter-bar .field-inline input,
  .filter-bar .field-inline select { flex: 1; min-width: 0; }
  .filter-actions { margin-left: 0; width: 100%; }
  .filter-actions .btn { flex: 1; }

  .record-card { flex-wrap: wrap; gap: 8px 12px; padding: 12px 14px; }
  .record-time { width: 100%; font-size: 13.5px; }
  .record-actions { width: 100%; justify-content: flex-end; }

  .task-arrows .icon-btn { width: 36px; height: 36px; }
  .task-drag { display: none; }

  /* 课程列表视图（移动端）：两行布局，名称整行 */
  .course-grid.list-mode .course-card { flex-wrap: wrap; gap: 6px 12px; padding: 12px 14px; }
  .course-grid.list-mode .course-card-top { max-width: calc(100% - 24px); }
  .course-grid.list-mode .course-note { flex-basis: 100%; max-width: 100%; }
  .course-grid.list-mode .course-stats { margin-left: 0; }
  .course-sort { opacity: 1; }
  .course-grid.list-mode .course-sort { position: static; margin-left: 4px; flex: none; }
  .course-sort .icon-btn { width: 32px; height: 32px; }

  .chart-box { height: 240px; }
  .donut-wrap { justify-content: center; }
  .donut-box { width: 220px; height: 220px; }

  .form-row { grid-template-columns: 1fr; gap: 0; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn-small { flex: 1; }
  .dash-greet { font-size: 29px; }
  .login-title { font-size: 46px; }
  .modal { padding: 24px 18px 18px; }
}

/* 任务操作按钮（编辑/删除/排序）在桌面端与移动端都应可见；
   原逻辑写反（min-width 隐藏了桌面端按钮），已移除。 */

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
