/* ==========================================================================
   考研学习站 V5.0 · 严格纯黑白（#000000 / #FFFFFF）设计系统
   全站零彩色、零灰阶：所有按钮、焦点、勾选、禁用、报错、加载均通过黑白反转、线框、图标与文字表达
   ========================================================================== */

:root {
  --black: #000000;
  --white: #FFFFFF;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dock-h: 88px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* 覆盖浏览器默认蓝色选中态、链接色、表单高亮与自动填充底色 */
::selection {
  background-color: #000000;
  color: #FFFFFF;
}

::-moz-selection {
  background-color: #000000;
  color: #FFFFFF;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #FFFFFF inset !important;
  -webkit-text-fill-color: #000000 !important;
  caret-color: #000000 !important;
  border-color: #000000 !important;
}

html,
body {
  background-color: #FFFFFF;
  color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  color-scheme: light;
}

a,
a:visited,
a:hover,
a:active {
  color: #000000;
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
  color: #000000;
  accent-color: #000000;
  caret-color: #000000;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
  box-shadow: none;
}

/* ==================== 1. 原比例纯黑白背景图层 ==================== */
.site-bg-host {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-color: #FFFFFF;
  overflow: hidden;
}

.site-bg-img {
  position: absolute;
  width: min(84vw, 430px);
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  display: block;
}

.site-bg-host[data-anchor="right-top"] .site-bg-img {
  top: 0;
  right: 0;
  object-position: right top;
}

.site-bg-host[data-anchor="right-bottom"] .site-bg-img {
  right: 0;
  bottom: calc(var(--dock-h) + var(--safe-bottom) + 4px);
  object-position: right bottom;
}

.site-bg-host[data-anchor="left-top"] .site-bg-img {
  top: calc(var(--safe-top) + 48px);
  left: 0;
  object-position: left top;
}

@media (min-width: 768px) {
  .site-bg-img {
    width: min(44vw, 540px);
    max-height: 62vh;
  }
  .site-bg-host[data-anchor="right-bottom"] .site-bg-img {
    bottom: 16px;
  }
}

/* ==================== 2. 登录与注册界面 ==================== */
.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 32px) 18px calc(var(--safe-bottom) + 36px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.auth-header {
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 4px 4px 0 #000000;
}

.brand-mark {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 13px;
  margin-top: 4px;
}

.auth-card-mount {
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 4px 4px 0 #000000;
}

/* ==================== 3. 顶栏与页面主容器（防底部小猫遮挡） ==================== */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  min-height: 100dvh;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: #FFFFFF;
  border-bottom: 2px solid #000000;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.top-brand {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.top-user-badge {
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid #000000;
  border-radius: 999px;
  padding: 1px 8px;
  background-color: #FFFFFF;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page {
  display: none;
  padding: 16px 16px calc(var(--dock-h) + var(--safe-bottom) + 52px);
}

.page.active {
  display: block;
}

/* ==================== 4. 纯黑白通用卡片、按钮与表单组件 ==================== */
.bw-card {
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.bw-card-hard {
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 3px 3px 0 #000000;
}

.bw-list {
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}

.bw-list-item {
  background-color: #FFFFFF;
  padding: 13px 14px;
  border-bottom: 1.5px solid #000000;
}

.bw-list-item:last-child {
  border-bottom: none;
}

/* 主按钮：黑底白字；次按钮：白底黑框 */
.btn-primary,
.btn-secondary {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 2px solid #000000;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: #000000;
  color: #FFFFFF;
}

.btn-primary:active:not(:disabled) {
  transform: translate(1px, 1px);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: #000000;
}

.btn-secondary:active:not(:disabled) {
  background-color: #000000;
  color: #FFFFFF;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 50px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 8px;
  border-width: 1.5px;
}

.btn-xs {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 11.5px;
  border-radius: 6px;
  border-width: 1.5px;
}

.chap-link-btn {
  white-space: normal;
  text-align: left;
  max-width: 100%;
  word-break: break-word;
  line-height: 1.35;
  padding: 4px 8px;
}

/* 禁用态：纯黑白虚线轮廓，不依赖灰色半透明 */
button:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
  background-color: #FFFFFF !important;
  color: #000000 !important;
  border: 1.5px dashed #000000 !important;
  cursor: not-allowed;
  text-decoration: line-through;
  box-shadow: none !important;
}

/* 分段切换器（黑底白字激活态，白底黑字未选态） */
.seg-bar {
  display: flex;
  background-color: #FFFFFF;
  border: 2px solid #000000;
  border-radius: 10px;
  padding: 3px;
  gap: 4px;
  margin-bottom: 14px;
}

.seg-btn {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid transparent;
  background-color: #FFFFFF;
  color: #000000;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.seg-btn.active {
  background-color: #000000;
  color: #FFFFFF;
  border-color: #000000;
}

/* 输入框与下拉框：纯白底、纯黑框、焦点双黑轮廓 */
.bw-input,
.bw-textarea,
.bw-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  background-color: #FFFFFF;
  color: #000000;
  border: 2px solid #000000;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14.5px;
  line-height: 1.45;
  outline: none;
  box-shadow: none;
}

.bw-select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.bw-textarea {
  min-height: 92px;
  resize: vertical;
}

.bw-input::placeholder,
.bw-textarea::placeholder {
  color: #000000;
  opacity: 1;
  font-weight: 400;
}

.bw-input:focus,
.bw-textarea:focus,
.bw-select:focus {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

.bw-input:invalid,
.bw-textarea:invalid {
  box-shadow: none;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

/* 纯黑白勾选框（白底黑框 / 黑底白勾） */
.bw-check {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid #000000;
  border-radius: 6px;
  background-color: #FFFFFF;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.bw-check.checked {
  background-color: #000000;
  color: #FFFFFF;
}

/* 纯黑白徽章与提示框（零彩色） */
.bw-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1.5px solid #000000;
  border-radius: 999px;
  background-color: #FFFFFF;
  color: #000000;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.bw-tag-solid {
  background-color: #000000;
  color: #FFFFFF;
}

.bw-alert {
  background-color: #FFFFFF;
  color: #000000;
  border: 2px solid #000000;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.bw-alert-invert {
  background-color: #000000;
  color: #FFFFFF;
}

/* 纯黑白进度条与加载动画 */
.bw-progress {
  width: 100%;
  height: 10px;
  background-color: #FFFFFF;
  border: 1.5px solid #000000;
  border-radius: 999px;
  overflow: hidden;
}

.bw-progress-fill {
  height: 100%;
  background-color: #000000;
  transition: width 0.2s ease;
}

.bw-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #000000;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bwSpin 0.75s linear infinite;
  vertical-align: -2px;
}

@keyframes bwSpin {
  to { transform: rotate(360deg); }
}

/* ==================== 5. 计划清单、目录层级与打卡日历 ==================== */
.plan-done-text {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.toc-row-l1 {
  font-weight: 800;
  font-size: 15px;
}

.toc-row-l2 {
  padding-left: 20px;
  font-weight: 500;
  font-size: 14px;
}

/* 打卡日历网格：黑点表示学过，黑底白勾表示全部完成，外圈表示今天 */
.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 0;
}

.cal-cell {
  appearance: none;
  -webkit-appearance: none;
  min-height: 54px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background-color: #FFFFFF;
  color: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px 2px;
  position: relative;
}

.cal-cell.is-empty {
  pointer-events: none;
}

/* 外圈表示今天 */
.cal-cell.is-today {
  border: 2px solid #000000;
}

/* 当前点击选中的查看日期：底部粗黑横线标识 */
.cal-cell.is-selected::after {
  content: "";
  position: absolute;
  bottom: 2px;
  width: 16px;
  height: 2.5px;
  background-color: #000000;
}

.cal-day-num {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.1;
}

.cal-mark {
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 黑点：当天完成至少一项 */
.cal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #000000;
  display: inline-block;
}

/* 黑底白勾：当天所有计划全部完成 */
.cal-all-done {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #000000;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==================== 6. 底部五只小猫导航栏（单次微动效 + 减少动态效果支持） ==================== */
.cat-dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background-color: #FFFFFF;
  border-top: 2px solid #000000;
  padding: 6px 8px calc(6px + var(--safe-bottom));
}

.cat-dock {
  max-width: 660px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.cat-nav-btn {
  appearance: none;
  -webkit-appearance: none;
  background-color: #FFFFFF;
  color: #000000;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 4px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.cat-nav-btn > * {
  pointer-events: none;
}

/* 动画结束后依然清晰可辨的选中态：双像素纯黑外框 + 黑底白字文字签 */
.cat-nav-btn.active {
  border-color: #000000;
  background-color: #FFFFFF;
}

.cat-nav-img-wrap {
  width: 42px;
  height: 42px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FFFFFF;
}

.cat-nav-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cat-nav-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 1px 7px;
  border-radius: 999px;
  background-color: #FFFFFF;
  color: #000000;
}

.cat-nav-btn.active .cat-nav-label {
  background-color: #000000;
  color: #FFFFFF;
}

.cat-nav-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background-color: #000000;
  color: #FFFFFF;
  border: 1.5px solid #FFFFFF;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 点击仅当前小猫播放一次轻量动画（摆尾 / 歪头 / 竖耳眨眼） */
.cat-nav-btn.play-once[data-anim="wag"] .cat-nav-img-wrap {
  animation: catWagOnce 0.46s ease-out 1;
}
.cat-nav-btn.play-once[data-anim="tilt"] .cat-nav-img-wrap {
  animation: catTiltOnce 0.46s ease-out 1;
}
.cat-nav-btn.play-once[data-anim="nod"] .cat-nav-img-wrap {
  animation: catNodOnce 0.44s ease-out 1;
}
.cat-nav-btn.play-once[data-anim="perk"] .cat-nav-img-wrap {
  animation: catPerkOnce 0.46s ease-out 1;
}

@keyframes catWagOnce {
  0% { transform: rotate(0deg) scale(1); }
  28% { transform: rotate(-9deg) translateY(-3px) scale(1.06); }
  62% { transform: rotate(8deg) translateY(-1px) scale(1.03); }
  100% { transform: rotate(0deg) scale(1); }
}

@keyframes catTiltOnce {
  0% { transform: rotate(0deg); }
  35% { transform: rotate(11deg) translateY(-3px); }
  70% { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}

@keyframes catNodOnce {
  0% { transform: translateY(0) scaleY(1); }
  35% { transform: translateY(2px) scaleY(0.92); }
  70% { transform: translateY(-4px) scaleY(1.05); }
  100% { transform: translateY(0) scaleY(1); }
}

@keyframes catPerkOnce {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.08, 0.90); }
  65% { transform: translateY(-4px) scale(0.97, 1.07); }
  100% { transform: scale(1, 1); }
}

/* 开启系统「减少动态效果」时禁用全部动画，保持清晰静态选中态 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .cat-nav-btn.play-once .cat-nav-img-wrap,
  .bw-spinner {
    animation: none !important;
  }
}

/* ==================== 7. 纯黑白抽屉弹窗与顶部提示 ==================== */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  /* 纯黑白网点遮罩：每个像素严格为 #000000 或透明，绝不引入半透明灰 */
  background-color: transparent;
  background-image: radial-gradient(#000000 1px, transparent 1px);
  background-size: 6px 6px;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet-mask.open {
  display: flex;
}

.sheet-panel {
  width: 100%;
  max-width: 680px;
  max-height: 90dvh;
  background-color: #FFFFFF;
  border-top: 3px solid #000000;
  border-left: 2px solid #000000;
  border-right: 2px solid #000000;
  border-radius: 18px 18px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-topbar {
  padding: 12px 16px;
  border-bottom: 2px solid #000000;
  background-color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 16px;
  font-weight: 800;
}

.sheet-body {
  padding: 16px 16px calc(36px + var(--safe-bottom));
  overflow-y: auto;
  background-color: #FFFFFF;
}

.bw-toast {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  background-color: #000000;
  color: #FFFFFF;
  border: 2px solid #000000;
  box-shadow: 0 0 0 2px #FFFFFF;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  max-width: 90vw;
  text-align: center;
  display: none;
}

.bw-toast.show {
  display: block;
}

/* ==================== 8. 排版辅助工具类 ==================== */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.row-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sec-head {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background-color: #FFFFFF;
  border: 1.5px solid #000000;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.toc-preview-img {
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  background-color: #FFFFFF;
  border: 1.5px solid #000000;
  border-radius: 8px;
  display: block;
}

.toc-thumb {
  width: 52px;
  height: 64px;
  object-fit: cover;
  border: 1.5px solid #000000;
  border-radius: 6px;
  background-color: #FFFFFF;
  flex-shrink: 0;
  cursor: pointer;
}

.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mb-6 { margin-bottom: 6px; }
.mb-10 { margin-bottom: 10px; }
.mb-14 { margin-bottom: 14px; }
.fw-800 { font-weight: 800; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mono { font-family: Consolas, ui-monospace, "SF Mono", Menlo, monospace; }
