:root {
  color-scheme: light;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1d2540;
  background: #f3f5fa;
  font-synthesis: none;
  --ink: #1d2540;
  --muted: #57617a;
  --line: #e2e6f0;
  --purple: #553ed2;
  --panel: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, select, input[type="checkbox"] { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #6d59ee;
  outline-offset: 4px;
}
a { color: var(--purple); }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.header { background: #fff; border-bottom: 1px solid var(--line); }
.topbar, .brand, nav { display: flex; align-items: center; }
.topbar { min-height: 68px; justify-content: space-between; gap: 16px; }
.brand { gap: 11px; color: var(--ink); text-decoration: none; font-weight: 700; }
.logo { display: grid; place-items: center; color: #fff; background: #211c4b; border-radius: 9px; width: 35px; height: 35px; font: 700 17px Georgia, serif; }
nav { gap: 8px; }
nav a { text-decoration: none; color: var(--muted); font-size: .9rem; padding: 9px 14px; border-radius: 8px; white-space: nowrap; }
nav a[aria-current] { background: #ece9ff; color: #4731bc; font-weight: 700; }
main { padding-top: 36px; }
#load-message { padding: 24px; color: var(--muted); }
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: 1fr 250px; align-items: center; gap: 32px;
  min-height: 262px; padding: 36px 50px; border-radius: 24px;
  color: white; background: linear-gradient(112deg, #141b37 15%, #272958 62%, #373669 100%);
}
.hero::before {
  position: absolute; z-index: -1; content: ""; width: 498px; height: 498px; right: -54px; top: 50%;
  border: 1px solid #c9c5ff29; border-radius: 100%; transform: translateY(-50%);
  box-shadow: 0 0 0 42px #c9c5ff0c, 0 0 0 94px #c9c5ff09, 0 0 0 148px #c9c5ff06;
}
.hero-date { display: flex; align-items: center; gap: 12px; color: #d1cdf7; font-size: .875rem; font-weight: 600; }
.hero-divider { height: 12px; width: 1px; background: #9e99c6; }
.hero h1 { margin-top: 12px; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.2; letter-spacing: -.035em; font-weight: 800; }
.hero-copy > p:last-child { color: #d3d7eb; margin-top: 15px; line-height: 1.65; }
.countdown {
  position: relative; display: grid; place-items: center; width: 183px; aspect-ratio: 1; justify-self: center;
  border: 1px solid #c7c5ff56; border-radius: 50%; background: #ffffff08; box-shadow: 0 0 0 12px #bfb7ff15, inset 0 0 22px #c3baff13;
}
.countdown::after {
  position: absolute; content: ""; height: 9px; width: 9px; border-radius: 50%;
  top: 24px; right: 18px; background: #bbf5dc; box-shadow: 0 0 14px #9af0d7b0;
}
.countdown-content { display: grid; gap: 7px; justify-items: center; color: #e5e2f6; font-size: .875rem; }
.countdown-number { display: flex; align-items: baseline; gap: 6px; color: #fff; }
.countdown-number b { font-size: 3.6rem; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.065em; }
.countdown-content time { color: #c4bff2; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 22px; margin-top: 24px; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 3px 7px #25284805; }
.tasks, .progress-panel { padding: 26px; }
.panel h2 { font-size: 1.25rem; font-weight: 750; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.panel-heading p, .task-info p, .progress-caption { color: var(--muted); font-size: .875rem; line-height: 1.55; }
.panel-heading p { margin-top: 5px; }
.task-count { flex-shrink: 0; background: #eeecfa; color: #4d4193; padding: 6px 9px; border-radius: 6px; font-size: .8125rem; font-weight: 700; }
.task { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.task:first-of-type { margin-top: 8px; }
.task:last-child { border-bottom: 0; padding-bottom: 0; }
.task-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; font-size: 1.4rem; font-weight: 700; }
.task-icon.mint { background: #dbf5e9; color: #155b42; font: 700 1.15rem Georgia, serif; }
.task-icon.lilac { background: #ece8ff; color: #5b42c6; }
.task-icon.blue { background: #e4edff; color: #2f5ba5; }
.task-info h3 { font-size: 1rem; margin-bottom: 3px; }
.primary, .secondary, .quiet {
  border: 1px solid transparent; border-radius: 9px; padding: 10px 15px;
  min-height: 42px; font-weight: 700; font-size: .875rem; white-space: nowrap;
}
.primary { background: var(--purple); color: white; }
.primary:hover { background: #4631b7; }
.secondary, .quiet { background: #f5f3ff; color: #4933b5; }
.secondary:hover, .quiet:hover { background: #eae5fe; }
button:disabled { cursor: default; color: #60687d; background: #f0f1f5; }
.reading-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; cursor: pointer; white-space: nowrap; }
.reading-toggle input { width: 17px; height: 17px; accent-color: var(--purple); margin: 0; }
.progress-summary { display: flex; align-items: end; justify-content: space-between; gap: 5px; margin-top: 14px; }
.progress-summary strong { color: #25214b; font-size: 2.2rem; line-height: 1.12; letter-spacing: -.03em; }
.progress-summary span { color: var(--muted); font-size: .875rem; }
#progress-percent { color: #503abf; font-weight: 750; padding-bottom: 3px; }
progress { display: block; width: 100%; height: 8px; appearance: none; border: none; border-radius: 99px; overflow: hidden; background: #ece9fa; color: #6850dc; }
progress::-webkit-progress-bar { background: #ece9fa; border-radius: 99px; }
progress::-webkit-progress-value { background: #6850dc; border-radius: 99px; }
progress::-moz-progress-bar { background: #6850dc; border-radius: 99px; }
#progress { margin-top: 12px; }
.progress-caption { margin-top: 7px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.mini-stats div { display: grid; gap: 3px; border: 1px solid #e9e7f3; background: #f8f7ff; padding: 10px 12px; border-radius: 10px; }
.mini-stats strong { font-weight: 750; font-size: 1.25rem; }
.mini-stats span { font-size: .875rem; color: var(--muted); }
.goal-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 17px; font-size: .875rem; }
select, input[type=search], input[type=text], .add-form input { min-height: 42px; border: 1px solid #dcdfee; border-radius: 8px; padding: 8px 11px; background: white; color: var(--ink); }
select {
  appearance: none; padding-right: 33px;
  background-image: linear-gradient(45deg, transparent 50%, #645d81 50%), linear-gradient(135deg, #645d81 50%, transparent 50%);
  background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat;
}
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 22px 0 32px; color: var(--muted); font-size: .8125rem; }
.footer a { text-underline-offset: 3px; }

.study { max-width: 740px; margin: 0 auto; }
.study-header { display: grid; grid-template-columns: 75px 1fr 75px; align-items: center; gap: 13px; margin-bottom: 15px; }
.study-header h1 { text-align: center; font-size: 1.25rem; }
.study-header span { text-align: right; color: var(--muted); font-size: .9rem; }
.flashcard { margin-top: 19px; padding: 36px 30px; min-height: 340px; text-align: center; display: grid; justify-items: center; align-content: center; gap: 12px; }
.card-instruction, #phonetic, #example, .keyboard-hint { color: var(--muted); }
.card-instruction, .keyboard-hint { font-size: .875rem; }
#headword { font-size: clamp(1.8rem, 7vw, 3.75rem); line-height: 1.1; overflow-wrap: anywhere; max-width: 100%; }
#phonetic { min-height: 1.2em; overflow-wrap: anywhere; }
#definition { width: min(100%, 600px); padding: 15px 0 5px; border-top: 1px solid var(--line); }
#meaning { white-space: pre-line; line-height: 1.65; font-size: 1.12rem; }
#example { margin-top: 7px; line-height: 1.45; }
.grades { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(100%, 450px); margin-top: 8px; }
.grade { border: 0; border-radius: 10px; padding: 10px 3px; min-height: 56px; line-height: 1.25; font-weight: 700; font-size: .95rem; }
.grade small { display: block; margin-top: 4px; font-size: .73rem; font-weight: 500; }
.grade.again { background: #fae5ed; color: #7d2244; }
.grade.unsure { background: #faeedb; color: #71470e; }
.grade.known { background: #daf3e7; color: #155941; }
.grade:hover { filter: brightness(.95); }
.keyboard-hint { margin-top: 16px; text-align: center; }
.done h2 { font-size: 1.8rem; }
.done p { color: var(--muted); }

.library-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.library-heading h1 { font-size: 2rem; }
.library-heading p { margin-top: 7px; color: var(--muted); line-height: 1.5; }
.word-panel, .add-form, .sources { padding: 22px; }
.add-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; align-items: end; margin-bottom: 16px; }
.add-form label, .word-tools label { display: grid; gap: 5px; color: var(--muted); font-size: .875rem; min-width: 0; }
.add-form input, #search { width: 100%; }
#add-feedback { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; }
#add-feedback:empty { display: none; }
.word-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 11px; align-items: end; }
.word-result { color: var(--muted); font-size: .875rem; margin-top: 16px; }
.word-list { margin: 7px 0 0; padding: 0; list-style: none; }
.word-list li { display: grid; grid-template-columns: minmax(110px, .47fr) 1fr auto; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.word-list li > span { color: var(--muted); line-height: 1.5; }
.word-list li > small { color: #503abf; background: #f0ebff; border-radius: 5px; padding: 3px 6px; font-size: .75rem; white-space: nowrap; }
.more { display: block; margin: 13px auto 0; }
.sources { max-width: 740px; margin-bottom: 32px; line-height: 1.75; }
.sources p { margin-top: 11px; }

@media (max-width: 780px) {
  .dashboard { grid-template-columns: 1fr; gap: 16px; }
  .shell { width: calc(100% - 36px); }
  main { padding-top: 22px; }
  .hero { grid-template-columns: 1fr 157px; min-height: 217px; padding: 26px; gap: 16px; }
  .hero::before { width: 330px; height: 330px; right: -54px; }
  .countdown { width: 138px; }
  .countdown-number b { font-size: 2.7rem; }
  .countdown::after { top: 17px; right: 13px; }
}
@media (max-width: 500px) {
  .shell { width: calc(100% - 28px); }
  .topbar { min-height: 60px; gap: 4px; }
  .brand { gap: 7px; font-size: .875rem; }
  .logo { width: 29px; height: 29px; font-size: .875rem; }
  nav { gap: 2px; }
  nav a { padding: 7px 8px; font-size: .8125rem; }
  main { padding-top: 16px; }
  .hero { grid-template-columns: minmax(0, 1fr) 88px; min-height: 169px; padding: 20px 16px; gap: 12px; border-radius: 16px; }
  .hero::before { right: -103px; }
  .hero-date { gap: 6px; font-size: .75rem; flex-wrap: wrap; }
  .hero h1 { font-size: clamp(1.35rem, 5.4vw, 2rem); margin-top: 8px; }
  .hero-copy > p:last-child { font-size: .875rem; margin-top: 8px; }
  .countdown { width: 79px; box-shadow: 0 0 0 6px #bfb7ff15; }
  .countdown::after { top: 7px; right: 6px; width: 6px; height: 6px; }
  .countdown-content { font-size: .75rem; gap: 1px; }
  .countdown-number { gap: 3px; }
  .countdown-number b { font-size: 1.85rem; }
  .countdown-content time { font-size: .5625rem; }
  .dashboard { margin-top: 15px; }
  .tasks, .progress-panel, .word-panel, .add-form { padding: 16px; }
  .task { grid-template-columns: 33px 1fr auto; gap: 8px; }
  .task-icon { width: 33px; height: 33px; font-size: 1.15rem; }
  .task .primary, .task .secondary { padding-inline: 9px; }
  .reading-toggle { gap: 4px; }
  .flashcard { padding: 28px 15px; min-height: 290px; }
  .keyboard-hint { display: none; }
  .library-heading { align-items: start; }
  .library-heading h1 { font-size: 1.6rem; }
  .library-heading p { font-size: .875rem; }
  .word-tools, .add-form { grid-template-columns: minmax(0, 1fr) auto; }
  .search-label, .add-form label { grid-column: 1 / -1; }
  .word-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .word-list li > span { grid-column: 1 / -1; grid-row: 2; }
  .word-list li > small { grid-row: 1; grid-column: 2; }
}
