*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f2f2ed;
    color: #1a1a1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Nav ── */
nav {
    background: #1a1a1a;
    color: #fff;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.nav-logo {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    letter-spacing: 0.05em;
}

.mode-toggle {
    display: flex;
    gap: 2px;
    background: #333;
    border-radius: 7px;
    padding: 3px;
}

.mode-toggle a {
    color: #999;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 5px;
    transition: background 0.12s, color 0.12s;
}

.mode-toggle a.active {
    background: #555;
    color: #fff;
}

.nav-links a {
    color: #999;
    text-decoration: none;
    margin-left: 24px;
    font-size: 14px;
    transition: color 0.12s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #fff;
}

.nav-email {
    color: #555;
    font-size: 13px;
    margin-left: 24px;
}

/* ── Main ── */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

/* ── State messages (no_words / all_done) ── */
.state-message {
    text-align: center;
    max-width: 400px;
}

.state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.state-message h2 {
    font-size: 26px;
    margin-bottom: 10px;
}

.state-message p {
    color: #666;
    font-size: 15px;
    line-height: 1.6;
}

.state-message code {
    background: #e8e8e4;
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
}

/* ── Review card ── */
.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.07);
    padding: 40px 44px;
    max-width: 700px;
    width: 100%;
}

/* Remaining counter */
.remaining {
    font-size: 12px;
    color: #bbb;
    text-align: right;
    margin-bottom: 16px;
}

/* Word badge */
.word-badge {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.word-chinese {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

.word-pinyin {
    font-size: 15px;
    color: #888;
}

.word-pos {
    font-size: 11px;
    color: #aaa;
    background: #f0f0ec;
    padding: 2px 9px;
    border-radius: 10px;
    margin-left: auto;
}

/* Sentence */
.sentence-area {
    margin-bottom: 36px;
    text-align: center;
    padding: 8px 0;
}

.sentence {
    font-size: 34px;
    line-height: 1.7;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

.sentence mark {
    background: #ffe566;
    border-radius: 3px;
    padding: 0 3px;
    font-style: normal;
}

/* Listening play button */
.listening-area {
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #1a1a1a;
    padding: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, transform 0.1s;
}

.play-btn:hover {
    background: #f0f0ec;
}

.play-btn:active {
    transform: scale(0.9);
}

.play-btn.playing {
    color: #2ea05a;
}

/* Reveal area */
.reveal-area {
    border-top: 1px solid #eee;
    padding-top: 24px;
    margin-bottom: 32px;
}

.sentence-revealed {
    font-size: 22px;
    text-align: center;
    margin-bottom: 12px;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

.sentence-pinyin {
    font-size: 16px;
    color: #999;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.sentence-english {
    font-size: 16px;
    color: #555;
    font-style: italic;
    text-align: center;
    margin-bottom: 22px;
    line-height: 1.5;
}

.word-details {
    background: #f7f7f3;
    border-radius: 10px;
    padding: 18px 20px;
}

.word-def-en {
    font-size: 15px;
    color: #222;
    margin-bottom: 8px;
    font-weight: 500;
}

.word-def-zh {
    font-size: 14px;
    color: #555;
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    line-height: 1.65;
}

.note {
    font-size: 13px;
    color: #888;
    margin-top: 10px;
    line-height: 1.55;
    padding-top: 10px;
    border-top: 1px solid #eae9e4;
}

.note-zh {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
}

.btn {
    font-size: 16px;
    font-weight: 500;
    padding: 13px 32px;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: filter 0.12s;
}

.btn:hover {
    filter: brightness(0.9);
}

.btn:active {
    filter: brightness(0.8);
}

.btn-reveal {
    background: #1a1a1a;
    color: #fff;
    width: 100%;
    max-width: 340px;
}

.btn-boost {
    margin-top: 12px;
    background: #444;
}

.rating-btns {
    display: flex;
    gap: 12px;
    width: 100%;
}

.btn-fail  { background: #e05252; color: #fff; flex: 1; }
.btn-kinda { background: #e8960a; color: #fff; flex: 1; }
.btn-pass  { background: #2ea05a; color: #fff; flex: 1; }

/* ── Settings ── */
.settings-container {
    max-width: 500px;
    width: 100%;
}

.settings-container h2 {
    font-size: 22px;
    margin-bottom: 28px;
}

.field {
    margin-bottom: 24px;
}

.field label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #444;
    margin-bottom: 8px;
}

.field select,
.field input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    cursor: pointer;
    margin-bottom: 8px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1a1a1a;
}

.field-hint {
    font-size: 13px;
    color: #999;
    line-height: 1.55;
}

.settings-container .btn-reveal {
    max-width: none;
    width: auto;
    padding: 12px 28px;
    margin-bottom: 36px;
}

.stats {
    background: #f7f7f3;
    border-radius: 10px;
    padding: 20px 24px;
}

.stats h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #aaa;
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: #444;
    padding: 6px 0;
    border-bottom: 1px solid #eee;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-value {
    font-weight: 600;
    color: #1a1a1a;
}

/* ── Auth ── */
.auth-container {
    max-width: 380px;
    width: 100%;
}

.auth-container h2 {
    font-size: 22px;
    margin-bottom: 24px;
}

.auth-container .field input[type="email"],
.auth-container .field input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    margin-bottom: 8px;
}

.auth-container .btn-reveal {
    width: 100%;
    max-width: none;
    margin-bottom: 20px;
}

.auth-error {
    background: #fdecea;
    color: #b91c1c;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-switch {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 20px;
}

.auth-switch a {
    color: #1a1a1a;
    font-weight: 500;
}

.cross-refs {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.cross-ref {
    font-size: 13px;
    color: #888;
    margin: 4px 0 0;
}

.cross-ref strong {
    color: #555;
}

.lang-toggle {
    font-size: 13px;
    color: #888;
    text-decoration: none;
    padding: 2px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-left: 4px;
}

.lang-toggle:hover {
    color: #333;
    border-color: #aaa;
}

.welcome-banner {
    background: #eef6ee;
    border: 1px solid #b4d9b4;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
    color: #1a3a1a;
}

/* ── Homepage ── */
.home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 64px 24px 48px;
    max-width: 860px;
    margin: 0 auto;
    width: 100%;
}

.home-hero {
    text-align: center;
    margin-bottom: 64px;
}

.home-title {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.home-subtitle {
    font-size: 18px;
    color: #555;
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto 36px;
}

.home-actions {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
}

.home-actions .btn {
    width: auto;
    max-width: none;
    padding: 14px 36px;
    font-size: 16px;
}

.btn-link {
    color: #555;
    text-decoration: none;
    font-size: 15px;
}

.btn-link:hover {
    color: #1a1a1a;
}

.btn-nav-cta {
    background: #fff;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 7px;
    margin-left: 16px;
    transition: background 0.12s;
}

.btn-nav-cta:hover {
    background: #e8e8e4;
}

.home-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
    width: 100%;
}

.feature {
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.feature-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ── Utility ── */
.hidden {
    display: none !important;
}
