:root {
  --ink: #0a0a0a;
  --muted: #5b6270;
  --line: #dbe1ec;
  --bg: #ffffff;
  --accent: #1d4ed8;
  --accent-dark: #173aa6;
  --accent-soft: #eef3ff;
  --warn: #b42318;
  --warn-soft: #fdf1ef;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-decoration: none; transition: color .18s var(--ease); }
a:hover { text-decoration: underline; }

header.top {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: flex-end;
  gap: 28px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink);
  padding-bottom: 12px;
  transition: color .18s var(--ease);
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; gap: 20px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  padding-bottom: 13px;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); border-bottom-color: var(--accent); }

.account {
  margin-left: auto;
  padding-bottom: 13px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.inline { display: inline; margin: 0; }

.guest-note {
  max-width: 760px;
  margin: 14px auto 0;
  padding: 0 24px;
  color: var(--muted);
  font-size: 13px;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 24px 72px;
  animation: pageIn .28s ease-out both;
}

h1 {
  font-size: 23px;
  font-weight: 600;
  line-height: 1.4;
  margin: 34px 0 10px;
  letter-spacing: .01em;
}
h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 40px 0 12px;
}

p { margin: 10px 0; }

.meta { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.error { color: var(--warn); font-size: 15px; }
.feedback { min-height: 26px; color: var(--accent); font-size: 14px; margin: 14px 0 0; }
.auto-note { min-height: 20px; color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.bankline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.bankline + .bankline { margin-top: 12px; }
.bankline label { font-size: 14px; color: var(--muted); }

select {
  font: inherit;
  font-size: 15px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
select:hover { border-color: #b8c2d4; }

.study { margin-top: 20px; min-height: 300px; }

.word-panel { margin-top: 26px; }
.word {
  font-family: Georgia, "Times New Roman", "Noto Serif SC", serif;
  font-size: clamp(38px, 8.5vw, 56px);
  line-height: 1.15;
  letter-spacing: .01em;
  word-break: break-word;
  min-height: 1.15em;
}
.phonetic {
  color: var(--muted);
  font-size: 15px;
  margin-top: 6px;
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
}
.trans { font-size: 19px; margin-top: 24px; max-width: 40em; }
.example {
  margin-top: 24px;
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 16px;
  max-width: 44em;
}
.example p { margin: 4px 0; }
.ex-zh { color: var(--muted); font-size: 15px; }

.marks { display: flex; gap: 10px; margin-top: 38px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .16s var(--ease), border-color .16s var(--ease),
              color .16s var(--ease), transform .1s var(--ease), opacity .16s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.key {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
  vertical-align: 1px;
  transition: color .16s var(--ease);
}
.btn:hover .key { color: #fff; }

.link {
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color .18s var(--ease);
}
.link:hover { text-decoration: underline; }

.actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 22px; }

.empty {
  margin-top: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.empty p { margin: 0 0 16px; color: var(--muted); }

.form { max-width: 380px; margin-top: 30px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
input[type="text"]:hover, input[type="password"]:hover { border-color: #b8c2d4; }
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .1);
  outline: none;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.form .btn { margin-top: 4px; }

.numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 26px;
}
.numbers > div { padding: 18px 18px 16px 0; border-right: 1px solid var(--line); }
.numbers > div + div { padding-left: 18px; }
.numbers > div:last-child { border-right: 0; }
.num {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1.25;
}
.lbl { color: var(--muted); font-size: 13px; }

.chart-wrap { margin-top: 6px; }
#chart { width: 100%; height: auto; display: block; }
.legend {
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.sw { display: inline-block; width: 10px; height: 10px; }
.sw-new { background: var(--accent); }
.sw-review { background: #b7c4dc; }

.chart-bar { animation: barGrow .5s var(--ease) both; transform-box: fill-box; transform-origin: 50% 100%; }

.bank-progress { list-style: none; padding: 0; margin: 12px 0 0; }
.bank-progress li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.bank-progress .name { width: 4em; }
.bank-progress .bar { flex: 1; height: 3px; background: #e6ebf4; align-self: center; }
.bank-progress .bar i {
  display: block;
  height: 3px;
  background: var(--accent);
  transition: width .6s var(--ease);
}
.bank-progress .fig { color: var(--muted); font-size: 14px; min-width: 9em; text-align: right; }

table.list { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.list th {
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.list tbody tr { transition: opacity .22s var(--ease); }
.list tbody tr.row-out { opacity: 0; }
.list td { padding: 11px 12px 11px 0; border-bottom: 1px solid #e9edf5; vertical-align: top; }
.list td.w { font-family: Georgia, "Times New Roman", serif; font-size: 17px; white-space: nowrap; }
.list td.meta { white-space: nowrap; }
.list td:last-child { white-space: nowrap; }

.practice { margin-top: 8px; }
#practice-status { margin-top: 18px; }

.timer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  margin-top: 24px;
}
.timerbar { height: 3px; background: #e6ebf4; margin-top: 7px; }
.timerbar i {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transition: width .12s linear, background-color .25s var(--ease);
}
.timerbar i.low { background: var(--warn); }

.score { display: flex; gap: 32px; margin-top: 18px; font-size: 15px; }
.score b {
  display: inline-block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 600;
  margin-left: 4px;
}
.score b.bump { animation: scorePop .3s var(--ease); }

.options { display: grid; gap: 10px; margin-top: 28px; }
.option {
  font: inherit;
  font-size: 16px;
  text-align: left;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .16s var(--ease), background-color .2s var(--ease), color .16s var(--ease);
}
.option:hover:not(:disabled) { border-color: var(--accent); background: #f8faff; }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--accent); background: var(--accent-soft); }
.option.wrong { border-color: var(--warn); background: var(--warn-soft); }

.result-score {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 56px;
  line-height: 1.2;
  margin-top: 28px;
}
.result-score .vs { font-size: 22px; color: var(--muted); margin: 0 14px; }
#pk-verdict { font-size: 18px; margin-top: 4px; }
.wrong-list { list-style: none; padding: 0; margin: 10px 0 0; }
.wrong-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid #e9edf5;
}
.wrong-list .w { font-family: Georgia, "Times New Roman", serif; white-space: nowrap; }
.wrong-list .t { color: var(--muted); font-size: 14px; min-width: 0; overflow-wrap: anywhere; }

.keys-hint { margin-top: 30px; }

.reveal { animation: riseIn .24s var(--ease) both; }

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes barGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes scorePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@media (max-width: 600px) {
  header.top { padding: 16px 18px 0; gap: 12px; }
  .brand { padding-bottom: 10px; }
  .nav { order: 3; width: 100%; gap: 16px; overflow-x: auto; }
  .nav a { padding-bottom: 10px; font-size: 14px; white-space: nowrap; }
  .account { padding-bottom: 10px; }
  .guest-note { padding: 0 18px; margin-top: 12px; }
  main { padding: 4px 18px 64px; }
  h1 { margin-top: 26px; }
  .study { min-height: 280px; }
  .numbers > div { padding: 14px 12px 12px 0; }
  .numbers > div + div { padding-left: 12px; }
  .num { font-size: 24px; }
  .lbl { font-size: 12px; }
  .trans { font-size: 17px; }
  .btn { padding: 10px 15px; }
  .marks { gap: 8px; }
  .marks .btn { flex: 1 1 auto; text-align: center; }
  .list th:nth-child(4), .list td:nth-child(4) { display: none; }
  .result-score { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
}
