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

html {
    scroll-behavior: smooth;
}

/* 自定义滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.screen {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    animation: fadeIn 0.3s ease-in;
    max-height: 92vh;
    overflow-y: auto;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 主菜单 */
.title {
    text-align: center;
    font-size: 3em;
    color: #667eea;
    margin-bottom: 40px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 首页大兔子 */
.home-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 35px;
}

.home-rabbit {
    font-size: 4.2em;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.28));
    cursor: pointer;
    animation: homeRabbitIdle 2.2s ease-in-out infinite;
}

/* 首页兔子被点时的小跳跃动画 */
.home-rabbit.jump {
    animation: homeRabbitJump 0.6s ease;
}

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

@keyframes homeRabbitJump {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(-14px) scale(1.05); }
    60% { transform: translateY(0) scale(1); }
    80% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

.home-hero-text {
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
}

.home-hero-text strong {
    color: #667eea;
}


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

.menu-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 30px 20px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

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

.subtitle {
    font-size: 0.5em;
    opacity: 0.9;
}

.score-display {
    text-align: center;
    margin-top: 20px;
}

.total-stars {
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
}

/* 游戏界面 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.back-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #e0e0e0;
}

.stars {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.8em;
}

/* 小兔子小助手 */
.rabbit-helper {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    pointer-events: auto;
}

.rabbit-emoji {
    font-size: 2.6em;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
    animation: bunnyBounce 1.2s ease-in-out infinite;
}

.rabbit-bubble {
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9em;
    color: #444;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.rabbit-bubble.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

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


/* 设置区域 */
.settings {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1em;
    flex-wrap: wrap;
}

.settings label {
    font-weight: bold;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 5px;
}

.settings input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.settings input[type="range"] {
    width: 150px;
    cursor: pointer;
}

.settings span {
    font-weight: bold;
    color: #764ba2;
    min-width: 30px;
}

#dotsFlashSettings {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 骰子游戏 */
.dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    min-height: 150px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.dice {
    width: 80px;
    height: 80px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 10px;
    gap: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: diceRoll 0.5s ease;
}

@keyframes diceRoll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.dice-dot {
    width: 100%;
    height: 100%;
    background: #667eea;
    border-radius: 50%;
}

.question {
    text-align: center;
    font-size: 1.3em;
    color: #333;
    margin: 12px 0;
}

.flash-hint {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    margin-top: 6px;
}

/* 点数游戏 */
.dots-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    min-height: 110px;
    margin: 12px auto 15px;
    padding: 10px 12px;
    max-width: 280px;
    background: #f8f9fa;
    border-radius: 12px;
    justify-items: center;
    align-items: center;
}

.dot {
    width: 24px;
    height: 24px;
    background: #667eea;
    border-radius: 50%;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* 神秘数字大探险 */
.mystery-intro {
    text-align: center;
    font-size: 1em;
    color: #555;
    margin-bottom: 15px;
}

.mystery-hints {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px 16px;
    min-height: 60px;
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.mystery-hint-line {
    font-size: 0.95em;
    color: #444;
    margin-bottom: 4px;
}

.mystery-visual {
    text-align: center;
    margin-bottom: 15px;
}

.mystery-guess-title {
    text-align: center;
    color: #555;
    margin-top: 10px;
    margin-bottom: 8px;
}

.mystery-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
    gap: 10px;
    margin: 10px 0 30px;
    max-height: 200px;
    overflow-y: auto;
}

.mystery-options .option-btn {
    font-size: 1.3em;
    padding: 10px 0;
}

.mystery-dots.dots-container {
    max-width: 260px;
    margin-top: 8px;
}

.mystery-dots .dot {
    width: 20px;
    height: 20px;
}

/* 神秘数字答对时的超级庆祝动画 */
.mystery-celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: celebrationFadeIn 0.3s ease;
}

@keyframes celebrationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.celebration-content {
    text-align: center;
    animation: celebrationBounce 0.6s ease;
}

@keyframes celebrationBounce {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    70% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.celebration-emoji {
    font-size: 8em;
    animation: emojiSpin 1s ease infinite;
}

@keyframes emojiSpin {
    0%, 100% {
        transform: rotate(-10deg) scale(1);
    }
    50% {
        transform: rotate(10deg) scale(1.1);
    }
}

.celebration-text {
    font-size: 3.5em;
    font-weight: bold;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    margin: 20px 0 10px;
    animation: textPulse 1s ease infinite;
}

.celebration-subtitle {
    font-size: 1.8em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
}

@keyframes textPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.celebration-stars {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.celebration-stars .star {
    font-size: 3em;
    display: inline-block;
    animation: starPop 0.6s ease forwards;
}

.celebration-stars .star:nth-child(1) {
    animation-delay: 0.2s;
}

.celebration-stars .star:nth-child(2) {
    animation-delay: 0.4s;
}

.celebration-stars .star:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes starPop {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* 彩带/彩纸效果 */
.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.8;
    z-index: 9998;
    animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}



/* 数学题目 */
.math-question {
    text-align: center;
    font-size: 3em;
    color: #333;
    margin: 30px 0;
    font-weight: bold;
}

/* 选项按钮 */
.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin: 20px 0 30px 0;
}

.option-btn {
    background: #f8f9fa;
    border: 3px solid #667eea;
    border-radius: 15px;
    padding: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.option-btn:active {
    transform: scale(0.95);
}

.option-btn.correct {
    background: #4caf50;
    color: white;
    border-color: #4caf50;
    animation: bounce 0.5s ease;
}

.option-btn.wrong {
    background: #f44336;
    color: white;
    border-color: #f44336;
    animation: shake 0.5s ease;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.start-btn {
    display: block;
    margin: 20px auto 30px auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 20px 40px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* 反馈动画 */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.feedback.show {
    opacity: 1;
    animation: feedbackPop 0.6s ease;
}

@keyframes feedbackPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 结果显示 */
.result-display {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin: 12px 0 15px 0;
    text-align: center;
    font-size: 1.1em;
    border: 2px solid #667eea;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-display .correct-answer {
    color: #4caf50;
    font-weight: bold;
    font-size: 1.5em;
    margin: 10px 0;
}

.result-display .show-dots {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    justify-items: center;
    margin: 12px auto;
    max-width: 260px;
}

.result-display .show-dots .dot {
    width: 24px;
    height: 24px;
}

/* 计算点数游戏 */
.points-target-selection {
    text-align: center;
    padding: 20px;
}

.points-intro {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 30px;
}

.target-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.target-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    padding: 40px 20px;
    font-size: 1.8em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.target-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.target-subtitle {
    font-size: 0.5em;
    opacity: 0.9;
}

.points-game-area {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.points-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 12px;
    font-size: 1.2em;
    font-weight: bold;
}

.points-target {
    color: #667eea;
}

.points-current {
    color: #764ba2;
}

.points-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    min-height: 120px;
}

.points-card {
    background: white;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.points-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.points-card.selected {
    background: #667eea;
    border-color: #764ba2;
    transform: translateY(-8px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.points-card.selected .card-value {
    color: white;
}

.points-card.selected .card-dots {
    color: white;
}

.card-value {
    font-size: 1.6em;
    font-weight: bold;
    color: #667eea;
}

.card-dots {
    font-size: 0.7em;
    color: #764ba2;
    line-height: 1.1;
    max-width: 55px;
    word-wrap: break-word;
}

.points-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 12px 0 10px 0;
    flex-wrap: wrap;
}

.action-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.reset-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.action-btn.back-btn {
    background: #f0f0f0;
    color: #333;
}

/* 练习题生成器 */
.worksheet-settings {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.setting-group {
    margin-bottom: 20px;
}

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

.setting-label {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.setting-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.setting-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.setting-btn:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.setting-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.generate-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.print-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.print-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
}

.worksheet-preview {
    margin-top: 20px;
}

.preview-header {
    text-align: center;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.preview-header h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 1.3em;
}

.preview-info {
    color: #666;
    font-size: 0.95em;
    margin-bottom: 12px;
}

.preview-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.regenerate-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.regenerate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.3);
}

.a4-preview-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow-y: auto;
    max-height: 70vh;
}

.a4-page {
    width: 210mm;
    min-height: 297mm;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 8mm 15mm;
    box-sizing: border-box;
}

.worksheet-content {
    background: white;
}

.worksheet-title {
    text-align: center;
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    margin-top: 0;
    margin-bottom: 8px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.worksheet-subtitle {
    text-align: center;
    color: #666;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 5px;
    font-size: 0.85em;
    line-height: 1.4;
}

.worksheet-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 3px;
    padding: 12px 15px;
    page-break-inside: avoid;
    border-radius: 25px;
}

/* 三数计算每行2题 */
.worksheet-row.three-number-row {
    grid-template-columns: repeat(2, 1fr);
}

.worksheet-row.row-highlight {
    background-color: #b8c9d9;
}

.worksheet-problem {
    font-size: 1.2em;
    font-weight: 500;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-family: 'Arial', 'Helvetica', sans-serif;
    padding: 0 10px;
}

/* 数字部分 */
.equation-part {
    min-width: 28px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', 'Consolas', monospace;
}

/* 运算符 */
.operator {
    text-align: center;
    min-width: 20px;
    margin: 0 6px;
    font-family: 'Courier New', 'Consolas', monospace;
}

/* 等号 */
.equals {
    text-align: center;
    min-width: 20px;
    margin: 0 6px;
    font-family: 'Courier New', 'Consolas', monospace;
}

/* 答题区域 */
.problem-answer {
    min-width: 55px;
    display: inline-block;
    height: 24px;
}

/* 打印样式 */
@media print {
    /* 隐藏所有元素 */
    body * {
        visibility: hidden !important;
    }

    /* 只显示练习题内容 */
    #worksheetContent,
    #worksheetContent *,
    #worksheetContent div,
    #worksheetContent span,
    #worksheetContent br {
        visibility: visible !important;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    #worksheetContent {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: white !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    .a4-page {
        width: 100% !important;
        min-height: auto !important;
        box-shadow: none !important;
        padding: 5mm 10mm !important;
        margin: 0 !important;
        page-break-after: avoid !important;
        display: block !important;
        visibility: visible !important;
    }

    .worksheet-title,
    #worksheetContent .worksheet-title,
    .a4-page .worksheet-title {
        font-size: 1.2em !important;
        margin-top: 0 !important;
        margin-bottom: 6px !important;
        padding-top: 0 !important;
        padding-bottom: 6px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        border-bottom: 2px solid #333 !important;
        display: block !important;
        text-align: center !important;
        color: #333 !important;
        visibility: visible !important;
        font-weight: bold !important;
        opacity: 1 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .worksheet-subtitle,
    #worksheetContent .worksheet-subtitle,
    .a4-page .worksheet-subtitle {
        font-size: 0.75em !important;
        margin-top: 0 !important;
        margin-bottom: 12px !important;
        padding-top: 0 !important;
        padding-bottom: 4px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        line-height: 1.3 !important;
        color: #333 !important;
        display: block !important;
        text-align: center !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .worksheet-subtitle br,
    #worksheetContent .worksheet-subtitle br {
        visibility: visible !important;
    }

    .worksheet-row {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        margin-bottom: 3px !important;
        padding: 12px 15px !important;
        gap: 0 !important;
        page-break-inside: avoid !important;
        border-radius: 25px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        visibility: visible !important;
    }

    /* 三数计算每行2题 */
    .worksheet-row.three-number-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .worksheet-row.row-highlight {
        background-color: #b8c9d9 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        visibility: visible !important;
    }

    .worksheet-problem {
        font-size: 1.2em !important;
        font-weight: 500 !important;
        color: #000 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        justify-content: center !important;
        padding: 0 10px !important;
        font-family: 'Arial', 'Helvetica', sans-serif !important;
        visibility: visible !important;
    }

    .equation-part {
        min-width: 28px !important;
        text-align: center !important;
        font-variant-numeric: tabular-nums !important;
        font-family: 'Courier New', 'Consolas', monospace !important;
        visibility: visible !important;
    }

    .operator {
        text-align: center !important;
        min-width: 20px !important;
        margin: 0 6px !important;
        font-family: 'Courier New', 'Consolas', monospace !important;
        visibility: visible !important;
    }

    .equals {
        text-align: center !important;
        min-width: 20px !important;
        margin: 0 6px !important;
        font-family: 'Courier New', 'Consolas', monospace !important;
        visibility: visible !important;
    }

    .problem-answer {
        min-width: 55px !important;
        display: inline-block !important;
        height: 24px !important;
        visibility: visible !important;
    }

    @page {
        size: A4 portrait;
        margin: 10mm 12mm;
    }

    /* 确保所有元素都可见 */
    * {
        color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .screen {
        padding: 15px;
        max-height: 95vh;
    }

    .title {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .menu-btn {
        font-size: 1.1em;
        padding: 18px 12px;
    }

    h2 {
        font-size: 1.4em;
        margin-bottom: 10px;
    }

    .game-header {
        margin-bottom: 8px;
    }

    .back-btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .stars {
        font-size: 1.1em;
    }

    .math-question {
        font-size: 1.8em;
        margin: 15px 0;
    }

    .dice {
        width: 60px;
        height: 60px;
    }

    .dot {
        width: 20px;
        height: 20px;
    }

    .dots-container {
        gap: 6px;
        min-height: 90px;
        margin: 10px auto 12px;
        padding: 8px 10px;
        max-width: 240px;
    }

    .result-display .show-dots {
        gap: 6px;
        margin: 10px auto;
        max-width: 220px;
    }

    .result-display .show-dots .dot {
        width: 20px;
        height: 20px;
    }

    .question {
        font-size: 1.2em;
        margin: 10px 0;
    }

    .flash-hint {
        font-size: 0.85em;
        margin-top: 5px;
    }

    .settings {
        padding: 8px 12px;
        margin-bottom: 10px;
        font-size: 0.95em;
        gap: 6px;
    }

    .options {
        margin: 12px 0 15px 0;
    }

    .points-info {
        font-size: 1em;
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .points-cards {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
        gap: 8px;
        padding: 10px;
        min-height: 100px;
    }

    .points-card {
        padding: 8px 5px;
    }

    .card-value {
        font-size: 1.4em;
    }

    .card-dots {
        font-size: 0.65em;
    }

    .points-actions {
        margin: 10px 0 8px 0;
        gap: 8px;
    }

    .action-btn {
        padding: 10px 18px;
        font-size: 1em;
    }

    .result-display {
        font-size: 0.95em;
        padding: 12px;
        margin: 10px 0 15px 0;
    }

    .rabbit-helper {
        right: 12px;
        bottom: 12px;
    }

    .rabbit-emoji {
        font-size: 1.8em;
    }

    .mystery-options {
        max-height: 150px;
    }

    .mystery-hints {
        max-height: 120px;
    }

    .a4-preview-container {
        padding: 10px;
        max-height: 65vh;
    }

    .a4-page {
        width: 100%;
        min-height: auto;
        padding: 15px;
    }

    .worksheet-title {
        font-size: 1.3em;
    }

    .worksheet-subtitle {
        font-size: 0.85em;
        margin-bottom: 15px;
    }

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

    .worksheet-problem {
        font-size: 1em;
    }

    .problem-number {
        min-width: 28px;
    }

    .equation-part {
        min-width: 28px;
        font-family: 'Courier New', 'Consolas', monospace;
    }

    .operator, .equals {
        min-width: 18px;
    }

    .problem-answer {
        width: 50px;
    }

    .preview-actions {
        flex-direction: column;
        gap: 8px;
    }

    .preview-actions button {
        width: 100%;
    }

    .setting-options {
        justify-content: center;
    }

    .setting-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}

