/* ==========================================================================
   数学拍题助手 - 首页导航 UI 样式 (1:1 还原设计稿)
   仅作用于 index.html，与 problem.html / app.css 完全隔离
   ========================================================================== */

:root {
  --sidebar-width: 214px;
  --text-primary: #151b26;
  --text-secondary: #5a6578;
  --text-muted: #949eae;
  --brand-blue: #1d63ff;
  --brand-blue-hover: #1554e6;
  --nav-active-bg: #dbe7ff;
  --nav-active-text: #1861ff;
  --card-border: rgba(226, 234, 248, 0.95);
  --shadow-input: 0 12px 36px rgba(31, 74, 166, 0.06), 0 2px 8px rgba(31, 74, 166, 0.03);
  --shadow-card: 0 8px 26px rgba(31, 74, 166, 0.045);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

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

html,
body {
  width: 100%;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: #f5f8ff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
}

button,
input,
textarea {
  font-family: inherit;
  outline: none;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
}

[hidden] {
  display: none !important;
}

/* ==================== 整体双栏骨架 ==================== */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  background:
    radial-gradient(540px 360px at 36% 24%, rgba(214, 231, 255, 0.52) 0%, rgba(214, 231, 255, 0) 72%),
    radial-gradient(520px 360px at 84% 28%, rgba(213, 229, 255, 0.55) 0%, rgba(213, 229, 255, 0) 74%),
    radial-gradient(640px 420px at 58% 84%, rgba(231, 238, 255, 0.5) 0%, rgba(231, 238, 255, 0) 75%),
    linear-gradient(180deg, #f6f9ff 0%, #f9fbff 54%, #f4f7ff 100%);
}

/* ==================== 左侧导航栏 ==================== */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 24px;
  background: linear-gradient(180deg, #eef4ff 0%, #f1f5fe 55%, #eef3fe 100%);
  border-right: 1px solid rgba(216, 227, 248, 0.72);
  z-index: 10;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 26px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #181f2c;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1f2633;
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(219, 231, 255, 0.52);
}

.nav-item:active {
  transform: scale(0.99);
}

.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

/* 默认态下首页显示线条图标，激活态显示实心蓝图标 */
.nav-item .icon-solid {
  display: none;
}

.nav-item.active .icon-solid {
  display: block;
}

.nav-item.active .icon-outline {
  display: none;
}

.sidebar-divider {
  height: 1px;
  margin: 16px 10px;
  background: rgba(203, 216, 240, 0.68);
}

/* ==================== 右侧主舞台 ==================== */
.main-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

/* -------------------- 顶部栏 -------------------- */
.topbar {
  height: 68px;
  flex-shrink: 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  z-index: 5;
}

.topbar-left {
  min-width: 1px;
}

/* 居中胶囊切换器：听讲解 | 记录 */
.mode-tabs {
  display: inline-flex;
  align-items: center;
  background: #eaeff9;
  padding: 4px;
  border-radius: 999px;
  height: 40px;
  box-shadow: inset 0 1px 2px rgba(26, 54, 110, 0.04);
}

.mode-tab {
  min-width: 84px;
  height: 32px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: #7c8698;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.mode-tab:hover {
  color: #2c3545;
}

.mode-tab.active {
  background: #ffffff;
  color: #141a25;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(24, 58, 125, 0.08);
}

/* 右上角消息铃铛、头像与窗口控制键 */
.topbar-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 18px;
}

.icon-action-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #252c39;
  transition: background-color 0.16s ease;
}

.icon-action-btn:hover {
  background: rgba(218, 229, 249, 0.55);
}

.icon-action-btn svg {
  width: 20px;
  height: 20px;
}

.unread-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4d4f;
  box-shadow: 0 0 0 1.5px #f7faff;
}

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(31, 64, 128, 0.08);
  transition: transform 0.16s ease;
}

.avatar-btn:hover {
  transform: scale(1.04);
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.win-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2c3340;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.win-btn:hover {
  background: rgba(212, 223, 244, 0.6);
}

.win-btn.win-close:hover {
  background: #ff4d4f;
  color: #ffffff;
}

.win-btn svg {
  width: 14px;
  height: 14px;
}

/* ==================== 主内容居中工作区 ==================== */
.stage-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 36px 14px;
  min-height: 580px;
}

.home-center-wrap {
  width: 100%;
  max-width: 824px;
  display: flex;
  flex-direction: column;
}

/* -------------------- Hero 横幅区域 -------------------- */
.hero-banner {
  position: relative;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 236px;
  align-items: center;
  min-height: 222px;
  margin-bottom: -10px;
  padding: 0 4px;
  z-index: 1;
}

.hero-portrait-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 232px;
  pointer-events: none;
}

.hero-portrait-slot img {
  width: 228px;
  height: 232px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 18px rgba(32, 62, 120, 0.06));
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-left: 14px;
  padding-bottom: 10px;
  z-index: 2;
}

.hero-headline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-title {
  font-size: 31px;
  line-height: 1.34;
  font-weight: 800;
  color: #131822;
  letter-spacing: 0.4px;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 23px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid #b3bdce;
  background: rgba(255, 255, 255, 0.55);
  color: #202736;
  font-size: 12px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.5px;
  transform: translateY(-1px);
}

/* 查看完整样题胶囊按钮 */
.sample-pill-btn {
  margin-top: 18px;
  height: 44px;
  padding: 0 16px 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #d9e3f4;

  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1e2532;
  font-size: 14.5px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  transition: all 0.18s ease;
}

.sample-pill-btn:hover {
  background: #ffffff;
  border-color: #bfd2f7;
  box-shadow: 0 6px 18px rgba(29, 99, 255, 0.11);
  transform: translateY(-1px);
}

.sample-play-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, #2b77ff 0%, #1962ff 100%);
  box-shadow: 0 3px 8px rgba(25, 98, 255, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.sample-play-circle svg {
  width: 12px;
  height: 12px;
  transform: translateX(1px);
}

.sample-chevron {
  width: 14px;
  height: 14px;
  color: #596579;
}

.hero-graphic-slot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 214px;
  pointer-events: none;
}

.hero-graphic-slot img {
  width: 248px;
  height: 196px;
  object-fit: contain;
}

/* -------------------- 中央输入大卡片 -------------------- */
.composer-card {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 172px;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-input);
  padding: 20px 22px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer-card:focus-within,
.composer-card.drag-over {
  border-color: #b9cffc;
  box-shadow: 0 14px 38px rgba(29, 99, 255, 0.09);
}

/* 本地图片预览条（选中图片后显示） */
.attachment-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.attachment-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border-radius: 12px;
  background: #f3f7ff;
  border: 1px solid #dbe6fb;
}

.attachment-chip img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
}

.attachment-name {
  max-width: 180px;
  font-size: 12.5px;
  color: #324057;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.08);
  color: #475569;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.composer-input {
  width: 100%;
  min-height: 76px;
  max-height: 160px;
  resize: none;
  font-size: 16px;
  line-height: 1.6;
  color: #18202e;
  user-select: text;
}

.composer-input::placeholder {
  color: #98a2b3;
  font-weight: 400;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
}

.composer-tools-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-pill-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e4eaf4;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #232a38;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.16s ease;
}

.tool-pill-btn:hover {
  background: #f5f8ff;
  border-color: #cad9f6;
  color: #185eff;
}

.tool-pill-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.composer-tools-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1c2330;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.mic-btn:hover {
  background: #f2f6fe;
  color: #1d63ff;
}

.mic-btn.recording {
  background: rgba(29, 99, 255, 0.12);
  color: #1d63ff;
  animation: micPulse 1.4s infinite;
}

.mic-btn svg {
  width: 20px;
  height: 20px;
}

@keyframes micPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(29, 99, 255, 0.28);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(29, 99, 255, 0);
  }
}

.send-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #a8c0ff;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
}

.send-circle-btn.ready {
  background: var(--brand-blue);
  box-shadow: 0 4px 12px rgba(29, 99, 255, 0.3);
}

.send-circle-btn.ready:hover {
  background: var(--brand-blue-hover);
  transform: translateY(-1px);
}

.send-circle-btn svg {
  width: 17px;
  height: 17px;
}

.send-circle-btn.loading {
  background: var(--brand-blue) !important;
  cursor: wait;
  pointer-events: none;
}

.send-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spinLoader 0.75s linear infinite;
}

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

.composer-submit-status {
  margin-top: 8px;
  font-size: 13px;
  color: var(--brand-blue);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-submit-status.error {
  color: #dc2626;
}

/* -------------------- 底部双功能入口卡片 -------------------- */
.feature-cards-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.feature-card {
  position: relative;
  height: 106px;
  padding: 0 24px 0 26px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(31, 74, 166, 0.08);
}

/* 右侧几何斜切柔光装饰，还原原稿卡片右端折光质感 */
.feature-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -24px;
  width: 148px;
  height: 132px;
  transform: rotate(24deg);
  border-radius: 18px;
  pointer-events: none;
}

.feature-card.card-camera {
  background: linear-gradient(108deg, #ffffff 46%, #f1f6ff 80%, #e1eeff 100%);
}

.feature-card.card-camera::after {
  background: linear-gradient(160deg, rgba(196, 223, 255, 0.38) 0%, rgba(173, 209, 255, 0.14) 100%);
}

.feature-card.card-homework {
  background: linear-gradient(108deg, #ffffff 46%, #f6f2ff 80%, #ece3ff 100%);
}

.feature-card.card-homework::after {
  background: linear-gradient(160deg, rgba(215, 196, 255, 0.36) 0%, rgba(198, 174, 255, 0.12) 100%);
}

.feature-card-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}

.feature-card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.feature-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.feature-card-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.feature-card-title {
  font-size: 16.5px;
  font-weight: 700;
  color: #161c28;
}

.feature-card-desc {
  font-size: 13px;
  color: #8892a4;
  font-weight: 400;
}

.feature-card-arrow {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: #7c899e;
  flex-shrink: 0;
  transition: transform 0.16s ease;
}

.feature-card:hover .feature-card-arrow {
  transform: translateX(3px);
}

/* ==================== 次级标签页占位视图（记录 / 侧边栏模块） ==================== */
.secondary-panel {
  width: 100%;
  max-width: 824px;
  min-height: 420px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-input);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  backdrop-filter: blur(10px);
}

/* 历史记录瀑布流模式容器 */
.secondary-panel.is-waterfall {
  max-width: 960px;
  height: calc(100vh - 132px);
  max-height: calc(100vh - 132px);
  padding: 20px 22px 24px;
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(164, 184, 224, 0.55) transparent;
}

.secondary-panel.is-waterfall::-webkit-scrollbar {
  width: 6px;
}

.secondary-panel.is-waterfall::-webkit-scrollbar-thumb {
  background: rgba(164, 184, 224, 0.55);
  border-radius: 999px;
}

.waterfall-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 0 2px;
  flex-shrink: 0;
}

.waterfall-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.waterfall-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #161d2b;
}

/* 卡片列表左上角「讲题 / 批改」分段切换 Tabs */
.waterfall-type-tabs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: #edf2fb;
  border: 1px solid rgba(210, 222, 245, 0.85);
  gap: 2px;
}

.waterfall-type-tab {
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  transition: all 0.16s ease;
  cursor: pointer;
}

.waterfall-type-tab:hover {
  color: #1e293b;
}

.waterfall-type-tab.active {
  background: #ffffff;
  color: #185eff;
  box-shadow: 0 2px 6px rgba(24, 94, 255, 0.1);
}

.waterfall-header-count {
  font-size: 12.5px;
  color: #7c8799;
  white-space: nowrap;
}

.waterfall-card-badge {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  border: 1px solid rgba(203, 213, 225, 0.7);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.waterfall-card-badge.is-completed {
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
  background: rgba(240, 253, 244, 0.94);
}

.waterfall-card-badge.is-processing {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.32);
  background: rgba(240, 249, 255, 0.94);
}

.waterfall-card-badge.is-failed {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(254, 242, 242, 0.94);
}

.waterfall-grid {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.waterfall-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 瀑布流卡片：上部分图片 + 下部分名称 */
.waterfall-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e4ecf8;
  box-shadow: 0 6px 20px rgba(31, 74, 166, 0.05);
  overflow: hidden;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.waterfall-card:hover {
  transform: translateY(-3px);
  border-color: #bfd4ff;
  box-shadow: 0 12px 28px rgba(29, 99, 255, 0.11);
}

.waterfall-card-media {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, #f3f7ff 0%, #eaf1fe 100%);
  overflow: hidden;
}

.waterfall-card-img {
  display: block;
  width: 100%;
  height: auto;
  min-height: 112px;
  max-height: 300px;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.waterfall-card:hover .waterfall-card-img {
  transform: scale(1.02);
}

/* 纯文字题目无原图时的上部题面预览卡 */
.waterfall-card-text-cover {
  width: 100%;
  min-height: 124px;
  padding: 16px 15px 14px;
  background:
    linear-gradient(rgba(195, 214, 248, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(195, 214, 248, 0.25) 1px, transparent 1px),
    linear-gradient(145deg, #f5f9ff 0%, #eaf2ff 100%);
  background-size: 18px 18px, 18px 18px, 100% 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.waterfall-card-cover-tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(29, 99, 255, 0.11);
  color: #185eff;
  font-size: 11px;
  font-weight: 600;
}

.waterfall-card-cover-excerpt {
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 下部分名称区域 */
.waterfall-card-body {
  padding: 12px 14px 13px;
  background: #ffffff;
  border-top: 1px solid rgba(230, 237, 248, 0.75);
}

.waterfall-card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: #171f2e;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.waterfall-card-submeta {
  margin-top: 5px;
  font-size: 12px;
  color: #8290a5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.waterfall-sentinel {
  width: 100%;
  padding: 18px 0 6px;
  text-align: center;
  font-size: 13px;
  color: #8a94a6;
  flex-shrink: 0;
}

.waterfall-sentinel.clickable {
  cursor: pointer;
  color: var(--brand-blue);
}

.waterfall-empty {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.secondary-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #edf3ff;
  color: var(--brand-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.secondary-badge svg {
  width: 28px;
  height: 28px;
}

.secondary-title {
  font-size: 20px;
  font-weight: 700;
  color: #171e2b;
  margin-bottom: 8px;
}

.secondary-desc {
  max-width: 420px;
  font-size: 14px;
  line-height: 1.65;
  color: #7c8799;
  margin-bottom: 24px;
}

.secondary-back-btn {
  height: 40px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(29, 99, 255, 0.24);
  transition: background-color 0.16s ease;
}

.secondary-back-btn:hover {
  background: var(--brand-blue-hover);
}

/* ==================== 错题本主视图、分类详情、复习卡与录入弹窗 ==================== */
.secondary-panel.is-error-book {
  position: relative;
  max-width: 940px;
  min-height: 490px;
  padding: 28px 28px 30px;
  background: linear-gradient(165deg, rgba(250, 252, 255, 0.88) 0%, rgba(243, 246, 255, 0.92) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 26px;
  box-shadow: 0 12px 36px rgba(31, 64, 145, 0.055);
  justify-content: space-between;
  align-items: stretch;
  text-align: left;
  overflow: hidden;
}

.eb-bg-wave {
  position: absolute;
  right: -12px;
  bottom: -10px;
  width: 340px;
  height: 92px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

.eb-home-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.eb-cards-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 20px;
}

.eb-book-card {
  position: relative;
  height: 114px;
  padding: 20px 22px;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(33, 62, 128, 0.055);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease;
}

.eb-book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(33, 62, 128, 0.1);
}

/* 卡片底部柔和波浪光晕层，还原原图通透质感 */
.eb-book-card::before {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -34px;
  height: 76px;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: rgba(255, 255, 255, 0.28);
  transform: rotate(-4deg);
  pointer-events: none;
}

.eb-book-card.theme-chat {
  background: linear-gradient(135deg, #eef8ff 0%, #d8efff 100%);
}

.eb-book-card.theme-math {
  background: linear-gradient(135deg, #ebfbf4 0%, #d3f5e5 100%);
}

.eb-book-card.theme-chinese {
  background: linear-gradient(135deg, #fff6ee 0%, #fde9d5 100%);
}

.eb-book-card.theme-english {
  background: linear-gradient(135deg, #eef2ff 0%, #dde6ff 100%);
}

.eb-book-card.theme-science {
  background: linear-gradient(135deg, #ecf8ff 0%, #d6efff 100%);
}

.eb-book-card.theme-essay {
  background: linear-gradient(135deg, #f5f0ff 0%, #e7deff 100%);
}

.eb-book-card.theme-custom {
  background: linear-gradient(135deg, #f7f8fd 0%, #eef0f9 100%);
}

.eb-card-title {
  position: relative;
  z-index: 2;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #141a26;
  letter-spacing: 0.01em;
}

.eb-card-meta {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #6f7c91;
}

.eb-card-illust {
  position: absolute;
  right: 14px;
  bottom: 7px;
  width: 68px;
  height: 68px;
  z-index: 1;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  transition: transform 0.22s ease;
}

.eb-book-card:hover .eb-card-illust {
  transform: scale(1.05) translateY(-1px);
}

.eb-card-illust svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 底部居中悬浮「+ 录入 | 去复习」双操作胶囊 */
.eb-bottom-dock-wrap {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.eb-bottom-dock {
  height: 46px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 24px rgba(31, 60, 136, 0.075);
  display: inline-flex;
  align-items: center;
}

.eb-dock-btn {
  height: 38px;
  padding: 0 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: #18202f;
  background: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.eb-dock-btn:hover {
  background: #f3f7ff;
  color: #185eff;
}

.eb-dock-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.eb-dock-divider {
  width: 1px;
  height: 18px;
  background: #e4eaf3;
  margin: 0 2px;
}

/* 错题本子视图（单科错题列表 & 互动复习模式） */
.eb-subview {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 188px);
}

.eb-subview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(214, 224, 242, 0.7);
}

.eb-subview-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eb-back-pill {
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #dfe7f5;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.eb-back-pill:hover {
  border-color: #b8ccf5;
  color: #185eff;
}

.eb-subview-title {
  font-size: 17px;
  font-weight: 700;
  color: #151c28;
}

.eb-add-mini-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.eb-add-mini-btn:hover {
  background: var(--brand-blue-hover);
}

.eb-mistake-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 4px;
  max-height: calc(100vh - 260px);
}

.eb-mistake-item {
  padding: 15px 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e4ecf8;
  box-shadow: 0 4px 14px rgba(29, 72, 160, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.eb-mistake-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.eb-mistake-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #172030;
}

.eb-mistake-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eb-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: #fef2f2;
  color: #dc2626;
}

.eb-tag.is-manual {
  background: #eff6ff;
  color: #1d4ed8;
}

.eb-jump-btn {
  padding: 3px 10px;
  border-radius: 999px;
  background: #f0f5ff;
  color: #185eff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.eb-jump-btn:hover {
  background: #e0ebff;
}

.eb-delete-btn {
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 12px;
  color: #94a3b8;
  cursor: pointer;
}

.eb-delete-btn:hover {
  color: #dc2626;
  background: #fef2f2;
}

.eb-mistake-ans-row {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.eb-mistake-exp {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.55;
  padding: 8px 11px;
  border-radius: 10px;
  background: #f8fafd;
}

.eb-mistake-thumb {
  max-width: 180px;
  max-height: 110px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
}

/* 复习翻转卡片 */
.eb-review-card {
  padding: 24px 26px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #e3ebf8;
  box-shadow: 0 8px 24px rgba(31, 60, 136, 0.06);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.eb-review-answer-box {
  padding: 14px 16px;
  border-radius: 12px;
  background: #f4fbf7;
  border: 1px solid #ccebd9;
  color: #14532d;
  font-size: 13.5px;
  line-height: 1.6;
}

.eb-review-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
}

/* 录入错题 / 创建错题本弹窗表单 */
.eb-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  text-align: left;
}

.eb-form-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.eb-form-input,
.eb-form-select,
.eb-form-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #dce5f4;
  background: #f9fbff;
  font-size: 13.5px;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.eb-form-input:focus,
.eb-form-select:focus,
.eb-form-textarea:focus {
  border-color: #185eff;
  background: #ffffff;
}

.eb-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.eb-btn-cancel {
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid #dce4f2;
  background: #ffffff;
  color: #475569;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.eb-btn-submit {
  height: 38px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.records-list {
  width: 100%;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  text-align: left;
}

.record-card {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f7faff;
  border: 1px solid #e2ecfb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.16s ease;
}

.record-card:hover {
  background: #edf4ff;
  border-color: #bfd4ff;
  transform: translateY(-1px);
}

.record-card-main {
  min-width: 0;
  flex: 1;
}

.record-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #18202f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.record-card-meta {
  font-size: 12px;
  color: #7c8799;
}

.record-status-pill {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e6efff;
  color: #185eff;
}

.record-status-pill.done {
  background: #e6f9ee;
  color: #15803d;
}

.record-status-pill.failed {
  background: #fee2e2;
  color: #dc2626;
}

/* ==================== 底部 AI 声明 ==================== */
.stage-footer {
  flex-shrink: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-bottom: 10px;
}

.footer-line {
  width: 66px;
  height: 1px;
  background: #dce3f0;
}

.footer-text {
  font-size: 12px;
  color: #9ba4b4;
  letter-spacing: 0.3px;
}

/* ==================== 完整样题预览弹窗 ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.sample-modal-card {
  width: 100%;
  max-width: 540px;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid #e3ecfa;
  box-shadow: 0 20px 52px rgba(18, 38, 82, 0.18);
  padding: 24px 26px;
}

.sample-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sample-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #161d2a;
}

.modal-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #667287;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: #f1f5fc;
  color: #1a2230;
}

.sample-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sample-item {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f7f9ff;
  border: 1px solid #e4ecfa;
  text-align: left;
  transition: all 0.16s ease;
}

.sample-item:hover {
  background: #eef4ff;
  border-color: #bfd4ff;
}

.sample-item-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #dbe8ff;
  color: #185eff;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 6px;
}

.sample-item-q {
  font-size: 14px;
  line-height: 1.55;
  color: #1e2634;
  font-weight: 500;
}

.sample-modal-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-secondary-link {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid #dbe5f6;
  color: #344156;
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.modal-secondary-link:hover {
  background: #f4f8ff;
  color: #185eff;
}

/* ==================== 轻提示 Toast ==================== */
.ui-toast {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(22, 29, 43, 0.88);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}

.ui-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 响应式适配 ==================== */

/* 平板 / 窄桌面过渡断点 */
@media (min-width: 769px) and (max-width: 1080px) {
  .sidebar {
    width: 184px;
  }

  .hero-banner {
    grid-template-columns: 184px minmax(0, 1fr) 186px;
  }

  .hero-title {
    font-size: 25px;
  }

  .hero-portrait-slot img {
    width: 180px;
  }

  .hero-graphic-slot img {
    width: 190px;
  }
}

/* 手机端 1:1 还原适配 */
@media (max-width: 768px) {
  html,
  body {
    height: 100dvh;
    background: #ffffff;
  }

  .app-shell {
    width: 100%;
    height: 100dvh;
    background:
      radial-gradient(260px 180px at 8% 2%, rgba(217, 234, 255, 0.68) 0%, rgba(217, 234, 255, 0) 76%),
      radial-gradient(190px 190px at 22% 29%, rgba(204, 226, 255, 0.62) 0%, rgba(204, 226, 255, 0) 74%),
      #ffffff;
  }

  /* 隐藏桌面端左侧导航栏 */
  .sidebar {
    display: none;
  }

  /* 顶部栏：仅保留居中「听讲解 / 记录」胶囊 + 右上角圆形头像 */
  .topbar {
    height: auto;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 8px;
    grid-template-columns: 36px 1fr 36px;
  }

  .mode-tabs {
    justify-self: center;
    height: 42px;
    padding: 4px;
    background: #eff2f8;
    box-shadow: none;
  }

  .mode-tab {
    min-width: 82px;
    height: 34px;
    padding: 0 18px;
    font-size: 15.5px;
  }

  #btn-notify,
  .window-controls {
    display: none;
  }

  .topbar-right {
    gap: 0;
  }

  .avatar-btn {
    width: 36px;
    height: 36px;
    border: none;
    box-shadow: none;
  }

  /* 主体垂直居中偏上排布，留出自然上下呼吸空间 */
  .stage-body {
    min-height: 0;
    padding: 0 18px 28px;
    justify-content: center;
  }

  .home-center-wrap {
    max-width: 440px;
    margin: 0 auto;
  }

  /* Hero 区：左欧拉半身像 + 右双行标题与样题胶囊，隐藏右侧函数图 */
  .hero-banner {
    grid-template-columns: 142px minmax(0, 1fr);
    align-items: end;
    column-gap: 8px;
    min-height: 168px;
    margin-bottom: -8px;
    padding: 0 2px;
  }

  .hero-graphic-slot {
    display: none;
  }

  .hero-portrait-slot {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 170px;
  }

  .hero-portrait-slot img {
    width: 146px;
    height: 170px;
    object-fit: contain;
    object-position: center bottom;
  }

  .hero-copy {
    align-items: flex-start;
    text-align: left;
    padding: 0 0 18px 2px;
  }

  .hero-headline-row {
    gap: 7px;
    flex-wrap: nowrap;
  }

  .hero-title {
    font-size: 19.5px;
    line-height: 1.42;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }

  .beta-badge {
    height: 20px;
    padding: 0 7px;
    border-radius: 5px;
    border-color: #9ba5b7;
    background: rgba(255, 255, 255, 0.85);
    font-size: 10.5px;
  }

  .sample-pill-btn {
    margin-top: 12px;
    height: 38px;
    padding: 0 16px 0 6px;
    background: #f3f6fb;
    border: 1px solid #e6ecf5;
    box-shadow: none;
    font-size: 13.5px;
    font-weight: 500;
    color: #242b38;
    gap: 8px;
  }

  .sample-play-circle {
    width: 26px;
    height: 26px;
    background: #0d74ff;
    box-shadow: none;
  }

  .sample-play-circle svg {
    width: 11px;
    height: 11px;
  }

  .sample-chevron {
    display: none;
  }

  /* 中央输入卡片：浅灰白柔和渐变 + 纯图标底栏 + 空态浅灰发送圆钮 */
  .composer-card {
    min-height: 206px;
    border-radius: 26px;
    padding: 20px 18px 16px;
    background: linear-gradient(180deg, #f5f6f9 0%, #fafbfc 52%, #ffffff 100%);
    border: 1.5px solid #ffffff;
    box-shadow: 0 12px 30px rgba(18, 32, 62, 0.06), 0 1px 3px rgba(18, 32, 62, 0.03);
  }

  .composer-input {
    min-height: 104px;
    font-size: 16.5px;
  }

  .composer-input::placeholder {
    color: #a3abb8;
  }

  .composer-tools-left {
    gap: 18px;
    padding-left: 2px;
  }

  .tool-pill-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #181f2c;
  }

  .tool-pill-btn:hover {
    background: rgba(24, 31, 44, 0.05);
    border-color: transparent;
  }

  .tool-pill-btn span {
    display: none;
  }

  .tool-pill-btn svg {
    width: 25px;
    height: 25px;
  }

  .composer-tools-right {
    gap: 14px;
  }

  .mic-btn {
    width: 36px;
    height: 36px;
    color: #181f2c;
  }

  .mic-btn svg {
    width: 24px;
    height: 24px;
  }

  .send-circle-btn {
    width: 38px;
    height: 38px;
    background: #dedfe3;
  }

  .send-circle-btn.ready {
    background: var(--brand-blue);
  }

  .send-circle-btn svg {
    width: 18px;
    height: 18px;
  }

  /* 底部双功能卡片：双列并排居中胶囊卡片，隐藏副标题与右箭头 */
  .feature-cards-grid {
    margin-top: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .feature-card {
    height: 82px;
    padding: 0 14px;
    border-radius: 22px;
    justify-content: center;
    border: 1.5px solid #ffffff;
    box-shadow: 0 10px 24px rgba(22, 42, 82, 0.055);
  }

  .feature-card::after {
    display: none;
  }

  .feature-card.card-camera {
    background: radial-gradient(120% 120% at 15% 15%, #f1f7ff 0%, #ffffff 55%, #edf6ff 100%);
  }

  .feature-card.card-homework {
    background: radial-gradient(120% 120% at 85% 85%, #f2ecff 0%, #ffffff 58%, #f8f5ff 100%);
  }

  .feature-card-main {
    gap: 10px;
  }

  .feature-card-icon {
    width: 32px;
    height: 32px;
  }

  .feature-card-title {
    font-size: 16px;
    font-weight: 700;
  }

  .feature-card-desc,
  .feature-card-arrow {
    display: none;
  }

  /* 次级视图手机端适配 */
  .secondary-panel {
    min-height: 340px;
    padding: 32px 22px;
    border-radius: 22px;
  }

  .secondary-panel.is-waterfall {
    height: calc(100dvh - 118px);
    max-height: calc(100dvh - 118px);
    padding: 14px 12px 18px;
    border-radius: 20px;
  }

  .waterfall-grid {
    gap: 10px;
  }

  .waterfall-col {
    gap: 10px;
  }

  .waterfall-card {
    border-radius: 14px;
  }

  .waterfall-card-body {
    padding: 10px 11px 11px;
  }

  .waterfall-card-name {
    font-size: 13px;
  }

  /* 错题本手机端双列网格适配 */
  .secondary-panel.is-error-book {
    padding: 18px 14px 20px;
    border-radius: 20px;
    min-height: calc(100dvh - 130px);
  }

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

  .eb-book-card {
    height: 100px;
    padding: 15px 15px;
    border-radius: 15px;
  }

  .eb-card-title {
    font-size: 16px;
  }

  .eb-card-meta {
    margin-top: 5px;
    font-size: 12.5px;
  }

  .eb-card-illust {
    width: 54px;
    height: 54px;
    right: 10px;
    bottom: 5px;
  }

  .eb-dock-btn {
    padding: 0 20px;
    font-size: 13.5px;
  }

  /* 底部 AI 声明：隐藏两侧横线，适配手机底部安全区 */
  .stage-footer {
    height: auto;
    padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .footer-line {
    display: none;
  }

  .footer-text {
    font-size: 12px;
    color: #b8bfc9;
  }

  /* 样题弹窗手机端边距优化 */
  .modal-backdrop {
    padding: 16px;
  }

  .sample-modal-card {
    padding: 20px 18px;
    border-radius: 20px;
  }
}

/* 超小屏手机（≤ 360px）防折行微调 */
@media (max-width: 360px) {
  .hero-banner {
    grid-template-columns: 116px minmax(0, 1fr);
    min-height: 148px;
  }

  .hero-portrait-slot {
    height: 148px;
  }

  .hero-portrait-slot img {
    width: 120px;
    height: 148px;
  }

  .hero-title {
    font-size: 17px;
  }

  .feature-card {
    height: 74px;
    padding: 0 10px;
  }

  .feature-card-title {
    font-size: 15px;
  }
}

/* ==================== 错题本异步 AI 解析状态徽标与详情三卡片（答案 / 解题思路 / 知识点） ==================== */
@keyframes ebSyncSpin {
  to {
    transform: rotate(360deg);
  }
}

.eb-sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.eb-sync-pill.is-syncing {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.eb-sync-pill.is-done {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.eb-sync-pill.is-failed {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.eb-sync-spinner {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  display: inline-block;
  animation: ebSyncSpin 0.8s linear infinite;
  flex-shrink: 0;
}

.waterfall-card-submeta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* 错题详情弹窗 */
.eb-detail-modal {
  max-width: 680px !important;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px !important;
}

.eb-detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.eb-detail-submeta {
  font-size: 12.5px;
  color: #64748b;
}

.eb-detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 2px;
}

.eb-detail-img-wrap {
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

.eb-detail-img-wrap img {
  max-width: 100%;
  max-height: 280px;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.eb-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}

.eb-sync-banner.is-syncing {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.eb-sync-banner.is-failed {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.eb-sync-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.eb-resync-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #185eff;
  background: #ffffff;
  color: #185eff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.eb-resync-btn:hover:not(:disabled) {
  background: #185eff;
  color: #ffffff;
}

.eb-resync-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 三段白卡容器（1:1 对齐参考图风格：浅灰底 + 答案/解题思路/知识点三张独立圆角白卡） */
.eb-analysis-stack {
  background: #f3f4f6;
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eb-analysis-card {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.eb-analysis-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.eb-analysis-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.eb-analysis-edit-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.eb-analysis-edit-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.eb-analysis-text {
  font-size: 15px;
  line-height: 1.75;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.eb-analysis-placeholder {
  font-size: 14px;
  color: #9ca3af;
}

.eb-kp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.eb-kp-tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  line-height: 1.35;
}

.eb-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.eb-inline-editor textarea,
.eb-inline-editor input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.6;
  color: #1f2937;
  font-family: inherit;
  outline: none;
  resize: vertical;
}

.eb-inline-editor textarea:focus,
.eb-inline-editor input:focus {
  border-color: #185eff;
  box-shadow: 0 0 0 3px rgba(24, 94, 255, 0.12);
}

.eb-inline-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.eb-inline-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.eb-inline-btn.is-cancel {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #4b5563;
}

.eb-inline-btn.is-save {
  border: none;
  background: #185eff;
  color: #ffffff;
}

/* ==================== AI 讲题多题拦截 · 单题框选与拉伸微调弹窗 ==================== */
.sq-modal-card {
  max-width: 780px !important;
  width: min(780px, 94vw) !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px !important;
}

.sq-notice-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.sq-canvas-scroll {
  flex: 1;
  min-height: 220px;
  overflow: auto;
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.sq-paper-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  user-select: none;
}

.sq-paper-img {
  display: block;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  pointer-events: none;
  -webkit-user-drag: none;
}

.sq-boxes-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sq-hit-box {
  position: absolute;
  z-index: 2;
  border-radius: 6px;
  border: 1.8px dashed rgba(100, 116, 139, 0.58);
  background: rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.sq-hit-box:hover {
  border-color: #185eff;
  background: rgba(24, 94, 255, 0.07);
}

.sq-hit-box.is-active {
  z-index: 12;
  border: 2.2px solid #185eff;
  background: rgba(24, 94, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(24, 94, 255, 0.18);
}

.sq-hit-box.is-resizing {
  z-index: 20 !important;
  transition: none !important;
}

.sq-box-badge {
  position: absolute;
  top: -11px;
  left: 6px;
  padding: 1px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.96);
  color: #475569;
  border: 1px solid rgba(148, 163, 184, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

.sq-hit-box.is-active > .sq-box-badge {
  background: #185eff;
  color: #ffffff;
  border-color: #185eff;
}

.sq-resize-handle {
  display: none;
  position: absolute;
  touch-action: none;
  z-index: 4;
}

.sq-hit-box.is-active > .sq-resize-handle {
  display: block;
}

.sq-resize-handle.dir-n {
  top: -5px;
  left: 8px;
  right: 8px;
  height: 10px;
  cursor: ns-resize;
}

.sq-resize-handle.dir-s {
  bottom: -5px;
  left: 8px;
  right: 8px;
  height: 10px;
  cursor: ns-resize;
}

.sq-resize-handle.dir-w {
  left: -5px;
  top: 8px;
  bottom: 8px;
  width: 10px;
  cursor: ew-resize;
}

.sq-resize-handle.dir-e {
  right: -5px;
  top: 8px;
  bottom: 8px;
  width: 10px;
  cursor: ew-resize;
}

.sq-resize-handle.dir-n::after,
.sq-resize-handle.dir-s::after,
.sq-resize-handle.dir-w::after,
.sq-resize-handle.dir-e::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  border: 2px solid #185eff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.sq-resize-handle.dir-n::after,
.sq-resize-handle.dir-s::after {
  width: 20px;
  height: 5px;
}

.sq-resize-handle.dir-w::after,
.sq-resize-handle.dir-e::after {
  width: 5px;
  height: 20px;
}

.sq-resize-handle.dir-nw,
.sq-resize-handle.dir-ne,
.sq-resize-handle.dir-sw,
.sq-resize-handle.dir-se {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #185eff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}

.sq-resize-handle.dir-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.sq-resize-handle.dir-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.sq-resize-handle.dir-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.sq-resize-handle.dir-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.sq-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.sq-footer-hint {
  font-size: 12.5px;
  color: #64748b;
}

/* ==================== 智能组卷 · 按学科挑选已生成知识点错题弹窗 ==================== */
.zj-picker-modal {
  max-width: 780px !important;
  width: min(780px, 94vw) !important;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px !important;
}

.zj-picker-sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.zj-picker-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.zj-picker-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.zj-picker-tab.is-active {
  background: #185eff;
  border-color: #185eff;
  color: #ffffff;
}

.zj-picker-list {
  flex: 1;
  min-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.zj-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.14s ease;
}

.zj-picker-item:hover {
  border-color: #93c5fd;
  background: #fafcff;
}

.zj-picker-item.is-checked {
  border-color: #185eff;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(24, 94, 255, 0.12);
}

.zj-picker-check {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #185eff;
  flex-shrink: 0;
  cursor: pointer;
}

.zj-picker-thumb {
  width: 86px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
}

.zj-picker-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zj-picker-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zj-picker-item-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.zj-picker-grade {
  font-size: 11.5px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 6px;
  background: #fef3c7;
  color: #b45309;
}

.zj-picker-kps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zj-picker-kp {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.zj-picker-empty {
  padding: 44px 16px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  line-height: 1.7;
}

.zj-picker-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* 弹窗底部页码分页栏（总数 > 10 时展示） */
.zj-picker-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.zj-picker-pager[hidden] {
  display: none !important;
}

.zj-page-btn {
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.zj-page-btn:hover:not(:disabled) {
  border-color: #185eff;
  color: #185eff;
  background: #f0f6ff;
}

.zj-page-btn.is-active {
  background: #185eff;
  border-color: #185eff;
  color: #ffffff;
}

.zj-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.zj-page-dots {
  font-size: 12.5px;
  color: #94a3b8;
  padding: 0 4px;
}

.zj-page-info {
  margin-left: 6px;
  font-size: 12px;
  color: #64748b;
}

.zj-picker-summary {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

/* ==================== 设置板块：3 列 Grid 圆角白卡导航（仿参考图） ==================== */
.secondary-panel.is-settings-grid {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 16px 36px;
  background: transparent;
  border: none;
  box-shadow: none;
  text-align: left;
}

.settings-grid-wrap {
  width: 100%;
}

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

.settings-nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 178px;
  padding: 28px 16px 24px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(30, 41, 59, 0.045);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.18s ease, border-color 0.16s ease;
}

.settings-nav-card:hover {
  transform: translateY(-3px);
  border-color: rgba(147, 197, 253, 0.65);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.09);
}

.settings-nav-card:active {
  transform: translateY(-1px);
}

.settings-card-icon {
  width: 58px;
  height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.settings-card-label {
  font-size: 16.5px;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
  text-align: center;
}

.settings-card-pill {
  margin-top: 10px;
  padding: 4px 14px;
  border-radius: 999px;
  background: #f1f0f9;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .settings-nav-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .settings-nav-card {
    min-height: 154px;
    padding: 22px 12px 18px;
  }
}
