/* 学英语 v1 — 视觉样式
   配色：墨青 (ink/teal) + 暖米白 (warm cream)，学术而温和 */

:root {
  --color-cream: #f6f1e4;
  --color-cream-deep: #efe6d2;
  --color-paper: #fffdf8;
  --color-ink: #233831;
  --color-ink-soft: #4a5f57;
  --color-teal: #1f6f66;
  --color-teal-deep: #164e48;
  --color-teal-light: #e3efec;
  --color-amber: #c97b3d;
  --color-amber-light: #f6e6d4;
  --color-rose: #b85c5c;
  --color-rose-light: #f5e2e0;
  --color-border: #e2d8c3;
  --shadow-soft: 0 4px 16px rgba(35, 56, 49, 0.08);
  --shadow-lift: 0 8px 24px rgba(35, 56, 49, 0.12);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-stack: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-cream-deep);
  color: var(--color-ink);
  font-family: var(--font-stack);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

a {
  color: var(--color-teal);
  text-decoration: none;
}

button {
  font-family: inherit;
}

.app-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background: var(--color-cream);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-lift);
}

.app-header {
  padding: 24px 20px 16px;
  background: linear-gradient(135deg, var(--color-teal-deep), var(--color-teal));
  color: var(--color-paper);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.app-header__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.app-header__title-en {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.85;
  margin-left: 4px;
}

.app-header__subtitle {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

.app-view {
  flex: 1;
  padding: 16px 16px 90px;
  overflow-y: auto;
}

/* ---------- 底部导航 ---------- */

.tab-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  background: var(--color-paper);
  border-top: 1px solid var(--color-border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border-radius: var(--radius-sm);
  color: var(--color-ink-soft);
  font-size: 11px;
}

.tab-bar__icon {
  font-size: 20px;
  line-height: 1;
}

.tab-bar__item--active {
  color: var(--color-teal-deep);
  font-weight: 700;
  background: var(--color-teal-light);
}

/* ---------- 通用卡片 / 组件 ---------- */

.card {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

.card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-teal-deep);
  margin-bottom: 12px;
}

.hero-card {
  background: linear-gradient(135deg, var(--color-teal-light), var(--color-paper));
}

.hero-card__greeting {
  font-size: 19px;
  font-weight: 700;
}

.hero-card__date {
  font-size: 13px;
  color: var(--color-ink-soft);
  margin-top: 4px;
}

.hero-card__badge {
  margin-top: 12px;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-teal);
  color: var(--color-paper);
  font-size: 12px;
  font-weight: 600;
}

.hero-card__badge--muted {
  background: var(--color-amber-light);
  color: var(--color-amber);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.stat-card__value {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-teal-deep);
}

.stat-card__unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-ink-soft);
}

.stat-card__label {
  font-size: 12px;
  color: var(--color-ink-soft);
  margin-top: 4px;
}

.mini-stat-row {
  display: flex;
  justify-content: space-between;
}

.mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.mini-stat__num {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-ink);
}

.mini-stat__label {
  font-size: 12px;
  color: var(--color-ink-soft);
  margin-top: 2px;
}

.hint-text {
  font-size: 12px;
  color: var(--color-ink-soft);
  text-align: center;
  margin: 10px 4px 0;
  line-height: 1.6;
}

/* ---------- 按钮 ---------- */

.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  padding: 0 16px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

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

.btn:focus-visible {
  outline: 3px solid var(--color-amber);
  outline-offset: 2px;
}

.btn--primary {
  background: var(--color-teal);
  color: var(--color-paper);
}

.btn--large {
  min-height: 56px;
  font-size: 16px;
}

.btn--secondary {
  background: var(--color-teal-light);
  color: var(--color-teal-deep);
  text-align: center;
  line-height: 48px;
}

.btn--danger {
  background: var(--color-rose-light);
  color: var(--color-rose);
}

.btn--ghost {
  background: transparent;
  color: var(--color-teal-deep);
  border: 1px dashed var(--color-teal);
  min-height: 44px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  padding: 0 8px;
}

.icon-btn {
  background: var(--color-teal-light);
  border: none;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-amber);
}

/* ---------- 学习卡片 ---------- */

.progress-bar {
  height: 8px;
  background: var(--color-cream-deep);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--color-teal);
  transition: width 0.25s ease;
}

.progress-label {
  text-align: right;
  font-size: 12px;
  color: var(--color-ink-soft);
  margin-bottom: 14px;
}

.study-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  cursor: pointer;
}

.study-card__word {
  font-size: 32px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 10px;
  word-break: break-word;
}

.study-card__phonetic-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}

.study-card__phonetic {
  font-size: 15px;
  color: var(--color-ink-soft);
}

.study-card__pos {
  font-size: 12px;
  color: var(--color-teal-deep);
  background: var(--color-teal-light);
  padding: 2px 8px;
  border-radius: 999px;
}

.study-card__meaning {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-teal-deep);
  margin-bottom: 16px;
}

.study-card__example {
  background: var(--color-cream);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
}

.study-card__example-en {
  font-size: 14px;
  color: var(--color-ink);
  margin-bottom: 6px;
}

.study-card__example-zh {
  font-size: 13px;
  color: var(--color-ink-soft);
}

.study-card .js-reveal {
  margin: 0 auto;
  width: auto;
  padding: 0 24px;
}

.grade-buttons {
  display: flex;
  gap: 8px;
}

.btn--grade {
  flex: 1;
  min-height: 52px;
}

.btn--grade-know {
  background: var(--color-teal);
  color: var(--color-paper);
}

.btn--grade-fuzzy {
  background: var(--color-amber-light);
  color: var(--color-amber);
}

.btn--grade-unknown {
  background: var(--color-rose-light);
  color: var(--color-rose);
}

.summary-card {
  text-align: center;
}

.summary-card__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.summary-card__goal {
  margin-top: 12px;
  font-size: 13px;
  color: var(--color-ink-soft);
}

.summary-card__spelling,
.summary-card__mastered {
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-teal-deep);
}

/* ---------- 拼写检测 ---------- */

.spelling-card {
  text-align: center;
}

.spelling-card__label {
  font-size: 13px;
  color: var(--color-ink-soft);
  margin-bottom: 10px;
}

.spelling-card__meaning {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-teal-deep);
  margin-bottom: 14px;
}

.spelling-input {
  margin-top: 14px;
  text-align: center;
  font-size: 16px;
}

.spelling-feedback {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
}

.spelling-feedback--correct {
  color: var(--color-teal);
}

.spelling-feedback--wrong {
  color: var(--color-rose);
}

.spelling-card #btn-spelling-submit {
  margin-top: 14px;
}

.spelling-recap {
  text-align: center;
}

.spelling-recap__title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.spelling-recap__score {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-teal-deep);
}

.empty-state {
  text-align: center;
  padding: 36px 18px;
}

.empty-state__emoji {
  font-size: 36px;
  margin-bottom: 10px;
}

.empty-state__text {
  color: var(--color-ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 错题本 ---------- */

.text-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 14px;
  background: var(--color-cream);
  color: var(--color-ink);
}

.text-input:focus-visible {
  outline: 2px solid var(--color-teal);
}

.wrong-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wrong-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
}

.wrong-item__word {
  font-size: 16px;
  font-weight: 700;
}

.wrong-item__phonetic {
  font-size: 12px;
  color: var(--color-ink-soft);
  font-weight: 400;
}

.wrong-item__meaning {
  font-size: 13px;
  color: var(--color-ink-soft);
  margin-top: 2px;
}

.wrong-item__meta {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wrong-item__due {
  font-size: 12px;
  color: var(--color-ink-soft);
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-cream-deep);
  color: var(--color-ink-soft);
}

.tag--know {
  background: var(--color-teal-light);
  color: var(--color-teal-deep);
}

.tag--fuzzy {
  background: var(--color-amber-light);
  color: var(--color-amber);
}

.tag--unknown {
  background: var(--color-rose-light);
  color: var(--color-rose);
}

/* ---------- 打卡日历 / 热力图 ---------- */

.calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}

.calendar__weekday {
  text-align: center;
  font-size: 11px;
  color: var(--color-ink-soft);
}

.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--color-cream);
  color: var(--color-ink-soft);
  min-height: 32px;
}

.calendar__cell--empty {
  background: transparent;
}

.calendar__cell--checked {
  background: var(--color-teal);
  color: var(--color-paper);
  font-weight: 700;
}

.calendar__cell--today {
  box-shadow: inset 0 0 0 2px var(--color-amber);
}

.heatmap__grid {
  display: grid;
  gap: 3px;
}

.heatmap__cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--color-cream-deep);
  min-width: 8px;
  min-height: 8px;
}

.heatmap__cell--empty {
  background: transparent;
}

.heatmap__cell--level1 {
  background: #cfe3de;
}

.heatmap__cell--level2 {
  background: #8fbfb3;
}

.heatmap__cell--level3 {
  background: var(--color-teal);
}

/* ---------- 设置页 ---------- */

.field-label {
  display: block;
  font-size: 13px;
  color: var(--color-ink-soft);
  margin: 14px 0 6px;
}

.field-label:first-of-type {
  margin-top: 0;
}

.segmented {
  display: flex;
  background: var(--color-cream);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}

.segmented__item {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-ink-soft);
  cursor: pointer;
  min-height: 44px;
}

.segmented__item--active {
  background: var(--color-teal);
  color: var(--color-paper);
  font-weight: 700;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--color-ink);
  margin: 4px 0 2px;
  cursor: pointer;
}

.switch-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-teal);
}

.mastered-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mastered-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
}

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

.mastered-item__word {
  font-weight: 700;
  color: var(--color-ink);
}

.mastered-item__meaning {
  flex: 1;
  color: var(--color-ink-soft);
}

.about-card {
  background: var(--color-cream);
}

.about-text {
  font-size: 13px;
  color: var(--color-ink-soft);
  line-height: 1.7;
  margin: 0;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--color-ink);
  color: var(--color-paper);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}

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

/* ---------- 响应式：桌面居中显示 ---------- */

@media (min-width: 480px) {
  body {
    padding: 24px 0;
  }
  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }
}

/* 一刻：纸张与墨色的移动端细节 */
.app-header { padding: 25px 22px 20px; background: #174d48; border-radius: 0 0 26px 26px; }
.app-header__title { font-family: Georgia, "Songti SC", serif; font-size: 27px; letter-spacing: .08em; }
.app-header__title-en { font-family: Georgia, serif; font-size: 16px; font-style: italic; font-weight: 400; letter-spacing: .01em; }
.app-header__subtitle { letter-spacing: .08em; opacity: .76; }
.app-view { padding: 20px 18px 28px; min-width: 0; }
.card { border-color: #e9dfcb; box-shadow: 0 5px 18px rgba(45, 58, 48, .055); padding: 20px; }
.hero-card { background: linear-gradient(125deg, #e0ede7, #fffdf8 80%); padding: 23px 20px; }
.hero-card__greeting { font-family: Georgia, "Songti SC", serif; font-size: 22px; }
.hero-card__badge { border-radius: 12px; line-height: 1.5; }
.stat-card__value, .mini-stat__num { font-family: Georgia, serif; }
.study-card { min-height: 310px; padding: 26px 20px; }
.study-card__word { font-family: Georgia, serif; font-size: 38px; font-weight: 600; }
.study-card__example { line-height: 1.6; }
.spelling-card { padding: 28px 20px 20px; }
.spelling-card__label { letter-spacing: .08em; }
.spelling-card__meaning { margin: 20px 0; }
.spelling-feedback { line-height: 1.5; overflow-wrap: anywhere; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; }
.text-input { font-size: 16px; }
.tab-bar { z-index: 2; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
.toast { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
.wrong-item__main, .mastered-item__meaning { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 360px) { .app-view { padding-left: 12px; padding-right: 12px; } .stat-card__value { font-size: 17px; } }
