/* =================================================================
   小静考研工作台 · 法式油画暖色调
   ================================================================= */

/* 密码错误时弹窗抖动 */
@keyframes pwShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake { animation: pwShake 0.35s ease; }
#pwInput { letter-spacing: 2px; }

:root {
  /* 法式油画暖色调 —— 明亮、温暖、不灰暗 */
  --cream: #fdf6ec;         /* 奶油底 */
  --cream-2: #f9ecdb;       /* 暖米色 */
  --paper: #fffcf5;         /* 卡片纸白 */
  --paper-warm: #fff7ea;    /* 暖纸 */
  --butter: #f7e5c2;        /* 黄油 */
  --honey: #e8b775;         /* 蜂蜜金 */
  --apricot: #f2c9a0;       /* 杏子 */
  --terracotta: #cd7f5a;    /* 陶土橘 */
  --rust: #b5653f;          /* 赭石 */
  --rose: #d98a8a;          /* 玫瑰 */
  --rose-deep: #c4717a;     /* 深玫瑰 */
  --olive: #8a9a5b;         /* 橄榄绿 */
  --olive-deep: #6f7f4a;    /* 深橄榄 */
  --sage: #a9bf8f;          /* 鼠尾草 */
  --sky: #9db8c9;           /* 天空蓝 */
  --ink: #5a4636;           /* 暖深棕（主文字） */
  --ink-soft: #8a7362;      /* 柔和文字 */
  --ink-faint: #b5a08e;     /* 更浅文字 */
  --gold: #d9a441;          /* 金色点缀 */
  --shadow: 0 10px 30px rgba(120, 84, 52, 0.12);
  --shadow-sm: 0 4px 14px rgba(120, 84, 52, 0.10);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 264px;
  --warm-gradient: linear-gradient(160deg, #fdf6ec 0%, #f9ecdb 55%, #f6e0c4 100%);
  --accent-gradient: linear-gradient(135deg, #d98a5f 0%, #c4717a 100%);
  --olive-gradient: linear-gradient(135deg, #a9bf8f 0%, #6f7f4a 100%);
}

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

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", -apple-system, sans-serif;
  color: var(--ink);
  background: #f6e6cd;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 油画装饰背景（仅氛围，不抢内容） ---------- */
.art-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(closest-side at 12% 8%, rgba(230, 178, 118, 0.55), transparent 72%),
    radial-gradient(closest-side at 88% 20%, rgba(214, 122, 122, 0.42), transparent 70%),
    radial-gradient(closest-side at 90% 88%, rgba(154, 176, 128, 0.40), transparent 74%),
    radial-gradient(closest-side at 8% 90%, rgba(157, 184, 201, 0.45), transparent 72%),
    linear-gradient(165deg, #fdf6ec 0%, #f8e7cc 50%, #f4ddb9 100%);
  overflow: hidden;
}
.art-bg::before,
.art-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(closest-side at 30% 40%, rgba(255, 252, 245, 0.7), transparent 70%),
    radial-gradient(closest-side at 72% 62%, rgba(255, 244, 224, 0.6), transparent 75%);
  mix-blend-mode: soft-light;
}
.art-bg::after {
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 7px);
  opacity: 0.5;
}
/* 油画笔触色块 */
.art-swirl {
  position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(46px); opacity: 0.5; pointer-events: none;
}
.art-swirl.s1 { width: 380px; height: 380px; top: -80px; left: 38%; background: #f2c9a0; }
.art-swirl.s2 { width: 300px; height: 300px; bottom: -70px; right: 6%; background: #d98a8a; opacity: 0.35; }
.art-swirl.s3 { width: 260px; height: 260px; top: 42%; right: -90px; background: #a9bf8f; }

/* ---------- 布局 ---------- */
.app {
  display: flex; height: 100vh; width: 100vw;
}

/* ---------- 侧边导航 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255, 251, 242, 0.92), rgba(249, 236, 219, 0.94));
  backdrop-filter: blur(8px);
  border-right: 1px solid rgba(205, 181, 152, 0.35);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  z-index: 40;
  transition: transform .3s ease, width .3s ease, opacity .3s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--accent-gradient);
  display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: 20px;
  box-shadow: var(--shadow-sm);
  letter-spacing: 1px;
}
.brand .brand-t { line-height: 1.2; }
.brand .brand-t b { font-size: 17px; display: block; color: var(--ink); }
.brand .brand-t span { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .5px; }

.nav-label { font-size: 11px; color: var(--ink-faint); letter-spacing: 1.5px; padding: 8px 12px 6px; text-transform: uppercase; }

.nav { flex: 1; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(205,160,110,.35); border-radius: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin: 3px 0;
  border-radius: 14px; cursor: pointer;
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  transition: all .18s ease; position: relative;
  user-select: none;
}
.nav-item .ico {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 16px;
  background: rgba(214, 138, 95, 0.12);
  transition: all .18s ease;
}
.nav-item:hover { background: rgba(232, 183, 117, 0.16); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(217, 138, 95, 0.16), rgba(196, 113, 122, 0.14));
  color: var(--rust); font-weight: 600;
}
.nav-item.active .ico {
  background: var(--accent-gradient); color: #fff; box-shadow: var(--shadow-sm);
}
.nav-item .badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--olive-gradient); color: #fff;
  padding: 2px 8px; border-radius: 20px; min-width: 20px; text-align: center;
}

/* 侧边栏底部角色切换 */
.sidebar-foot { padding-top: 12px; border-top: 1px solid rgba(205,181,152,.35); }
.role-block { display: flex; gap: 8px; }
.role-btn {
  flex: 1; padding: 10px; border: 1px solid rgba(205,181,152,.4);
  background: rgba(255,252,245,.6); border-radius: 12px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: all .18s; text-align: center;
}
.role-btn.on { background: var(--accent-gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }
.role-btn.teacher.on { background: var(--olive-gradient); }

/* ---------- 主内容区 ---------- */
.main {
  flex: 1; overflow-y: auto; position: relative; padding: 24px 30px 60px;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: rgba(205,160,110,.4); border-radius: 8px; }

/* 汉堡菜单按钮（移动端） */
.hamburger {
  display: none; position: fixed; top: 16px; left: 16px; z-index: 60;
  width: 46px; height: 46px; border-radius: 14px; border: none;
  background: var(--accent-gradient); color: #fff; cursor: pointer;
  box-shadow: var(--shadow); font-size: 18px;
}
.scrim {
  display: none; position: fixed; inset: 0; z-index: 39;
  background: rgba(60, 40, 26, 0.35); backdrop-filter: blur(2px);
}
.scrim.show { display: block; }

/* ---------- 通用组件 ---------- */
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.page-head h1 .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-gradient); }
.page-head p { color: var(--ink-soft); margin-top: 6px; font-size: 13.5px; }

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(232, 214, 189, 0.7);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 16.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.card-title .ct-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: rgba(214,138,95,.14); }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

.btn {
  border: none; cursor: pointer; font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 12px; font-family: inherit;
  transition: all .18s; display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-gradient); color: #fff; box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translateY(-1px); opacity: .95; }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--rust); border: 1.5px solid rgba(196,113,122,.4); box-shadow: none; }
.btn.ghost:hover { background: rgba(196,113,122,.08); }
.btn.olive { background: var(--olive-gradient); }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 表格 */
table.task-table { width: 100%; border-collapse: collapse; }
table.task-table th {
  text-align: left; font-size: 12px; color: var(--ink-faint); font-weight: 600;
  letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid rgba(232,214,189,.9);
  text-transform: uppercase;
}
table.task-table td {
  padding: 11px 10px; border-bottom: 1px solid rgba(240,226,205,.7); font-size: 14px; vertical-align: middle;
}
table.task-table tr:last-child td { border-bottom: none; }
table.task-table tr:hover td { background: rgba(250,240,222,.5); }

/* 任务勾选 */
.task-check { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.checkbox {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  border: 2px solid var(--honey); display: grid; place-items: center;
  transition: all .18s; background: #fff;
  color: transparent; font-size: 13px;
}
.task-check.done .checkbox { background: var(--olive-gradient); border-color: transparent; color: #fff; }
.task-check .t-text { font-size: 14.5px; color: var(--ink); }
.task-check.done .t-text { color: var(--ink-faint); text-decoration: line-through; }
.task-check .t-sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.task-check .t-time { font-size: 11px; color: var(--olive-deep); margin-top: 2px; }

/* 进度条 */
.progress-wrap { background: var(--cream-2); border-radius: 20px; height: 12px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; background: var(--olive-gradient); transition: width .4s ease; }
.progress-bar.warm { background: var(--accent-gradient); }

/* 标签 chip */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 20px; background: rgba(214,138,95,.14); color: var(--rust); }
.chip.green { background: rgba(138,154,91,.16); color: var(--olive-deep); }
.chip.gold { background: rgba(217,164,65,.18); color: #a87b1f; }
.chip.rose { background: rgba(196,113,122,.16); color: var(--rose-deep); }

/* 章节卡 */
.chapter-card {
  background: var(--paper-warm); border-radius: var(--radius-sm);
  border: 1px solid rgba(232,214,189,.7); padding: 18px;
  transition: all .2s; position: relative; overflow: hidden;
}
.chapter-card.locked { opacity: .62; }
.chapter-card .ch-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.chapter-card .ch-name { font-size: 16px; font-weight: 700; color: var(--ink); }
.chapter-card .ch-num { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.chapter-card .lock-ico { font-size: 18px; }
.chapter-card .ch-actions { display: flex; gap: 6px; margin-top: 12px; }

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(70, 46, 30, 0.42); backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--paper); border-radius: 24px; box-shadow: var(--shadow);
  width: 100%; max-width: 460px; padding: 26px; max-height: 88vh; overflow-y: auto;
}
.modal.wide { max-width: 640px; }
.modal h3 { font-size: 20px; margin-bottom: 6px; color: var(--ink); }
.modal .m-sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 18px; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 输入框 */
.field { margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid rgba(205,181,152,.5);
  background: var(--paper); font-size: 14px; font-family: inherit; color: var(--ink);
  transition: border .18s, box-shadow .18s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(205,127,90,.15);
}
.field textarea { resize: vertical; min-height: 90px; }

/* 统计卡片 */
.stat-card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(232,214,189,.7); padding: 20px; display: flex; flex-direction: column;
}
.stat-card .sc-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat-card .sc-value { font-size: 36px; font-weight: 800; color: var(--ink); margin-top: 8px; letter-spacing: -1px; }
.stat-card .sc-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 4px; }

/* 环形进度 */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring-svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--cream-2); stroke-width: 16; }
.ring-fg { fill: none; stroke: url(#ringGrad); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-center { font-size: 30px; font-weight: 800; color: var(--ink); }

/* 日历 */
.cal-shell { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.calendar { }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head .cal-title { font-size: 16px; font-weight: 700; }
.cal-nav-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid rgba(205,181,152,.4); background: #fff; cursor: pointer; color: var(--ink); font-size: 15px; }
.cal-nav-btn:hover { background: var(--cream-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--ink-faint); font-weight: 600; padding: 4px 0; }
.cal-cell {
  aspect-ratio: 1/1; border-radius: 12px; display: grid; place-items: center;
  font-size: 13.5px; cursor: pointer; position: relative; background: var(--cream-2);
  transition: all .16s; color: var(--ink);
}
.cal-cell:hover { background: #fff; }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { border: 2px solid var(--terracotta); }
.cal-cell.sel { background: var(--accent-gradient); color: #fff; font-weight: 700; }
.cal-cell .cal-dot { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--honey); }
.cal-cell.sel .cal-dot { background: #fff; }
.day-panel { background: var(--paper-warm); border-radius: var(--radius); border: 1px solid rgba(232,214,189,.7); padding: 18px; }
.day-panel .dp-date { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }

/* 倒计时 */
.countdown { display: flex; gap: 10px; align-items: center; }
.countdown .cd-box { background: var(--cream-2); border-radius: 12px; padding: 8px 10px; text-align: center; min-width: 58px; }
.countdown .cd-box b { font-size: 22px; color: var(--rust); display: block; }
.countdown .cd-box span { font-size: 10.5px; color: var(--ink-faint); }

/* 快捷跳转 */
.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.quick-link {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 16px; cursor: pointer;
  background: var(--paper); border: 1px solid rgba(232,214,189,.7); transition: all .2s;
}
.quick-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.quick-link .ql-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; background: rgba(214,138,95,.14); }
.quick-link .ql-t { font-size: 14px; font-weight: 600; }
.quick-link .ql-s { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.quick-link .ql-p { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--terracotta); }

/* 老师后台专属 */
.admin-bar {
  background: linear-gradient(135deg, rgba(138,154,91,.14), rgba(111,127,74,.12));
  border: 1px solid rgba(111,127,74,.3); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 18px; font-size: 13px; color: var(--olive-deep);
  display: flex; align-items: center; gap: 8px; font-weight: 600;
}
.add-row { display: flex; gap: 8px; margin-bottom: 12px; }
.add-row input, .add-row textarea { flex: 1; }

/* 空状态 */
.empty { text-align: center; color: var(--ink-faint); padding: 34px 10px; }
.empty .e-ico { font-size: 34px; }

/* toast */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 24px; border-radius: 14px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow); z-index: 100;
  opacity: 0; transition: all .3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 添加到主屏幕提示（平板 Safari 首次） */
.home-tip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: linear-gradient(135deg, #fdf6ec, #f7ede0);
  border-top: 1px solid rgba(205, 127, 90, .35);
  box-shadow: 0 -8px 30px rgba(139, 84, 60, .18);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
}
.home-tip .ht-inner { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.home-tip .ht-ico { font-size: 26px; flex-shrink: 0; }
.home-tip b { color: var(--rust); }
.home-tip .ht-close { margin-left: auto; flex-shrink: 0; background: var(--rust); color: #fff; border: 0; padding: 8px 16px; border-radius: 10px; font-size: 13px; }
.home-tip .ht-close:hover { background: var(--rose-deep); }

/* 视角角标 */
.role-pill {
  position: fixed; bottom: 18px; right: 20px; z-index: 50;
  padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 700;
  color: #fff; box-shadow: var(--shadow); cursor: pointer;
}
.role-pill.student { background: var(--accent-gradient); }
.role-pill.teacher { background: var(--olive-gradient); }

/* 单词 */
.word-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.word-stat .ws { background: var(--paper-warm); border-radius: var(--radius-sm); padding: 14px; text-align: center; border: 1px solid rgba(232,214,189,.7); }
.word-stat .ws b { font-size: 26px; color: var(--rust); display: block; }
.word-stat .ws span { font-size: 12px; color: var(--ink-soft); }

/* 复盘特殊标识 */
.review-tag { font-size: 11px; font-weight: 700; color: #fff; background: var(--apple); }

/* 响应式 */
@media (max-width: 1100px) {
  .g4, .g3 { grid-template-columns: repeat(2, 1fr); }
  .cal-shell { grid-template-columns: 1fr; }
  .day-panel { order: -1; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: grid; place-items: center; }
  .main { padding: 74px 16px 60px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .role-pill { display: none; }
  #toast { width: auto; left: 16px; right: 16px; transform: translateY(20px); }
  #toast.show { transform: translateY(0); }
}
@media (max-width: 600px) {
  .word-stat { grid-template-columns: 1fr; }
  table.task-table { font-size: 13px; }
}
