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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-weight: 600;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #2c3e50;
}

/* 游戏区域 */
.game-area {
    margin-bottom: 40px;
}

/* 扑克牌样式 */
.cards-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.card {
    width: 120px;
    height: 180px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: 500;
    position: relative;
    transition: transform 0.3s ease;
    border: 1px solid #e0e0e0;
}

.card:hover {
    transform: translateY(-5px);
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #2c3e50;
}

.card .suit {
    position: absolute;
    font-size: 1.5rem;
}

.card .top-suit {
    top: 10px;
    left: 10px;
}

.card .bottom-suit {
    bottom: 10px;
    right: 10px;
    transform: rotate(180deg);
}

.card .value {
    font-size: 2.5rem;
    font-weight: 600;
}

/* 控制区域 */
.controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group .btn {
    flex: 1;
}

.custom-input {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.number-inputs {
    display: flex;
    gap: 10px;
}

.number-inputs input {
    flex: 1;
    text-align: center;
}

.hidden {
    display: none;
}

.input-group {
    display: flex;
    gap: 10px;
}

input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

input:focus {
    border-color: #3498db;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background-color: #3498db;
    color: white;
}

.primary-btn:hover {
    background-color: #2980b9;
}

.secondary-btn {
    background-color: #2ecc71;
    color: white;
}

.secondary-btn:hover {
    background-color: #27ae60;
}

.tertiary-btn {
    background-color: #f1c40f;
    color: white;
}

.tertiary-btn:hover {
    background-color: #f39c12;
}

/* 消息和解决方案区域 */
.message {
    margin: 20px 0;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    display: none;
    /* 默认隐藏 */
}

.message.success {
    background-color: #d5f5e3;
    color: #27ae60;
    display: block;
}

.message.error {
    background-color: #fadbd8;
    color: #e74c3c;
    display: block;
}

.message.warning {
    background-color: #fef9e7;
    color: #f39c12;
    display: block;
}

.message.info {
    background-color: #eaf2f8;
    color: #3498db;
    display: block;
}

.solutions-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease;
    opacity: 0;
}

.solutions-container.visible {
    max-height: 500px;
    opacity: 1;
    background-color: #f8f9fa;
    padding: 15px;
    margin-top: 20px;
    border-radius: 8px;
}

.solutions-list {
    max-height: 300px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.solution-item {
    padding: 8px 12px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 游戏规则部分 */
.instructions {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.instructions p {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .cards-container {
        gap: 10px;
    }

    .card {
        width: 90px;
        height: 140px;
        font-size: 1.5rem;
    }

    .card .value {
        font-size: 2rem;
    }

    .solutions-list {
        grid-template-columns: 1fr;
    }

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

    .number-inputs {
        flex-wrap: wrap;
    }

    .number-inputs input {
        min-width: 70px;
    }
}

.challenge-info {
    display: flex;
    flex-direction: column;
    margin: 10px 0;
    padding: 10px;
    background-color: #f0f8ff;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.challenge-info.hidden {
    display: none;
}

.challenge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.challenge-buttons {
    display: flex;
    gap: 10px;
}

#challenge-level {
    font-size: 1.2rem;
    font-weight: 600;
    color: #3498db;
}

.mini-btn {
    padding: 5px 10px;
    font-size: 0.9rem;
    background-color: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mini-btn:hover {
    background-color: #d0d0d0;
}

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

/* 闯关模式激活时的样式 */
.challenge-mode .game-area {
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 10px;
}

/* 在闯关模式下添加到主按钮区的按钮样式 */
.button-group .mini-btn.primary-btn {
    padding: 12px 25px;
    font-size: 1rem;
}

/* 添加一个闯关成功的动画效果 */
@keyframes levelComplete {
    0% {
        background-color: #fff;
    }

    50% {
        background-color: #d4edda;
    }

    100% {
        background-color: #fff;
    }
}

.level-complete {
    animation: levelComplete 1s ease;
}

code {
    background-color: #f8f9fa;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    color: #e74c3c;
}

/* 按钮的显示与隐藏动画 */
.button-transition {
    transition: all 0.3s ease;
}