:root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172033; background: #FAF7FE; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, rgba(117,92,210,.16), transparent 34%), radial-gradient(circle at 86% 12%, rgba(241,155,128,.24), transparent 25%), #FBF8FF; }
button { cursor: pointer; font: inherit; }
p, h1, h2 { margin: 0; }
.topbar { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 15px clamp(14px,4vw,38px); border-bottom: 1px solid rgba(23,32,51,.12); background: rgba(255,255,255,.9); backdrop-filter: blur(14px); }
.home-button { width: 42px; height: 42px; border: 0; border-radius: 12px; color: #fff; background: #7656C8; font-size: 23px; font-weight: 900; }
.eyebrow { color: #5E42B8; font-size: 13px; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
h1 { margin-top: 4px; font-size: clamp(22px,4vw,34px); line-height: 1.12; }
h2 { margin-top: 4px; font-size: clamp(28px,5vw,44px); line-height: 1.06; }
.count { border-radius: 999px; padding: 8px 13px; color: #172033; background: #F4D8A6; font-size: 14px; font-weight: 850; white-space: nowrap; }
main { width: min(1120px,100%); margin: 0 auto; padding: 18px clamp(14px,3vw,28px) 44px; }
.hero, .controls, .blind-test { border-radius: 18px; background: #fff; box-shadow: 0 12px 28px rgba(33,64,96,.10); }
.hero { margin-bottom: 18px; padding: clamp(20px,4vw,34px); }
.hero > p:last-of-type { max-width: 660px; margin-top: 10px; color: #536477; line-height: 1.55; }
.starred-list-button { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 16px; border: 0; border-radius: 14px; padding: 0 16px; color: #69400a; background: #FFF0EA; font-weight: 900; }
.starred-list-button:hover { background: #FFD8CD; }
.starred-list-title { font-size: 16px; }
.starred-list-count { color: #87662e; font-size: 13px; font-weight: 750; }
.unit-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.unit-card { display: grid; gap: 10px; min-height: 108px; border: 0; border-radius: 18px; padding: 18px; color: #172033; background: linear-gradient(135deg,#fff,#EEE9FA); text-align: left; box-shadow: 0 12px 28px rgba(33,64,96,.12); }
.unit-card:nth-child(2n) { background: linear-gradient(135deg,#fff,#FFF0EA); }
.unit-card:nth-child(3n) { background: linear-gradient(135deg,#fff,#F5E5EE); }
.unit-card:hover { transform: translateY(-2px); }
.unit-title { font-size: 25px; font-weight: 900; line-height: 1.1; }
.unit-meta { color: #536477; font-size: 14px; font-weight: 800; }
.controls { display: grid; grid-template-columns: minmax(180px,1fr) auto; gap: 12px; align-items: end; margin-bottom: 16px; padding: 14px; }
.search-box { display: grid; gap: 6px; color: #536477; font-size: 13px; font-weight: 850; }
input[type=search] { width: 100%; height: 42px; border: 1px solid #c7d7df; border-radius: 12px; padding: 0 12px; background: #FFFCFF; color: #172033; font-size: 16px; }
.button-row, .blind-actions, .blind-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.button-row button, .blind-actions button, .blind-buttons button, .spell-actions button, .spell-form button, .spell-next, .spell-complete button { min-height: 42px; border: 0; border-radius: 12px; padding: 0 13px; color: #172033; background: #F0EEF5; font-weight: 850; }
.button-row button:hover, .button-row button[aria-pressed=true], .blind-buttons button:first-child { color: #fff; background: #7656C8; }
.button-row #spellTestBtn { color: #fff; background: #EF755D; }
.button-row #spellTestBtn:hover { background: #D85D49; }
.button-row #spellTestBtn:disabled, .spell-form button:disabled, .spell-next:disabled { cursor: not-allowed; opacity: .55; }
.blind-buttons button:nth-child(2) { color: #fff; background: #EF755D; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.spell-test { position: fixed; inset: 0; z-index: 10; min-height: 100vh; overflow: auto; margin: 0; border-radius: 0; background: #fffdfa; box-shadow: none; }
.spell-topline { position: absolute; top: clamp(18px,3vh,34px); left: clamp(18px,3vw,58px); right: clamp(18px,3vw,58px); display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 14px; align-items: start; }
.spell-back { width: 42px; height: 42px; border: 0; border-radius: 50%; color: #838892; background: transparent; font-size: 36px; line-height: 1; }
.spell-back:hover { color: #172033; background: #f1f2f3; }
.spell-previous { min-width: 0; color: #90939a; }
.spell-previous-label { margin: 1px 0 5px; color: #92949b; font-size: 13px; font-weight: 750; }
.spell-previous-word { min-height: 1.1em; color: #838892; font-size: clamp(28px,4vw,40px); font-weight: 500; line-height: 1.15; overflow-wrap: anywhere; }
.spell-previous-phonetic { margin-top: 6px; color: #a0a2a8; font-size: 21px; }
.spell-previous-meaning { margin-top: 4px; color: #a0a2a8; font-size: 16px; }
.spell-progress { padding-top: 6px; color: #9699a0; font-size: 14px; font-weight: 750; white-space: nowrap; }
.spell-stage { position: absolute; top: 51%; left: 50%; display: grid; justify-items: center; gap: 14px; width: min(620px,calc(100% - 36px)); transform: translate(-50%,-50%); text-align: center; }
.spell-form { width: min(490px,100%); margin: 0; }
.spell-input { width: 100%; height: 64px; border: 0; border-bottom: 2px solid #344054; border-radius: 0; padding: 0 12px; outline: none; color: #172033; background: transparent; font-size: clamp(26px,4vw,36px); font-weight: 500; text-align: center; }
.spell-input:focus { border-color: #7656C8; box-shadow: 0 2px 0 #7656C8; }
.spell-input:disabled { color: #16803c; }
.spell-key-hint { color: #a0a2a8; font-size: 13px; }
.spell-tools { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 5px; }
.spell-sound-button { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; color: #858a92; background: transparent; }
.spell-sound-button:hover { color: #172033; background: #f0f1f2; }
.spell-sound-button svg { width: 32px; height: 32px; fill: currentColor; }
.spell-sound-button .sound-wave { fill: none; stroke: currentColor; stroke-width: 2.7; stroke-linecap: round; }
.spell-hint-button { min-height: 38px; border: 1px solid #c9cdd2; border-radius: 10px; padding: 0 14px; color: #686e78; background: transparent; font-size: 14px; font-weight: 750; }
.spell-hint-button[aria-pressed=true] { color: #5E42B8; border-color: #BBA8E8; background: #F7F3FE; }
.spell-star-button { min-height: 38px; border: 1px solid #e0bf6c; border-radius: 10px; padding: 0 14px; color: #8a6722; background: #FFF6E8; font-size: 14px; font-weight: 800; }
.spell-star-button[aria-pressed=true] { color: #fff; border-color: #EF755D; background: #EF755D; }
.spell-hint { max-width: min(560px,100%); border-radius: 12px; padding: 10px 16px; color: #636a73; background: #f2f4f5; font-size: 16px; line-height: 1.45; }
.spell-feedback { min-height: 22px; color: #b54708; font-size: 15px; font-weight: 800; }
.spell-feedback.correct { color: #16803c; }
.spell-complete { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 14px; padding: 32px; background: #fffdfa; text-align: center; }
.spell-complete h2 { color: #5E42B8; font-size: 32px; }
.spell-complete p { color: #747982; font-size: 16px; }
.spell-complete-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.spell-complete button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 16px; color: #fff; background: #7656C8; font-weight: 850; }
.spell-complete button:last-child { color: #172033; background: #F0EEF5; }
body.is-spelling { background: #fffdfa; }
body.is-spelling .topbar { display: none; }
body.is-spelling main { width: 100%; min-height: 100vh; margin: 0; padding: 0; }
body.is-spelling #unitView { min-height: 100vh; }
.blind-test { margin-bottom: 16px; overflow: hidden; }
.blind-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 16px; background: #EEE9FA; }
.blind-card { display: grid; justify-items: center; gap: 14px; padding: clamp(18px,4vw,34px); text-align: center; }
.blind-progress { color: #5E42B8; font-size: 15px; font-weight: 900; }
.blind-play { min-width: min(100%,280px); min-height: 68px; border: 0; border-radius: 18px; color: #fff; background: #EF755D; font-size: 24px; font-weight: 950; }
.blind-answer { width: min(100%,580px); border-radius: 18px; padding: 16px; background: #FFF1EC; text-align: left; }
.blind-word { color: #172033; font-size: clamp(30px,7vw,50px); font-weight: 950; overflow-wrap: anywhere; }
.blind-meaning { margin-top: 12px; color: #172033; font-size: 18px; font-weight: 850; line-height: 1.45; }
.blind-hint { max-width: 560px; color: #536477; font-size: 15px; line-height: 1.55; }
.word-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.word-card { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 12px; min-height: 122px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 10px 22px rgba(33,64,96,.09); }
.word-card.is-playing { outline: 3px solid #7656C8; }
.play-button { width: 44px; height: 44px; border: 0; border-radius: 14px; color: #fff; background: #7656C8; font-weight: 900; }
.word-main { min-width: 0; }
.word-source { margin-top: 7px; color: #8a6722; font-size: 12px; font-weight: 750; }
.word-source:empty { display: none; }
.word-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.word-no { color: #EF755D; font-size: 13px; font-weight: 900; }
.word-text { min-width: 0; border: 0; padding: 0; color: #172033; background: transparent; font-size: 25px; font-weight: 900; line-height: 1.1; text-align: left; overflow-wrap: anywhere; }
.phonetic { flex: 0 1 auto; color: #5E42B8; font-size: 15px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.star-button { flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 10px; color: #8ea0ad; background: #F0EEF5; font-size: 22px; font-weight: 950; line-height: 1; }
.star-button[aria-pressed=true] { color: #fff; background: #EF755D; }
.meaning { margin-top: 10px; color: #46576b; font-size: 16px; font-weight: 750; line-height: 1.45; }
.example { white-space: pre-line; margin-top: 8px; color: #68798c; font-size: 14px; line-height: 1.45; }
.audio-status { min-height: 18px; margin-top: 8px; color: #b54708; font-size: 13px; font-weight: 750; }
body.hide-chinese .chinese { display: none; }
.empty-state { grid-column: 1/-1; padding: 36px 18px; border-radius: 18px; color: #536477; background: #fff; text-align: center; }
@media (max-width: 820px) { .unit-grid, .word-grid { grid-template-columns: 1fr; } .controls { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .topbar { grid-template-columns: 42px minmax(0,1fr); } .count { grid-column: 2; width: fit-content; } .blind-head { display: grid; align-items: start; } }
@media (max-width: 600px) { .spell-topline { grid-template-columns: 36px minmax(0,1fr) auto; gap: 8px; } .spell-back { width: 36px; height: 36px; font-size: 31px; } .spell-previous-word { font-size: 28px; } .spell-previous-phonetic { font-size: 17px; } .spell-previous-meaning { font-size: 14px; } .spell-progress { font-size: 12px; } .spell-stage { top: 52%; } }
