* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding-bottom: 2rem;
    background: rgb(var(--mdui-color-background));
    color: rgb(var(--mdui-color-on-background));
    font-family: var(--mdui-font-family);
}

.top-loading {
    display: none;
}

/* ------- 通用 ------- */
.hidden {
    display: none !important;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel {
    padding: 1.25rem;
    border-radius: 1rem;
}

.panel-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: .75rem;
    color: rgb(var(--mdui-color-on-surface));
}

/* ------- 选诗页 ------- */
.poem-search {
    width: 100%;
}

.search-hint {
    font-size: .8rem;
    color: rgb(var(--mdui-color-on-surface-variant));
    margin: .5rem .25rem 0;
}

.poem-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: .9rem;
    color: rgb(var(--mdui-color-on-surface-variant));
}

.poem-list {
    border-radius: .75rem;
    margin-top: .5rem;
}

.poem-list mdui-list-item {
    cursor: pointer;
    border-radius: .75rem;
}

.poem-list mdui-list-item:hover {
    background: rgb(var(--mdui-color-surface-container-high));
}

.poem-item-title {
    font-weight: 600;
}

.poem-item-sub {
    font-size: .8rem;
    color: rgb(var(--mdui-color-on-surface-variant));
    margin-top: .15rem;
}

.poem-item-best {
    font-size: .8rem;
    font-weight: 600;
    color: rgb(var(--mdui-color-tertiary));
    flex-shrink: 0;
    white-space: nowrap;
}

.poem-item-best-empty {
    color: rgb(var(--mdui-color-on-surface-variant));
    font-weight: 400;
}

.select-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .5rem;
}

/* ------- 背诵页 ------- */
.head-panel {
    text-align: center;
}

.poem-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.poem-author {
    margin-top: .25rem;
    color: rgb(var(--mdui-color-on-surface-variant));
}

.poem-mode {
    display: inline-block;
    margin-top: .6rem;
    padding: .2rem .75rem;
    border-radius: 999px;
    font-size: .8rem;
    background: rgb(var(--mdui-color-secondary-container));
    color: rgb(var(--mdui-color-on-secondary-container));
}

#line-progress {
    margin: .25rem 0 .5rem;
}

.line-info {
    text-align: center;
    color: rgb(var(--mdui-color-on-surface-variant));
    font-size: .9rem;
}

/* 提示卡片 */
.hint-label {
    font-size: .85rem;
    color: rgb(var(--mdui-color-on-surface-variant));
    margin-bottom: .5rem;
    text-align: center;
}

.hint-pattern {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .1rem;
    padding: .5rem 0;
    font-size: 1.6rem;
    line-height: 2.3rem;
    letter-spacing: .08em;
    text-align: center;
}

.hint-blank {
    min-width: 1.15em;
    text-align: center;
    color: rgb(var(--mdui-color-on-surface));
    border-bottom: 2px solid rgb(var(--mdui-color-outline));
}

.hint-punct {
    color: rgb(var(--mdui-color-primary));
}

.hint-meta {
    text-align: center;
    color: rgb(var(--mdui-color-on-surface-variant));
    font-size: .9rem;
    margin-top: .25rem;
}

.hint-actions {
    display: flex;
    justify-content: center;
    gap: .5rem;
    margin-top: .5rem;
}

.origin-line {
    margin-top: .75rem;
    padding: .75rem;
    border-radius: .75rem;
    background: rgb(var(--mdui-color-surface-container-high));
    text-align: center;
    font-size: 1.15rem;
    letter-spacing: .05em;
}

/* 模式切换 */
.mode-switch {
    display: flex;
    justify-content: center;
    gap: .5rem;
}

/* 输入区 */
.action-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}

/* 语音 */
.voice-status {
    text-align: center;
    color: rgb(var(--mdui-color-on-surface-variant));
    margin-bottom: .5rem;
}

.voice-status.listening {
    color: rgb(var(--mdui-color-primary));
    font-weight: 600;
}

.voice-status.listening::before {
    content: '';
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: rgb(var(--mdui-color-error));
    margin-right: .4rem;
    vertical-align: middle;
    animation: blink 1s infinite;
}

@keyframes blink {
    50% {
        opacity: .2;
    }
}

.voice-transcript {
    padding: .75rem;
    border-radius: .75rem;
    background: rgb(var(--mdui-color-surface-container-high));
    font-size: 1.05rem;
    line-height: 1.6;
    min-height: 2.5rem;
}

.voice-actions {
    justify-content: center;
}

.mic-btn.listening {
    animation: micPulse 1.2s infinite;
}

.mic-btn {
    width: fit-content !important;
}

@keyframes micPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--mdui-color-error), .45);
    }
    100% {
        box-shadow: 0 0 0 14px rgba(var(--mdui-color-error), 0);
    }
}

/* 反馈 */
.feedback-head {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    flex-wrap: wrap;
}

.feedback-score {
    font-size: 2rem;
    font-weight: 800;
}

.feedback-score.score-good {
    color: rgb(var(--mdui-color-primary));
}

.feedback-score.score-bad {
    color: rgb(var(--mdui-color-error));
}

.feedback-verdict {
    font-size: 1.05rem;
    font-weight: 600;
}

.feedback-stats {
    color: rgb(var(--mdui-color-on-surface-variant));
    font-size: .9rem;
    margin: .35rem 0;
}

.diff {
    padding: .75rem;
    border-radius: .75rem;
    background: rgb(var(--mdui-color-surface-container-high));
    font-size: 1.35rem;
    line-height: 2.1;
    letter-spacing: .06em;
    text-align: center;
}

.diff-correct {
    color: #2e7d32;
}

.diff-wrong {
    color: rgb(var(--mdui-color-error));
    text-decoration: underline wavy rgb(var(--mdui-color-error)) .08em;
}

.diff-punct {
    color: rgb(var(--mdui-color-on-surface-variant));
}

.diff-extras {
    margin-top: .5rem;
    color: rgb(var(--mdui-color-secondary));
    font-size: .9rem;
    text-align: center;
}

.feedback-actions {
    justify-content: flex-end;
}

.recite-actions {
    display: flex;
    justify-content: center;
    gap: .5rem;
    flex-wrap: wrap;
}

/* 等级颜色 */
.g-green {
    color: #2e7d32;
}

.g-lime {
    color: #558b2f;
}

.g-orange {
    color: #ef6c00;
}

.g-red {
    color: #c62828;
}

.mdui-theme-dark .g-green,
.mdui-theme-dark .diff-correct {
    color: #81c784;
}

.mdui-theme-dark .g-lime {
    color: #aed581;
}

.mdui-theme-dark .g-orange {
    color: #ffb74d;
}

.mdui-theme-dark .g-red {
    color: #ef9a9a;
}

@media (prefers-color-scheme: dark) {

    .g-green,
    .diff-correct {
        color: #81c784;
    }

    .g-lime {
        color: #aed581;
    }

    .g-orange {
        color: #ffb74d;
    }

    .g-red {
        color: #ef9a9a;
    }
}

/* ------- 结果页 ------- */
.result-panel {
    text-align: center;
}

.result-score {
    font-size: 3rem;
    font-weight: 800;
    color: rgb(var(--mdui-color-primary));
}

.result-title {
    color: rgb(var(--mdui-color-on-surface-variant));
    margin-top: .25rem;
}

.stat-row {
    display: flex;
    justify-content: space-around;
    gap: .5rem;
    margin: 1.25rem 0;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 700;
}

#stat-pass {
    color: rgb(var(--mdui-color-primary));
}

#stat-review {
    color: rgb(var(--mdui-color-error));
}

#stat-skip {
    color: rgb(var(--mdui-color-tertiary));
}

.stat-label {
    font-size: .8rem;
    color: rgb(var(--mdui-color-on-surface-variant));
}

.grade-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: .75rem;
}

.grade-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    background: rgb(var(--mdui-color-surface-container-high));
    font-size: .85rem;
}

.grade-dot {
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: currentColor;
}

.weak-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.weak-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    border-radius: .75rem;
    background: rgb(var(--mdui-color-surface-container-high));
}

.weak-index {
    color: rgb(var(--mdui-color-on-surface-variant));
    font-size: .8rem;
    flex-shrink: 0;
}

.weak-text {
    flex: 1;
    line-height: 1.5;
}

.weak-score {
    flex-shrink: 0;
    font-weight: 700;
    font-size: .9rem;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
}
