/* 天空蓝系配色 - 与英语单词消消乐保持一致 */
:root {
    --primary: #4D96FF;
    --primary-dark: #3A7BD5;
    --primary-light: #7BB0FF;
    --primary-lighter: #E8F0FF;
    --bg-main: #FFF9E6;
    --bg-card: #FFFFFF;
    --text-primary: #555555;
    --text-secondary: #888888;
    --border: rgba(77, 150, 255, 0.14);
    --shadow: rgba(77, 150, 255, 0.08);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(201, 177, 255, 0.22), transparent 28%),
        radial-gradient(circle at top right, rgba(255, 217, 61, 0.18), transparent 24%),
        linear-gradient(180deg, #fffdf4 0%, #fff7e7 100%);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(77, 150, 255, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

.nav-home {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s ease;
}

.nav-home:hover {
    color: var(--primary);
    transform: translateX(-2px);
}

.nav-icon {
    font-size: 20px;
}

.nav-brand {
    color: var(--primary);
}

.container {
    max-width: 900px;
    margin: 30px auto 0;
    position: relative;
    z-index: 1;
}

.decor-element {
    position: fixed;
    font-size: 30px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.decor-cloud-1 { top: 5%; left: 5%; animation: float 8s ease-in-out infinite; }
.decor-cloud-2 { top: 15%; right: 10%; animation: float 10s ease-in-out infinite reverse; }
.decor-cloud-3 { bottom: 10%; left: 20%; animation: float 12s ease-in-out infinite; }
.decor-star-1 { top: 20%; left: 80%; animation: twinkle 2s ease-in-out infinite; }
.decor-star-2 { top: 60%; right: 5%; animation: twinkle 3s ease-in-out infinite; }
.decor-bubble-1 { top: 30%; left: 10%; animation: bounce 4s ease-in-out infinite; }
.decor-bubble-2 { bottom: 20%; right: 15%; animation: bounce 5s ease-in-out infinite; }
.decor-heart-1 { top: 70%; left: 15%; animation: float 6s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* 头部 */
.header {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-bottom: 24px;
    border: 3px solid white;
    box-shadow: 0 20px 50px rgba(77, 150, 255, 0.08);
}

.header h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-shadow: 3px 3px 0 rgba(77, 150, 255, 0.08);
}

.header p {
    margin-top: 8px;
    opacity: 0.8;
    font-size: 16px;
    color: var(--text-secondary);
}

/* 设置面板 */
.settings-panel {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 24px;
    border: 3px solid white;
    box-shadow: 0 20px 50px rgba(77, 150, 255, 0.08);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    border: 1px solid rgba(77, 150, 255, 0.14);
    border-radius: 15px;
    padding: 16px;
    background: white;
}

.setting-group h3 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(77, 150, 255, 0.14);
}

.setting-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    cursor: pointer;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item input[type="radio"],
.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    accent-color: var(--primary);
    cursor: pointer;
}

.setting-item label {
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 15px;
    border: 1px solid rgba(77, 150, 255, 0.14);
}

.checkbox-group .setting-item {
    flex: 1 1 20%;
    min-width: 120px;
}

.custom-count-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-count-item input[type="number"] {
    width: 60px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-family: inherit;
}

/* 按钮 */
.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    position: relative;
}

.btn:hover {
    transform: translateY(-4px);
}

.btn:active {
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary);
    flex: 1;
    box-shadow: 0 16px 30px rgba(77, 150, 255, 0.24);
}

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

.btn-secondary {
    background: var(--primary);
    color: white;
}

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

/* 题目区域 */
.questions-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 24px;
    border: 3px solid white;
    box-shadow: 0 20px 50px rgba(77, 150, 255, 0.08);
    display: none;
}

.questions-section.show {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(77, 150, 255, 0.14);
}

.section-title {
    font-size: 18px;
    color: var(--primary);
    font-weight: 600;
}

.question-count {
    font-size: 14px;
    color: var(--text-secondary);
}

.questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.question-item {
    background: white;
    padding: 16px;
    border-radius: 15px;
    text-align: center;
    font-size: 14px;
    border: 1px solid rgba(77, 150, 255, 0.08);
    transition: all 0.3s ease;
    min-width: 200px;
}

.question-item:hover {
    background: rgba(77, 150, 255, 0.06);
    transform: translateY(-4px);
}

.question-num {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.question-text {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.question-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.question-input {
    width: 70px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
    font-size: 15px;
    font-family: inherit;
    flex-shrink: 0;
}

.question-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-lighter);
}

.question-input.correct {
    background: #D4EDDA;
    border-color: #28A745;
    color: #155724;
}

.question-input.wrong {
    background: #F8D7DA;
    border-color: #DC3545;
    color: #721C24;
}

.question-result {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.question-result.correct {
    color: #28A745;
}

.question-result.wrong {
    color: #DC3545;
}

/* 答案区域 */
.answers-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 24px;
    border: 3px solid white;
    box-shadow: 0 20px 50px rgba(77, 150, 255, 0.08);
    display: none;
}

.answers-section.show {
    display: block;
}

.answers-toggle {
    cursor: pointer;
    user-select: none;
}

.answers-toggle::before {
    content: '▶ ';
    font-size: 12px;
    transition: transform 0.3s;
}

.answers-toggle.expanded::before {
    content: '▼ ';
}

.answers-content {
    display: none;
    margin-top: 16px;
}

.answers-content.show {
    display: block;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.answer-item {
    background: rgba(77, 150, 255, 0.06);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
}

.answer-num {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 错题本 */
.wrong-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 24px;
    border: 3px solid white;
    box-shadow: 0 20px 50px rgba(77, 150, 255, 0.08);
    display: none;
}

.wrong-section.show {
    display: block;
}

.wrong-list {
    margin-top: 16px;
}

.wrong-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(77, 150, 255, 0.08);
    border-left: 4px solid var(--primary);
}

.wrong-question {
    font-weight: 500;
}

.wrong-answer {
    color: var(--primary-dark);
    font-weight: 600;
}

/* 统计信息 */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(77, 150, 255, 0.06);
    border-radius: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 打印样式 */
@media print {
    @page {
        margin: 12mm 12mm 18mm;
        size: A4;
    }

    body {
        background: white;
        padding: 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        min-height: auto;
        font-size: 12pt;
    }

    .header {
        background: none;
        color: var(--text-primary);
        border-bottom: 2px solid var(--primary);
        margin-bottom: 16px;
        padding: 16px 0;
        text-align: center;
    }

    .header h1 {
        text-align: center;
        margin: 0;
    }

    .settings-panel,
    .answers-section,
    .wrong-section,
    .btn-group,
    .stats-bar {
        display: none !important;
    }

    .questions-section {
        display: block !important;
        box-shadow: none;
        padding: 0 0 18mm;
        margin-bottom: 0;
        border-radius: 0;
    }

    .questions-grid {
        display: block;
        column-count: 2;
        column-gap: 8mm;
    }

    .question-item {
        border: 1px solid #ccc;
        display: block;
        width: 100%;
        margin: 0 0 4mm;
        padding: 10px 12px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .question-input,
    .question-result {
        display: none !important;
    }

    .question-text::after {
        content: " __________";
    }

    .print-footer {
        display: none !important;
    }

    .print-watermark-layer {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        pointer-events: none;
        z-index: 0;
        overflow: hidden;
    }

    .print-watermark {
        position: absolute;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-22deg);
        font-size: 38pt;
        font-weight: 700;
        letter-spacing: 4px;
        color: rgba(77, 150, 255, 0.08);
        white-space: nowrap;
    }

    .print-page-footer-layer {
        display: block !important;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        pointer-events: none;
        z-index: 2;
        overflow: hidden;
    }

    .print-page-footer {
        position: absolute;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 4mm 0 0;
        border-top: 1px solid #ccc;
        font-size: 10pt;
        color: #666;
        background: rgba(255, 255, 255, 0.92);
    }

    .container,
    .header,
    .questions-section,
    .questions-grid {
        position: relative;
        z-index: 1;
    }

    .site-footer {
        display: none !important;
    }
}

.print-footer {
    display: none;
}

.print-page-footer-layer {
    display: none;
}

.print-watermark-layer {
    display: none;
}

.site-footer {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 30px 20px 22px;
    text-align: center;
    color: #888;
    font-size: 13px;
    margin-top: 50px;
}

.site-footer p {
    margin: 0;
}

.pdf-render-root {
    position: fixed;
    top: 0;
    left: -99999px;
    width: 210mm;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.pdf-page {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 210mm;
    height: 297mm;
    padding: 12mm 12mm 18mm;
    box-sizing: border-box;
    background: #fff;
    color: #555555;
    overflow: hidden;
}

.pdf-page + .pdf-page {
    margin-top: 12mm;
}

.pdf-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-22deg);
    font-size: 36pt;
    font-weight: 700;
    letter-spacing: 4px;
    color: rgba(77, 150, 255, 0.08);
    white-space: nowrap;
    pointer-events: none;
}

.pdf-page-header {
    position: relative;
    z-index: 1;
    padding: 0;
}

.pdf-header-card {
    padding: 6mm 8mm 5mm;
    background: linear-gradient(180deg, #ffffff 0%, #fffdf4 100%);
    border-radius: 6mm;
    border: 1px solid rgba(77, 150, 255, 0.14);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 2mm 5mm rgba(77, 150, 255, 0.08);
}

.pdf-header-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4mm;
    text-align: center;
}

.pdf-header-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10mm;
    height: 10mm;
    border-radius: 3mm;
    background: #fff7ef;
    border: 1px solid #f3d9b8;
    font-size: 18px;
    flex-shrink: 0;
}

.pdf-header-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pdf-page-title {
    font-size: 22pt;
    font-weight: 700;
    color: #555555;
}

.pdf-page-subtitle {
    margin-top: 1.5mm;
    font-size: 11pt;
    color: #888888;
}

.pdf-section-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8mm;
    margin-top: 7mm;
    padding: 0 1mm 3mm;
    border-bottom: 1px solid rgba(77, 150, 255, 0.14);
}

.pdf-section-title {
    font-size: 16pt;
    font-weight: 700;
    color: var(--primary);
}

.pdf-section-meta {
    display: flex;
    align-items: center;
    gap: 6mm;
    font-size: 10pt;
    color: #888888;
    white-space: nowrap;
}

.pdf-questions-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4mm 6mm;
    margin-top: 5mm;
    align-content: start;
}

.pdf-question-item {
    min-height: 14mm;
    padding: 4mm;
    border: 1px solid rgba(77, 150, 255, 0.14);
    border-radius: 3mm;
    background: #FFF9E6;
}

.pdf-question-num {
    font-size: 9pt;
    color: #888888;
}

.pdf-question-text {
    margin-top: 2mm;
    font-size: 13pt;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.pdf-question-text.is-empty {
    color: transparent;
}

.pdf-page-footer {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6mm;
    margin-top: auto;
    padding-top: 4mm;
    border-top: 1px solid #ccc;
    font-size: 10pt;
    color: #666;
    background: rgba(255, 255, 255, 0.92);
    z-index: 1;
    flex-shrink: 0;
}

.pdf-preview-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pdf-preview-modal.show {
    display: flex;
}

.pdf-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(77, 150, 255, 0.45);
}

.pdf-preview-dialog {
    position: relative;
    width: min(92vw, 1100px);
    height: min(90vh, 860px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.pdf-preview-header,
.pdf-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
}

.pdf-preview-header {
    border-bottom: 1px solid var(--border);
}

.pdf-preview-header h3 {
    font-size: 18px;
    color: var(--primary);
}

.pdf-preview-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.pdf-preview-body {
    flex: 1;
    padding: 12px;
    background: #FFF9E6;
}

.pdf-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    border-radius: 12px;
}

.pdf-preview-actions {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

/* 响应式 */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        max-width: 100%;
    }

    .header {
        padding: 20px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

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

    .header p {
        font-size: 13px;
    }

    .settings-panel {
        padding: 16px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }

    .setting-group {
        padding: 12px;
        border-radius: 10px;
    }

    .setting-group h3 {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .setting-item {
        margin-bottom: 6px;
    }

    .setting-item input[type="radio"],
    .setting-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 8px;
    }

    .setting-item label {
        font-size: 13px;
    }

    .checkbox-group {
        padding: 12px;
        border-radius: 10px;
        gap: 8px;
    }

    .checkbox-group .setting-item {
        flex: 1 1 45%;
        min-width: 100px;
    }

    .custom-count-item input[type="number"] {
        width: 50px;
        height: 26px;
        font-size: 13px;
    }

    .btn-group {
        gap: 8px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 50px;
    }

    .btn span {
        font-size: 12px;
    }

    .questions-section,
    .answers-section,
    .wrong-section {
        padding: 16px;
        border-radius: 16px;
        margin-bottom: 16px;
    }

    .section-header {
        margin-bottom: 16px;
        padding-bottom: 10px;
    }

    .section-title {
        font-size: 16px;
    }

    .question-count {
        font-size: 13px;
    }

    .stats-bar {
        gap: 16px;
        padding: 12px;
        margin-bottom: 16px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .questions-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .question-item {
        padding: 12px;
        border-radius: 8px;
        font-size: 13px;
        min-width: auto;
    }

    .question-num {
        font-size: 11px;
    }

    .question-input {
        width: 60px;
        height: 28px;
        font-size: 14px;
    }

    .question-result {
        font-size: 11px;
    }

    .answers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .answer-item {
        padding: 10px;
        font-size: 13px;
    }

    .answer-num {
        font-size: 11px;
    }

    .wrong-item {
        padding: 10px 12px;
        border-radius: 6px;
        margin-bottom: 6px;
    }

    .wrong-question {
        font-size: 13px;
    }

    .wrong-answer {
        font-size: 13px;
    }

    .site-footer {
        padding: 14px 16px 18px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .header {
        padding: 16px;
        border-radius: 12px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header p {
        font-size: 12px;
    }

    .settings-panel {
        padding: 12px;
        border-radius: 12px;
    }

    .settings-grid {
        gap: 10px;
    }

    .setting-group {
        padding: 10px;
    }

    .setting-group h3 {
        font-size: 12px;
    }

    .setting-item label {
        font-size: 12px;
    }

    .checkbox-group {
        padding: 10px;
        gap: 6px;
    }

    .checkbox-group .setting-item {
        flex: 1 1 48%;
        min-width: 80px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
        justify-content: center;
    }

    .questions-section,
    .answers-section,
    .wrong-section {
        padding: 12px;
        border-radius: 12px;
    }

    .section-title {
        font-size: 15px;
    }

    .stats-bar {
        gap: 12px;
        padding: 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .question-item {
        padding: 10px;
        font-size: 12px;
    }

    .question-input {
        width: 55px;
        height: 26px;
        font-size: 13px;
    }

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

    .wrong-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .site-footer {
        padding: 12px 16px;
        font-size: 12px;
    }
}
