:root {
  --bg: #faf8f5; --fg: #1d1b19; --muted: #6f6a64; --card: #ffffff; --line: #e6e1da;
  --red: #b3261e; --blue: #1f6feb; --green: #1a7f37; --orange: #b35900; --gray: #8c8781;
  --hz: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161412; --fg: #f1ede8; --muted: #a39d95; --card: #211e1b; --line: #36322d;
    --red: #ff7a6e; --blue: #6ea8ff; --green: #56c46f; --orange: #f0a35a; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; padding: 0 16px; }
/* Safe-area padding lives inside #app so the page is exactly one screen tall (border-box). */
#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 8px) 0 calc(env(safe-area-inset-bottom) + 16px); }
button, input, label.file { font: inherit; color: inherit; }
button { border: 0; border-radius: 12px; cursor: pointer; }
button:disabled { opacity: .35; }
.muted { color: var(--muted); } .small { font-size: 14px; } .center { text-align: center; }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.top h1 { margin: 0; font-size: 28px; } .top h2 { margin: 0; font-size: 18px; }
.back { background: none; color: var(--blue); padding: 8px 0; font-size: 17px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 8px; text-align: center; }
.stat b { display: block; font-size: 30px; } .stat span { color: var(--muted); font-size: 13px; }
.due { color: var(--green); } .new { color: var(--blue); } .learn { color: var(--orange); }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress div { height: 100%; background: var(--red); }
.primary { background: var(--red); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .primary { color: #1d1b19; } }
.big { padding: 16px; font-size: 18px; width: 100%; }
.ghost, label.file { display: block; width: 100%; text-align: center; background: var(--card); border: 1px solid var(--line); padding: 13px; border-radius: 12px; }
label.file input { display: none; }
.danger { background: none; color: var(--red); padding: 13px; width: 100%; }
.links { display: grid; gap: 10px; margin-top: auto; }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 36px 20px 28px; text-align: center; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; min-height: 52dvh; }
.card.tap { cursor: pointer; }
.hz { font-family: var(--hz); font-size: clamp(64px, 22vw, 110px); line-height: 1.15; }
.py { font-size: 26px; color: var(--red); }
.en { font-size: 21px; margin-top: 8px; } .pos { font-size: 14px; }
.hint { position: absolute; bottom: 14px; left: 0; right: 0; }
.peek { background: none; color: var(--muted); text-decoration: underline; padding: 6px 10px; }
.sound { background: var(--bg); border: 1px solid var(--line); font-size: 22px; padding: 8px 18px; margin-top: 12px; }
.tag { position: absolute; top: 12px; left: 14px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.words .tag { position: static; margin-left: auto; white-space: nowrap; }
.tag.new { background: var(--blue); color: #fff; } .tag.learn { background: var(--orange); color: #fff; } .tag.known { background: var(--green); color: #fff; }
.answers { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.answers.one { grid-template-columns: 1fr; }
.answers [data-g] { padding: 12px 4px; display: flex; flex-direction: column; align-items: center; color: #fff; }
.answers [data-g] span { font-size: 13px; opacity: .9; }
.again { background: #c62828; } .hard { background: #8d6e63; } .good { background: #2e7d32; } .easy { background: #1565c0; }
.counts { font-size: 15px; }
.done { text-align: center; padding: 40px 0; flex: 1; }
.big-hz { font-family: var(--hz); font-size: 80px; color: var(--red); }
input[type=search] { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.words { list-style: none; margin: 0; padding: 0; }
.words li { display: flex; gap: 10px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; flex-wrap: wrap; }
.lh { font-family: var(--hz); font-size: 22px; min-width: 3em; } .lp { color: var(--red); } .le { color: var(--muted); font-size: 14px; flex-basis: 100%; padding-left: calc(3em + 10px); margin-top: -4px; }
.form { display: grid; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.form h3 { margin: 0; }
.form label { display: grid; gap: 6px; font-size: 15px; }
.form label.row { display: flex; align-items: center; gap: 10px; }
.form input[type=number] { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); width: 100px; }
.form .ghost, .form label.file { background: var(--bg); }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; }
[hidden] { display: none !important; }
