/* 考研自习室 · 视觉学研招网 wap：蓝渐变头区 + 灰底白卡 + 胶囊标签 + 手机底部 tabbar
   主蓝 #1887e0，渐变 #167ff0→#50a5ff，文字 #2b2e33/#65696e，分隔线 #e8eaed */
body { background: #f4f6f9; }

.study-wrap { max-width: 680px; margin: 0 auto; padding: 0 0 48px; }
.pad { padding: 0 16px; }

/* ---------- 蓝色头区（学研招网 top-bg） ---------- */
.yz-hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(165deg, #2f9bf4 0%, #1887e0 45%, #1668c4 100%);
  padding: 20px 16px 18px;
}
.yz-hero::after {
  content: ""; position: absolute; right: -42px; top: -46px;
  width: 170px; height: 170px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.09); pointer-events: none;
}
.yz-hero::before {
  content: ""; position: absolute; left: -34px; bottom: -64px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.07); pointer-events: none;
}
.yz-hero-row { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.yz-hero-hi { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.yz-hero-date { font-size: 13px; color: rgba(255, 255, 255, 0.85); margin-top: 4px; }
.yz-hero-link {
  flex: none; color: #fff; background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; text-decoration: none;
}
.yz-hero-link:active { background: rgba(255, 255, 255, 0.28); }
.yz-hero .study-h1 { color: #fff; margin: 0 0 6px; font-size: 22px; }
.yz-hero .study-lead { color: rgba(255, 255, 255, 0.88); margin: 0; position: relative; z-index: 1; }

/* 头区内的目标横幅：半透明白卡 */
.yz-hero .goal-banner {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: none; border-radius: 10px; padding: 12px 14px; margin: 14px 0 0;
  border-left: none;
}
.yz-hero .g-school { color: #fff; }
.yz-hero .g-sub { color: rgba(255, 255, 255, 0.85); }
.yz-hero .g-count { color: #fff; }
.yz-hero .g-empty { color: rgba(255, 255, 255, 0.85); }

/* ---------- 通用排版 ---------- */
.study-h1 { font-size: 24px; margin: 0 0 8px; color: #2b2e33; }
.study-lead { color: #65696e; margin: 0 0 14px; font-size: 15px; }
.study-when { font-size: 12.5px; color: #9aa0a8; font-weight: 400; margin-left: 8px; }
.study-muted { color: #65696e; font-size: 14px; margin: 4px 0 10px; }
.study-muted.small { font-size: 12.5px; color: #9aa0a8; }
.study-msg { font-size: 13px; color: #167ff0; min-height: 1.2em; margin: 6px 0 0; }
.study-msg.err { color: #e64340; }

/* ---------- 跨设备冲突提示条（静态骨架在 index.html，脚本只切 class 与文本） ----------
   注意：site.css 的 .is-hidden{display:none} 与 .sync-bar{display:flex} 同为单类选择器，
   study.css 在 site.css 之后加载会反压掉隐藏规则，所以这里必须显式写 .sync-bar.is-hidden。 */
.sync-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff8e8; border: 1px solid #ffd591; border-left: 4px solid #d48806;
  border-radius: 8px; padding: 10px 12px; margin: 0 0 12px;
  font-size: 13.5px; line-height: 1.5; color: #7a4b00;
}
.sync-bar.is-hidden { display: none; }
.sync-bar-text { flex: 1 1 auto; }
.sync-bar .btn.small { flex: none; padding: 5px 12px; font-size: 13px; }
.study-link { color: #1887e0; text-decoration: none; font-weight: 600; }
.study-link:hover { text-decoration: underline; }

/* ---------- 卡片（白底圆角，学研招网 van-card） ---------- */
.study-card {
  background: #fff; border: none; border-radius: 10px;
  padding: 14px 14px 12px; box-shadow: 0 1px 3px rgba(30, 60, 100, 0.06); margin-bottom: 12px;
}
.study-card.inner { box-shadow: none; margin-bottom: 0; }
.study-card-head { display: flex; align-items: baseline; }
.study-card-head h2 { font-size: 16px; margin: 0 0 8px; color: #2b2e33; position: relative; padding-left: 11px; }
.study-card-head h2::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 4px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, #50a5ff, #167ff0);
}
.study-label { display: block; font-size: 13px; color: #65696e; margin: 10px 0 4px; }
.study-hr { border: 0; border-top: 1px dashed #e8eaed; margin: 18px 0 4px; }
#view-loading .study-card { margin-top: 16px; }
#view-login .login-card { max-width: 420px; margin: 14px auto 0; }

/* ---------- 表单 ---------- */
.study-input {
  width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 15px;
  border: 1px solid #e8eaed; border-radius: 8px; background: #fff;
  color: #2b2e33; font-family: inherit;
}
.study-input.slim { padding: 8px 10px; font-size: 14px; width: auto; }
.study-input.slim.grow { flex: 1; min-width: 0; width: auto; }
.study-input.slim.num { width: 84px; }
.study-input:focus { outline: 3px solid rgba(24, 135, 224, 0.16); border-color: #1887e0; }
textarea.study-input { resize: vertical; }
.study-btn { margin-top: 12px; }
#btn-login { width: 100%; }
.btn.primary { background: linear-gradient(90deg, #167ff0, #50a5ff); border-color: transparent; }
.btn.primary:active { filter: brightness(1.06); }
.btn.small { padding: 6px 14px; font-size: 13.5px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-file { position: relative; overflow: hidden; display: inline-flex; align-items: center; cursor: pointer; }
.visually-hidden-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* 目标横幅（非头区场景兜底，保持旧语义） */
.goal-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; border-left: 3px solid #1887e0; }
.goal-banner .g-school { font-size: 17px; font-weight: 700; color: #2b2e33; }
.goal-banner .g-sub { color: #65696e; font-size: 14px; }
.goal-banner .g-count { margin-left: auto; font-size: 14px; color: #167ff0; font-weight: 600; }
.goal-banner .g-empty { color: #65696e; font-size: 14.5px; }

/* ---------- 今日任务 ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid #eef1f6; border-radius: 8px; background: #f7f9fc;
}
.task-item.done { opacity: 0.6; }
.task-item.done .t-title { text-decoration: line-through; }
.task-check { width: 26px; height: 26px; flex: none; accent-color: #1887e0; cursor: pointer; }
.t-body { flex: 1; min-width: 0; }
.t-title { font-size: 15px; display: block; overflow-wrap: break-word; color: #2b2e33; }
.t-meta { font-size: 12px; color: #9aa0a8; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.t-meta .t-active { color: #167ff0; font-weight: 600; }
.t-actions { display: flex; gap: 6px; flex: none; }
.t-btn {
  border: 1px solid #e8eaed; background: #fff; border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; color: #1887e0; cursor: pointer;
}
.t-btn:hover { border-color: #1887e0; }
.task-add { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.task-add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-empty { color: #9aa0a8; font-size: 14px; padding: 14px 4px; text-align: center; }

/* ---------- 统计 ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 680px) { .grid2 { grid-template-columns: 1fr; } }
.kv-big { display: flex; gap: 22px; flex-wrap: wrap; }
.kv-big .n { font-size: 22px; font-weight: 700; color: #2b2e33; display: block; }
.kv-big .t { font-size: 12.5px; color: #9aa0a8; }
.subj-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; color: #2b2e33; }
.subj-row .name { width: 72px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-bar { flex: 1; height: 8px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.subj-bar i { display: block; height: 100%; background: linear-gradient(90deg, #167ff0, #50a5ff); border-radius: 99px; }
.subj-row .cnt { flex: none; font-size: 12.5px; color: #65696e; width: 64px; text-align: right; }

/* ---------- 周计划 ---------- */
.week-day { margin: 6px 0; }
.week-day .wd-head { font-size: 13.5px; color: #65696e; display: flex; gap: 8px; align-items: baseline; }
.week-day .wd-head .today-tag {
  color: #fff; background: linear-gradient(90deg, #167ff0, #50a5ff);
  font-size: 11px; border-radius: 99px; padding: 1px 8px;
}
.week-day ul { margin: 4px 0 10px; padding-left: 20px; font-size: 14px; color: #2b2e33; }
.week-day li { margin: 2px 0; }
.week-day li.done { color: #9aa0a8; text-decoration: line-through; }
.week-day li.wd-empty { list-style: none; }

/* ---------- 设置 ---------- */
.set-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.set-grid .study-input { flex: 1 1 140px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #65696e; margin: 12px 0 2px; }
.check-row input { width: 18px; height: 18px; accent-color: #1887e0; }

/* ---------- 专注计时条（蓝渐变，压在 tabbar 之上） ---------- */
.timer-bar[hidden] { display: none; }   /* hidden 属性必须能压过 display:flex */
.timer-bar .btn[hidden] { display: none; }   /* .btn 有显式 display，会压过 hidden 属性，必须显式补上 */
.timer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: linear-gradient(90deg, #167ff0, #50a5ff); color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; box-shadow: 0 -4px 18px rgba(22, 90, 160, 0.35);
}
.timer-bar.folded .timer-task { display: none; }
.timer-fold { background: none; border: 0; color: rgba(255, 255, 255, 0.75); font-size: 16px; cursor: pointer; padding: 4px 6px; }
.timer-main { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; }
.timer-task { font-size: 13px; color: rgba(255, 255, 255, 0.88); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-task .paused-tag { color: #ffe1a1; font-weight: 600; }
.timer-clock { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.timer-actions { display: flex; gap: 8px; }
.timer-bar .btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.45); color: #fff; }
.timer-bar .btn.primary { background: #fff; border-color: #fff; color: #167ff0; }
body.has-timer { padding-bottom: 64px; }

/* ---------- 密码输入行 ---------- */
.pw-row { display: flex; gap: 8px; align-items: stretch; }
.pw-row .study-input { flex: 1; min-width: 0; }
.pw-row .t-btn { display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px; }

/* 保存状态指示 */
.saving { color: #9aa0a8; }

/* ---------- 手机底部 tabbar（学研招网 van-tabbar） ---------- */
.yz-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: none; background: #fff; border-top: 1px solid #e8eaed;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
}
.yz-tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; color: #65696e; text-decoration: none; padding: 2px 0;
}
.yz-tabbar a svg { width: 22px; height: 22px; display: block; }
.yz-tabbar a.on, .yz-tabbar a:active { color: #1887e0; }
/* 仅在已登录（body.app，由 study.js 切换）时显示底栏；登录前不出现任何私人功能入口 */
@media (max-width: 720px) {
  body.app .yz-tabbar { display: flex; }
  body.app { padding-bottom: 64px; }
  body.app.has-timer { padding-bottom: 118px; }
  .timer-bar { bottom: 52px; }
}

/* ---------- 固定条遮挡修正（窄屏，390px 实测） ----------
   底部 tabbar（约 60px）与「空闲态也常驻」的计时条（约 57px，bottom:52px）都是 position:fixed，
   合计压住视口底部约 109px（390×844 实测：tabbar top=784、timer-bar top=735）。
   浏览器的「最小滚动」只保证目标元素进入视口，会把它停在视口最下沿 —— 正好落进这 109px 的暗区，
   于是点击命中固定条，请求根本发不出去（实测落点 elementFromPoint 命中 .yz-tabbar 的 <a>）。
   给「可能被滚入视口」的元素留出底部外边距，让最小滚动把它停在固定条之上（130px > 109px，留 21px 余量）。
   注意：scroll-margin 只影响滚动定位，不参与布局，因此不会引入横向溢出或改变页面高度。 */
@media (max-width: 720px) {
  body.app .task-item,
  body.app .task-check,
  body.app .t-btn,
  body.app .btn,
  body.app button,
  body.app .study-input,
  body.app input,
  body.app label {
    scroll-margin-bottom: 130px;
  }
}

/* Desktop daily plan, existing task actions and storage retained. */
@media(min-width:1000px){.study-wrap{max-width:1000px}.set-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
.daily-plan-scroll{overflow-x:auto}.daily-plan{width:100%;border-collapse:collapse;min-width:620px}.daily-plan th{text-align:left;font-size:12px;color:#626d7d;background:#f4f7fb;padding:12px 10px}.daily-plan .task-list{display:table-row-group}.daily-plan .task-item{display:table-row;border:0}.daily-plan td{padding:14px 10px;border-bottom:1px solid #e8edf3;font-size:13px}.daily-plan .t-body{width:42%}.daily-plan .t-actions{display:table-cell;white-space:nowrap}.daily-plan .t-actions button{margin:2px}.daily-plan .task-check{margin:0}.daily-plan .task-empty{padding:26px 12px;text-align:center}.daily-plan .done .t-title{text-decoration:line-through;color:#8290a0}
.yz-hero .goal-banner .g-sub{color:#fff}.yz-hero .goal-banner .g-school{color:#fff}
