/* 每日英语练习 — 响应式中文 UI */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1c2333;
  --muted: #6b7280;
  --accent: #2f6fed;
  --accent-2: #5b8def;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(28, 35, 51, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
#app { max-width: 720px; margin: 0 auto; padding: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; margin-top: 8px; }
.error { color: var(--danger); min-height: 1.2em; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 1rem; cursor: pointer; background: #e5e9f2; color: var(--ink);
  transition: transform .1s, opacity .15s;
  min-height: 44px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent-2); }
.btn.sm { padding: 8px 12px; font-size: 0.88rem; min-height: 36px; }
.btn.block { width: 100%; margin-top: 12px; }

/* password */
.pwd-box {
  background: var(--card); border-radius: var(--radius); padding: 32px 24px;
  margin: 12vh auto 0; max-width: 360px; box-shadow: var(--shadow); text-align: center;
}
.pwd-box h1 { font-size: 1.4rem; margin-bottom: 8px; }
.pwd-box input {
  width: 100%; padding: 12px; border: 1px solid #d5dbe8; border-radius: 10px;
  margin: 16px 0; font-size: 1rem;
}
.pwd-box .btn { width: 100%; }

/* hero / users */
.hero { text-align: center; padding: 28px 8px 12px; }
.hero h1 { font-size: 1.8rem; letter-spacing: 0.5px; }
.hero p { color: var(--muted); margin-top: 6px; }
.user-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
@media (max-width: 520px) {
  .user-cards { grid-template-columns: 1fr; }
}
.user-card {
  background: var(--card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); cursor: pointer; border: 2px solid transparent;
  transition: border-color .15s, transform .1s;
}
.user-card:hover { border-color: var(--accent-2); }
.user-card:active { transform: scale(0.98); }
.user-card h2 { font-size: 1.25rem; margin-bottom: 10px; }
.user-card .stat-row { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--muted); padding: 3px 0; }
.user-card .stat-row b { color: var(--ink); }

/* topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 4px; gap: 8px; flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 600; }
.badge {
  background: #e8f0fe; color: var(--accent); padding: 6px 12px;
  border-radius: 999px; font-size: 0.88rem;
}

/* tabs */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.tab {
  flex: 0 0 auto; border: none; background: #e5e9f2; color: var(--muted);
  padding: 10px 16px; border-radius: 999px; cursor: pointer; font-size: 0.95rem;
  min-height: 40px;
}
.tab.active { background: var(--accent); color: #fff; }

.content { margin-top: 12px; padding-bottom: 40px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* today */
.today-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); gap: 12px;
}
.date-label { font-size: 1.05rem; font-weight: 600; }
.topic-label { color: var(--accent); margin-top: 4px; font-size: 0.95rem; }
.progress-ring-wrap { position: relative; width: 80px; height: 80px; }
.progress-ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e5e9f2; stroke-width: 8; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 8;
  stroke-linecap: round; stroke-dasharray: 201; stroke-dashoffset: 201;
  transition: stroke-dashoffset .4s;
}
.ring-text {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: 0.95rem; font-weight: 600;
}

.task-list { list-style: none; margin-top: 14px; }
.task-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow); cursor: pointer;
}
.task-item.done { opacity: 0.65; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check {
  width: 22px; height: 22px; border: 2px solid var(--accent); border-radius: 6px;
  flex: 0 0 auto; margin-top: 2px; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 14px;
}
.task-item.done .task-check { background: var(--accent); }
.task-title { font-weight: 600; }
.task-desc { color: var(--muted); font-size: 0.88rem; margin-top: 2px; }

.sentence-box {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  margin-top: 16px; box-shadow: var(--shadow);
}
.sentence-box h3 { font-size: 1rem; margin-bottom: 10px; }
.sentence-box textarea {
  width: 100%; border: 1px solid #d5dbe8; border-radius: 10px;
  padding: 10px; font-size: 1rem; resize: vertical; font-family: inherit;
}
.sentence-box .btn { margin-top: 10px; }

/* words */
.word-stats { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 10px; }
.flashcard {
  background: var(--card); border-radius: var(--radius); min-height: 220px;
  box-shadow: var(--shadow); padding: 28px 20px; text-align: center;
  cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.word-en { font-size: 2rem; font-weight: 700; letter-spacing: 0.5px; }
.word-ipa { color: var(--muted); font-size: 1.05rem; }
.word-zh { font-size: 1.35rem; color: var(--accent); margin: 8px 0; }
.word-ex { font-style: italic; color: var(--ink); }
.word-ex-zh { color: var(--muted); font-size: 0.95rem; }
.rate-btns { display: flex; gap: 10px; margin-top: 14px; }
.rate-btns .btn { flex: 1; }
#btn-word-next { width: 100%; margin-top: 14px; }

/* practice */
.practice-pick { display: grid; gap: 10px; }
.practice-card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; border: 2px solid transparent;
}
.practice-card:hover { border-color: var(--accent-2); }
.practice-card h3 { font-size: 1.05rem; }
.practice-card p { color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.practice-meta {
  display: flex; justify-content: space-between; margin-bottom: 10px;
  color: var(--muted); font-size: 0.92rem;
}
.q-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.q-text { font-size: 1.05rem; font-weight: 600; margin-bottom: 14px; }
.q-choices { display: grid; gap: 10px; }
.choice-btn {
  text-align: left; padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid #d5dbe8; background: #fff; cursor: pointer;
  font-size: 1rem; min-height: 44px;
}
.choice-btn:hover { border-color: var(--accent-2); }
.choice-btn.selected { border-color: var(--accent); background: #e8f0fe; }
.choice-btn.correct { border-color: var(--success); background: #dcfce7; }
.choice-btn.wrong { border-color: var(--danger); background: #fee2e2; }
.q-explain {
  margin-top: 14px; padding: 12px; background: #f0f4ff;
  border-radius: 10px; font-size: 0.95rem; color: var(--ink);
}

/* mistakes */
.mistake-item {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow);
}
.mistake-item .topic-tag {
  display: inline-block; background: #fef3c7; color: var(--warn);
  padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; margin-bottom: 6px;
}
.mistake-item .q-text { font-size: 0.98rem; margin-bottom: 6px; font-weight: 500; }

/* reading */
.reading-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-weight: 600;
}
.reading-text {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); white-space: pre-wrap; line-height: 1.85;
  font-size: 1.02rem; margin-bottom: 12px;
}
.long-sentence {
  background: #fff7ed; border-left: 4px solid var(--warn);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 0.92rem;
}
.long-sentence b { color: var(--warn); }
.reading-q {
  background: var(--card); border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.reading-q .q-text { margin-bottom: 10px; }
#btn-reading-submit { width: 100%; margin-top: 8px; }

/* dashboard */
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.dash-item {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  text-align: center; box-shadow: var(--shadow);
}
.dash-item .num { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.dash-item .lbl { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.bar-chart {
  display: flex; align-items: flex-end; gap: 8px; height: 120px;
  background: var(--card); border-radius: var(--radius); padding: 14px;
  margin-bottom: 16px;
}
.bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  height: 100%; justify-content: flex-end; gap: 4px;
}
.bar-fill {
  width: 100%; background: var(--accent-2); border-radius: 6px 6px 0 0;
  min-height: 2px; transition: height .3s;
}
.bar-lbl { font-size: 0.72rem; color: var(--muted); }
.acc-row {
  display: flex; justify-content: space-between; padding: 10px 12px;
  background: var(--card); border-radius: 10px; margin-bottom: 8px;
  box-shadow: var(--shadow); font-size: 0.95rem;
}
.acc-row .rate { font-weight: 600; color: var(--accent); }
#btn-export { width: 100%; margin-top: 12px; }

@media (max-width: 420px) {
  .word-en { font-size: 1.6rem; }
  .today-header { flex-direction: column; text-align: center; }
}
