/* ===== 英语听写网站 全局样式 ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --red: #dc2626;
  --green: #16a34a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2ff; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* 顶部导航 */
.topbar {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar .brand { font-size: 18px; font-weight: 700; }
.topbar nav a { color: #e0e7ff; margin-left: 18px; font-size: 14px; }
.topbar nav a:hover { color: #fff; text-decoration: none; }

.container { max-width: 1080px; margin: 24px auto; padding: 0 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.card h2 { font-size: 20px; margin-bottom: 6px; color: #1e3a8a; }
.card h3 { font-size: 16px; margin: 16px 0 8px; }

/* 按钮 */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s;
  text-align: center;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-lg { padding: 16px 42px; font-size: 18px; border-radius: 12px; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #b91c1c; }
.btn-gray { background: #6b7280; }
.btn-gray:hover { background: #4b5563; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: #374151; font-weight: 600; white-space: nowrap; }
tbody tr:hover td { background: #f8fafc; }
.table-card { padding: 0; overflow-x: auto; }
.table-card table { border-radius: 12px; }

/* 表单 */
.form-row { margin-bottom: 14px; }
label { display: block; font-size: 14px; color: #374151; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .form-row { margin-bottom: 0; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-bad { background: #fee2e2; color: #991b1b; }
.tag-mode { background: #e0e7ff; color: #3730a3; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

/* 首页（清新活泼 · 学生向） */
.home { min-height: calc(100vh - 60px); display: flex; flex-direction: column; align-items: center; padding: 0 16px 40px; }

.hero {
  width: 100%;
  max-width: 760px;
  margin: 28px auto 0;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  border-radius: 28px;
  padding: 46px 28px 40px;
  text-align: center;
  color: #fff;
  box-shadow: 0 18px 40px rgba(99, 102, 241, .22);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 170px; height: 170px;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 70%);
  border-radius: 50%;
}
.hero-emoji { font-size: 54px; line-height: 1; margin-bottom: 10px; }
.hero-title { font-size: 30px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.hero-sub { font-size: 15px; opacity: .92; margin-top: 10px; }
.hero-date {
  display: inline-flex; align-items: baseline; gap: 12px;
  margin-top: 20px; padding: 10px 22px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
}
.hero-date-d { font-size: 20px; font-weight: 700; }
.hero-date-w { font-size: 15px; opacity: .9; }

.home-actions {
  width: 100%; max-width: 760px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  margin-top: 22px;
}
.action-card {
  display: flex; flex-direction: column; align-items: flex-start;
  background: #fff; border-radius: 20px; padding: 24px 22px;
  border: 2px solid transparent;
  box-shadow: 0 8px 22px rgba(37, 99, 235, .08);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  color: var(--text);
}
.action-card:hover { transform: translateY(-4px); text-decoration: none; box-shadow: 0 16px 34px rgba(37, 99, 235, .16); }
.action-card.action-primary { border-color: #bfdbfe; }
.action-card.action-primary:hover { border-color: #60a5fa; }
.action-card.action-soft { border-color: #ddd6fe; }
.action-card.action-soft:hover { border-color: #a78bfa; }
.action-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 14px;
}
.action-primary .action-icon { background: #eff6ff; }
.action-soft .action-icon { background: #f5f3ff; }
.action-title { font-size: 20px; font-weight: 800; color: #1e3a8a; }
.action-desc { font-size: 14px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.action-go { margin-top: 16px; font-size: 15px; font-weight: 700; color: var(--primary); }

.home-stats {
  width: 100%; max-width: 760px;
  display: flex; gap: 14px; margin-top: 18px; flex-wrap: wrap;
}
.home-stat {
  flex: 1; min-width: 140px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; text-align: center;
}
.home-stat .num { font-size: 26px; font-weight: 800; color: #1e3a8a; }
.home-stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

.home-tip {
  width: 100%; max-width: 760px;
  margin-top: 18px; padding: 16px 20px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 16px;
  color: #92400e; font-size: 14px; line-height: 1.65;
  display: flex; align-items: center; gap: 10px;
}
.home-tip .tip-ico { font-size: 20px; flex-shrink: 0; }

/* 任务选择卡片 */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.choice-card {
  display: block;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 40px 28px;
  text-align: center;
  transition: .15s;
  color: var(--text);
}
.choice-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 12px 28px rgba(37, 99, 235, .12); text-decoration: none; }
.choice-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; color: #1e3a8a; }

/* 单词表 */
.word-table .w { font-weight: 700; font-size: 16px; color: #111827; }
.word-table .ph { color: var(--primary); font-family: Georgia, "Times New Roman", serif; }
.check-cell { width: 46px; text-align: center; }

/* 听写页 */
#clock {
  position: fixed;
  left: 18px;
  bottom: 14px;
  background: rgba(17, 24, 39, .85);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: Consolas, Monaco, monospace;
  font-size: 15px;
  z-index: 50;
}
.dictation-stage { max-width: 640px; margin-left: auto; margin-right: auto; }
.progress-text { text-align: center; color: var(--muted); margin-bottom: 6px; font-size: 15px; }
.countdown { font-size: 56px; font-weight: 800; text-align: center; color: #1e3a8a; font-variant-numeric: tabular-nums; }
.countdown.soon { color: var(--red); }
.answer-input { font-size: 22px; text-align: center; letter-spacing: 1px; padding: 14px; }
.feedback { text-align: center; font-size: 19px; font-weight: 700; min-height: 34px; margin-top: 14px; }
.feedback.ok { color: var(--green); }
.feedback.bad { color: var(--red); }
.summary-score { font-size: 46px; font-weight: 800; text-align: center; color: #1e3a8a; }

/* 后台统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px; text-align: center; }
.stat-num { font-size: 30px; font-weight: 800; color: #1e3a8a; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 分页 */
.pager { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 13px; }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .dis { color: #9ca3af; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; }

/* 单词卡片（听写前清单 / 选词页） */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.word-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px 11px;
  transition: .15s;
}
.word-card:hover { border-color: #bfdbfe; box-shadow: 0 4px 14px rgba(37, 99, 235, .08); }
.word-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; min-height: 20px; }
.word-no {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: #eef2ff; color: #3730a3;
  font-size: 12px; font-weight: 700;
}
.word-card-word { font-size: 19px; font-weight: 800; color: #111827; letter-spacing: .3px; word-break: break-word; }
.word-card-ph { font-family: Georgia, "Times New Roman", serif; color: var(--primary); font-size: 13px; margin-top: 2px; word-break: break-word; }
.word-card-cn { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.word-card-tag { position: absolute; top: 8px; right: 8px; }

/* 选词页 */
.select-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 10px; padding: 0 16px 16px; }
.select-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px 0; }
.select-toolbar #btn-go { margin-left: auto; }
.toggle-inline { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.select-card { cursor: pointer; user-select: none; display: block; }
.select-card input[type=checkbox] { display: none; }
.select-card.selected { border-color: var(--primary); background: #eff6ff; box-shadow: inset 0 0 0 1px var(--primary); }

/* 记录页日期多选 */
.date-picker { margin-bottom: 4px; }
.date-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.date-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: 13px; color: var(--text);
  margin: 0; user-select: none; transition: .15s;
}
.date-chip:hover { border-color: var(--primary); }
.date-chip input[type=checkbox] { width: auto; padding: 0; margin: 0; }
.date-chip.checked { border-color: var(--primary); background: #eff6ff; color: var(--primary-dark); font-weight: 600; }

/* 易错单词朗读 stage */
.listen-word { text-align: center; padding: 30px 10px 24px; }
.listen-word-en { font-size: 36px; font-weight: 800; letter-spacing: .5px; }
.listen-word-ph { color: var(--primary); font-size: 17px; margin-top: 10px; }
.listen-word-cn { color: var(--muted); font-size: 15px; margin-top: 12px; }
/* 朗读页：进度区与单词展示区相互分离（各自独立面板） */
.listen-progress-area { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px 16px; margin-bottom: 18px; }
.listen-word-area { background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.listen-word-area .listen-word { padding: 24px 10px 20px; }

/* 通用进度条（听写 / 朗读共用） */
.pbar { height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.pbar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), #60a5fa); border-radius: 999px; transition: width .35s ease; }

/* 单词听写：圆形倒计时（不显示单词，也不写提示文案） */
.dict-clock {
  width: 132px; height: 132px; margin: 22px auto;
  border: 6px solid var(--border); border-radius: 50%; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 46px; font-weight: 800; line-height: 1;
  transition: color .2s ease, border-color .2s ease;
}
.dict-clock.is-text { font-size: 20px; font-weight: 700; color: var(--muted); }
.dict-clock.is-soon { color: var(--red); border-color: var(--red); }

/* 听写页（清新活泼 · 学生向） */
.dict-prepare-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.dict-prepare-emoji { font-size: 40px; line-height: 1; }
.dict-prepare-head h2 { margin: 0; }

.btn-gradient { background: linear-gradient(135deg, #60a5fa, #a78bfa); border: none; }
.btn-gradient:hover { background: linear-gradient(135deg, #4f9bf6, #9466f5); text-decoration: none; }

.dict-listen-card, .dict-done-card { max-width: 560px; text-align: center; }
.listen-emoji { font-size: 56px; line-height: 1; margin-bottom: 4px; animation: listenPulse 1.8s ease-in-out infinite; }
@keyframes listenPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.dict-listen-tip { text-align: center; color: var(--muted); font-size: 15px; margin-top: 14px; }

.done-emoji { font-size: 56px; line-height: 1; margin-bottom: 4px; animation: listenPulse 1.8s ease-in-out infinite; }
.done-title { text-align: center; font-size: 24px; font-weight: 800; color: #1e3a8a; }

/* 听写页圆形倒计时：渐变描边 + 柔光，更活泼 */
.dict-clock {
  width: 132px; height: 132px; margin: 18px auto;
  border: 6px solid transparent; border-radius: 50%;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, #60a5fa, #a78bfa) border-box;
  display: flex; align-items: center; justify-content: center;
  color: #4f46e5; font-size: 46px; font-weight: 800; line-height: 1;
  box-shadow: 0 10px 26px rgba(99, 102, 241, .20);
  transition: color .2s ease;
}
.dict-clock.is-text { font-size: 20px; font-weight: 700; color: var(--muted); }
.dict-clock.is-soon {
  color: #fff;
  background:
    linear-gradient(#ef4444, #dc2626) padding-box,
    linear-gradient(135deg, #f87171, #dc2626) border-box;
  box-shadow: 0 10px 26px rgba(220, 38, 38, .25);
}

@media (max-width: 640px) {
  .today-date { font-size: 28px; }
  .today-card { padding: 32px 24px; }
  .btn-lg { padding: 14px 28px; font-size: 16px; }
  .countdown { font-size: 44px; }
  .listen-word-en { font-size: 28px; }
  .listen-progress-area { padding: 12px 12px 14px; margin-bottom: 14px; }
  .dict-clock { width: 104px; height: 104px; font-size: 36px; margin: 16px auto; }
  .home-actions { grid-template-columns: 1fr; }
  .hero { padding: 38px 22px 34px; border-radius: 24px; }
  .hero-title { font-size: 24px; }
  .hero-emoji { font-size: 46px; }
}
