:root {
  color-scheme: light;
  --ink: #102a43;
  --muted: #627d98;
  --faint: #f0f4f8;
  --line: #d9e2ec;
  --paper: #ffffff;
  --canvas: #f7f9fc;
  --primary: #1f7a8c;
  --primary-dark: #145b68;
  --orange: #f29d49;
  --red: #d64545;
  --green: #2f855a;
  --shadow: 0 18px 45px rgba(16, 42, 67, 0.09);
}

* { box-sizing: border-box; }
body.locked { overflow: hidden; }
.access-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 50% 0%, #e4f7f8 0, var(--canvas) 48%, #eef3f7 100%); }
.access-card { width: min(100%, 390px); padding: 34px 30px 30px; text-align: center; background: rgba(255,255,255,.96); border: 1px solid rgba(217,226,236,.95); border-radius: 24px; box-shadow: 0 24px 70px rgba(16,42,67,.14); }
.access-mark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 18px 18px 18px 6px; color: white; background: var(--primary); font-size: 27px; font-weight: 800; }
.access-kicker { margin-bottom: 5px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
.access-card h1 { margin-bottom: 8px; font-size: 34px; }
.access-intro { color: var(--muted); margin-bottom: 23px; font-size: 14px; }
.access-form { display: grid; gap: 11px; }
.access-form input { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--ink); background: var(--paper); text-align: center; outline: none; }
.access-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,122,140,.13); }
.access-error { min-height: 20px; margin: 0; color: var(--red); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.dark .access-gate { background: radial-gradient(circle at 50% 0%, #183c50 0, var(--canvas) 52%, #091a2a 100%); }
.dark .access-card { background: rgba(16,42,67,.96); border-color: var(--line); }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; padding-bottom: 84px; }
.topbar {
  height: 76px;
  padding: 0 max(22px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 13px 13px 13px 4px; color: white; background: var(--primary); font-weight: 800; font-size: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .04em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: -2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.status-pill { color: var(--green); background: #e8f5ed; padding: 5px 10px; border-radius: 999px; font-size: 12px; }
.status-pill.pending { color: #a65b11; background: #fff3df; }
.icon-button { border: 1px solid var(--line); color: var(--ink); background: var(--paper); border-radius: 10px; width: 36px; height: 36px; }
.update-banner { max-width: 1120px; margin: 16px auto -4px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff5e6; color: #8a4b08; border: 1px solid #f6d49f; border-radius: 12px; font-size: 13px; }
.hidden { display: none !important; }
.text-button { border: 0; background: none; color: var(--primary-dark); font-weight: 700; }
.main-content { width: min(1120px, calc(100% - 44px)); margin: 0 auto; padding: 42px 0 28px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero-block { max-width: 760px; padding: 9px 0 14px; }
.hero-block .eyebrow { display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid #bfe2e5; border-radius: 999px; background: #eaf8f9; letter-spacing: .16em; }
.hero-block h1 { margin-top: 16px; max-width: 660px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 47px); line-height: 1.12; letter-spacing: -.04em; margin-bottom: 12px; }
h2 { font-size: 24px; letter-spacing: -.025em; margin-bottom: 7px; }
h3 { font-size: 16px; margin-bottom: 5px; }
.lead { color: var(--muted); max-width: 620px; margin-bottom: 28px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 22px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.panel-pad { padding: 23px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.panel-head p { color: var(--muted); font-size: 13px; margin-bottom: 0; }
.book-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.book-card { border: 1px solid var(--line); border-radius: 15px; padding: 15px; background: #fbfdff; transition: .18s ease; }
.book-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,122,140,.1); background: #f2fbfc; }
.book-card-top { display: flex; gap: 11px; align-items: flex-start; }
.check { width: 20px; height: 20px; accent-color: var(--primary); margin-top: 2px; }
.book-card label { display: block; font-weight: 750; cursor: pointer; }
.book-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.unit-toggle { margin: 12px 0 0 31px; color: var(--primary-dark); background: none; border: 0; font-size: 12px; padding: 0; }
.unit-options { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0 31px; }
.unit-chip { border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--muted); padding: 4px 9px; font-size: 11px; }
.unit-chip.selected { color: var(--primary-dark); border-color: var(--primary); background: #e6f7f8; }
.settings-grid { display: grid; gap: 17px; }
.field-label { color: var(--muted); font-size: 12px; font-weight: 750; display: block; margin-bottom: 7px; }
.quantity-control { display: flex; align-items: center; gap: 9px; }
.quantity-control input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); background: var(--paper); }
.quick-quantity { display: flex; gap: 6px; }
.quick-quantity button { padding: 6px 9px; font-size: 11px; color: var(--muted); background: var(--faint); border: 0; border-radius: 8px; }
.quick-quantity button.active { color: white; background: var(--primary); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--ink); font-size: 13px; }
.switch { position: relative; width: 43px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 20px; background: #bcccdc; transition: .2s; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px #829ab1; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(19px); }
.mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-button, .secondary-button, .danger-button { border-radius: 11px; padding: 11px 15px; font-weight: 750; border: 1px solid transparent; }
.primary-button { color: white; background: var(--primary); box-shadow: 0 7px 16px rgba(31,122,140,.2); }
.primary-button:hover { background: var(--primary-dark); }
.secondary-button { color: var(--primary-dark); border-color: #a8d5da; background: #effbfc; }
.danger-button { color: var(--red); border-color: #f0b5b5; background: #fff8f8; }
.full { width: 100%; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 15px; }
.stat { background: var(--faint); border-radius: 13px; padding: 13px; }
.stat strong, .stat span { display: block; }
.stat strong { font-size: 23px; letter-spacing: -.03em; }
.stat span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.session-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 18px; }
.progress-track { height: 8px; flex: 1; background: #d9e2ec; border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: inherit; transition: width .25s ease; }
.session-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.session-layout { max-width: 760px; margin: 0 auto; }
.word-card { min-height: 455px; padding: clamp(26px, 5vw, 56px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; overflow: hidden; }
.word-card:before { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; background: rgba(31,122,140,.08); top: -90px; right: -72px; }
.word-number { position: absolute; top: 20px; left: 23px; color: var(--muted); font-size: 12px; }
.star-label { position: absolute; top: 19px; right: 23px; color: var(--orange); font-size: 13px; }
.word-english { font-size: clamp(39px, 7vw, 70px); letter-spacing: -.05em; line-height: 1.12; margin-bottom: 8px; position: relative; }
.word-phonetic { color: var(--primary); font-size: 17px; margin-bottom: 15px; }
.meaning { font-size: 22px; font-weight: 750; margin-bottom: 19px; }
.example-box { max-width: 540px; background: #f7f9fc; border-radius: 15px; padding: 14px 18px; margin-top: 8px; }
.example-en { font-size: 16px; margin-bottom: 3px; }
.example-zh { color: var(--muted); font-size: 13px; }
.audio-button { border: 0; color: var(--primary-dark); background: #e5f5f6; border-radius: 999px; padding: 8px 13px; font-size: 12px; font-weight: 750; }
.audio-button:hover { background: #ccecef; }
.audio-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 0; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 25px; }
.card-actions .primary-button, .card-actions .secondary-button, .card-actions .danger-button { min-width: 120px; }
.review-ratings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; width: 100%; max-width: 530px; margin-top: 20px; }
.rating { padding: 12px 8px; border-radius: 11px; border: 1px solid var(--line); background: white; font-weight: 750; }
.rating.good { color: var(--green); border-color: #a5d6b8; background: #f1fbf4; }
.rating.hazy { color: #a65b11; border-color: #f3d39e; background: #fff9ed; }
.rating.bad { color: var(--red); border-color: #efb2b2; background: #fff5f5; }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.select, .search-input { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); padding: 9px 11px; }
.search-input { min-width: 180px; }
.weak-list { display: grid; gap: 9px; }
.weak-item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.weak-word { font-weight: 800; }
.weak-word small { color: var(--muted); display: block; font-weight: 400; font-size: 11px; }
.error-count { color: var(--red); font-size: 12px; }
.empty-state { text-align: center; padding: 55px 24px; color: var(--muted); }
.empty-icon { font-size: 37px; margin-bottom: 10px; }
.data-actions { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-top: 17px; }
.data-note { color: var(--muted); font-size: 12px; margin-top: 14px; }
.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; height: 68px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: flex; justify-content: center; gap: min(10vw, 76px); backdrop-filter: blur(14px); }
.nav-item { width: 72px; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1px; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item small { font-size: 11px; }
.nav-item.active { color: var(--primary); font-weight: 750; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 87px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; color: white; background: rgba(16,42,67,.92); border-radius: 10px; padding: 9px 15px; font-size: 12px; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dark { color-scheme: dark; --ink: #e6eef5; --muted: #9fb3c8; --faint: #243b53; --line: #486581; --paper: #102a43; --canvas: #0b1f33; --primary: #55b7c5; --primary-dark: #8bd5dd; --shadow: 0 18px 45px rgba(0,0,0,.24); }
.dark .topbar, .dark .bottom-nav { background: rgba(16,42,67,.94); }
.dark .book-card, .dark .example-box, .dark .rating { background: #173b56; }
.dark .book-card.selected { background: #194e5a; }
.dark .secondary-button { background: #183c50; }
.dark .hero-block .eyebrow { background: #183c50; border-color: #28606a; }

@media (max-width: 780px) {
  .topbar { height: 65px; padding: 0 16px; }
  .status-pill { display: none; }
  .main-content { width: min(100% - 28px, 620px); padding-top: 30px; }
  .home-grid { grid-template-columns: 1fr; }
  .book-list { grid-template-columns: 1fr; }
  .panel-pad { padding: 18px; }
  .word-card { min-height: 520px; padding: 42px 19px 25px; }
  .weak-item { grid-template-columns: 1fr auto; }
  .weak-item .secondary-button { grid-column: 1 / -1; width: 100%; }
  .bottom-nav { gap: 2px; justify-content: space-around; }
  .nav-item { width: 25%; }
}

@media (max-width: 420px) {
  h1 { font-size: 33px; }
  .mode-buttons, .data-actions { grid-template-columns: 1fr; }
  .review-ratings { grid-template-columns: 1fr; }
  .word-english { font-size: 45px; }
}
