/* ==========================================================================
   ILOVEVOCAB — 前端设计系统
   视觉语言照搬 proto/（Apple 风格，克制、留白、暖白背景），文案与信息架构
   按真实后端能力重新设计。全站原生 HTML/CSS/JS，不引入任何框架/外部 CDN。
   ========================================================================== */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-muted: #f2f1ed;
  --border: rgba(0, 0, 0, 0.08);
  --border-soft: rgba(0, 0, 0, 0.06);

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #98989d;

  /* 原来是 Apple 系统蓝 #0071e3（饱和度 100%），在暖白背景上太跳，先压成
     饱和度 55% 的柔和版，后来又觉得太素，色相不变、饱和度回调到 75%
     左右，比第一版鲜艳，但没有原版那么冲；试过半透明填充又觉得不如纯色
     直接，最后定成这个纯色版本 */
  --accent: #1d73c9;
  --accent-hover: #2f82d6;
  --accent-soft: rgba(29, 115, 201, 0.08);
  --accent-soft-strong: rgba(29, 115, 201, 0.14);

  --danger: #c8463c;
  --danger-soft: rgba(200, 70, 60, 0.08);

  --success: #248a4d;

  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.03), 0 12px 28px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.04), 0 24px 48px rgba(0, 0, 0, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", "Apple SD Gothic Neo", "Malgun Gothic",
    Inter, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --container: 1160px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

/* scrollbar-gutter 常驻预留滚动条宽度——不然切换视图时，内容高度一旦
   跨过"要不要出滚动条"的临界点，居中的 .container 就会跟着滚动条的
   出现/消失横向跳一下（比如从矮的登录页跳到内容多的页面），看起来像
   文字自己往右挪了一截 */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
p { margin: 0; }
svg { display: block; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px 96px;
}

/* -------------------------------------------------------------------- */
/* Top navigation                                                        */
/* -------------------------------------------------------------------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 246, 243, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  flex: none;
}

/* logo.png 现在已经是紧裁过的横向字标（无多余留白/slogan），按原始宽高比
   （约 6.12:1）用固定高度、宽度 auto 显示即可，不用再裁切。 */
.brand-logo {
  height: 28px;
  width: auto;
  flex: none;
}

.auth-card .brand-logo { height: 34px; }

.nav-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.navlink {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.navlink:hover { color: var(--text); background: var(--surface-muted); }

.navlink.active {
  color: var(--text);
  font-weight: 600;
  background: var(--surface-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.lang-switch {
  appearance: none;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease);
}
.lang-switch:hover { background: var(--surface-muted); }
.lang-switch svg { color: var(--text-tertiary); }

.nav-toggle {
  display: none;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.mobile-nav.open { display: flex; }

.mobile-nav .navlink { text-align: left; width: 100%; }

/* -------------------------------------------------------------------- */
/* Hero                                                                   */
/* -------------------------------------------------------------------- */

.hero {
  padding: 56px 0 32px;
}

.hero h1 {
  margin: 0;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero p {
  margin-top: 8px;
  font-size: 19px;
  color: var(--text-secondary);
}

/* 自定义词书详情页的标题——没有单独的"改名"按钮，点标题本身就是改名 */
.editable-title {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  cursor: pointer;
  transition: opacity 0.15s var(--ease);
}
.editable-title:hover,
.editable-title:focus-visible { opacity: 0.75; }

.editable-title-icon {
  align-self: center;
  color: var(--text-tertiary);
  flex: none;
  transition: color 0.15s var(--ease);
}
.editable-title:hover .editable-title-icon { color: var(--text); }

/* 编辑中的标题——原生 contenteditable 光标即所见即所得，这里只加一条
   下划线标出"现在在改名"，不用默认那圈丑的浏览器 focus 轮廓 */
#list-title-text[contenteditable="true"] {
  outline: none;
  border-bottom: 2px solid var(--accent);
}

/* -------------------------------------------------------------------- */
/* Continue Learning / Today's review card                               */
/* -------------------------------------------------------------------- */

.continue-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 44px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.continue-left { flex: 1 1 auto; min-width: 0; }

.continue-book {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.continue-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.progress-track {
  margin-top: 14px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.5s var(--ease);
}

.continue-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border-soft);
  flex: none;
}

.continue-right {
  flex: none;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* 首页"学习"/"复习"拆成两张并排的卡，各自独立显示待学/待复习数量——
   不再共用一个位置轮着显示，两件事互不遮挡 */
.continue-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.continue-card-compact {
  display: flex;
  flex-direction: column;
  /* stretch（默认值）：子元素撑满容器宽度，不是收缩到内容宽度——之前
   写成 flex-start 的话，进度条这种自身没有内容撑开宽度的空 div 会直接
   缩成 0 宽，整条看不见（教训） */
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}
.continue-card-compact .continue-book { margin-top: 10px; }
.continue-card-compact .btn { margin-top: 18px; width: 100%; }

.next-word {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 8px;
}

.next-phonetic {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--surface-muted);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border-soft); }

/* 危险操作（删除词书等）跟旁边的正常操作按钮配对时用——保留按钮的
   形状/尺寸让两个按钮看起来协调，但默认颜色跟正文一样低调，不常驻红色，
   悬停才亮出红色，是 .word-row-remove 那套"平时收着"处理方式的按钮版 */
.btn-secondary.danger { color: var(--text-tertiary); }
.btn-secondary.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* 词书详情页头部"+ 导入单词"/"删除词书"这一对按钮，文字长短不一样，
   不给统一宽度的话两个按钮会一大一小，配不成一对 */
.list-header-btn { min-width: 112px; text-align: center; }

.btn-block { width: 100%; text-align: center; }

/* 比标准 .btn 小一圈，给 section-head 里跟标题并排的按钮用（比如"新建
   词书"）——标准尺寸在窄屏上跟标题挤在一起视觉上偏重，缩小一圈更协调 */
.btn-compact { padding: 8px 16px; font-size: 13px; }

.link-cta {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  padding: 0;
  transition: opacity 0.2s var(--ease);
}
.link-cta:hover { opacity: 0.7; }

/* -------------------------------------------------------------------- */
/* Two-panel grid                                                        */
/* -------------------------------------------------------------------- */

.grid-2 {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 30px 32px;
}

.panel-title {
  font-size: 17px;
  font-weight: 600;
}

.panel-stat {
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-secondary);
}

.panel-foot {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-row {
  display: flex;
  gap: 36px;
  margin-top: 14px;
}

.stat-item .stat-number {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-item .stat-label {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------------- */
/* Section headers                                                       */
/* -------------------------------------------------------------------- */

.section {
  margin-top: 48px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* -------------------------------------------------------------------- */
/* Word rows (recently added / library list)                             */
/* -------------------------------------------------------------------- */

.word-list {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.word-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s var(--ease);
}

.word-row:last-child { border-bottom: none; }
.word-row:hover { background: var(--surface-muted); }
.word-row:hover .word-row-remove { opacity: 1; }

.word-row-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.word-row-word {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.word-row-phonetic {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  color: var(--text-secondary);
  flex: none;
}

.word-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.word-row-remove {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.word-row-remove:hover { background: var(--danger-soft); color: var(--danger); }
@media (hover: none) {
  .word-row-remove { opacity: 1; }
}

.chevron { color: var(--text-tertiary); flex: none; }

.empty-state {
  padding: 48px 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* .empty-state 平时是放在 .word-list 那种自带卡片外观的容器里，边框/背景
   靠外层给；但 .card-grid（预设词书/自定义词书那两片网格）本身只是布局用
   的 grid，没有任何视觉外观，空的时候如果只塞一个 .empty-state 进去，
   文字就会直接裸露在空白页面上，跟其它区域的卡片感脱节——这里单独给
   .card-grid 里的 .empty-state 补上卡片外观，并且横跨整行，不被 grid 的
   列宽挤成一小块。 */
.card-grid .empty-state {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* -------------------------------------------------------------------- */
/* Library view — filter/pagination                                      */
/* -------------------------------------------------------------------- */

.list-note {
  margin: 18px 0 14px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.library-section + .library-section { margin-top: 28px; }

.library-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.library-section-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.library-section-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
}

/* -------------------------------------------------------------------- */
/* Card grid（预设词书 / 自定义词书）                                       */
/* -------------------------------------------------------------------- */

/* 预设词书/自定义词书区域：响应式多列（电脑上最多 4 列，卡片够宽的时候
   自动减列，手机上退到 1 列），卡片多了不会无限撑高整个页面，超过一定
   高度就在区域内部自己滚动。容器四周留够 padding，不然选中卡片的外发光
   （box-shadow）会被 overflow 裁掉一截，看起来像高光被滚动条边缘"削平"。 */
.card-grid {
  display: grid;
  /* minmax(240px, 1fr) + 页面容器宽度封顶在 1160px，算下来正好最多能塞
     进 4 列（4×240+3×16=1008px，能放；5 列要 1264px，放不下），列数会
     随视口变窄自动减少，手机上窄到只够 1 列——不用另外写断点。
     用 auto-fit 不用 auto-fill：卡片数量比理论列数少时（比如宽度够放
     4 列但只有 3 张卡），auto-fill 会保留那根空轨道占位置，1fr 把它也
     算进空间分配，实际卡片被挤得比容器窄，右边留白，跟旁边"+新建词书"
     按钮（对齐容器真实右边界）对不齐；auto-fit 会把空轨道折叠掉，把
     宽度让给真正存在的卡片，卡片撑满整行，右边界自然对齐——代价是
     卡片数量少的时候卡片本身会被拉宽，这是特意接受的取舍，不是意外。 */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-height: 560px;
  overflow-y: auto;
  padding: 6px;
  /* 只抵消左右，不抵消上下——上下的 padding 是留给"选中卡片外发光"用的
     真实间距，抵消掉会让这个区域跟上面的小标题、下面的下一个区块顶到
     一起，间距小得离谱（改之前的教训） */
  margin: 0 -6px;
}

.entity-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

/* 卡片默认白底，不额外刷色——点卡片主体是"选择"（会弹确认），右上角
   这个小按钮才是"查看详情"（跳转），两个动作在同一张卡上用不同的点击
   目标区分，不需要整卡换底色或者切全局模式。按钮做得不突兀：平时只是
   个淡淡的图标，hover 才明显一点。 */
.card-detail-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.card-detail-btn:hover { background: var(--surface-muted); color: var(--text); }

/* 预设词书被"选择"之后的高亮——纯视觉状态，不代表已经导入学习记录 */
.entity-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

/* 整卡可点是这两种卡片共享的交互原则——预设和自定义词书点主体都是"选择"
   （会弹确认），角标按钮才是"查看详情"，两者共用同一份 hover 反馈和光标样式 */
.entity-card[role="button"] { cursor: pointer; }
/* :not(.selected)：hover 和 selected 的边框色特异性一样，谁写在后面谁赢——
   不排除的话，鼠标一停在已选中的卡片上，强调色边框会被 hover 的灰边盖掉 */
.entity-card:hover:not(.selected) { border-color: var(--border); }

.preset-tag {
  align-self: flex-start;
  color: var(--accent);
  background: var(--accent-soft);
}

.entity-card-title {
  font-size: 16px;
  font-weight: 600;
  /* 给右上角常驻的"查看详情"按钮留出空间，标题长到要换行时不会有一行
     文字正好钻到按钮底下 */
  padding-right: 22px;
}

.entity-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.entity-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1 1 auto;
}

.entity-card-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.entity-card-actions .btn {
  flex: 1;
  padding: 9px 14px;
  font-size: 13px;
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

/* -------------------------------------------------------------------- */
/* Settings view                                                         */
/* -------------------------------------------------------------------- */

.settings-block {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 30px 32px;
  margin-bottom: 20px;
}

.settings-block h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.settings-block .settings-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--border-soft);
  margin-top: 6px;
  padding-top: 16px;
}

.settings-row-label { font-size: 14px; color: var(--text-secondary); }
.settings-row-value { font-size: 14px; font-weight: 600; }

/* -------------------------------------------------------------------- */
/* Forms (auth / settings)                                               */
/* -------------------------------------------------------------------- */

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-muted);
  outline: none;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.field input:focus,
.field select:focus { border-color: var(--accent); background: var(--surface); }

/* select 原生控件带一整套跟页面视觉完全对不上的系统外观（下拉箭头尤其
   突兀）——去掉原生外观，自己画一个跟别处 SVG 图标同款（细线 chevron，
   用 --text-tertiary 描边）的箭头当背景图 */
.field select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 40px;
  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='%2398989d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.form-msg {
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}
.form-msg.error { color: var(--danger); }
.form-msg.success { color: var(--accent); }

/* 默写答错时的分色反馈：正确的部分需要跟"正确拼写"那一行共用同一个
   分歧点，所以两行的颜色语义不一样——打出来那行，答对的前缀是绿色（这
   段确实没打错），答错的部分是红色；正确拼写那行反过来，共同前缀是
   灰色（已经在上面用绿色确认过了，这里不用再强调），只有从分歧点开始
   真正该打的字母用绿色+下划线标出来，一眼能看出自己哪里开始错的 */
/* 第二轮没有词标题（不能提前泄题），头部只剩发音按钮，靠右对齐；去掉
   标题之后原本靠标题撑开的高度没了，补一条 margin-bottom 别让释义贴上来 */
.daily-round2-head { justify-content: flex-end; margin-bottom: 20px; }

/* 默写提示：一行中文释义，不带词性标签也不能展开收起——参考图里就是
   一行带过（"合计；聚合体；总计的"），跟卡片里正式的释义列表（带词性、
   可展开）是两回事 */
.daily-round2-meaning {
  margin: 20px 0 24px;
  font-size: 19px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

/* 输入框改成参考图那种大字下划线风格，不再是别处表单那套小字描边框；
   居中对齐，跟参考图一致 */
#daily-round2-input {
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: 8px 2px;
  font-size: 30px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--text-secondary);
}
#daily-round2-input:focus {
  border-bottom-color: var(--accent);
  background: transparent;
}
/* 拼对了：不用另外在下面重复显示一遍，直接把输入框自己的文字变绿 */
#daily-round2-input.correct {
  color: var(--success);
  border-bottom-color: var(--success);
}

/* 拼错了：<input> 没法给文字分段上色（对的部分绿、错的部分红），只能
   拿一个长得一模一样的 div 换掉原来那个 input，尺寸/位置严格对齐，看
   起来就像"输入框里的字自己变了色"，不是另起一行重复显示 */
#daily-round2-typed {
  border-bottom: 2px solid var(--danger);
  border-radius: 0;
  padding: 8px 2px;
  font-size: 30px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  text-align: center;
  word-break: break-all;
}
#daily-round2-typed .diff-match { color: var(--success); }
#daily-round2-typed .diff-wrong { color: var(--danger); }

.spell-feedback { margin: 4px 0 10px; text-align: center; }

.spell-feedback-correct-label {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
/* 纯文本，不上色——对错已经在上面输入框位置标出来了，这里只是再给一遍
   完整正确拼写方便确认 */
.spell-feedback-correct {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  word-break: break-all;
}

/* -------------------------------------------------------------------- */
/* Auth view                                                             */
/* -------------------------------------------------------------------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.auth-card .brand {
  justify-content: center;
  font-size: 20px;
  margin-bottom: 6px;
}

.auth-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 18px 0 4px;
}

.auth-card .auth-sub {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 26px;
}

/* -------------------------------------------------------------------- */
/* View switching                                                        */
/* -------------------------------------------------------------------- */

.view { display: none; }
.view.active { display: block; animation: fadein 0.35s var(--ease); }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------------- */
/* Modal / sheet                                                         */
/* -------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(29, 29, 31, 0.32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.overlay.open { opacity: 1; pointer-events: auto; }

.sheet {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 32px;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.3s var(--ease);
}

.overlay.open .sheet { transform: translateY(0) scale(1); }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.icon-btn-round {
  appearance: none;
  border: none;
  background: var(--surface-muted);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease);
}
.icon-btn-round:hover { background: var(--border-soft); }

.sheet p.sheet-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Radio-style option list (language switch) */

.option-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.option-list-item:hover { background: var(--surface-muted); }

.option-list-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option-name { font-size: 15px; font-weight: 600; }
.option-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex: none;
  position: relative;
}

.option-list-item.selected .radio-dot { border-color: var(--accent); }
.option-list-item.selected .radio-dot::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}

/* Import sheet */

.import-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
}

.import-tab {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 4px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-right: 14px;
}

.import-tab.active { color: var(--text); border-color: var(--accent); }
.import-tab:disabled { cursor: not-allowed; opacity: 0.5; }

.import-textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-muted);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.import-textarea:focus { border-color: var(--accent); background: var(--surface); }

/* "上传 TXT" 模式下换成这个区域，跟粘贴用的 textarea 二选一显示，选中的
   文件最终还是塞进同一个 textarea 走原来那套解析/计数逻辑，不用另开一条
   处理路径 */
.import-file-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 140px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface-muted);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.import-file-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.import-file-name {
  font-size: 13px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* 复制 AI 提示词——放在导入说明正下方，字号比正文小一号，弱化成辅助
   操作，不跟"导入 →"这个主按钮抢视觉重量 */
.import-ai-helper {
  display: block;
  margin: 6px 0 18px;
  font-size: 13px;
}

.import-toast {
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.import-toast.show { opacity: 1; }

/* 导入前的确认清单——每个词一行，点"下一步"从粘贴/上传解析出来之后先
   摆在这里让用户删掉不想要的，再点"导入"才真的发请求。跟 .word-list
   复用同一套行样式（.word-row 等），只是外层容器限高、能滚动，不然贴
   几百个词整个弹层会被撑爆 */
.import-review-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.import-review-row { cursor: default; padding: 12px 16px; }
.import-review-row:hover { background: none; }

.import-review-status {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}
.import-review-status.ok { color: var(--accent); background: var(--accent-soft); }
/* 释义来自 LLM 兜底、没有词典背书——要求是明确的黄色，不能跟其他状态
   混淆或者太暗看着像棕色 */
.import-review-status.uncertain { color: #8a6d00; background: rgba(255, 196, 0, 0.16); }
.import-review-status.failed { color: var(--danger); background: var(--danger-soft); }

.sheet-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

/* margin-right: auto 把"返回编辑"顶到最左边，主按钮（下一步/导入/完成）
   照旧贴右——它 display:none 时不占位，第一步只有主按钮照样正常靠右 */
#import-back-btn { margin-right: auto; }

/* Confirm sheet (remove word) */

.confirm-body {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #ac3b32; }

/* -------------------------------------------------------------------- */
/* Global toast (import result / errors, outside sheets)                 */
/* -------------------------------------------------------------------- */

.global-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 200;
  max-width: calc(100% - 48px);
  text-align: center;
}
.global-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------------------------------------------------------------------- */
/* Word study / review page (word.html)                                  */
/* -------------------------------------------------------------------- */

.learn-body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 20px 64px;
}

.learn-container {
  width: 100%;
  max-width: 528px;
}

.learn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 34px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.deck-counter {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
}

.word-index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.word-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 44px 44px;
  /* 复习模式一张一张翻词，词与词之间释义/例句多少差很多——不固定高度的话
     卡片下面的操作按钮会跟着每张卡片忽上忽下地跳。固定高度+内部滚动，
     内容少就留白，内容多（展开了"更多释义/例句"）就卡片内部自己滚，
     卡片本身、还有它下面的按钮，位置永远不变。 */
  height: 480px;
  overflow-y: auto;
}

/* 每日新词两轮共用的翻转卡片机制。flip-stage 本身没有 round1-flip/
   round2-flip 类时是个无副作用的包裹层，不带任何 3D/绝对定位样式——
   #word-card 平时（复习/查看模式）该怎么展示还怎么展示。
   - round1-flip：正面 #flip-face-front（只有单词）↔ 背面 #word-card
     （完整内容），点"很陌生/有点印象"触发翻转
   - round2-flip：正面 #daily-round2-card（默写输入框）↔ 背面同一个
     #word-card，答错触发翻转，答对不翻直接下一个
   两种模式共用同一张 #word-card 当背面，不用为每轮各建一份完整内容。
   flipped 类沿垂直中轴转 180°，backface-visibility 让转到背面的那一面
   自然显现，不用额外 JS 切换 hidden 类。 */
.flip-stage.round1-flip,
.flip-stage.round2-flip {
  perspective: 1600px;
}
.flip-stage.round1-flip .flip-stage-inner,
.flip-stage.round2-flip .flip-stage-inner {
  position: relative;
  height: 480px;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease);
}
.flip-stage.flipped .flip-stage-inner {
  transform: rotateY(180deg);
}
.flip-stage.round1-flip .flip-face-front,
.flip-stage.round2-flip #daily-round2-card,
.flip-stage.round1-flip .word-card.flip-face-back,
.flip-stage.round2-flip .word-card.flip-face-back {
  position: absolute;
  inset: 0;
  margin: 0;
  backface-visibility: hidden;
}
.flip-stage.round1-flip .word-card.flip-face-back,
.flip-stage.round2-flip .word-card.flip-face-back {
  transform: rotateY(180deg);
}

.flip-face-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.flip-front-word {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
  padding: 0 32px;
}

.word-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.word-title {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.speaker-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}
.speaker-btn:hover { background: var(--accent-soft-strong); }
.speaker-btn:active { transform: scale(0.94); }
.speaker-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.word-meta {
  margin-top: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  color: var(--text-secondary);
}

.word-meta .phonetic { font-family: var(--font-mono); }
.word-meta .romanization { font-family: var(--font-mono); color: var(--text-tertiary); }
.word-meta .dot { color: var(--text-tertiary); }
.word-meta .source-tag { font-family: var(--font-mono); }

.word-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 26px 0 24px;
}

.word-section + .word-section { margin-top: 22px; }

.definition-item + .definition-item { margin-top: 10px; }

.definition-pos {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-right: 8px;
}

.definition-text {
  font-size: 19px;
  line-height: 1.5;
  color: var(--text);
}

.example-item + .example-item { margin-top: 14px; }

.example {
  margin: 8px 0 0;
  padding-left: 16px;
  border-left: 2px solid var(--accent-soft-strong);
  font-size: 16px;
  color: var(--text);
}

.example-translation {
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

.collapse-toggle-row {
  margin-top: 14px;
}

.collapse-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}

.collapse-toggle-btn:hover {
  text-decoration: underline;
}

.learn-progress-row {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.learn-progress-track {
  margin-top: 8px;
  margin-bottom: 28px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-muted);
  overflow: hidden;
}

.learn-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--ease);
}

.learn-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quality-btn {
  flex: 1;
  height: 52px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s var(--ease);
}
.quality-btn:hover { background: var(--surface-muted); }
.quality-btn:active { transform: scale(0.98); }
.quality-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.quality-btn.remembered { background: var(--accent); color: #fff; border-color: transparent; }
.quality-btn.remembered:hover { background: var(--accent-hover); }

.view-actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
}

.done-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 64px 44px;
  text-align: center;
}

.done-card h2 { margin: 18px 0 8px; font-size: 26px; }
.done-card p { color: var(--text-secondary); font-size: 15px; margin-bottom: 26px; }

.done-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.state-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 56px 40px;
  text-align: center;
  color: var(--text-secondary);
}

/* -------------------------------------------------------------------- */
/* Admin page (admin.html)                                               */
/* -------------------------------------------------------------------- */

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.admin-card .field { margin-bottom: 16px; }
.admin-card .field:last-of-type { margin-bottom: 20px; }
.admin-status-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.admin-status-row .status-ok { color: #2f9e5b; }
.admin-status-row .status-off { color: var(--text-secondary); }

.admin-events-wrap { padding: 0; overflow-x: auto; }
.admin-events-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-events-table th,
.admin-events-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.admin-events-table td:last-child { white-space: normal; }
.admin-events-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
}
.admin-events-table tbody tr:last-child td { border-bottom: none; }

/* -------------------------------------------------------------------- */
/* Utility                                                                */
/* -------------------------------------------------------------------- */

.hidden { display: none !important; }
.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------------- */
/* Responsive                                                            */
/* -------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .container { padding: 0 24px 80px; }
  .nav-inner { padding: 16px 24px; }
  .continue-card { padding: 36px; gap: 32px; }
  .grid-2 { gap: 16px; }
}

@media (max-width: 860px) {
  .continue-card { flex-direction: column; align-items: stretch; }
  .continue-divider { display: none; }
  .continue-right { align-items: flex-start; text-align: left; width: 100%; }
  .continue-right .btn { width: 100%; }
  .continue-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .progress-stats { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav-center { display: none; }
  .nav-toggle { display: flex; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
  .hero { padding: 32px 0 24px; }
  .continue-card { padding: 28px 24px; border-radius: var(--radius-md); }
  .next-word { font-size: 28px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .word-row { padding: 16px 20px; }
  .word-card { padding: 30px 24px 32px; }
  .word-title { font-size: 30px; }
  .flip-front-word { font-size: 32px; }
  #daily-round2-input, #daily-round2-typed { font-size: 24px; }
  .definition-text { font-size: 17px; }
  .sheet { padding: 24px; }
  .nav-right .lang-switch span.lang-switch-label { display: none; }
  .brand-logo { height: 24px; }
}
