:root {
  --background: #fafafa;
  --surface: #ffffff;
  --foreground: #1a1a1a;
  --muted: #555555;
  --light: #777777;
  --border: #e8e8e8;
  --soft: #f5f5f5;
  --danger: #c44;
  --success: #3f6f58;
  --warning: #9a6b2f;
  --info: #3f6478;
  --max-w: 48rem;
  --font-cn: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-cn);
  font-size: 16px;
  line-height: 1.75;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(232, 232, 232, 0.86);
  background: rgba(250, 250, 250, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--foreground);
  text-decoration: none;
  font-weight: 700;
}

.nav-meta {
  color: var(--muted);
  font-size: 14px;
}

.shell {
  width: min(var(--max-w), calc(100vw - 48px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero {
  padding: 8px 0 36px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--light);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 14px;
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 650;
  line-height: 1.25;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.35;
}

.lead {
  max-width: 40rem;
  margin-bottom: 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.compact {
  max-width: 440px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-head span {
  color: var(--light);
  font-size: 13px;
  white-space: nowrap;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 20px;
}

.login-panel {
  display: grid;
  place-items: start;
}

.login-body {
  display: grid;
  gap: 12px;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--foreground);
}

input {
  min-height: 44px;
  padding: 8px 12px;
}

textarea {
  min-height: 168px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

input:focus, textarea:focus {
  outline: 2px solid rgba(63, 100, 120, 0.16);
  border-color: var(--info);
}

.primary-action, .link-button, .small-button, .rating-button {
  border: 1px solid var(--foreground);
  border-radius: 999px;
  background: var(--foreground);
  color: #fff;
}

.primary-action {
  min-height: 42px;
  padding: 9px 18px;
  font-weight: 650;
}

.primary-action.wide {
  width: 100%;
  margin-top: 18px;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.56;
}

.link-button {
  background: transparent;
  color: var(--foreground);
  padding: 7px 14px;
}

.small-button {
  min-height: 30px;
  padding: 4px 12px;
  background: transparent;
  color: var(--foreground);
  font-size: 13px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.count-input-row {
  display: grid;
  grid-template-columns: minmax(0, 180px) auto;
  gap: 10px;
  align-items: center;
}

.count-input-row input {
  min-height: 56px;
  font-size: 26px;
  font-weight: 700;
}

.count-input-row span {
  color: var(--muted);
}

.practice-layout {
  display: grid;
  gap: 16px;
}

.practice-card {
  padding: 20px;
}

.progress-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.progress-track div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--foreground);
  transition: width 0.2s ease;
}

.word-block {
  padding-bottom: 10px;
}

.recall-word {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 34px 16px 24px;
  text-align: center;
}

.word-block h2 {
  margin-bottom: 8px;
  font-size: clamp(46px, 9vw, 72px);
  line-height: 1.05;
}

#phoneticText {
  margin: 0;
  color: var(--info);
}

#exampleText {
  margin: 10px 0 0;
  color: var(--muted);
}

.sound-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.recall-prompt {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.answer-box {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.meaning {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.6;
}

.pos-text {
  margin-bottom: 8px;
  color: var(--info);
  font-size: 16px;
  font-weight: 700;
}

.exam-meta {
  margin-top: 6px;
  color: var(--light);
  font-size: 13px;
}

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

.rating-button {
  min-height: 50px;
  padding: 10px 12px;
  border-color: var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--foreground);
  font-weight: 700;
}

.rating-button.good {
  border-color: var(--success);
  background: rgba(63, 111, 88, 0.1);
}

.rating-button.warn {
  border-color: var(--warning);
  background: rgba(154, 107, 47, 0.1);
}

.rating-button.bad {
  border-color: var(--danger);
  background: rgba(204, 68, 68, 0.08);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.stat {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.insight-box {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--info);
  background: rgba(63, 100, 120, 0.08);
}

.insight-box p {
  margin: 6px 0 0;
  color: var(--muted);
}

.word-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 8px 0 0;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.4;
}

.word-chip small {
  color: var(--muted);
  font-size: 12px;
}

.teacher-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
  margin: 14px 0;
}

.detail-list, .wrong-list, .week-bars {
  display: grid;
  gap: 10px;
}

.detail-row, .wrong-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child, .wrong-row:last-child {
  border-bottom: 0;
}

.detail-row span, .wrong-row span {
  color: var(--muted);
  font-size: 13px;
}

.wrong-row strong {
  display: block;
}

.week-row {
  display: grid;
  grid-template-columns: 92px 1fr 96px;
  gap: 12px;
  align-items: center;
}

.week-label {
  color: var(--muted);
  font-size: 13px;
}

.week-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.week-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--info);
}

.week-meta {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.import-body {
  display: grid;
  gap: 12px;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

@media (max-width: 820px) {
  .top-nav {
    padding: 0 24px;
  }

  .shell {
    width: min(100vw - 32px, var(--max-w));
    padding-top: 36px;
  }

  .stat-grid,
  .teacher-grid,
  .rating-actions {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .top-nav {
    min-height: 58px;
    padding: 0 18px;
  }

  .nav-meta {
    display: none;
  }

  .shell {
    width: min(100vw - 24px, var(--max-w));
  }

  .panel-head {
    padding: 16px;
  }

  .panel-body,
  .practice-card {
    padding: 16px;
  }

  .word-block h2 {
    font-size: 32px;
  }

  .week-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .week-meta {
    text-align: left;
  }
}
