/* 算术游戏专用样式文件 */

/* 游戏页面样式 */
.question-container {
    margin: 2vh 0;
    padding: 2vw;
    background-color: var(--theme-container);
    border-radius: 15px;
    border: 2px solid var(--theme-border);
    box-sizing: border-box;
    flex: 0 0 auto;
}

.question-counter {
    color: var(--theme-dark);
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
    transition: color var(--transition-theme);
}

.question-text {
    font-size: clamp(0.5rem, 4vw, 2rem);
    font-weight: bold;
    color: var(--theme-primary);
    margin: 2vh 0;
    white-space: nowrap;
    overflow: visible;
    max-width: 100%;
    text-align: center;
    line-height: 1.2;
    display: inline-block;
    width: 100%;
}

.answer-input {
    margin: 1.5vh 0;
    display: flex;
    align-items: center;
    gap: 2vw;
    width: 100%;
    box-sizing: border-box;
    padding: 0 2vw;
    min-height: 8vw;
    height: auto;
    max-height: 12vh;
    aspect-ratio: auto;
}

.answer-display {
    flex: 1;
    padding: 1vw 2vw;
    font-size: 5vw;
    text-align: center;
    border: 3px solid var(--theme-light);
    border-radius: 10px;
    background-color: #fff;
    color: var(--theme-dark);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 8vw;
    min-height: 8vw;
    max-height: 8vw;
    box-sizing: border-box;
    line-height: 1.2;
}

.num-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 1vw;
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    max-height: 30vh;
    box-sizing: border-box;
    padding: 1vw;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    transform: scale(1);
    overflow: hidden;
    grid-auto-flow: dense;
    border: 1px solid var(--theme-border);
}

.num-keypad .keypad-btn.delete {
    grid-column: span 1;
    font-size: clamp(0.8rem, 6vw, 2rem);
}

.keypad-btn {
    padding: 1vw;
    font-size: clamp(0.8rem, 6vw, 2rem);
    font-weight: bold;
    color: #fff;
    background: var(--gradient-theme);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    min-height: 8vw;
    max-width: none;
    min-width: auto;
    white-space: nowrap;
    overflow: hidden;
    grid-row: auto;
    margin: 0;
}

.num-keypad .keypad-btn {
    grid-column: auto;
}

.keypad-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-theme-small);
}

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

.num-keypad .keypad-btn.delete {
    background: var(--gradient-red);
}

.answer-input .keypad-btn.confirm {
    flex: 1;
    min-width: 8vw;
    max-width: none;
    background: var(--gradient-green);
    aspect-ratio: auto;
    padding: 1vw;
    font-size: clamp(0.8rem, 6vw, 2rem);
    border-radius: 10px;
    white-space: nowrap;
    box-sizing: border-box;
    align-self: center;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    gap: 2vw;
    margin-bottom: 2vh;
    flex-wrap: nowrap;
    padding: 0 2vw;
    box-sizing: border-box;
    width: 100%;
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1vw 2vw;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.progress-container {
    width: 100%;
    padding: 0 2vw;
    box-sizing: border-box;
    margin-bottom: 2vh;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1vh;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.progress-fill {
    height: 100%;
    background: var(--gradient-theme);
    border-radius: 6px;
    width: 0%;
    transition: width var(--transition-normal);
}

.control-btn {
    padding: 1.5vw 1.5vw;
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    color: #fff;
    border: none;
    border-radius: 10px;
    flex: 1;
    white-space: nowrap;
    min-height: 6vw;
    transition: var(--transition-fast);
}

.restart-btn {
    background: var(--gradient-orange);
}

.end-btn {
    background: var(--gradient-red);
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.result-title {
    color: var(--theme-primary);
    font-size: clamp(1.5rem, 8vw, 2.5rem);
    margin-bottom: 2vh;
    text-align: center;
    transition: color var(--transition-theme);
}

.result-card {
    background-color: #fff;
    border-radius: 15px;
    box-shadow: var(--shadow-theme);
    margin-bottom: 2vh;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.result-header {
    background: var(--gradient-theme);
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition-theme);
}

.result-header h3 {
    margin: 0;
    font-size: clamp(1rem, 5vw, 1.5rem);
}

.toggle-btn {
    padding: 8px 15px;
    font-size: clamp(0.8rem, 3vw, 1rem);
    font-weight: bold;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.result-body {
    padding: 20px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

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

.result-label {
    display: inline-block;
    font-size: clamp(0.8rem, 3vw, 1rem);
    color: var(--theme-dark);
    margin-bottom: 0;
    transition: color var(--transition-theme);
}

.result-value {
    display: inline-block;
    font-size: clamp(1.2rem, 6vw, 1.8rem);
    font-weight: bold;
    color: var(--theme-primary);
    transition: color var(--transition-theme);
}

.result-value.correct {
    color: #27ae60;
}

.result-value.wrong {
    color: #e74c3c;
}

.result-unit {
    display: inline-block;
    font-size: clamp(0.8rem, 3vw, 1rem);
    color: var(--theme-dark);
    margin-top: 0;
    transition: color var(--transition-theme);
}

.stars {
    font-size: clamp(2rem, 10vw, 3.5rem);
    margin: 0;
    color: #ffd700;
}

.details-body {
    max-height: 400px;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.details-body.collapsed {
    max-height: 0;
    padding: 0;
}

.questions-details {
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 2px solid var(--theme-border);
}

.question-detail {
    
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: var(--transition-fast);
}

.question-detail:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.question-detail.correct {
    background-color: #d4edda;
    border-left: 5px solid #28a745;
}

.question-detail.wrong {
    background-color: #f8d7da;
    border-left: 5px solid #dc3545;
}

.question-content {
    flex: 1;
    font-size: clamp(0.9rem, 3.5vw, 1.2rem);
    font-weight: bold;
    color: #333;
}

.question-answer {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(0.8rem, 3vw, 1.1rem);
    justify-content: center;
}

.answer-correct {
    color: #28a745;
    font-weight: bold;
}

.answer-wrong {
    color: #dc3545;
    font-weight: bold;
}

.answer-tip {
    margin: 10px 0;
    padding: 10px;
    font-size: clamp(0.9rem, 3.5vw, 1.2rem);
    font-weight: bold;
    text-align: center;
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    display: none;
}

.answer-tip.show {
    display: block;
    animation: var(--animation-fade-in);
}

/* 游戏页面响应式样式 */
@media (min-width: 1024px) and (max-width: 1280px) {
    .num-keypad {
        max-height: 40vh;
    }
    
    .question-text {
        font-size: clamp(0.8rem, 3.5vw, 1.8rem);
    }
    
    .control-btn {
        max-width: 220px;
    }
}

@media (min-width: 1281px) {
    .num-keypad {
        max-height: 45vh;
    }
    
    .question-text {
        font-size: clamp(1rem, 3vw, 2rem);
    }
    
    .control-btn {
        max-width: 240px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .question-text {
        font-size: clamp(0.7rem, 4vw, 1.6rem);
    }
    
    .control-btn {
        max-width: 250px;
    }
}

@media (max-width: 767px) {
    .question-text {
        font-size: clamp(1.5rem, 10vw, 2.5rem);
        margin: 1.5vh 0;
    }

    .answer-tip {
        font-size: clamp(0.8rem, 4vw, 1rem);
        padding: 2vw;
    }

    .num-keypad {
        grid-template-columns: repeat(3, 1fr);
        gap: 2vw;
        padding: 2vw;
    }
    
    .control-btn {
        max-width: none;
        margin: 0.5vw;
    }
}

@media (max-width: 480px) {
    .question-text {
        font-size: clamp(1.2rem, 12vw, 2rem) !important;
    }

    .num-keypad {
        gap: 1.5vw !important;
        padding: 1.5vw !important;
    }
    
    .keypad-btn {
        padding: 1.5vw !important;
    }
}