/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

/* Container */
.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    text-align: center;
}

/* Header */
header {
    margin-bottom: 30px;
}

.game-title {
    color: #e91e63;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Game Selector Styles */
.game-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 30px;
}

.game-btn {
    padding: 16px 32px;
    border: 3px solid #e91e63;
    background: white;
    color: #e91e63;
    border-radius: 40px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.game-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e91e63 0%, #f48fb1 100%);
    transition: all 0.5s ease;
    z-index: -1;
}

.game-btn:hover:before {
    left: 0;
}

.game-btn:hover {
    color: white;
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.game-btn.active {
    background: linear-gradient(135deg, #e91e63 0%, #f48fb1 100%);
    color: white;
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 25px rgba(233, 30, 99, 0.5);
    border-color: #f06292;
}

.game-btn.active:before {
    left: 0;
}

.game-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Game Stats */
.game-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #e74c3c;
}

/* Word Display */
.word-display {
    margin-bottom: 30px;
}

.word-letters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.letter {
    width: 40px;
    height: 50px;
    border-bottom: 3px solid #e74c3c;
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 5px;
}

/* Hint Container */
.hint-container {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
}

.hint-label {
    font-weight: bold;
    color: #856404;
}

.hint-text {
    color: #856404;
    margin-top: 5px;
}

/* Keyboard */
.keyboard {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 8px;
    margin-bottom: 30px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.key {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.key:hover:not(:disabled) {
    background: #e9ecef;
    transform: translateY(-2px);
}

.key:active:not(:disabled) {
    transform: translateY(0);
}

.key.pressed {
    background: #3498db;
    transform: scale(0.95);
}

.key:disabled {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
}

.key.correct {
    background: #28a745;
    color: white;
}

.key.incorrect {
    background: #dc3545;
    color: white;
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* Footer */
footer {
    margin-top: 20px;
}

.game-instructions {
    font-size: 0.9rem;
    color: #7f8c8d;
    line-height: 1.5;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    font-size: 2rem;
    color: #e74c3c;
    margin-bottom: 15px;
}

.modal-content p {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 25px;
}

#final-score {
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.3rem;
}

.hidden {
    display: none;
}

/* 胜利动画 - 气球样式 */
.balloon {
    position: fixed;
    bottom: -50px;
    border-radius: 50%;
    z-index: 1000;
    pointer-events: none;
    animation: floatUp linear forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .keyboard {
        grid-template-columns: repeat(7, 1fr);
        gap: 6px;
    }
    
    .key {
        padding: 12px 3px;
        font-size: 0.9rem;
    }
    
    .letter {
        width: 35px;
        height: 45px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .game-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-selector {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .game-btn {
        width: 80%;
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .keyboard {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
}

/* Loading Indicator Styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-text {
    font-size: 1.2rem;
    color: #e91e63;
    font-weight: 600;
    margin-top: 20px;
}

.container-loading {
    --uib-size: 45px;
    --uib-color: #e91e63;
    --uib-speed: 1.75s;
    --uib-bg-opacity: .1;
    position: relative;
    display: flex;
    flex-direction: column;
    height: var(--uib-size);
    width: var(--uib-size);
    transform: rotate(45deg);
    animation: rotate calc(var(--uib-speed) * 2) ease-in-out infinite;
}

.container-loading .half {
    --uib-half-size: calc(var(--uib-size) * 0.435);
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--uib-half-size);
    height: var(--uib-half-size);
    overflow: hidden;
    isolation: isolate;
}

.container-loading .half:first-child {
    top: 8.25%;
    left: 8.25%;
    border-radius: 50% 50% calc(var(--uib-size) / 15);
}

.container-loading .half:last-child {
    bottom: 8.25%;
    right: 8.25%;
    transform: rotate(180deg);
    align-self: flex-end;
    border-radius: 50% 50% calc(var(--uib-size) / 15);
}

.container-loading .half:last-child::after {
    animation-delay: calc(var(--uib-speed) * -1);
}

.container-loading .half::before {
    content: '';
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--uib-color);
    opacity: var(--uib-bg-opacity);
    transition: background-color 0.3s ease;
}

.container-loading .half::after {
    content: '';
    position: relative;
    z-index: 1;
    display: block;
    background-color: var(--uib-color);
    height: 100%;
    transform: rotate(45deg) translate(-3%, 50%) scaleX(1.2);
    width: 100%;
    transform-origin: bottom right;
    border-radius: 0 0 calc(var(--uib-size) / 20) 0;
    animation: flow calc(var(--uib-speed) * 2) linear infinite both;
    transition: background-color 0.3s ease;
}

@keyframes flow {
    0% {
        transform: rotate(45deg) translate(-3%, 50%) scaleX(1.2);
    }
    30% {
        transform: rotate(45deg) translate(115%, 50%) scaleX(1.2);
    }

    30.001%,
    50% {
        transform: rotate(0deg) translate(-85%, -85%) scaleX(1);
    }

    80%,
    100% {
        transform: rotate(0deg) translate(0%, 0%) scaleX(1);
    }
}

@keyframes rotate {
    0%,
    30% {
        transform: rotate(45deg);
    }

    50%,
    80% {
        transform: rotate(225deg);
    }

    100% {
        transform: rotate(405deg);
    }
}