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

body {
    font-family: "Microsoft YaHei", sans-serif;
    background-color: #c8102e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

h1 {
    color: #ffd700;
    font-size: 2.5rem;
    margin-bottom: 30px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-container {
    position: relative;
    width: 630px;
    height: 630px;
    margin-bottom: 30px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(7, 90px);
    grid-template-rows: repeat(7, 90px);
    gap: 0;
    position: relative;
}

.grid-item {
    width: 90px;
    height: 90px;
    background-color: #c8102e;
    border: 2px solid #ffd700;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.grid-item:hover {
    transform: scale(1.05);
}

.grid-item .front {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ffd700;
    backface-visibility: hidden;
    transition: all 0.6s ease;
}

.grid-item .back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffd700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    backface-visibility: hidden;
    transform: rotateY(180deg);
    transition: all 0.6s ease;
}

.grid-item.flipped .front {
    transform: rotateY(180deg);
}

.grid-item.flipped .back {
    transform: rotateY(0deg);
}

.idiom {
    font-size: 1.5rem;
    font-weight: bold;
    color: #c8102e;
    margin-bottom: 5px;
    font-family: "LiSu", cursive;
}

.meaning {
    font-size: 0.9rem;
    color: #333;
    text-align: center;
    line-height: 1.2;
}

.light {
    position: absolute;
    width: 90px;
    height: 90px;
    border: 4px solid #ffd700;
    border-radius: 0;
    box-shadow: 0 0 20px #ffd700, inset 0 0 20px #ffd700;
    background-color: rgba(255, 215, 0, 0.3);
    pointer-events: none;
    transition: all 0.1s ease;
    z-index: 10;
    display: none;
}

.light.visible {
    display: block;
}

.controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-start {
    background-color: #c8102e;
    color: #ffd700;
    border: 3px solid #ffd700;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 10px rgba(255, 215, 0, 0.5);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-start:hover {
    background-color: #a80d26;
    transform: scale(1.05);
    box-shadow: 
        0 6px 8px rgba(0, 0, 0, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 15px rgba(255, 215, 0, 0.7);
}

.btn-start:disabled {
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.btn-close {
    background-color: #ffd700;
    color: #c8102e;
    display: none;
}

.btn-close:hover {
    background-color: #e6c200;
    transform: scale(1.05);
}

.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.fullscreen-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 90px;
    height: 90px;
    background-size: cover;
    background-position: center;
    border-radius: 0;
    opacity: 0;
    transition: all 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 101;
}

.fullscreen-image.animate {
    opacity: 1;
    transform: translate(-50%, -50%) scale(20) rotateY(180deg);
}

.fullscreen-image.fade-out {
    opacity: 0;
    transform: translate(-50%, -50%) scale(20) rotateY(360deg);
}

@media (max-width: 768px) {
    .fullscreen-image {
        width: 50px;
        height: 50px;
    }
    
    .fullscreen-image.animate {
        transform: translate(-50%, -50%) scale(25) rotateY(180deg);
    }
    
    .fullscreen-image.fade-out {
        transform: translate(-50%, -50%) scale(25) rotateY(360deg);
    }
}

.result-card {
    background-color: #ffd700;
    border: 4px solid #c8102e;
    border-radius: 10px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    z-index: 102;
}

.result-card .idiom {
    font-size: 3rem;
    margin-bottom: 20px;
}

.result-card .meaning {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.result-card .btn-close {
    display: inline-block;
}

.setup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.setup-card {
    background-color: #ffd700;
    border: 4px solid #c8102e;
    border-radius: 10px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.setup-card h2 {
    color: #c8102e;
    font-size: 2rem;
    margin-bottom: 30px;
    font-family: "LiSu", cursive;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #c8102e;
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #c8102e;
    border-radius: 5px;
    font-size: 1rem;
    background-color: #fff;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.btn-confirm {
    background-color: #c8102e;
    color: #ffd700;
    border: 3px solid #ffd700;
    box-shadow: 
        0 4px 6px rgba(0, 0, 0, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 10px rgba(255, 215, 0, 0.5);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 20px;
}

.btn-confirm:hover {
    background-color: #a80d26;
    transform: scale(1.05);
    box-shadow: 
        0 6px 8px rgba(0, 0, 0, 0.4),
        0 3px 6px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 15px rgba(255, 215, 0, 0.7);
}

.prize-result {
    font-size: 2.5rem;
    font-weight: bold;
    color: #c8102e;
    margin-bottom: 20px;
    font-family: "LiSu", cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .game-container {
        width: 350px;
        height: 350px;
    }

    .grid {
        grid-template-columns: repeat(7, 50px);
        grid-template-rows: repeat(7, 50px);
    }

    .grid-item {
        width: 50px;
        height: 50px;
    }

    .light {
        width: 50px;
        height: 50px;
        border-radius: 0;
    }

    h1 {
        font-size: 2rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 500px;
    font-family: "LiSu", "SimSun", serif;
    color: rgba(255, 215, 0, 0.15);
    pointer-events: none;
    z-index: 5;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .watermark {
        font-size: 360px;
    }
}