/* 27考研打卡 */
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --soft: #f8fafc;      /* 行悬停/表头/气泡底色 */
  --input-bg: #fbfdff;  /* 输入框底色 */
  --today-bg: #eff6ff;  /* 周表「今天」行底色 */
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .06);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, .10);
  --topbar-grad: linear-gradient(120deg, #1e3a8a, #2563eb 55%, #3b82f6);
  --summary-grad: linear-gradient(120deg, #eff6ff, #e0f2fe);
  --summary-border: #bfdbfe;
  --summary-ink: #1e40af;
  --plan-bg: #f0fdf4; --plan-border: #86efac; --plan-ink: #166534; --plan-hover: #dcfce7;
  --carry-bg: #fffbeb; --carry-border: #fcd34d; --carry-ink: #92400e; --carry-hover: #fef3c7;
}

/* ===== 姚总主题：成熟稳重（深蓝黑 + 钢蓝点缀 + 网格纹理） ===== */
body.theme-yao {
  --bg: #0d1526;
  --card: #182238;
  --ink: #e6edf7;
  --muted: #9fb0c8;
  --faint: #66758f;
  --line: #2c3a55;
  --brand: #4f8ef7;
  --brand-dark: #3b74d6;
  --soft: #1f2c47;
  --input-bg: #101a30;
  --today-bg: rgba(79, 142, 247, .14);
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .4);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, .5);
  --topbar-grad: linear-gradient(120deg, #0b1220, #1b2a4a 55%, #24406b);
  --summary-grad: linear-gradient(120deg, rgba(79, 142, 247, .16), rgba(56, 189, 248, .12));
  --summary-border: #33507e;
  --summary-ink: #9cc3ff;
  --plan-bg: rgba(34, 197, 94, .12); --plan-border: #1f7a45; --plan-ink: #7fe0a3; --plan-hover: rgba(34, 197, 94, .2);
  --carry-bg: rgba(250, 204, 21, .12); --carry-border: #8a6d1f; --carry-ink: #f5d873; --carry-hover: rgba(250, 204, 21, .2);
  background: linear-gradient(180deg, #0a1120, #0d1526 40%, #0e1a30);
}
/* 姚总：淡网格纹理，像工程师图纸 */
body.theme-yao::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(rgba(148, 163, 184, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .05) 1px, transparent 1px);
  background-size: 44px 44px;
}
body.theme-yao .brand { letter-spacing: 2px; }
body.theme-yao .del:hover { background: rgba(239, 68, 68, .18); }
body.theme-yao .carried { background: rgba(250, 204, 21, .15); color: #f5d873; }
/* 伤心乌云在深色顶栏上提亮 */
body.theme-yao .wx-dark, body.theme-yao .wx-dark::before, body.theme-yao .wx-dark::after { background: #6b7a93; }

/* ===== 弯弯主题：软萌可爱（粉白渐变 + 漂浮小花 + 幼圆字体 + 大圆角） ===== */
body.theme-shi {
  --bg: #fdf3f8;
  --card: #ffffff;
  --ink: #7a2e52;
  --muted: #b06d8c;
  --faint: #d3a7bd;
  --line: #f6d3e4;
  --brand: #ec4899;
  --brand-dark: #db2777;
  --soft: #fdf0f6;
  --input-bg: #fffafc;
  --today-bg: #fdeef6;
  --radius: 20px;
  --shadow: 0 2px 12px rgba(236, 72, 153, .08);
  --shadow-lg: 0 10px 28px rgba(236, 72, 153, .16);
  --topbar-grad: linear-gradient(120deg, #db2777, #ec4899 55%, #f472b6);
  --summary-grad: linear-gradient(120deg, #fdf0f6, #fce7f3);
  --summary-border: #f9a8d4;
  --summary-ink: #be185d;
  --plan-bg: #f0fdf4; --plan-border: #86efac; --plan-ink: #166534; --plan-hover: #dcfce7;
  --carry-bg: #fffbeb; --carry-border: #fcd34d; --carry-ink: #92400e; --carry-hover: #fef3c7;
  font-family: "YouYuan", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #fdf2f8, #fce7f3 45%, #fbcfe8);
}
/* 弯弯：右上角「连续学习」天数用蓝色（红色与粉色顶栏混在一起看不清） */
body.theme-shi .streak-num { color: #2563eb; }
/* 弯弯：角落漂浮的♡和✿，轻轻浮动 */
body.theme-shi::before {
  content: '♡'; position: fixed; top: 6%; right: 5%; z-index: -1; pointer-events: none;
  font-size: 110px; color: rgba(236, 72, 153, .12); animation: floaty 7s ease-in-out infinite;
}
body.theme-shi::after {
  content: '✿'; position: fixed; bottom: 5%; left: 4%; z-index: -1; pointer-events: none;
  font-size: 90px; color: rgba(244, 114, 182, .13); animation: floaty 9s ease-in-out infinite reverse;
}
@keyframes floaty { 50% { transform: translateY(-18px) rotate(10deg); } }
/* 姚总：两侧淡淡光晕，增加纵深 */
body.theme-yao::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 620px 420px at -2% 50%, rgba(79, 142, 247, .08), transparent 70%),
    radial-gradient(ellipse 620px 420px at 102% 50%, rgba(56, 189, 248, .07), transparent 70%);
}

/* ===== 背景装饰层（左右两侧填充） ===== */
.deco { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.deco-yao, .deco-shi { display: none; }
body.theme-yao .deco-yao, body.theme-shi .deco-shi { display: block; }
.deco i { position: absolute; }

/* 姚总：蓝图圆环（实线+虚线） */
.deco-yao .y-ring {
  border: 1.5px solid rgba(148, 163, 184, .12); border-radius: 50%;
  animation: ringSpin 80s linear infinite;
}
.deco-yao .y-ring:nth-child(3) { border-style: dashed; border-color: rgba(79, 142, 247, .16); }
.deco-yao .y-ring:nth-child(4) { border-color: rgba(148, 163, 184, .10); animation-duration: 60s; animation-direction: reverse; }
@keyframes ringSpin { to { transform: rotate(360deg); } }
/* 姚总：星光 */
.deco-yao .y-star {
  width: var(--s, 2.5px); height: var(--s, 2.5px); border-radius: 50%;
  background: rgba(226, 232, 240, .8);
  box-shadow: 0 0 6px 1px rgba(147, 197, 253, .35);
  animation: twinkle 4s ease-in-out infinite; animation-delay: var(--dl, 0s);
}
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }
/* 姚总：加号刻度 */
.deco-yao .y-plus { color: rgba(148, 163, 184, .16); font-size: 20px; line-height: 1; }
.deco-yao .y-plus::before { content: '+'; }
/* 姚总：左侧虚线标尺边 */
.deco-yao .y-vline {
  left: 40px; top: 0; bottom: 0; width: 0;
  border-left: 1px dashed rgba(148, 163, 184, .12);
}

/* 弯弯：上升的爱心气球 */
.deco-shi .s-heart {
  bottom: -60px; font-size: var(--sz, 26px); line-height: 1; color: #ec4899; opacity: 0;
  animation: rise var(--dur, 30s) linear infinite; animation-delay: var(--dl, 0s);
}
.deco-shi .s-heart::before { content: '♥'; }
@keyframes rise {
  0% { transform: translateY(0) rotate(-6deg); opacity: 0; }
  6% { opacity: var(--op, .15); }
  92% { opacity: var(--op, .15); }
  100% { transform: translateY(-108vh) rotate(12deg); opacity: 0; }
}
/* 弯弯：轻轻摇曳的小花 */
.deco-shi .s-flower {
  font-size: var(--sz, 26px); line-height: 1; color: #f472b6; opacity: .2;
  animation: sway 8s ease-in-out infinite;
}
.deco-shi .s-flower::before { content: '✿'; }
@keyframes sway { 50% { transform: translateY(-10px) rotate(14deg); } }
/* 弯弯：闪烁的星星 */
.deco-shi .s-spark {
  font-size: 15px; line-height: 1; color: #f9a8d4;
  animation: twinkle 3.4s ease-in-out infinite; animation-delay: var(--dl, 0s);
}
.deco-shi .s-spark::before { content: '✦'; }
/* 弯弯：棉花糖云 */
.deco-shi .s-cloud {
  width: 92px; height: 26px; background: rgba(255, 255, 255, .38); border-radius: 999px;
  animation: cloudDrift 11s ease-in-out infinite alternate;
}
.deco-shi .s-cloud::before {
  content: ''; position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: inherit; top: -18px; left: 12px;
}
.deco-shi .s-cloud::after {
  content: ''; position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: inherit; top: -11px; left: 44px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  padding-bottom: 80px;
}

/* 顶部 */
.topbar {
  background: var(--topbar-grad);
  color: #fff; padding: 16px 28px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.exam-info { font-size: 14px; opacity: .96; }
.exam-info b { font-size: 18px; }
.streak {
  margin-left: auto; background: rgba(255,255,255,.16);
  padding: 8px 18px; border-radius: 999px; font-size: 15px; white-space: nowrap;
}
/* 连续打卡数字：红色，比文字大两号（弯弯主题下覆盖为蓝色，见 theme-shi 块） */
.streak-num { color: #f87171; font-weight: 900; font-size: 20px; margin-left: 2px; }
#tile-streak { color: #dc2626; }
.topbar-switch {
  border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12); color: #fff;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
.topbar-switch:hover { background: rgba(255,255,255,.26); }

/* 心情记录仪（顶栏左上角） */
.mood {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255, 255, 255, .14); border-radius: 999px;
  padding: 2px 8px 2px 10px;
}
.mood-label { font-size: 12px; opacity: .95; }
.mood-btn {
  border: none; background: none; font-size: 17px; cursor: pointer;
  width: 28px; height: 28px; border-radius: 50%; line-height: 1;
  opacity: .75; transition: transform .15s, opacity .15s;
}
.mood-btn:hover { opacity: 1; transform: scale(1.18); }
.mood-btn.active { background: #fff; opacity: 1; box-shadow: 0 2px 6px rgba(15, 23, 42, .25); }

/* 顶栏：对方状态胶囊（v23） */
.partner-pill {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .16); border-radius: 999px;
  padding: 6px 8px 6px 14px; font-size: 13px; white-space: nowrap;
}
.partner-pill[hidden] { display: none; } /* 同 .modal[hidden]：display:flex 会覆盖 hidden */
.pp-name { font-weight: 700; }
.pp-status { opacity: .92; }
.pp-status.ok { color: #86efac; font-weight: 700; }
.pp-time, .pp-tasks { font-size: 12px; opacity: .88; }
.pp-active { font-size: 12px; opacity: .66; }
#btn-poke {
  border: none; background: rgba(255, 255, 255, .22); color: #fff;
  width: 27px; height: 27px; border-radius: 50%; font-size: 15px; cursor: pointer;
  transition: transform .15s, background .15s;
}
#btn-poke:hover { background: rgba(255, 255, 255, .38); transform: scale(1.12); }
#btn-poke:disabled { opacity: .6; cursor: default; transform: none; }

/* 右上角天气动画（与心情联动，选定后保持常在） */
.weather { position: relative; width: 110px; height: 46px; flex: none; margin-left: 4px; }
/* 开心：小太阳（光晕呼吸 + 光线旋转） */
.wx-sun {
  position: absolute; top: 2px; right: 6px; width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fef08a, #facc15 70%);
  box-shadow: 0 0 16px 5px rgba(250, 204, 21, .45);
  animation: sunPulse 3s ease-in-out infinite;
}
.wx-sun::before {
  content: ''; position: absolute; inset: -11px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(253, 224, 71, .95) 0 12deg, transparent 12deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 53%);
  mask: radial-gradient(circle, transparent 52%, #000 53%);
  animation: sunSpin 26s linear infinite;
}
@keyframes sunPulse { 50% { transform: scale(1.12); } }
@keyframes sunSpin { to { transform: rotate(360deg); } }
/* 平静：几朵云慢慢飘 + 小鸟飞过 */
.wx-cloud { position: absolute; background: #fff; border-radius: 999px; opacity: .95; }
.wx-cloud::before, .wx-cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.wx-c1 { width: 46px; height: 15px; top: 22px; left: 6px; animation: cloudDrift 7s ease-in-out infinite alternate; }
.wx-c1::before { width: 17px; height: 17px; top: -9px; left: 8px; }
.wx-c1::after { width: 22px; height: 22px; top: -12px; left: 20px; }
.wx-c2 { width: 30px; height: 11px; top: 6px; left: 58px; opacity: .85; animation: cloudDrift 9s ease-in-out infinite alternate-reverse; }
.wx-c2::before { width: 12px; height: 12px; top: -6px; left: 5px; }
.wx-c2::after { width: 15px; height: 15px; top: -9px; left: 13px; }
@keyframes cloudDrift { from { transform: translateX(-6px); } to { transform: translateX(7px); } }
.wx-bird { position: absolute; width: 26px; height: 12px; overflow: visible; }
.wx-b1 { top: 2px; left: 28px; animation: birdFly 11s linear infinite; }
.wx-b2 { top: 13px; left: 62px; width: 20px; height: 10px; animation: birdFly 14s linear infinite; animation-delay: 3s; }
@keyframes birdFly {
  0% { transform: translateX(72px); }
  50% { transform: translateX(0) translateY(-3px); }
  100% { transform: translateX(-72px) translateY(1px); }
}
/* 伤心：乌云 + 下雨 */
.wx-dark { width: 58px; height: 19px; top: 9px; left: 16px; background: #475569; animation: cloudDrift 5s ease-in-out infinite alternate; }
.wx-dark::before { width: 22px; height: 22px; top: -11px; left: 9px; background: #475569; }
.wx-dark::after { width: 26px; height: 26px; top: -15px; left: 26px; background: #475569; }
.wx-drop {
  position: absolute; top: 36px; width: 2.5px; height: 8px; border-radius: 999px;
  background: rgba(203, 213, 225, .95); animation: rainFall 1.1s linear infinite;
}
@keyframes rainFall {
  from { transform: translateY(-2px); opacity: 0; }
  25% { opacity: 1; }
  to { transform: translateY(14px); opacity: 0; }
}

/* 登录界面（云端密码模式） */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6);
  /* 背景图：public\img\fenmian.jpg 原图直出，不加滤镜；没放图时自动用上面的蓝渐变 */
  background-image: url('img/fenmian.jpg');
  background-size: cover; background-position: center;
  padding: 24px;
}
.login-screen[hidden] { display: none; }
.login-form { display: flex; gap: 10px; justify-content: center; }
#login-password {
  border: none; border-radius: 10px; padding: 10px 14px; font-size: 15px;
  width: 220px; outline: none; font-family: inherit;
}
.login-btn {
  border: none; border-radius: 10px; padding: 10px 22px; font-size: 15px; font-weight: 700;
  background: #fff; color: #2563eb; cursor: pointer; font-family: inherit;
}
.login-btn:hover { background: #e0e7ff; }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-err { margin-top: 14px; color: #fecaca; font-size: 13px; min-height: 18px; }

/* 身份选择界面 */
.role-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #3b82f6);
  /* 背景图：public\img\fenmian.jpg 原图直出，不加滤镜；没放图时自动用上面的蓝渐变 */
  background-image: url('img/fenmian.jpg');
  background-size: cover; background-position: center;
  padding: 24px;
}
.role-screen[hidden] { display: none; }
.role-box { text-align: center; color: #fff; }
/* 大标题：蓝→粉渐变 + 蓝粉光晕（登录页与选角色页共用） */
.role-box h1 { font-size: 48px; font-weight: 900; letter-spacing: 4px; text-shadow: 0 2px 8px rgba(15, 23, 42, .55); }
.role-box h1 .h1-text {
  background: linear-gradient(90deg, #93c5fd 0%, #c4b5fd 50%, #f9a8d4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, .75)) drop-shadow(0 0 18px rgba(96, 165, 250, .55)) drop-shadow(0 0 24px rgba(236, 72, 153, .45));
}
.role-sub { margin: 8px 0 4px; opacity: .95; font-size: 14px; text-shadow: 0 1px 4px rgba(15, 23, 42, .6); }
.role-quote {
  margin: 0 auto 26px; max-width: 560px; font-size: 13px;
  opacity: .92; font-style: italic; letter-spacing: .5px;
  text-shadow: 0 1px 4px rgba(15, 23, 42, .6);
}
.role-cards { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.role-ver { margin-top: 18px; font-size: 12px; opacity: .7; letter-spacing: 1px; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.ver { font-size: 11px; opacity: .55; font-weight: 400; margin-left: 2px; }
.role-card {
  /* 15% 白：更通透，背景图更明显 */
  width: 250px; background: rgba(255, 255, 255, .15); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 16px;
  padding: 28px 20px; cursor: pointer; backdrop-filter: blur(8px) saturate(1.2);
  box-shadow: var(--shadow-lg); text-align: center; font-family: inherit;
  transition: transform .15s;
}
/* 透明卡片上的文字：15% 白底很透，名字用「白→主题色渐变+投影」，课程列表用白字+深描影，保证清晰 */
.role-avatar { font-size: 52px; display: block; filter: drop-shadow(0 2px 6px rgba(255, 255, 255, .9)); }
.role-name {
  font-size: 24px; font-weight: 900; display: block; margin: 8px 0 10px; letter-spacing: 3px;
}
/* 姚总：白→蓝渐变 */
.role-card[data-role="yao"] .role-name {
  background: linear-gradient(180deg, #ffffff 15%, #bfdbfe 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, .8)) drop-shadow(0 0 16px rgba(96, 165, 250, .7));
}
/* 弯弯：白→粉渐变 */
.role-card[data-role="shi"] .role-name {
  background: linear-gradient(180deg, #ffffff 15%, #fbcfe8 80%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 5px rgba(15, 23, 42, .75)) drop-shadow(0 0 16px rgba(244, 114, 182, .65));
}
.role-subjects {
  font-size: 13px; font-weight: 600; line-height: 1.9; display: block; letter-spacing: .5px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(15, 23, 42, .7), 0 0 10px rgba(15, 23, 42, .45);
}
.role-card:hover { transform: translateY(-4px); }
/* 角色卡各带主题色边：姚总蓝、弯弯粉 */
.role-card[data-role="yao"] { border-color: rgba(147, 197, 253, .8); box-shadow: 0 10px 28px rgba(30, 64, 175, .35), 0 0 32px rgba(96, 165, 250, .5); }
.role-card[data-role="shi"] { border-color: rgba(249, 168, 212, .85); box-shadow: 0 10px 28px rgba(219, 39, 119, .32), 0 0 32px rgba(244, 114, 182, .5); }

/* 日期导航 */
.date-nav {
  max-width: 1180px; margin: 18px auto 0; padding: 0 20px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.date-nav button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 7px 14px; cursor: pointer; font-size: 14px;
}
.date-nav button:hover { border-color: var(--brand); color: var(--brand); }
.date-nav .primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.date-nav .primary:hover { background: var(--brand-dark); color: #fff; }
.date-nav input[type="date"] {
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  font-size: 14px; background: var(--card); color: var(--ink);
}
#date-label { font-weight: 600; font-size: 15px; }
.plan-btn {
  background: var(--plan-bg); border: 1px solid var(--plan-border) !important;
  color: var(--plan-ink) !important; font-weight: 600;
}
.plan-btn:hover { background: var(--plan-hover) !important; }
.carry-btn {
  margin-left: auto; background: var(--carry-bg); border: 1px solid var(--carry-border) !important;
  color: var(--carry-ink) !important; font-weight: 600;
}
.carry-btn:hover { background: var(--carry-hover) !important; }

/* 统计瓦片 */
.tiles {
  max-width: 1180px; margin: 16px auto 0; padding: 0 20px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px;
}
.tile {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; text-align: center;
}
.tile-num { font-size: 26px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
#tile-today-done { color: #16a34a; } /* 当日任务完成：绿色 */
#tile-today-min { color: #fb923c; } /* 当日总时长：淡橙色 */

/* 全天汇总条 */
.day-summary {
  max-width: 1180px; margin: 14px auto 0; padding: 12px 20px;
  background: var(--summary-grad);
  border: 1px solid var(--summary-border); border-radius: 12px;
  font-size: 14px; color: var(--summary-ink);
}
.day-summary b { font-size: 19px; }

/* 共同目标卡片（v23） */
.goal-card {
  max-width: 1180px; margin: 14px auto 0; padding: 14px 20px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.goal-card[hidden] { display: none; }
.goal-head { display: flex; align-items: center; gap: 10px; }
.goal-head h3 { font-size: 16px; }
.goal-meta { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-bar {
  margin-top: 10px; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--soft); border: 1px solid var(--line);
}
.goal-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  transition: width .5s ease; /* 20s 轮询下进度条平滑推进 */
}
.goal-card.achieved .goal-fill { background: linear-gradient(90deg, #16a34a, #4ade80); }
.goal-text { margin-top: 8px; font-size: 13px; color: var(--muted); }
.goal-card.achieved .goal-text { color: #22c55e; font-weight: 600; }

/* 学科卡片：两列排版（第一行 专业课一|专业课二，第二行 英语|政治，第三行 每日总结） */
.cards {
  max-width: 1180px; margin: 18px auto 0; padding: 0 20px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; border-top: 4px solid var(--c);
}
.card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.card-head h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }
.sub-full { font-size: 12px; color: var(--faint); font-weight: 400; margin-left: 2px; }
.task-count {
  margin-left: auto; font-size: 12px; color: var(--muted);
  background: var(--bg); padding: 3px 10px; border-radius: 999px;
}

/* 当日时长填写 */
.time-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.time-label { font-size: 13px; color: var(--muted); }
.time-input {
  width: 92px; font-size: 19px; font-weight: 700; color: var(--c);
  border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px;
  font-variant-numeric: tabular-nums; background: var(--input-bg);
}
.time-input:focus { border-color: var(--c); outline: none; }
.time-unit { font-size: 13px; color: var(--muted); }
.time-eq { font-size: 12px; color: var(--faint); margin-left: auto; }

/* 任务列表 */
.tasks { list-style: none; }
.task { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; }
.task:hover { background: var(--soft); }
.task label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; flex: 1; font-size: 14px; }
.task input[type="checkbox"] { margin-top: 3px; accent-color: var(--c); width: 15px; height: 15px; flex: none; cursor: pointer; }
.task.done label span { text-decoration: line-through; color: var(--faint); }
.carried {
  font-style: normal; font-size: 11px; background: #fef3c7; color: #92400e;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
}
.del {
  border: none; background: none; color: var(--faint); font-size: 15px;
  cursor: pointer; padding: 2px 6px; border-radius: 6px; visibility: hidden;
}
.task:hover .del { visibility: visible; }
.del:hover { color: #dc2626; background: #fee2e2; }
.empty { color: var(--faint); font-size: 13px; padding: 6px; }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input {
  flex: 1; border: 1px dashed var(--line); border-radius: 9px; padding: 7px 10px;
  font-size: 13px; outline: none; background: var(--input-bg); color: var(--ink);
}
.add-row input:focus { border-color: var(--c); border-style: solid; }

/* 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 9px; padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }

/* 每日总结 */
.note-wrap { max-width: 1180px; margin: 18px auto 0; padding: 0 20px; }
.note-card { --c: #64748b; }
.note-save-state { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
#note-text {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; line-height: 1.7;
  resize: vertical; min-height: 120px; background: var(--input-bg); color: var(--ink);
}
#note-text:focus { border-color: var(--brand); outline: none; background: var(--card); }

/* 照片留存 */
.photo-wrap { max-width: 1180px; margin: 18px auto 0; padding: 0 20px; }
.photo-card { --c: #64748b; }
.photo-hint { margin-left: auto; font-size: 12px; color: var(--faint); white-space: nowrap; }
.photo-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px;
}
.photo-item {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  cursor: zoom-in; background: var(--soft);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .18s; }
.photo-item:hover img { transform: scale(1.06); }
.photo-item .del {
  position: absolute; top: 5px; right: 5px; background: rgba(15, 23, 42, .5);
  color: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.photo-item:hover .del { visibility: visible; }
.photo-item .del:hover { background: #dc2626; color: #fff; }
.photo-add {
  aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); cursor: pointer; font-size: 13px; background: var(--input-bg);
  transition: border-color .15s, color .15s;
}
.photo-add:hover { border-color: var(--brand); color: var(--brand); }
.photo-add-icon { font-size: 26px; }
.photo-lightbox {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 24, .82); cursor: zoom-out; padding: 24px;
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox img {
  max-width: 92vw; max-height: 90vh; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

/* 统计区 */
.stats { max-width: 1180px; margin: 26px auto 0; padding: 0 20px; }
.stats h2 { font-size: 18px; margin-bottom: 12px; }
.chart-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
#pie-chart { width: 100%; height: auto; display: block; }
.pie-bottom {
  display: flex; flex-direction: column; gap: 8px;
  padding: 4px 12px 10px;
}
.pie-row { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; }
.pie-item { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
.pie-item i { width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.pie-item b { color: var(--ink); font-weight: 700; }
.pie-item em { font-style: normal; font-size: 12px; }
.legend { display: flex; gap: 18px; margin-top: 10px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.stats h3 { font-size: 15px; margin: 22px 0 10px; color: var(--muted); }
.stats table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; font-size: 13px;
}
.stats th, .stats td { padding: 9px 12px; text-align: center; border-bottom: 1px solid var(--line); }
.stats th { background: var(--soft); color: var(--muted); font-weight: 600; }
.stats tr:last-child td { border-bottom: none; }
.today-row td { background: var(--today-bg); font-weight: 600; }
#cumulative { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 12px; }
.cum-row { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 12px; font-size: 13px; }
.cum-name { font-weight: 700; }
.cum-bar { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.cum-bar div { height: 100%; border-radius: 999px; }
.cum-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
/* 关键：display:flex 会覆盖 hidden 属性的默认隐藏，必须显式补回 */
.modal[hidden] { display: none; }
.modal-box {
  background: var(--card); border-radius: var(--radius);
  padding: 24px; width: 340px; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow: auto;
}
.modal-box h3 { margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--faint); margin: 4px 0 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* 共同目标弹窗（v23） */
.goal-box { width: min(360px, 94vw); }
.goal-form { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; }
#goal-target {
  width: 90px; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 16px; background: var(--input-bg); color: var(--ink);
}
#goal-target:focus { border-color: var(--brand); outline: none; }

/* 计划弹窗 */
.plan-box { width: min(600px, 94vw); }
.plan-box .hint input[type="date"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px;
  font-size: 12px; background: var(--card); color: var(--ink); vertical-align: middle;
}
#plan-text {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; font-family: inherit; resize: vertical;
  background: var(--input-bg); color: var(--ink);
}
#plan-text:focus { border-color: var(--brand); outline: none; }
.plan-actions { display: flex; gap: 10px; margin: 10px 0 0; }
#plan-preview { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
#plan-preview h4 { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
#plan-preview-list { list-style: none; max-height: 280px; overflow: auto; }
.plan-item { display: flex; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.plan-item select {
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px;
  font-size: 12px; flex: none; background: var(--card); color: var(--ink);
}
.plan-item span { flex: 1; font-size: 13px; word-break: break-all; }
.plan-item .del { visibility: visible; }

#err-banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: #dc2626; color: #fff; padding: 10px 20px; border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 60;
}

/* 拍一拍提示（v23）：顶部滑入 + 小粒子 */
.poke-toast {
  position: fixed; top: 14px; left: 0; right: 0; margin: 0 auto; width: max-content;
  max-width: calc(100vw - 32px); z-index: 3000; pointer-events: auto; cursor: pointer; /* v24：可点击关闭 */
  background: var(--topbar-grad); color: #fff;
  border-radius: 999px; padding: 12px 22px; font-size: 15px;
  box-shadow: var(--shadow-lg); text-align: center;
}

/* 版本更新提示条（v24）：服务器比当前页面新时显示，点击刷新 */
#ver-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5000;
  background: var(--topbar-grad); color: #fff;
  text-align: center; padding: 9px 16px; font-size: 14px; cursor: pointer;
  box-shadow: var(--shadow-lg); animation: pokeIn .45s ease-out;
}
#ver-bar[hidden] { display: none; }
.poke-toast[hidden] { display: none; }
.poke-toast.anim { animation: pokeIn .45s ease-out; }
.poke-msg { position: relative; z-index: 1; }
.poke-part {
  position: absolute; left: 50%; bottom: 6px; font-style: normal; font-size: 15px;
  opacity: 0; pointer-events: none;
  animation: pokeBurst 1.4s ease-out .15s infinite;
}
.poke-part:nth-of-type(2) { animation-delay: .3s; }
.poke-part:nth-of-type(3) { animation-delay: .45s; }
.poke-part:nth-of-type(4) { animation-delay: .6s; }
@keyframes pokeIn {
  0% { transform: translateY(-140%); opacity: 0; }
  60% { transform: translateY(10%); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes pokeBurst {
  0% { transform: translate(0, 0) scale(.5); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(var(--dx, 20px), -40px) scale(1.2); opacity: 0; }
}

/* 共同目标达成庆祝（v23）：全屏 emoji 飘落 3.5s，JS 生成并自动清空 */
.celebrate { position: fixed; inset: 0; z-index: 4000; overflow: hidden; pointer-events: none; }
.celebrate[hidden] { display: none; }
.celebrate i {
  position: absolute; top: -8vh; font-style: normal; line-height: 1;
  animation: fallDown var(--dur, 3s) linear var(--dl, 0s) forwards;
}
@keyframes fallDown {
  0% { transform: translateY(-8vh) rotate(0deg); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translateY(112vh) rotate(var(--rot, 360deg)); opacity: 1; }
}

/* 两侧小部件：默认隐藏（登录页/选角色页不显示），进入应用后 body.in-app 才显示 */
.board, .relax-cat { display: none; }
body.in-app .board, body.in-app .relax-cat { display: block; }
/* 只在宽屏显示（窄屏自动隐藏，不挤占内容） */
.board {
  position: fixed; left: 18px; top: 36%; width: 236px; z-index: 40;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
  padding: 12px 14px;
}
.board-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.board-hint { font-size: 11px; color: var(--faint); font-weight: 400; }
.board-list { max-height: 200px; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.board-msg { background: var(--soft); border-radius: 10px; padding: 7px 10px; font-size: 12px; }
.board-msg b { color: var(--brand); margin-right: 6px; }
.board-msg .ts { color: var(--faint); font-size: 11px; }
.board-msg p { margin-top: 2px; word-break: break-all; }
.board-empty { color: var(--faint); font-size: 12px; text-align: center; padding: 10px 0; }
.board-input { display: flex; gap: 6px; }
.board-input input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 8px; font-size: 12px; outline: none; font-family: inherit;
  background: var(--input-bg); color: var(--ink);
}
.board-input input:focus { border-color: var(--brand); }
.board-input button {
  border: none; background: var(--brand); color: #fff; border-radius: 8px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.board-input button:hover { background: var(--brand-dark); }
.relax-cat {
  position: fixed; right: 18px; top: 42%; width: 54px; height: 54px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--card); font-size: 26px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .15); z-index: 40;
  transition: transform .15s;
}
.relax-cat:hover { transform: scale(1.1) rotate(-8deg); }
.relax-cat.dragging { transition: none; transform: none; cursor: grabbing; } /* 拖动中禁用悬停变形 */
.relax-panel {
  position: fixed; right: 18px; top: calc(42% + 66px); width: 250px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
  padding: 14px 16px; z-index: 40; font-size: 13px;
}
.relax-panel[hidden] { display: none; }
.relax-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; color: var(--muted); font-size: 12px;
}
.relax-close {
  border: none; background: none; color: var(--faint);
  font-size: 16px; cursor: pointer; padding: 0 4px;
}
.relax-close:hover { color: #dc2626; }
#relax-panel-text { min-height: 44px; line-height: 1.8; color: var(--ink); }
.relax-panel .btn { margin-top: 10px; }
@media (max-width: 1439px) {
  body.in-app .board, body.in-app .relax-cat, .relax-panel { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; gap: 12px; }
  .brand { font-size: 16px; }
  .streak { margin-left: 0; }
  .cards { grid-template-columns: 1fr; }
  .carry-btn { margin-left: 0; }

  /* 手机端留言板：从左侧悬浮改为页面底部整宽区块（数据与按天逻辑不变） */
  body.in-app .board {
    display: block; position: static; width: auto;
    margin: 18px 20px 24px;
  }
  .board-list { max-height: 260px; }

  /* 触屏没有悬停：删除按钮常显，并加大点按区域 */
  .task .del, .photo-item .del { visibility: visible; }
  .task .del { padding: 2px 10px; font-size: 16px; }
  .photo-item .del { width: 26px; height: 26px; }

  /* 近7天明细表：窄屏横向滚动（电脑端不受影响） */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #week-table { min-width: 520px; }
  #week-table th, #week-table td { padding: 8px 9px; }

  /* 计划弹窗自适应宽度；提示文字可换行 */
  .modal-box { width: min(340px, calc(100vw - 32px)); padding: 20px 16px; }
  .plan-actions { flex-wrap: wrap; }
  .photo-hint { white-space: normal; }

  /* iOS 聚焦输入框会自动放大页面：把可编辑元素字号提到 16px（time-input 已是 19px） */
  .add-row input, #note-text, .board-input input, #plan-text, #login-password { font-size: 16px; }

  /* v23：对方胶囊压缩、目标卡缩内边距（顶栏 flex-wrap 自动换行） */
  .partner-pill { padding: 5px 8px 5px 12px; font-size: 12px; gap: 6px; }
  .partner-pill .pp-active { display: none; } /* 手机端省空间（最近活跃是次要信息） */
  .goal-card { padding: 12px 16px; }
}
