:root {
  --bg: #ebebf2;
  --bg-deep: #e3e4ec;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #8e8e93;
  --line: rgba(60, 60, 67, 0.12);
  --line-strong: rgba(60, 60, 67, 0.2);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-press: #0058b0;
  --danger: #d4183d;
  --danger-soft: rgba(212, 24, 61, 0.08);
  --warn: #c27c00;
  --warn-soft: rgba(194, 124, 0, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background: linear-gradient(165deg, var(--bg) 0%, var(--bg-deep) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

.shell {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top)) 18px calc(104px + env(safe-area-inset-bottom));
  gap: 12px;
}

/* —— 顶栏 —— */
.app-header {
  padding: 4px 2px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #f2f2f7 100%);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.brand-text {
  flex: 1;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}

.brand-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-tertiary);
  letter-spacing: -0.01em;
}

/* —— 主舞台 —— */
.main-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.stage-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 620px);
  animation: fadeIn 0.28s ease;
}

.stage-panel[hidden] {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.card-elevated {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 22px 20px 28px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.card-elevated--list {
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* —— 学习页内组件 —— */
.study-guide {
  margin-bottom: 8px;
}

.study-phase {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.study-tip {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.02em;
  color: var(--text-secondary);
}

.word-ordinal {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
}

.word {
  margin: 20px 0 12px;
  font-size: clamp(2.5rem, 11vw, 3.25rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
}

.hint-footer {
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-tertiary);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.actions-wordthree {
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 380px) {
  .actions-wordthree {
    grid-template-columns: repeat(3, 1fr);
  }
}

.primary-btn,
.option-btn,
.ghost-btn {
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.option-btn {
  padding: 14px 12px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  text-align: center;
  line-height: 1.35;
  box-shadow: var(--shadow-sm);
}

.option-btn:hover {
  background: #fafafa;
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.know {
  border-color: rgba(0, 113, 227, 0.35);
  background: var(--accent-soft);
  color: var(--accent);
}

.option-btn.dont-know {
  border-color: rgba(212, 24, 61, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  background: var(--accent);
  border: none;
  box-shadow: 0 2px 12px rgba(0, 113, 227, 0.35);
  border-radius: var(--radius-md);
}

.primary-btn:hover {
  background: var(--accent-press);
}

.primary-btn:active {
  transform: scale(0.99);
}

.answer-card {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: #f5f5f7;
  border: 1px solid var(--line);
}

.answer-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.answer-main {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.study-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: #f5f5f7;
  border: 1px solid var(--line);
  text-align: left;
}

.study-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.study-card-list {
  margin: 10px 0 0;
  padding-left: 1.15em;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.study-card-list li {
  margin-bottom: 8px;
}

.empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px 16px;
  min-height: 220px;
}

.empty h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.empty p {
  margin: 0;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.done-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* —— 底部导航 —— */
.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(404px, calc(100vw - 24px));
  z-index: 50;
  display: flex;
  gap: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.tab-bar__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-bar__btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-bar__badge {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  background: var(--accent);
  color: #fff;
}

.tab-bar__btn:not(.is-active) .tab-bar__badge {
  background: var(--text-tertiary);
}

/* —— 工具条 —— */
.tools-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  padding: 4px 0 64px;
}

.link-ghost {
  padding: 8px 10px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text-tertiary);
  letter-spacing: -0.01em;
  border-radius: 8px;
}

.link-ghost:hover:not(:disabled) {
  color: var(--accent);
  background: rgba(0, 113, 227, 0.06);
}

.link-ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.tools-sep {
  width: 1px;
  height: 12px;
  background: var(--line);
}

/* —— 生词本列表 —— */
.wb-inner {
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.wb-head {
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.wb-head-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.wb-head-desc {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.wb-head-lead {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.wb-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.wb-filter-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  border-radius: 12px;
  background: #f5f5f7;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wb-filter-btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.wb-coach {
  margin: 0 12px 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 113, 227, 0.06);
  border: 1px solid rgba(0, 113, 227, 0.12);
}

.wb-coach-line {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.wb-coach-line:last-child {
  margin-bottom: 0;
}

.wb-coach-tag {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  background: var(--warn-soft);
  color: var(--warn);
}

.wb-coach-tag--hard {
  background: var(--danger-soft);
  color: var(--danger);
}

.wb-group {
  margin-bottom: 4px;
}

.wb-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 16px 6px;
}

.wb-group-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wb-group-sub {
  flex: 1 1 140px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.wb-group-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
}

.wb-day-block {
  margin-bottom: 6px;
}

.wb-day-head {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 14px 16px 8px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.wb-day-block:first-of-type .wb-day-head {
  border-top: none;
  padding-top: 8px;
}

.wb-day-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wb-day-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wb-day-title {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.wb-day-count {
  flex-shrink: 0;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: #f5f5f7;
  color: var(--text-secondary);
}

.wb-day-arrow {
  font-size: 12px;
  color: var(--text-tertiary);
}

.wb-day-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.35;
}

.wb-day-body.is-collapsed {
  display: none;
}

.wb-empty-tip {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.wb-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px 16px;
}

.wb-list--flat {
  padding-top: 2px;
}

.wb-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 14px 13px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.15s ease;
}

.wb-item--soft {
  border-left: 3px solid #c9a227;
}

.wb-item--hard {
  border-left: 3px solid #d4183d;
}

.wb-item:hover {
  box-shadow: var(--shadow-md);
}

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

.wb-item-core {
  flex: 1;
  min-width: 0;
}

.wb-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.wb-item-en {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.wb-item-rank {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.wb-item-mean {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wb-item-mean--pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fafafa 0%, #f2f2f7 100%);
  border: 1px dashed rgba(60, 60, 67, 0.22);
  -webkit-line-clamp: unset;
  overflow: visible;
}

.wb-mean-dots {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.35em;
  color: var(--text-tertiary);
  opacity: 0.65;
}

.wb-item-foot {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.wb-pill {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wb-item-actions {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.wb-pill--soft {
  background: var(--warn-soft);
  color: var(--warn);
}

.wb-pill--hard {
  background: var(--danger-soft);
  color: var(--danger);
}

.wb-remove-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wb-remove-btn:hover {
  color: var(--danger);
}

.wb-empty {
  padding: 48px 24px;
  text-align: center;
}

.wb-empty-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 12px;
  opacity: 0.35;
}

.wb-empty h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.wb-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 生词本内复习 */
.wb-review {
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.wb-review-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.wb-back {
  border: none;
  background: #f5f5f7;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
}

.wb-review .word {
  margin-top: 8px;
}

.wb-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn-secondary {
  flex: 1;
  min-width: 120px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.btn-secondary:hover {
  background: #fafafa;
}

.btn-ghost-danger {
  border-color: rgba(212, 24, 61, 0.35);
  color: var(--danger);
  background: var(--danger-soft);
}
