/* 拾词 SHI CI */
:root {
  --ink: #173a32;
  --ink-2: #36554d;
  --muted: #788b85;
  --paper: #f6f3e9;
  --card: #fffdf7;
  --green: #1b5a4b;
  --green-2: #2f7c67;
  --mint: #cde4d8;
  --lime: #dce99c;
  --orange: #f08a5d;
  --yellow: #f3c969;
  --red: #d96459;
  --line: rgba(23, 58, 50, .11);
  --shadow: 0 20px 55px rgba(25, 67, 57, .10);
  --shadow-sm: 0 8px 24px rgba(25, 67, 57, .08);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(240,138,93,.35); outline-offset: 3px; }
svg { display: block; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.ambient-one { width: 500px; height: 500px; background: rgba(205,228,216,.38); right: -180px; top: -220px; }
.ambient-two { width: 420px; height: 420px; background: rgba(243,201,105,.13); left: -240px; bottom: -180px; }

.topbar {
  width: 100%;
  max-width: 100vw;
  height: 82px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1fr;
  align-items: center;
  padding: 0 clamp(22px, 5vw, 76px);
  background: rgba(255,253,247,.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; width: max-content; max-width: 100%; }
.brand-mark { width: 40px; height: 40px; color: var(--green); }
.brand b { display: block; font-size: 21px; letter-spacing: 3px; line-height: 1.05; }
.brand small { display: block; font-size: 8px; font-weight: 800; letter-spacing: 3.5px; color: var(--green-2); margin-top: 5px; }
.main-nav { display: flex; align-items: center; gap: 6px; padding: 6px; background: rgba(23,58,50,.05); border-radius: 16px; }
.nav-item { min-width: 82px; border: 0; padding: 9px 15px; border-radius: 11px; background: transparent; color: #6b7c77; font-size: 14px; font-weight: 700; transition: .2s ease; }
.nav-item span { margin-right: 6px; font-size: 16px; }
.nav-item:hover { color: var(--ink); }
.nav-item.active { background: var(--card); color: var(--green); box-shadow: 0 4px 15px rgba(24,58,51,.08); }
.top-actions { justify-self: end; min-width: 0; display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--card); border-radius: 50%; color: var(--green); font-weight: 900; }
.icon-button.muted { color: #a4aea9; text-decoration: line-through; }
.login-button { max-width: 150px; overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(27,90,75,.22); border-radius: 20px; padding: 8px 13px; color: var(--green); background: transparent; font-size: 11px; font-weight: 900; white-space: nowrap; transition: .2s; }
.login-button:hover { color: #fff; background: var(--green); }
.login-button.logged-in { color: #fff; background: var(--orange); border-color: transparent; }
.mini-profile { display: flex; align-items: center; gap: 9px; }
.profile-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--paper); background: var(--green); font-weight: 800; }
.mini-profile b, .mini-profile small { display: block; line-height: 1.2; }
.mini-profile b { font-size: 15px; }
.mini-profile small { color: var(--muted); font-size: 10px; margin-top: 3px; }

main { max-width: 1280px; margin: 0 auto; padding: 0 clamp(22px, 4vw, 58px) 80px; }
.page { display: none; animation: pageIn .35s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
h1, h2, h3, p { margin-top: 0; }
.kicker, .eyebrow { color: var(--green-2); font-size: 11px; letter-spacing: 2px; font-weight: 900; }
.primary-button, .secondary-button { border-radius: 13px; padding: 14px 20px; border: 0; font-weight: 800; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.primary-button { color: #fff; background: var(--green); box-shadow: 0 9px 24px rgba(27,90,75,.2); }
.primary-button:hover { transform: translateY(-2px); background: #124c3e; box-shadow: 0 13px 28px rgba(27,90,75,.26); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.secondary-button { background: var(--mint); color: var(--green); }
.text-button { border: 0; background: transparent; color: var(--green-2); font-weight: 800; padding: 12px 4px; }
.panel { background: var(--card); border: 1px solid rgba(23,58,50,.07); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* Home */
.home-hero { min-height: 545px; display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(40px, 7vw, 100px); align-items: center; padding: 52px 4px 55px; }
.eyebrow { display: flex; align-items: center; gap: 8px; letter-spacing: 1px; }
.eyebrow b { color: var(--ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(240,138,93,.14); }
.hero-copy h1 { margin: 22px 0 18px; max-width: 630px; font-family: "Microsoft YaHei UI", sans-serif; font-size: clamp(42px, 5.1vw, 68px); line-height: 1.14; letter-spacing: -3px; }
.hero-copy h1 span { position: relative; color: var(--green-2); }
.hero-copy h1 span::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 10px; background: var(--lime); z-index: -1; transform: rotate(-1deg); }
.hero-copy p { color: var(--ink-2); opacity: .78; line-height: 1.9; font-size: 16px; }
.hero-actions { display: flex; align-items: center; gap: 26px; margin-top: 30px; }
.daily-card { position: relative; overflow: hidden; padding: 24px 27px; border: 1px solid rgba(23,58,50,.1); border-radius: 32px; background: #e5eee5; box-shadow: var(--shadow); }
.daily-card::after { content: ""; position: absolute; width: 180px; height: 180px; background: var(--lime); border-radius: 50%; right: -70px; bottom: -80px; opacity: .45; }
.card-topline, .daily-footer { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; }
.card-topline { font-size: 13px; font-weight: 900; letter-spacing: 2px; }
.date-pill { padding: 6px 10px; border-radius: 20px; background: rgba(255,255,255,.5); font-size: 10px; letter-spacing: .5px; }
.word-illustration { height: 170px; position: relative; display: grid; place-items: center; }
.book { position: relative; width: 145px; height: 90px; border-radius: 5px 5px 16px 16px; background: var(--green); transform: rotate(-4deg); box-shadow: 0 16px 22px rgba(23,58,50,.2); display: grid; place-items: center; }
.book::before, .book::after { content: ""; position: absolute; top: 7px; bottom: 7px; width: 10px; border-radius: 8px; background: rgba(255,255,255,.13); }
.book::before { left: 12px; } .book::after { right: 12px; }
.book b { color: var(--yellow); font-family: Georgia, serif; font-size: 46px; }
.book i, .book em { position: absolute; left: 12px; right: 12px; height: 3px; background: rgba(255,255,255,.15); border-radius: 5px; }
.book i { top: -3px; } .book em { bottom: 5px; }
.orbit { position: absolute; border: 1px dashed rgba(47,124,103,.22); border-radius: 50%; }
.orbit-one { width: 250px; height: 110px; transform: rotate(-8deg); }
.orbit-two { width: 210px; height: 140px; transform: rotate(30deg); }
.floating-char { position: absolute; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--card); color: var(--green); font-weight: 900; box-shadow: var(--shadow-sm); }
.char-one { top: 24px; left: 12%; transform: rotate(-12deg); color: var(--orange); }
.char-two { right: 13%; bottom: 27px; transform: rotate(10deg); }
.daily-word-row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid rgba(23,58,50,.1); padding-top: 19px; }
.daily-word-row h2 { margin: 0 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 37px; letter-spacing: -.8px; }
.daily-word-row p { margin: 0; color: var(--ink-2); font-weight: 700; }
.round-button { width: 43px; height: 43px; border: 0; border-radius: 50%; color: var(--paper); background: var(--green); font-size: 18px; box-shadow: 0 6px 15px rgba(23,58,50,.2); }
.round-button.speaking { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(27,90,75,.1); } }
.daily-footer { margin: 20px 0 9px; color: var(--ink-2); font-size: 11px; }
.progress-track { height: 7px; border-radius: 20px; background: rgba(23,58,50,.1); overflow: hidden; }
.progress-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--green-2); transition: width .5s ease; }

.stats-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); background: rgba(255,253,247,.66); border-radius: 20px; margin-bottom: 70px; overflow: hidden; }
.stat-card { display: flex; align-items: center; gap: 13px; padding: 22px 25px; border-right: 1px solid var(--line); }
.stat-card:last-child { border: 0; }
.stat-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; }
.stat-icon.flame { background: #fee6d8; color: var(--orange); }
.stat-icon.star { background: #fbefc7; color: #c69219; }
.stat-icon.check { background: #dcecdf; color: var(--green-2); }
.stat-icon.bolt { background: #e5e4f5; color: #6c67a7; }
.stat-card b, .stat-card small { display: block; }
.stat-card b { font-size: 22px; line-height: 1; }
.stat-card small { color: var(--muted); font-size: 11px; margin-top: 7px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.section-heading h2, .panel-heading h3 { margin: 5px 0 0; }
.section-heading h2 { font-size: 28px; }
.section-heading > span { color: var(--muted); font-size: 12px; padding-bottom: 4px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mode-card { min-height: 205px; padding: 28px; border-radius: 23px; display: grid; grid-template-columns: 54px 1fr; gap: 17px; position: relative; overflow: hidden; border: 1px solid rgba(23,58,50,.07); transition: .25s ease; }
.mode-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.mode-card > button { position: absolute; right: 20px; bottom: 20px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--green); background: rgba(255,255,255,.7); font-weight: 900; }
.mode-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; color: var(--green); background: var(--card); font-family: Georgia, serif; font-size: 22px; font-weight: 800; }
.mode-copy > span { color: var(--green-2); font-size: 10px; letter-spacing: 1.4px; font-weight: 900; }
.mode-copy h3 { margin: 8px 0; font-size: 20px; }
.mode-copy p { color: var(--ink-2); opacity: .7; font-size: 12px; line-height: 1.6; padding-right: 12px; }
.choice-mode { background: #d8e9de; }
.spelling-mode { background: #f7e4b5; }
.focus-mode { background: #f7d9cc; }
.home-bottom { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; margin-top: 55px; }
.level-card { padding: 28px 30px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; }
.panel-heading h3 { font-size: 20px; }
.panel-heading > span { color: var(--green-2); font-size: 24px; font-weight: 900; }
.level-bars { display: grid; gap: 17px; margin: 29px 0 23px; }
.level-row { display: grid; grid-template-columns: 42px 1fr 55px; align-items: center; gap: 13px; font-size: 12px; }
.level-row b { font-family: Georgia, serif; font-size: 18px; }
.level-row > span:last-child { color: var(--muted); text-align: right; }
.level-row .progress-track { height: 9px; }
.legend { display: flex; gap: 25px; color: var(--muted); font-size: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.level-a { background: var(--orange); } .level-b { background: var(--green-2); } .level-c { background: var(--yellow); }
.tip-card { position: relative; overflow: hidden; padding: 32px; border-radius: var(--radius); color: #f8f4e6; background: var(--green); }
.tip-card::after { content: "A"; position: absolute; right: -10px; bottom: -55px; color: rgba(255,255,255,.05); font-family: Georgia, serif; font-size: 180px; font-weight: 900; }
.quote { color: var(--yellow); font-family: Georgia, serif; font-size: 60px; line-height: .5; }
.tip-card p { font-size: 19px; line-height: 1.6; margin: 17px 0; position: relative; z-index: 1; }
.tip-card p b { color: var(--yellow); }
.tip-card small { opacity: .65; font-size: 11px; position: relative; z-index: 1; }

/* Setup */
.game-setup-wrap, .result-card, .mistake-panel, .library-toolbar { max-width: 900px; margin-left: auto; margin-right: auto; }
.page-intro { text-align: center; padding: 70px 0 34px; }
.page-intro h1 { font-size: clamp(34px, 4vw, 48px); margin: 10px 0; letter-spacing: -1.5px; }
.page-intro p { color: var(--muted); }
.setup-card { padding: 35px; }
.setup-section > label { display: block; margin-bottom: 12px; font-size: 12px; font-weight: 900; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.segmented button { border: 1px solid var(--line); background: #faf8f1; color: var(--ink-2); border-radius: 11px; padding: 12px 10px; font-size: 12px; font-weight: 800; transition: .2s; }
.segmented button:hover { border-color: rgba(27,90,75,.3); }
.segmented button.selected { border-color: var(--green); color: #fff; background: var(--green); box-shadow: 0 5px 12px rgba(27,90,75,.16); }
.segmented small { opacity: .65; margin-left: 3px; }
.segmented.compact { grid-template-columns: repeat(3, 1fr); }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 27px; }
.setup-summary { display: flex; align-items: center; gap: 15px; margin: 34px -35px -35px; padding: 23px 35px; border-top: 1px solid var(--line); background: rgba(205,228,216,.22); border-radius: 0 0 var(--radius) var(--radius); }
.summary-icon { width: 43px; height: 43px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; color: #8a6818; background: var(--yellow); }
.setup-summary > div:nth-child(2) { flex: 1; }
.setup-summary b, .setup-summary p { display: block; }
.setup-summary p { color: var(--muted); font-size: 11px; margin: 5px 0 0; }
.review-ready { display: flex; align-items: center; gap: 15px; margin-top: 18px; padding: 20px 24px; border-radius: 18px; background: #f6dfd4; }
.review-ready > span { font-size: 26px; color: var(--orange); }
.review-ready > div { flex: 1; }
.review-ready b, .review-ready p { display: block; margin: 0; }
.review-ready p { color: var(--muted); font-size: 11px; margin-top: 4px; }
.review-ready button { border: 0; background: transparent; color: #ad5437; font-weight: 900; }

/* Quiz */
.quiz-shell { max-width: 880px; margin: 0 auto; padding: 55px 0 40px; }
.quiz-top { display: grid; grid-template-columns: 45px 1fr 70px; gap: 22px; align-items: center; margin-bottom: 28px; }
.exit-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 25px; font-weight: 300; }
.quiz-meta { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: 11px; font-weight: 800; }
.quiz-track { height: 8px; }
.quiz-track i { background: var(--orange); }
.timer { text-align: right; color: var(--green-2); }
.timer span { margin-right: 4px; }
.question-card { min-height: 500px; position: relative; padding: 36px 45px 42px; overflow: hidden; }
.question-card::before { content: ""; position: absolute; width: 210px; height: 210px; border-radius: 50%; right: -100px; top: -110px; background: var(--mint); opacity: .4; }
.question-type { position: relative; color: var(--green-2); font-size: 11px; letter-spacing: 1.5px; font-weight: 900; }
.question-prompt { min-height: 145px; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; }
.question-prompt h1 { font-size: clamp(32px, 5vw, 48px); margin: 10px 0 7px; }
.question-prompt p { color: var(--muted); margin: 0; font-size: 12px; }
.listen-button { width: 64px; height: 64px; margin: 0 auto 15px; border: 0; border-radius: 50%; color: var(--green); background: var(--mint); font-size: 19px; box-shadow: 0 0 0 8px rgba(205,228,216,.35); }
.listen-button.speaking { animation: pulse 1s infinite; }
.answers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer-button { position: relative; min-height: 61px; padding: 14px 18px 14px 50px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf5; text-align: left; font-size: 15px; font-weight: 800; transition: .16s ease; }
.answer-button:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--green-2); background: #f2f8f3; }
.answer-button .key { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 10px; }
.answer-button.correct { border-color: #6fa68f; background: #e2f0e7; color: #1b654f; }
.answer-button.correct .key { background: var(--green-2); border-color: var(--green-2); color: white; }
.answer-button.wrong { border-color: #e49c90; background: #fbe5df; color: #a74238; }
.answer-button.wrong .key { background: var(--red); border-color: var(--red); color: white; }
.answer-button:disabled { cursor: default; }
.spelling-form { max-width: 530px; margin: 20px auto 0; }
.spelling-form > label { display: block; text-align: center; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.input-row { display: flex; gap: 9px; }
.input-row input { min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 13px; padding: 0 16px; color: var(--ink); background: #fbfaf5; font-size: 18px; font-weight: 800; text-transform: lowercase; }
.input-row input.correct { border-color: #6fa68f; background: #e2f0e7; }
.input-row input.wrong { border-color: #e49c90; background: #fbe5df; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.input-tip { text-align: center; color: var(--muted); font-size: 10px; margin-top: 12px; }
.answer-feedback { display: none; position: absolute; left: 0; right: 0; bottom: 0; min-height: 91px; align-items: center; gap: 13px; padding: 19px 35px; border-top: 1px solid var(--line); background: #f8f7ef; }
.answer-feedback.show { display: flex; animation: slideUp .25s ease; }
.answer-feedback.correct { background: #e8f2e9; }
.answer-feedback.wrong { background: #fae9e2; }
.feedback-icon { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: white; background: var(--green-2); font-weight: 900; }
.wrong .feedback-icon { background: var(--red); }
.feedback-copy { flex: 1; }
.feedback-copy b, .feedback-copy p { display: block; margin: 0; }
.feedback-copy p { color: var(--ink-2); font-size: 11px; margin-top: 4px; }
.next-button { border: 0; background: transparent; color: var(--green); font-weight: 900; }
.keyboard-tip { text-align: center; color: var(--muted); font-size: 10px; margin-top: 18px; }
kbd { padding: 2px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--card); color: var(--ink-2); font-family: inherit; }
@keyframes slideUp { from { transform: translateY(20px); } to { transform: none; } }

/* Result */
.result-card { position: relative; margin-top: 60px; padding: 42px 45px 38px; text-align: center; overflow: hidden; }
.result-kicker { color: var(--green-2); font-size: 10px; letter-spacing: 3px; font-weight: 900; }
.result-card h1 { margin: 9px 0; font-size: 37px; }
.result-card > p { color: var(--muted); }
.score-ring { --score: 0deg; width: 175px; height: 175px; margin: 24px auto; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--orange) var(--score), #e9e7df 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--card); }
.score-ring div { position: relative; z-index: 1; }
.score-ring b, .score-ring span { display: block; }
.score-ring b { font-family: Georgia, serif; font-size: 48px; }
.score-ring span { color: var(--muted); font-size: 11px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 560px; margin: 0 auto 28px; border: 1px solid var(--line); border-radius: 16px; }
.result-stats div { padding: 15px; border-right: 1px solid var(--line); }
.result-stats div:last-child { border: 0; }
.result-stats b, .result-stats span { display: block; }
.result-stats b { font-size: 22px; }
.result-stats span { color: var(--muted); font-size: 10px; margin-top: 4px; }
.result-actions { display: flex; align-items: center; justify-content: center; gap: 12px; }
.celebration i { position: absolute; font-style: normal; }
.celebration i:nth-child(1) { left: 13%; top: 15%; color: var(--yellow); font-size: 24px; }
.celebration i:nth-child(2) { right: 12%; top: 20%; color: var(--mint); }
.celebration i:nth-child(3) { right: 8%; top: 39%; color: var(--orange); font-size: 11px; }
.celebration i:nth-child(4) { left: 9%; top: 36%; color: var(--green-2); font-size: 14px; }
.mistake-panel { margin-top: 20px; padding: 25px 30px; }
.mistake-panel .panel-heading button { border: 0; background: transparent; color: var(--green-2); font-size: 11px; }
.mistake-item { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 20px; padding: 15px 3px; border-top: 1px solid var(--line); }
.mistake-item:first-child { margin-top: 18px; }
.mistake-item b { font-family: Georgia, serif; font-size: 19px; }
.mistake-item p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.mistake-item button { width: 37px; height: 37px; border: 0; border-radius: 50%; background: var(--mint); color: var(--green); }

/* Library */
.library-intro { max-width: 1100px; margin-left: auto; margin-right: auto; display: flex; align-items: end; justify-content: space-between; text-align: left; }
.library-intro > div:first-child { flex: 1; }
.library-search { width: 310px; height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.library-search span { color: var(--muted); font-size: 22px; }
.library-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.library-toolbar { display: flex; justify-content: space-between; padding: 12px; margin-bottom: 14px; }
.library-toolbar .segmented { min-width: 310px; }
.word-list { max-width: 900px; margin: 0 auto; border: 1px solid var(--line); border-radius: 20px; background: var(--card); overflow: hidden; box-shadow: var(--shadow-sm); }
.word-row { display: grid; grid-template-columns: 35px 1fr 1.2fr 80px auto; gap: 15px; align-items: center; min-height: 72px; padding: 10px 20px; border-bottom: 1px solid var(--line); transition: background .15s; }
.word-row:last-child { border: 0; }
.word-row:hover { background: #faf9f3; }
.word-index { color: #a6b0ac; font-family: Georgia, serif; font-size: 12px; }
.word-term { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 800; }
.word-meaning { color: var(--ink-2); font-size: 13px; }
.word-level { justify-self: start; padding: 5px 9px; border-radius: 20px; color: var(--green); background: #e5efe7; font-size: 9px; font-weight: 900; }
.word-level.level-A { color: #a85337; background: #f9e4da; }
.word-level.level-B { color: var(--green); background: #e0eee6; }
.word-level.level-C { color: #8a6c19; background: #f6edcf; }
.word-actions { display: flex; gap: 6px; }
.word-actions button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); }
.word-actions button:hover, .word-actions button.active { color: var(--green); background: var(--mint); border-color: transparent; }
.mastery-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d8dcd8; margin-left: 6px; }
.mastery-dot.learning { background: var(--yellow); }
.mastery-dot.mastered { background: var(--green-2); }
.load-more { display: block; margin: 22px auto; border: 1px solid var(--line); border-radius: 12px; padding: 11px 24px; background: var(--card); color: var(--green); font-size: 12px; font-weight: 800; }
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state span { display: block; color: #aab7b1; font-size: 50px; }
.empty-state b { display: block; margin-top: 12px; }
.empty-state p { color: var(--muted); font-size: 12px; }

/* Report */
.report-summary { max-width: 1050px; margin: 0 auto 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.big-stat { padding: 25px 27px; }
.big-stat > span { color: var(--muted); font-size: 11px; }
.big-stat b { display: block; margin: 14px 0 8px; font-size: 15px; }
.big-stat b i { width: 37px; height: 37px; margin-right: 10px; display: inline-grid; place-items: center; vertical-align: middle; border-radius: 12px; background: var(--mint); color: var(--green); font-style: normal; }
.big-stat b strong { font-family: Georgia, serif; font-size: 29px; margin: 0 3px; }
.big-stat p { margin: 0; color: var(--muted); font-size: 10px; }
.big-stat p em { color: var(--green-2); font-style: normal; }
.report-grid { max-width: 1050px; margin: 0 auto; display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.accuracy-card, .achievement-card { padding: 27px; }
.chart { height: 210px; display: flex; align-items: end; justify-content: space-around; gap: 13px; padding-top: 25px; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 8px; }
.chart-value { font-size: 9px; color: var(--green-2); font-weight: 800; }
.chart-bar { width: min(30px, 75%); min-height: 3px; border-radius: 7px 7px 2px 2px; background: var(--mint); transition: height .5s; }
.chart-col.today .chart-bar { background: var(--orange); }
.chart-label { color: var(--muted); font-size: 9px; }
.achievement { display: flex; align-items: center; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.achievement:last-child { border: 0; }
.achievement > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: #f3eacb; color: #9a791f; }
.achievement:nth-child(3) > span { background: var(--mint); color: var(--green); }
.achievement:nth-child(4) > span { background: #f6ddd3; color: var(--orange); }
.achievement b, .achievement small { display: block; }
.achievement b { font-size: 12px; }
.achievement small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.achievement progress { width: 65px; height: 5px; margin-left: auto; accent-color: var(--green-2); }

/* Auth */
.modal-backdrop { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 20px; background: rgba(15,42,36,.48); backdrop-filter: blur(8px); animation: pageIn .2s ease; }
.modal-backdrop[hidden] { display: none; }
.auth-modal { position: relative; width: min(100%, 430px); padding: 32px; }
.modal-close { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(23,58,50,.07); color: var(--muted); font-size: 22px; }
.auth-modal h2 { margin: 9px 0 6px; font-size: 29px; }
.auth-intro { color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 22px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; margin-bottom: 20px; border-radius: 11px; background: #f0eee5; }
.auth-tabs button { border: 0; border-radius: 8px; padding: 9px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 900; }
.auth-tabs button.active { color: var(--green); background: var(--card); box-shadow: var(--shadow-sm); }
#authForm { display: grid; gap: 14px; }
#authForm label { display: grid; gap: 7px; color: var(--ink-2); font-size: 11px; font-weight: 900; }
#authForm input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; color: var(--ink); background: #fbfaf5; outline: 0; font-size: 13px; }
#authForm input:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(47,124,103,.12); }
.auth-error { min-height: 14px; margin: -2px 0 0; color: var(--red); font-size: 11px; }
.auth-submit { width: 100%; margin-top: 1px; }
.auth-submit:disabled { opacity: .6; cursor: wait; }
.auth-footnote { display: block; margin-top: 18px; color: var(--muted); font-size: 10px; line-height: 1.6; text-align: center; }

/* Toast & confetti */
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; transform: translate(-50%, 25px); display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 13px 18px; border-radius: 13px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--green-2); }
.toast p { margin: 0; font-size: 12px; font-weight: 700; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; width: 9px; height: 14px; top: -20px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(620deg); opacity: .2; } }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .main-nav { order: 3; position: fixed; top: auto; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; justify-content: center; background: rgba(255,253,247,.94); backdrop-filter: blur(15px); box-shadow: 0 8px 30px rgba(23,58,50,.15); }
  .nav-item { min-width: 0; flex: 1; padding: 10px 5px; }
  .nav-item span { display: block; margin: 0; }
  main { padding-bottom: 110px; }
  .home-hero { grid-template-columns: 1fr; min-height: 0; padding-top: 50px; }
  .hero-copy { text-align: center; }
  .eyebrow, .hero-actions { justify-content: center; }
  .daily-card { max-width: 500px; width: 100%; margin: 0 auto; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 160px; }
  .stats-strip { grid-template-columns: 1fr 1fr; }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .home-bottom, .report-grid { grid-template-columns: 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  .library-intro { flex-direction: column; align-items: stretch; gap: 10px; }
  .library-search { width: 100%; }
  .report-summary { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; height: 68px; padding: 0 17px; padding-top: env(safe-area-inset-top); height: calc(68px + env(safe-area-inset-top)); overflow: hidden; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .brand { min-width: 0; gap: 6px; }
  .brand > span:last-child { min-width: 0; overflow: hidden; }
  .brand-mark { width: 34px; height: 34px; flex: 0 0 auto; }
  .brand b { font-size: 18px; }
  .top-actions { min-width: 0; gap: 7px; }
  .top-actions .mini-profile { display: none; }
  .top-actions .icon-button { flex: 0 0 auto; }
  .login-button { max-width: 94px; padding: 7px 8px; font-size: 10px; }
  main { padding-left: 16px; padding-right: 16px; }
  .home-hero { padding: 38px 0 40px; gap: 35px; }
  .hero-copy h1 { font-size: 39px; letter-spacing: -2px; }
  .hero-copy p { font-size: 14px; }
  .hero-copy p br { display: none; }
  .hero-actions { flex-direction: column; gap: 5px; }
  .daily-card { padding: 21px; }
  .stats-strip { margin-bottom: 45px; }
  .stat-card { padding: 16px; }
  .stat-icon { width: 33px; height: 33px; }
  .stat-card b { font-size: 18px; }
  .section-heading { align-items: start; }
  .section-heading > span { display: none; }
  .section-heading h2 { font-size: 23px; }
  .mode-card { padding: 22px; }
  .home-bottom { margin-top: 38px; }
  .legend { gap: 11px; flex-wrap: wrap; }
  .page-intro { padding: 48px 0 25px; }
  .page-intro h1 { font-size: 32px; }
  .setup-card { padding: 22px; }
  .segmented { grid-template-columns: 1fr 1fr; }
  .setup-grid { gap: 18px; }
  .setup-summary { margin: 27px -22px -22px; padding: 18px 20px; flex-wrap: wrap; }
  .setup-summary .primary-button { width: 100%; }
  .quiz-shell { padding-top: 28px; }
  .quiz-top { grid-template-columns: 40px 1fr 58px; gap: 10px; }
  .question-card { min-height: 470px; padding: 28px 20px; }
  .question-prompt h1 { font-size: 31px; }
  .answers-grid { grid-template-columns: 1fr; }
  .answer-feedback { padding: 16px 20px; }
  .feedback-copy p { max-width: 160px; }
  .result-card { margin-top: 28px; padding: 38px 18px 28px; }
  .result-card h1 { font-size: 28px; }
  .result-actions { flex-wrap: wrap; }
  .result-actions .text-button { width: 100%; }
  .mistake-panel { padding: 20px; }
  .mistake-item { grid-template-columns: 1fr auto; }
  .mistake-item p { grid-column: 1; }
  .library-toolbar { flex-direction: column; gap: 8px; }
  .library-toolbar .segmented { min-width: 0; }
  .word-row { grid-template-columns: 26px 1fr auto; gap: 8px; padding: 12px; }
  .word-index { display: none; }
  .word-term, .word-meaning { grid-column: 2; }
  .word-level { grid-column: 2; grid-row: 3; }
  .word-actions { grid-column: 3; grid-row: 1 / span 3; }
  .word-term { font-size: 16px; }
  .word-meaning { font-size: 11px; }
  .nav-item { font-size: 10px; }
  .nav-item span { font-size: 15px; }
  .modal-backdrop { padding: 12px; align-items: end; }
  .auth-modal { max-height: calc(100dvh - 24px - env(safe-area-inset-bottom)); overflow-y: auto; padding: 26px 20px 22px; border-radius: 24px 24px 14px 14px; }
  #authForm input, .library-search input { font-size: 16px; }
  .word-term, .daily-word-row h2, .result-card h1 { overflow-wrap: anywhere; }
  .word-row { min-height: 78px; }
  .primary-button, .secondary-button, .nav-item, .login-button, .review-ready button { min-height: 44px; }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); max-width: calc(100% - 28px); }
}

@media (max-width: 380px) {
  .brand-mark { display: none; }
  .brand b { font-size: 17px; }
  .topbar { padding-left: 13px; padding-right: 13px; }
  .top-actions { gap: 7px; }
  .icon-button { width: 34px; height: 34px; }
  .login-button { max-width: 84px; padding-left: 6px; padding-right: 6px; }
  .hero-copy h1 { font-size: 34px; }
  .hero-actions .primary-button { width: 100%; }
  .stats-strip { margin-left: -2px; margin-right: -2px; }
  .stat-card { padding-left: 11px; padding-right: 8px; gap: 8px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-card small { font-size: 9px; }
  .setup-summary { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .review-ready { padding-left: 15px; padding-right: 12px; }
  .review-ready b { font-size: 12px; }
}
