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

body {
    font-family: 'Arial', 'Microsoft JhengHei', sans-serif;
    background: #ff9a56;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5em;
    color: #ff6b35;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
}

.difficulty-selection, .game-mode-selection {
    margin-bottom: 40px;
}

.difficulty-selection h2, .game-mode-selection h2 {
    font-size: 1.8em;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.difficulty-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    flex: 1;
    min-width: 200px;
    padding: 30px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.difficulty-btn.easy {
    background: #84fab0;
    color: #2d5a3d;
}

.difficulty-btn.medium {
    background: #ffecd2;
    color: #8b4513;
}

.difficulty-btn.hard {
    background: #ff9a9e;
    color: #8b1538;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

.difficulty-icon {
    font-size: 2em;
}

.difficulty-title {
    font-weight: bold;
    font-size: 1.3em;
}

.difficulty-desc {
    font-size: 0.9em;
    opacity: 0.8;
}

.mode-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.mode-btn {
    flex: 1;
    min-width: 200px;
    padding: 30px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    background: #a8edea;
    color: #2c3e50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.mode-icon {
    font-size: 2em;
}

.mode-title {
    font-weight: bold;
    font-size: 1.3em;
}

/* 遊戲頁面樣式 */
.game-container {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    width: 100%;
    min-height: 600px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.back-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background: #ff6b35;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #ff8c5a;
    transform: scale(1.05);
}

.progress-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.difficulty-badge {
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9em;
}

.difficulty-badge.easy {
    background: #84fab0;
    color: #2d5a3d;
}

.difficulty-badge.medium {
    background: #ffecd2;
    color: #8b4513;
}

.difficulty-badge.hard {
    background: #ff9a9e;
    color: #8b1538;
}

.progress-text, .score-text {
    font-size: 1.1em;
    color: #333;
    font-weight: bold;
}

.question-area {
    text-align: center;
    margin-bottom: 40px;
}

.question-title {
    font-size: 1.5em;
    color: #ff6b35;
    margin-bottom: 30px;
}

.pattern-display {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    min-height: 120px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* AI 生成标签样式 */
.ai-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.pattern-item {
    min-width: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 2em;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.pattern-item.number {
    background: #ff6b35;
    color: white;
}

.pattern-item.color {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.pattern-item.red {
    background: #ff6b6b;
}

.pattern-item.yellow {
    background: #ffd93d;
}

.pattern-item.green {
    background: #6bcf7f;
}

.pattern-item.blank {
    background: #dee2e6;
    border: 3px dashed #adb5bd;
    color: transparent;
    min-width: 80px;
    min-height: 80px;
}

.pattern-item.correct {
    animation: correctPulse 0.6s ease;
}

.pattern-item.wrong {
    animation: wrongShake 0.5s ease;
}

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

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

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 500px;
    margin: 0 auto;
}

.option-btn {
    padding: 25px;
    border: none;
    border-radius: 6px;
    font-size: 1.8em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.option-btn.number {
    background: #ff6b35;
    color: white;
}

.option-btn.color {
    color: white;
}

.option-btn.red {
    background: #ff6b6b;
}

.option-btn.yellow {
    background: #ffd93d;
}

.option-btn.green {
    background: #6bcf7f;
}

.option-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

.option-btn.correct {
    animation: correctPulse 0.6s ease;
    background: #51cf66 !important;
}

.option-btn.wrong {
    animation: wrongShake 0.5s ease;
    background: #ff6b6b !important;
}

.option-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.drag-mode {
    margin-top: 30px;
}

.drag-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.drag-item {
    min-width: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 1.8em;
    font-weight: bold;
    cursor: grab;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    user-select: none;
}

.drag-item:active {
    cursor: grabbing;
}

.drag-item.number {
    background: #ff6b35;
    color: white;
}

.drag-item.color {
    color: white;
}

.drag-item.red {
    background: #ff6b6b;
}

.drag-item.yellow {
    background: #ffd93d;
}

.drag-item.green {
    background: #6bcf7f;
}

.drag-item.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

.drag-item.dropped {
    pointer-events: none;
    opacity: 0.5;
}

.feedback-area {
    text-align: center;
    min-height: 60px;
    margin: 20px 0;
    font-size: 1.5em;
    font-weight: bold;
}

.feedback-area.correct {
    color: #51cf66;
    animation: fadeIn 0.5s ease;
}

.feedback-area.wrong {
    color: #ff6b6b;
    animation: fadeIn 0.5s ease;
}

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

.next-btn {
    display: block;
    margin: 30px auto 0;
    padding: 15px 40px;
    border: none;
    border-radius: 6px;
    background: #ff6b35;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

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

/* 配置区域 */
.config-section {
    text-align: center;
    margin-top: 30px;
}

.config-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    background: #f0f0f0;
    color: #333;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 6px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 15px;
}

.close:hover {
    color: #000;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.config-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1em;
}

.config-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

.config-form input[type="password"],
.config-form input[type="text"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.config-form input[type="password"]:focus,
.config-form input[type="text"]:focus {
    border-color: #ff6b35;
    outline: none;
}

.help-text {
    font-size: 0.9em;
    color: #666;
    line-height: 1.6;
}

.help-text a {
    color: #ff6b35;
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

.save-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    background: #ff6b35;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

/* 加载状态 */
.loading-spinner {
    text-align: center;
    padding: 40px;
    font-size: 1.5em;
    color: #ff6b35;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }
    
    .difficulty-btn, .mode-btn {
        min-width: 100%;
    }
    
    .pattern-item {
        min-width: 60px;
        min-height: 60px;
        font-size: 1.5em;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

