:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #667085;
    --line: #e4e9f1;
    --surface: #ffffff;
    --background: #f2f5fa;
    --primary: #315ee8;
    --primary-dark: #244bc8;
    --success: #178653;
    --success-soft: #eaf8f0;
    --warning: #a76509;
    --warning-soft: #fff6df;
    --danger: #c43d4f;
    --danger-soft: #fff0f2;
}

.logout-form {
    display: inline;
    margin: 0;
}

.logout-form button {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
}

.login-card form {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.login-card input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    border: 1px solid var(--line, #d8dee9);
    border-radius: 10px;
    font-size: 1rem;
}

.login-error {
    margin-top: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 24px;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, #e5edff 0, transparent 32%),
        var(--background);
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.page {
    width: min(100%, 920px);
    margin: 0 auto;
}

.brand {
    display: block;
    margin: 25px 0 10px;
    color: var(--ink);
    text-align: center;
    text-decoration: none;
    font-size: clamp(25px, 6vw, 38px);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 24px;
}

.main-nav a {
    padding: 8px 12px;
    border-radius: 999px;
    color: #536078;
    text-decoration: none;
    font-size: 14px;
}

.main-nav a:hover {
    color: var(--primary);
    background: #e9eefc;
}

.card {
    padding: clamp(24px, 5vw, 38px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 18px 50px rgba(37, 55, 89, 0.12);
}

.dashboard-card,
.study-card,
.complete-card {
    width: min(100%, 620px);
    margin: 0 auto;
}

.today-entry-dashboard {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.today-entry-dashboard:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 60px rgba(37, 55, 89, 0.16);
}

.today-detail-card h1 {
    margin-bottom: 26px;
}

.today-detail-count {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}

.today-detail-count span,
.today-status span {
    color: var(--muted);
}

.today-detail-count strong {
    color: var(--primary);
    font-size: 28px;
}

.today-status {
    display: grid;
    gap: 6px;
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    background: #f1f4f8;
}

.finished-status {
    color: var(--success);
    background: var(--success-soft);
}


.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.dashboard-grid .dashboard-card,
.dashboard-grid .quick-links {
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
}

.task-card h2 {
    margin-bottom: 10px;
}

.task-card > p:not(.eyebrow),
.empty-copy {
    color: var(--muted);
}

.quiet-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
}

.quiet-link:hover {
    color: var(--primary);
}

.ai-panel {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 14px;
    color: #29406f;
    background: #eef3ff;
    line-height: 1.65;
}

.ai-panel p {
    margin: 8px 0 0;
}

.ai-panel small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

h1,
h2,
p {
    margin-top: 0;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.section-heading h1,
.complete-card h1 {
    margin-bottom: 25px;
    font-size: 28px;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.library-count,
.study-meta span,
.tag {
    padding: 7px 11px;
    border-radius: 999px;
    color: #536078;
    background: #f1f4f8;
    font-size: 13px;
    white-space: nowrap;
}

.active-session {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    padding: 15px 16px;
    border-radius: 14px;
    color: #27418f;
    background: #edf2ff;
}

.active-session span,
.active-session small {
    font-size: 13px;
}

.task {
    display: flex;
    justify-content: space-between;
    padding: 17px 0;
    border-bottom: 1px solid var(--line);
    font-size: 18px;
}

.task strong {
    color: var(--primary);
}

.progress-track {
    height: 9px;
    margin-top: 26px;
    overflow: hidden;
    border-radius: 99px;
    background: #e7ebf2;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #315ee8, #6a8bff);
}

.progress-copy {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.quick-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

.quick-links a {
    padding: 12px;
    border-radius: 10px;
    color: #42526d;
    background: #f3f5f9;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
}

.button {
    display: inline-flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    padding: 13px 20px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
}

.button:hover,
.choice-button:hover,
.compact-button:hover {
    transform: translateY(-1px);
}

.primary-button {
    color: #ffffff;
    background: var(--primary);
}

.primary-button:hover {
    background: var(--primary-dark);
}

.secondary-button,
.subtle-button {
    color: var(--ink);
    background: #edf1f7;
}

.study-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.word-block {
    padding: 58px 0 40px;
    text-align: center;
}

.compact-word-block {
    padding-bottom: 34px;
}

.word-block h1,
.detail-heading h1 {
    margin-bottom: 8px;
    font-size: clamp(42px, 11vw, 64px);
    letter-spacing: -0.04em;
}

.phonetic {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 18px;
}

.recognition-card {
    min-height: 410px;
    outline: none;
    cursor: pointer;
}

.recognition-card.revealed {
    cursor: default;
}

.reveal-hint {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.recognition-answer {
    padding: 0 0 10px;
    text-align: center;
}

.meaning-line {
    margin: 18px 0 0;
    line-height: 1.8;
}

.recognition-actions form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 28px;
}

.choice-button {
    min-height: 48px;
    border: 0;
    border-radius: 11px;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.known-choice {
    color: var(--success);
    background: var(--success-soft);
}

.fuzzy-choice {
    color: var(--warning);
    background: var(--warning-soft);
}

.unknown-choice {
    color: var(--danger);
    background: var(--danger-soft);
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

textarea,
.text-input,
select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #cfd7e6;
    border-radius: 11px;
    color: var(--ink);
    background: #ffffff;
    outline: none;
    font: inherit;
}

textarea {
    resize: vertical;
    line-height: 1.6;
}

textarea:focus,
.text-input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(49, 94, 232, 0.11);
}

.spelling-input {
    padding: 17px;
    text-align: center;
    font-size: 22px;
}

.spelling-prompt {
    padding: 48px 0 38px;
    text-align: center;
}

.answer-panel {
    margin-top: 26px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.answer-row {
    padding: 17px 19px;
    border-bottom: 1px solid var(--line);
}

.answer-row:last-child {
    border-bottom: 0;
}

.answer-row span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.answer-row p {
    margin-bottom: 0;
    line-height: 1.7;
}

.correct-answer {
    background: var(--success-soft);
}

.answer-word {
    margin-bottom: 5px !important;
    font-size: 30px;
    font-weight: 800;
}

.rating-prompt {
    margin: 22px 0 -8px;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}

.rating-actions,
.two-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.wrong-button {
    color: var(--danger);
    background: var(--danger-soft);
}

.correct-button {
    color: var(--success);
    background: var(--success-soft);
}

.result-symbol {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    margin: 32px auto 0;
    border-radius: 50%;
    font-size: 30px;
    font-weight: 800;
}

.success-symbol {
    color: var(--success);
    background: var(--success-soft);
}

.error-symbol {
    color: var(--danger);
    background: var(--danger-soft);
}

.complete-card {
    text-align: center;
}

.complete-card > p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.7;
}

.complete-icon {
    display: grid;
    width: 64px;
    height: 64px;
    place-items: center;
    margin: 0 auto 20px;
    border-radius: 50%;
    color: #ffffff;
    background: var(--success);
    font-size: 32px;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 26px;
}

.summary-grid div {
    padding: 18px;
    border-radius: 14px;
    background: #f4f6fa;
}

.summary-grid strong,
.summary-grid span {
    display: block;
}

.summary-grid strong {
    margin-bottom: 5px;
    font-size: 26px;
}

.summary-grid span {
    color: var(--muted);
    font-size: 13px;
}

.message {
    width: min(100%, 620px);
    margin: 0 auto 16px;
    padding: 12px 16px;
    border-radius: 10px;
    color: #8b3541;
    background: #fff0f2;
    text-align: center;
}

.filter-form {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr) auto;
    gap: 10px;
    margin-bottom: 24px;
}

.compact-button {
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    background: var(--primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.word-list {
    border-top: 1px solid var(--line);
}

.word-list-item,
.wrong-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 4px;
    border-bottom: 1px solid var(--line);
}

.word-list-item {
    color: var(--ink);
    text-decoration: none;
}

.word-list-item:hover strong,
.wrong-list-item a:hover strong {
    color: var(--primary);
}

.word-list-item strong,
.word-list-item span,
.wrong-list-item strong,
.wrong-list-item span,
.wrong-list-item small {
    display: block;
}

.word-list-item > div:first-child span,
.wrong-list-item span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.word-badges {
    display: flex;
    gap: 6px;
}

.tag {
    display: inline-block !important;
    margin: 0 !important;
    font-size: 12px !important;
}

.known-tag {
    color: var(--success);
    background: var(--success-soft);
}

.fuzzy-tag {
    color: var(--warning);
    background: var(--warning-soft);
}

.unknown-tag,
.error-tag {
    color: var(--danger);
    background: var(--danger-soft);
}

.wrong-book-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
}

.wrong-list-item > a {
    flex: 1;
    color: var(--ink);
    text-decoration: none;
}

.wrong-list-item small {
    margin-top: 7px;
    color: var(--danger);
}

.text-button {
    padding: 8px 12px;
    border: 0;
    color: var(--danger);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.empty-state {
    padding: 50px 20px;
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-top: 24px;
}

.pagination a,
.back-link {
    color: var(--primary);
    text-decoration: none;
}

.detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-top: 30px;
}

.definition-box {
    margin: 25px 0;
    padding: 20px;
    border-radius: 14px;
    background: #f5f7fb;
    line-height: 1.8;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 0 0 30px;
}

.detail-grid div {
    padding: 14px;
    border-radius: 12px;
    background: #f5f7fb;
}

.detail-grid dt {
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 12px;
}

.detail-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
    font-weight: 700;
}

.history-title {
    margin: 38px 0 15px;
    font-size: 20px;
}

.history-list {
    border-top: 1px solid var(--line);
}

.history-item {
    padding: 15px 4px;
    border-bottom: 1px solid var(--line);
}

.history-item > div {
    display: flex;
    justify-content: space-between;
}

.history-item span {
    color: var(--muted);
}

.history-item small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.history-item p {
    margin: 8px 0 0;
    color: #42526d;
}

.quick-screen-card {
    width: min(100%, 880px);
    margin: 0 auto;
}

.quick-screen-note {
    margin-bottom: 22px;
    color: var(--muted);
}

.quick-screen-list {
    max-height: 62vh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
}

.quick-screen-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(240px, 2fr) 105px;
    gap: 16px;
    align-items: center;
    padding: 13px 6px;
    border-bottom: 1px solid var(--line);
}

.quick-screen-word strong,
.quick-screen-word small {
    display: block;
}

.quick-screen-word small {
    margin-top: 3px;
    color: var(--muted);
}

.quick-screen-meaning {
    color: #42526d;
    line-height: 1.55;
}

.quick-screen-row select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: var(--surface);
    font: inherit;
}

.completed-row {
    opacity: 0.58;
}

.quick-screen-done {
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

@media (max-width: 760px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid .dashboard-card,
    .dashboard-grid .quick-links {
        grid-column: auto;
    }
    .filter-form {
        grid-template-columns: 1fr 1fr;
    }

    .filter-form .text-input {
        grid-column: 1 / -1;
    }

    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 540px) {
    body {
        padding: 14px;
    }

    .brand {
        margin-top: 16px;
    }

    .main-nav {
        margin-bottom: 18px;
    }

    .main-nav a {
        padding: 7px 9px;
        font-size: 13px;
    }

    .rating-actions,
    .two-actions,
    .quick-links {
        grid-template-columns: 1fr;
    }

    .rating-actions .button,
    .two-actions .button {
        margin-top: 16px;
    }

    .rating-actions .button + .button,
    .two-actions .button + .button {
        margin-top: 0;
    }

    .recognition-actions form {
        grid-template-columns: 1fr;
    }

    .active-session {
        grid-template-columns: 1fr;
    }

    .filter-form {
        grid-template-columns: 1fr;
    }

    .filter-form .text-input {
        grid-column: auto;
    }

    .word-list-item,
    .wrong-list-item {
        align-items: flex-start;
    }

    .word-badges {
        flex-direction: column;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .quick-screen-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
