:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --line: #d8dfeb;
    --text: #1e2430;
    --muted: #617089;
    --primary: #315efb;
    --primary-dark: #2345c4;
    --secondary: #eef2ff;
    --success: #127a43;
    --danger: #a22525;
    --shadow: 0 12px 32px rgba(30, 36, 48, 0.08);
}

html {
    -webkit-text-size-adjust: 100%;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.page-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0 0 10px;
    font-size: 30px;
}

.page-header p {
    margin: 0;
}

h1,
h2,
h3,
h4,
p,
li,
td,
th,
span {
    overflow-wrap: anywhere;
}

a {
    color: var(--primary-dark);
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}

.hero-card {
    padding: 28px;
}

.choice-grid,
.media-grid,
.recorder-grid,
.summary-grid {
    display: grid;
    gap: 16px;
}

.choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 18px;
}

.choice-btn {
    min-height: 140px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f0f4ff 100%);
    cursor: pointer;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    padding: 20px 16px;
    text-align: center;
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(49, 94, 251, 0.12);
}

.choice-letter {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
}

.btn,
button,
input,
select,
textarea {
    font: inherit;
}

.btn,
button[type="submit"],
button[type="button"],
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    padding: 12px 18px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn:hover,
button[type="submit"]:hover,
button[type="button"]:hover,
a.btn:hover {
    background: var(--primary-dark);
}

.btn[disabled],
button[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: #e8edf8;
    color: var(--text);
}

.btn-secondary:hover {
    background: #dde4f2;
}

.inline-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.spaced-top {
    margin-top: 16px;
}

.status-text,
.muted {
    color: var(--muted);
}

.clean-list,
.number-list {
    padding-left: 20px;
    margin: 10px 0 0;
}

.clean-list li,
.number-list li {
    margin-bottom: 8px;
}

.checkbox-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.checkbox-line input {
    flex: 0 0 auto;
}

.form-card,
.login-card,
.questionnaire-form,
.score-grid {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea,
input[type="file"] {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    color: var(--text);
}

input[type="checkbox"] {
    margin-top: 4px;
}

.timer-banner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #eff4ff;
    color: #173b8d;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
}

.media-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.recorder-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.full-audio {
    width: 100%;
    margin-top: 10px;
}

.lyrics-box {
    white-space: pre-wrap;
    font-size: 16px;
    line-height: 1.9;
    background: #fbfcff;
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 16px;
    overflow-x: auto;
}

.timer-text {
    margin: 10px 0 12px;
    font-weight: 600;
}

.script-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.script-head h2 {
    margin-bottom: 6px;
}

.script-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 14px;
    background: #eff4ff;
    color: #173b8d;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.script-box {
    margin-top: 14px;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fbfcff 0%, #f4f7ff 100%);
}

.script-box p {
    margin: 0;
    font-size: 18px;
    line-height: 1.9;
}

.support-note,
.table-hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 14px;
}

.submit-box {
    margin-top: 20px;
}

.progress-box {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #f7f9ff 0%, #eef3ff 100%);
}

.progress-head,
.progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-track {
    height: 12px;
    border-radius: 999px;
    background: #dfe7ff;
    overflow: hidden;
    margin: 12px 0 10px;
}

.progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary) 0%, #8ba3ff 100%);
    transition: width 0.8s ease;
}

.progress-eta {
    font-variant-numeric: tabular-nums;
}

.hidden {
    display: none !important;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 32, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 999;
}

.overlay-card {
    width: min(760px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 18px 42px rgba(15, 20, 32, 0.24);
}

.questionnaire-grid {
    display: grid;
    gap: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.flash-error {
    background: #fff2f2;
    color: var(--danger);
    border-color: #f3c8c8;
}

.flash-success {
    background: #eefbf3;
    color: var(--success);
    border-color: #b8e3c8;
}

.stack-list {
    display: grid;
    gap: 16px;
}

.expert-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.expert-audio {
    min-width: min(280px, 100%);
    width: min(360px, 100%);
}

.score-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 16px;
}

.table-card {
    overflow: hidden;
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.table-wrap th,
.table-wrap td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 12px 10px;
    vertical-align: top;
    font-size: 14px;
}

.table-wrap th {
    background: #f8faff;
    font-weight: 700;
}

.summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-box {
    background: #f8faff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}

.summary-label {
    display: block;
    color: var(--muted);
    margin-bottom: 8px;
}

.summary-value {
    font-size: 32px;
}

.centered-card {
    text-align: center;
    padding: 48px 24px;
}

@media (max-width: 720px) {
    .page-shell {
        padding: 20px max(14px, env(safe-area-inset-right)) 36px max(14px, env(safe-area-inset-left));
    }

    .page-header h1 {
        font-size: 24px;
    }

    .card {
        padding: 18px;
        border-radius: 16px;
    }

    .overlay-card {
        padding: 18px;
    }

    .choice-grid,
    .media-grid,
    .recorder-grid,
    .score-grid,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .choice-btn {
        min-height: 120px;
        font-size: 20px;
    }

    .inline-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-actions > * {
        width: 100%;
    }

    .timer-banner {
        width: 100%;
        justify-content: center;
        text-align: center;
        border-radius: 16px;
    }

    .script-badge {
        width: 100%;
        justify-content: center;
    }

    .script-box {
        padding: 16px;
    }

    .script-box p {
        font-size: 17px;
    }

    .expert-row-header {
        flex-direction: column;
        align-items: stretch;
    }

    .expert-audio {
        width: 100%;
        min-width: 0;
    }

    .lyrics-box {
        font-size: 15px;
        line-height: 1.75;
        padding: 14px;
    }

    .table-wrap table {
        min-width: 720px;
    }

    .centered-card {
        padding: 34px 18px;
    }
}

@media (max-width: 480px) {
    .page-shell {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(28px, env(safe-area-inset-bottom));
    }

    .page-header {
        margin-bottom: 18px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .card,
    .hero-card,
    .overlay-card {
        padding: 16px;
    }

    .choice-letter {
        width: 48px;
        height: 48px;
    }

    .summary-value {
        font-size: 28px;
    }
}
