/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'SimHei', 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* 标题样式 */
header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 设置面板 */
.settings-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* 题库选择区域 - 横向排列优化 */
.subject-selection {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.subject-group {
    flex: 1;
    min-width: 220px;
    margin-bottom: 0;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

/* 科目宽度调整：语文、数学 70%，英语 160% */
.subject-group[data-subject="chinese"],
.subject-group[data-subject="math"] {
    flex: 0.7;
}

.subject-group[data-subject="english"] {
    flex: 1.6;
}

.subject-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.subject-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.subject-name {
    font-weight: 700;
    font-size: 1.15rem;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.grade-checkboxes {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

.grade-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    color: #555;
    font-size: 0.95rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.grade-label:hover {
    background: #f8f9fa;
}

.grade-label:last-child {
    margin-bottom: 0;
}

.grade-checkboxes input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    accent-color: #667eea;
}

/* 英语题库两列布局 */
.grade-checkboxes-english {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 15px;
}

.grade-checkboxes-english .grade-label {
    margin-bottom: 5px;
}

.setting-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.setting-row:last-of-type {
    margin-bottom: 15px;
}

.setting-row label {
    min-width: 100px;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.setting-row input[type="range"] {
    flex: 1;
    min-width: 150px;
    margin: 0 15px;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.setting-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.value-display {
    min-width: 70px;
    font-weight: 600;
    color: #667eea;
    font-size: 1rem;
}

/* 动画选项横向排列容器 */
.animation-toggles {
    display: flex;
    gap: 30px;
    justify-content: flex-start;
}

.animation-toggle {
    justify-content: flex-start;
    margin-bottom: 0;
}

.animation-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-width: auto !important;
    pointer-events: auto;
    position: relative;
}

.animation-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    z-index: 10;
    opacity: 1;
}

/* 按钮样式 */
.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.btn {
    padding: 14px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 2px solid #ddd;
}

.btn-secondary:hover:not(:disabled) {
    background: #eee;
    border-color: #ccc;
}

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

/* 全屏模式样式 */
/* 全屏模式 - 统一样式 */
body.fullscreen-mode {
    padding: 0;
    overflow: hidden;
    background: white; /* 防止紫色背景露出 */
}

body.fullscreen-mode .container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    background: white;
}

body.fullscreen-mode header,
body.fullscreen-mode .settings-panel,
body.fullscreen-mode .mode-tab,
body.fullscreen-mode .mode-selector {
    display: none;
}

body.fullscreen-mode .display-area {
    flex: 1;
    height: auto;
    min-height: 0;
    border-radius: 0;
    margin-bottom: 0;
    overflow: visible;
    background: white;
}

body.fullscreen-mode .progress-section {
    height: auto;
    min-height: 80px;
    border-radius: 0;
    margin-bottom: 0;
    flex-shrink: 0;
    padding: 20px 40px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

body.fullscreen-mode .progress-fill {
    height: 12px; /* 加粗进度条 */
}

body.fullscreen-mode .progress-text {
    font-size: 18px; /* 增大字体 */
    font-weight: 600;
}

/* 显示区域 */
.display-area {
    background: white;
    border-radius: 16px;
    min-height: 350px;
    height: 400px;
    position: relative;
    overflow: visible; /* 改为visible，让字母降部可以显示 */
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    /* 给字母降部留出额外空间 */
    padding-bottom: 30px;
}

.position-left,
.position-center,
.position-right {
    position: absolute;
    width: 33.33%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.position-left {
    left: 0;
    justify-content: center;
    padding-left: 20px;
}

.position-center {
    left: 33.33%;
    justify-content: center;
}

.position-right {
    right: 0;
    justify-content: center;
    padding-right: 20px;
}

.character-display {
    font-weight: bold;
    color: #333;
    text-align: center;
    position: absolute;
    z-index: 10;
    user-select: none;
    line-height: 1.3; /* 增加行高，给英文字母降部留出空间 */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: block; /* 改为block，避免flex裁剪内容 */
    overflow: visible;
    white-space: nowrap;
    /* 确保字体大小不受其他因素限制 */
    font-size: inherit;
    box-sizing: content-box;
    /* 给字母降部留出足够padding */
    padding: 0.15em 0;
}

/* 彩色字体效果 - 使用CSS变量动态设置颜色 */
.character-display.rainbow {
    /* CSS变量将由JS动态设置 */
    --color-start: #ff6b6b;
    --color-mid: #ff8e53;
    --color-end: #ff6b9d;

    background: linear-gradient(
        135deg,
        var(--color-start) 0%,
        var(--color-mid) 50%,
        var(--color-end) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.15));
}

/* 等待状态 - 在非全屏模式下隐藏整个显示区域 */
body:not(.fullscreen-mode) .display-area.waiting {
    display: none;
}

.display-area.waiting {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

/* 进度条区域 */
.progress-section {
    background: white;
    border-radius: 16px;
    padding: 20px 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

#progressCount {
    color: #667eea;
}

.progress-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
}

/* 完成弹窗 */
.completion-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.completion-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    padding: 50px 70px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.5s ease;
}

.modal-content h2 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 20px;
}

/* 练习生字回顾 */
.character-review {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.character-review h3 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
}

.character-list {
    font-size: 1.5rem;
    color: #333;
    letter-spacing: 8px;
    line-height: 2;
    word-break: break-all;
}

/* 弹窗按钮组 */
.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ==================== 动画特效 ==================== */

/* 淡入淡出 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* 缩放进入 */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* 左侧滑入 */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100px);
    }
}

/* 右侧滑入 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* 弹跳进入 */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
    }
    100% {
        opacity: 0;
        transform: scale(0.3);
    }
}

/* 翻转进入 */
@keyframes flipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateY(-90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateY(0);
    }
}

@keyframes flipOut {
    from {
        opacity: 1;
        transform: perspective(400px) rotateY(0);
    }
    to {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
}

/* 旋转进入 */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.3);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

@keyframes rotateOut {
    from {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
    to {
        opacity: 0;
        transform: rotate(180deg) scale(0.3);
    }
}

/* 弹性进入 */
@keyframes elasticIn {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    75% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes elasticOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

/* 动画类名 */
.anim-fade-in { animation: fadeIn 0.5s ease forwards; }
.anim-fade-out { animation: fadeOut 0.4s ease forwards; }

.anim-zoom-in { animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.anim-zoom-out { animation: zoomOut 0.4s ease forwards; }

.anim-slide-left-in { animation: slideInLeft 0.5s ease forwards; }
.anim-slide-left-out { animation: slideOutLeft 0.4s ease forwards; }

.anim-slide-right-in { animation: slideInRight 0.5s ease forwards; }
.anim-slide-right-out { animation: slideOutRight 0.4s ease forwards; }

.anim-bounce-in { animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; }
.anim-bounce-out { animation: bounceOut 0.4s ease forwards; }

.anim-flip-in { animation: flipIn 0.5s ease forwards; }
.anim-flip-out { animation: flipOut 0.4s ease forwards; }

.anim-rotate-in { animation: rotateIn 0.6s ease forwards; }
.anim-rotate-out { animation: rotateOut 0.4s ease forwards; }

.anim-elastic-in { animation: elasticIn 0.6s ease forwards; }
.anim-elastic-out { animation: elasticOut 0.4s ease forwards; }

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .setting-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .setting-row input[type="range"] {
        width: 100%;
        margin: 10px 0;
    }

    .value-display {
        margin-left: 0;
    }

    .character-display {
        font-size: 80px !important;
    }

    .display-area {
        min-height: 250px;
    }

    .btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .modal-content {
        padding: 35px 40px;
        margin: 20px;
    }

    .modal-content h2 {
        font-size: 1.8rem;
    }
}
/* ... existing styles ... */

/* ==================== 模式切换 ==================== */
.mode-switcher {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 0 20px;
}

.mode-tab {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.mode-tab:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.mode-tab.active {
    background: white;
    color: #667eea;
    border-color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ==================== 火柴棒游戏 ==================== */
.matchstick-game {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}
.hidden {
    display: none !important;
}

.matchstick-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.matchstick-stats {
    display: flex;
    gap: 20px;
    font-weight: 600;
    color: #333;
}

#matchstickTimer {
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
}

.matchstick-instruction {
    text-align: center;
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(135deg, #fff9e6 0%, #fff5d6 100%);
    border-radius: 10px;
    border-left: 4px solid #f59e0b;
}

.matchstick-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 16px;
    padding: 40px 30px;
    margin-bottom: 20px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.matchstick-field {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    transform-origin: center center;
    transition: transform 0.1s linear;
}

/* 火柴棒数字 */
.matchstick-token {
    position: relative;
    flex-shrink: 0;
}

.matchstick-digit {
    width: 104px;
    height: 180px;
    position: relative;
}

/* 七段数码管 */
.matchstick-segment {
    position: absolute;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.matchstick-segment.h {
    width: 64px;
    height: 16px;
}

.matchstick-segment.v {
    width: 16px;
    height: 64px;
}

/* 段位置 */
.matchstick-segment.seg-a { top: 0; left: 20px; }
.matchstick-segment.seg-b { top: 20px; left: 88px; }
.matchstick-segment.seg-c { top: 96px; left: 88px; }
.matchstick-segment.seg-d { top: 164px; left: 20px; }
.matchstick-segment.seg-e { top: 96px; left: 0; }
.matchstick-segment.seg-f { top: 20px; left: 0; }
.matchstick-segment.seg-g { top: 82px; left: 20px; }

/* 空槽样式 */
.matchstick-segment.empty {
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.matchstick-segment.empty:hover,
.matchstick-segment.empty.highlight {
    background: rgba(255, 255, 255, 0.2);
    border-color: #667eea;
}

/* 激活的火柴棒 */
.matchstick-segment.active {
    background: linear-gradient(180deg, #f5d17a 0%, #d97706 50%, #a55a10 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 火柴头 */
.matchstick-segment.active::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #b91c1c);
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(185, 28, 28, 0.5);
}

.matchstick-segment.h.active::before {
    right: -11px;
    top: 50%;
    transform: translateY(-50%);
}

.matchstick-segment.v.active::before {
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
}

/* 运算符 */
.matchstick-operator {
    width: 88px;
    height: 180px;
    position: relative;
}

.matchstick-op-slot {
    position: absolute;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.matchstick-op-slot.h {
    width: 64px;
    height: 16px;
    top: 82px;
    left: 12px;
}

.matchstick-op-slot.v {
    width: 16px;
    height: 64px;
    top: 58px;
    left: 36px;
}

.matchstick-op-slot.empty {
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.15);
}

.matchstick-op-slot.empty:hover,
.matchstick-op-slot.empty.highlight {
    background: rgba(255, 255, 255, 0.2);
    border-color: #667eea;
}

.matchstick-op-slot.active {
    background: linear-gradient(180deg, #f5d17a 0%, #d97706 50%, #a55a10 100%);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

.matchstick-op-slot.active::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #b91c1c);
    border-radius: 50%;
}

.matchstick-op-slot.h.active::before {
    right: -11px;
    top: -3px;
}

.matchstick-op-slot.v.active::before {
    bottom: -11px;
    left: -3px;
}

/* 等号 */
.matchstick-equals {
    width: 88px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.matchstick-eq-bar {
    width: 64px;
    height: 16px;
    background: linear-gradient(180deg, #f5d17a 0%, #d97706 50%, #a55a10 100%);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

/* 控制按钮 */
.matchstick-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 拖拽幽灵 */
#dragGhost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    display: none;
    width: 64px;
    height: 16px;
    background: linear-gradient(180deg, #f5d17a 0%, #d97706 50%, #a55a10 100%);
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
    transform: translate(-50%, -50%);
}

#dragGhost.v {
    width: 16px;
    height: 64px;
}

#dragGhost::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #b91c1c);
    border-radius: 50%;
    right: -11px;
    top: 50%;
    transform: translateY(-50%);
}

#dragGhost.v::before {
    right: 50%;
    top: auto;
    bottom: -11px;
    transform: translateX(50%);
}
/* 弹窗 */
.matchstick-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.matchstick-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.matchstick-modal-content {
    background: white;
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.5s ease;
    max-width: 90%;
    width: 400px;
}

.matchstick-modal-content h3 {
    font-size: 1.8rem;
    color: #667eea;
    margin-bottom: 15px;
}

.matchstick-modal-content p {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.6;
}

.matchstick-modal-content button {
    padding: 14px 35px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.matchstick-modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* 响应式 */
@media (max-width: 768px) {
    .mode-tab {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .matchstick-container {
        padding: 20px 15px;
        min-height: 200px;
    }
    
    .matchstick-digit {
        width: 52px;
        height: 90px;
    }
    
    .matchstick-segment.h {
        width: 32px;
        height: 8px;
    }
    
    .matchstick-segment.v {
        width: 8px;
        height: 32px;
    }
    
    .matchstick-segment.seg-a { top: 0; left: 10px; }
    .matchstick-segment.seg-b { top: 10px; left: 44px; }
    .matchstick-segment.seg-c { top: 48px; left: 44px; }
    .matchstick-segment.seg-d { top: 82px; left: 10px; }
    .matchstick-segment.seg-e { top: 48px; left: 0; }
    .matchstick-segment.seg-f { top: 10px; left: 0; }
    .matchstick-segment.seg-g { top: 41px; left: 10px; }
    
    .matchstick-operator {
        width: 44px;
        height: 90px;
    }
    
    .matchstick-op-slot.h {
        width: 32px;
        height: 8px;
        top: 41px;
        left: 6px;
    }
    
    .matchstick-op-slot.v {
        width: 8px;
        height: 32px;
        top: 29px;
        left: 18px;
    }
    
    .matchstick-equals {
        width: 44px;
        height: 90px;
        gap: 14px;
    }
    
    .matchstick-eq-bar {
        width: 32px;
        height: 8px;
    }
}

/* ===== 字母认读模式样式 ===== */

.alphabet-game {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.alphabet-game.hidden {
    display: none;
}

/* 字母认读设置面板 */
.alphabet-settings {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 字母认读设置一行布局 */
.alphabet-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.alphabet-setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
}

.alphabet-setting-item label {
    color: #555;
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.alphabet-setting-item input[type="range"] {
    flex: 1;
    min-width: 60px;
    max-width: 100px;
}

.alphabet-setting-item .value-display {
    color: #667eea;
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 50px;
}

.alphabet-checkbox-item {
    flex: 0 0 auto;
    min-width: auto;
}

.alphabet-checkbox-item .animation-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.alphabet-settings .button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 字母网格 */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    padding: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 第四行只有6个字母，居中显示 */
.alphabet-grid::after {
    content: "";
    grid-column: span 1;
}

.alphabet-cell {
    aspect-ratio: 1.5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 8px;
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: default;
    user-select: none;
    border: 2px solid transparent;
}

.alphabet-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 高亮状态 - 纯色橙色背景 */
.alphabet-cell.active {
    background: #e8913a;
    border-color: #c67320;
    box-shadow: 0 4px 15px rgba(232, 145, 58, 0.4);
    transform: scale(1.05);
}

/* 字母认读进度条 */
.alphabet-progress {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.alphabet-progress .progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #555;
    font-weight: 500;
}

.alphabet-progress .progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.alphabet-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 字母认读响应式 */
@media (max-width: 768px) {
    .alphabet-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        padding: 8px;
    }
    
    .alphabet-cell {
        font-size: 1.2rem;
        border-radius: 6px;
    }
    
    .alphabet-settings-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .alphabet-setting-item {
        min-width: 100%;
    }
    
    .alphabet-setting-item input[type="range"] {
        max-width: none;
    }
    
    .alphabet-settings .button-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .alphabet-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 8px;
    }
    
    .alphabet-cell {
        font-size: 1.1rem;
        border-radius: 6px;
    }
}


/* 字母认读彩色字体 - 选中时字母彩色渐变 */
.alphabet-cell.rainbow-text {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 25%, #48dbfb 50%, #ff9ff3 75%, #54a0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
