@font-face {
  font-family: "Hand";
  src: url("/fonts/PlaywriteDEGrund.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #F3F1E8;
  --surface: #FDFCF7;
  --line: #E2DED0;
  --line-soft: #EAE6D9;
  --text: #23241E;
  --dim: #6E7066;
  --dim-2: #9B9C90;
  --dim-3: #B8B5A6;
  --accent: #2F6B4E;
  --accent-soft: #E8EFE6;
  --bad: #B4573F;
  --bad-soft: #F5E6E0;
  --on: #FBFAF4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
.hand { font-family: "Hand", Georgia, serif; }

.view { display: none; min-height: 100%; }
.view.show { display: block; }

/* ---------- 登录 ---------- */
#v-login { display: none; align-items: center; justify-content: center; padding: 28px; }
#v-login.show { display: flex; }
.login-box { width: 100%; max-width: 400px; }
.kicker { font-size: 12px; letter-spacing: .14em; color: var(--dim-2); margin-bottom: 14px; }
h1 { font-size: 30px; font-weight: 600; letter-spacing: -.01em; }
.sub { font-size: 14px; color: var(--dim); margin-top: 10px; line-height: 1.6; }
label { display: block; font-size: 12px; color: var(--dim-2); letter-spacing: .08em; margin: 22px 0 8px; }
label.opt { margin-top: 16px; }
input {
  width: 100%; height: 52px; border: 1px solid #D8D3C3; background: var(--surface);
  border-radius: 12px; padding: 0 16px; font-size: 17px; color: var(--text);
  font-family: inherit; outline: none;
}
input:focus { border-color: var(--accent); }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 54px; border: 0; border-radius: 14px; background: var(--accent); color: var(--on);
  font-size: 17px; font-weight: 600; font-family: inherit; cursor: pointer;
  margin-top: 24px; letter-spacing: .02em;
}
.btn:active { opacity: .9; }
.btn.ghost { background: transparent; border: 1px solid #D8D3C3; color: var(--dim); font-weight: 500; height: 46px; font-size: 14px; margin: 0; }
.msg { font-size: 13px; color: var(--bad); margin-top: 12px; min-height: 18px; line-height: 1.5; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; flex-direction: column; }
.rail { display: none; }
.stage { flex: 1; display: flex; flex-direction: column; padding: 0 20px calc(64px + env(safe-area-inset-bottom)); }
.pane { display: none; flex: 1; flex-direction: column; }
.pane.show { display: flex; }

.top { display: flex; align-items: center; gap: 12px; padding-top: 18px; }
.pbar { flex: 1; height: 4px; background: #E7E3D5; border-radius: 99px; overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s; }
.cnt { font-size: 12px; color: var(--dim-2); font-variant-numeric: tabular-nums; }

/* ---------- 今日 ---------- */
.today { margin: auto 0; padding-bottom: 40px; }
.day-label { font-size: 12px; letter-spacing: .12em; color: var(--dim-2); }
.bignum { font-size: 76px; line-height: 1; margin-top: 18px; letter-spacing: -.02em; }
.bignum-sub { font-size: 15px; color: var(--dim); margin-top: 8px; }
.chips { display: flex; gap: 8px; margin-top: 22px; }
.chip { font-size: 13px; color: var(--dim); background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 7px 13px; }
.chip b { color: var(--text); font-weight: 600; }
.btn.start { margin-top: 34px; }
.bar { height: 5px; background: #E7E3D5; border-radius: 99px; overflow: hidden; margin-top: 22px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; }
.meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim-2); margin-top: 9px; }

/* ---------- 卡片 ---------- */
.card { margin: auto 0; text-align: center; padding-bottom: 10px; position: relative; }
.lesson-label { font-size: 11px; letter-spacing: .12em; color: var(--dim-2); margin-bottom: 18px; }
.word-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.speak {
  border: 1px solid var(--line); background: var(--surface); color: var(--dim);
  border-radius: 99px; height: 34px; padding: 0 13px; font-size: 12px;
  font-family: inherit; cursor: pointer; flex: none;
}
.speak:active { color: var(--accent); border-color: var(--accent); }
.word { font-size: 58px; line-height: 1.1; letter-spacing: -.01em; min-height: 0; }
.word:empty { display: none; }
.meaning { font-size: 25px; font-weight: 500; line-height: 1.45; margin-top: 16px; }
.word:empty + .meaning { margin-top: 0; }

.typer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; }
.slots { display: flex; gap: 5px; justify-content: center; margin: 30px 0 4px; }
.slot {
  flex: 1; max-width: 48px; min-width: 0; aspect-ratio: 1 / 1.35;
  border: 1.2px solid #DFDACA; border-radius: 8px; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: "Hand", Georgia, serif; font-size: var(--slot-font, 20px);
}
.slot.f { border-color: #BFD3C4; }
.slot.c { border-color: var(--accent); background: var(--accent-soft); }
.slot.d { border-style: dashed; border-color: #DDD8C8; background: transparent; }
.slot.ok { border-color: var(--accent); color: var(--accent); }
.slot.no { border-color: var(--bad); color: var(--bad); }
.hint { font-size: 12px; color: var(--dim-2); margin-top: 16px; min-height: 16px; }
.card-actions { margin-top: 22px; }

/* 反馈 */
.fb { text-align: left; }
.fb-verdict { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.fb-mark { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.fb-mark.ok { background: var(--accent-soft); color: var(--accent); }
.fb-mark.no { background: var(--bad-soft); color: var(--bad); }
.fb-word { font-family: "Hand", Georgia, serif; font-size: 40px; margin-top: 16px; letter-spacing: .02em; }
.fb-word .ok { color: var(--accent); }
.fb-word .no { color: var(--bad); }
.fb-sub { font-size: 13px; color: var(--dim); margin-top: 10px; line-height: 1.6; }
.fb-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- 结算 ---------- */
.done { margin: auto 0; padding-bottom: 30px; }
.tiles { display: flex; gap: 10px; margin-top: 26px; }
.tile { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.tile .n { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 11px; color: var(--dim-2); margin-top: 5px; }

/* ---------- 管理台 ---------- */
#p-admin h2 { font-size: 24px; font-weight: 600; margin-top: 26px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; color: var(--dim-2); font-weight: 500; letter-spacing: .06em; padding: 0 10px 10px 0; border-bottom: 1px solid #D5D0BE; white-space: nowrap; }
td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 99px; }
.t-ok { color: var(--accent); background: var(--accent-soft); }
.t-idle { color: var(--dim); background: #EFECE2; }
.t-late { color: var(--bad); background: var(--bad-soft); }

/* ---------- 底部栏 ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
}
.bottombar a { flex: 1; text-align: center; font-size: 12px; color: var(--dim-2); text-decoration: none; }
.bottombar a.on { color: var(--accent); font-weight: 600; }

/* ---------- 平板 ---------- */
@media (min-width: 640px) {
  .stage { padding: 0 40px calc(64px + env(safe-area-inset-bottom)); }
  .bignum { font-size: 96px; }
  .word { font-size: 76px; }
  .meaning { font-size: 30px; }
  .slot { max-width: 60px; border-radius: 10px; }
  .login-box { max-width: 440px; }
}

/* ---------- 桌面 ---------- */
@media (min-width: 1024px) {
  .shell { flex-direction: row; min-height: 100vh; }
  .bottombar { display: none; }
  .rail {
    display: flex; flex-direction: column; width: 232px; flex: none;
    border-right: 1px solid var(--line); padding: 28px 20px;
  }
  .brand { font-size: 22px; }
  .brand span { display: block; font-family: -apple-system, "PingFang SC"; font-size: 11px; color: var(--dim-2); letter-spacing: .12em; margin-top: 6px; }
  .rail nav { margin-top: 32px; display: flex; flex-direction: column; gap: 2px; }
  .rail nav a { text-decoration: none; color: var(--dim); font-size: 14px; padding: 10px 12px; border-radius: 9px; }
  .rail nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .who { margin-top: auto; display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--dim); }
  .who .av { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
  .stage { padding: 0 56px; max-width: 900px; }
  .pane { max-width: 720px; width: 100%; margin: 0 auto; }
  .word { font-size: 88px; }
  .meaning { font-size: 34px; }
  .top { padding-top: 26px; }
  .card-actions .btn.ghost { max-width: 240px; margin: 0 auto; }
}

/* 错词本 */
.wlist { margin-top: 8px; }
.wrow { display: flex; align-items: baseline; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.wrow .w { font-family: "Hand", Georgia, serif; font-size: 21px; min-width: 96px; }
.wrow .m { flex: 1; font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .c { font-size: 11px; color: var(--bad); background: var(--bad-soft); border-radius: 99px; padding: 3px 8px; flex: none; }
