/* Game of specific variables - scoped to avoid conflicts */
.game_of-game {
    --game-primary: #ff6b6b;
    --game-accent: #feca57;
    --game-darker-bg: rgba(255, 255, 255, 0.15);
    --game-glass-border: rgba(255, 255, 255, 0.3);
    --game-text-muted: rgba(45, 52, 54, 0.7);
}

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

body {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    animation: gradientShift 15s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.game-header-banner {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-header-banner h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.game-header-banner p {
    position: relative;
    z-index: 1;
    font-size: 1.1em;
    opacity: 0.9;
}

.setup-section {
    padding: 30px;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-bottom: 2px solid rgba(255,255,255,0.3);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #2d3436;
    font-size: 1.1em;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 3px solid #dfe6e9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
    background: rgba(255,255,255,0.8);
}

.input-group input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
    transform: scale(1.02);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
}

.game-section {
    padding: 30px;
    display: none;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: rgba(255,255,255,0.7);
    border-radius: 15px;
    backdrop-filter: blur(5px);
}

.target-word {
    font-size: 1.8em;
    font-weight: 800;
    color: #2d3436;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.controls {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(116, 185, 255, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.4);
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.player-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #dfe6e9;
    border-radius: 20px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.player-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    border-color: #ff6b6b;
}

.player-card.active {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    animation: activeGlow 2s infinite;
}

@keyframes activeGlow {
    0%, 100% { box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
    50% { box-shadow: 0 5px 25px rgba(255, 107, 107, 0.4); }
}

.player-name {
    font-size: 1.4em;
    font-weight: 800;
    margin-bottom: 15px;
    color: #2d3436;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.player-score {
    font-size: 2.5em;
    font-weight: 900;
    margin: 15px 0;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.player-letters {
    font-size: 1.3em;
    color: #636e72;
    margin-bottom: 15px;
    min-height: 35px;
    font-weight: 700;
    letter-spacing: 2px;
}

.undo-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: none;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(253, 121, 168, 0.3);
}

.player-card:hover .undo-btn {
    display: block;
    animation: bounce 0.5s;
}

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

.undo-btn:hover {
    background: linear-gradient(135deg, #e84393 0%, #d63031 100%);
    transform: scale(1.1) rotate(-10deg);
}

.winner {
    animation: winnerGlow 1.5s infinite;
    border-color: #00b894 !important;
    background: linear-gradient(135deg, #55efc4 0%, #00b894 100%) !important;
}

@keyframes winnerGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 10px 30px rgba(0, 184, 148, 0.5);
    }
}

.history {
    margin-top: 30px;
    padding: 25px;
    background: rgba(255,255,255,0.7);
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(255,255,255,0.5);
}

.history h3 {
    margin-bottom: 20px;
    color: #2d3436;
    font-size: 1.4em;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.history-item {
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 10px;
    font-size: 14px;
    color: #636e72;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Fun confetti effect for winner */
.confetti {
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    position: absolute;
    animation: confettiFall 3s linear;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@media (max-width: 620px) {
    .player-card {
        padding: 5px;
    }

}

/* Custom Dialog Modals */
.game-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.game-modal {
    background: linear-gradient(135deg, #ffffff 0%, #fff5f7 100%);
    border-radius: 25px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateY(-30px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 3px solid #ff6b6b;
    position: relative;
    overflow: hidden;
}

.game-modal-overlay.active .game-modal {
    transform: scale(1) translateY(0);
}

.game-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    background-size: 200% 100%;
    animation: rainbowSlide 3s linear infinite;
}

@keyframes rainbowSlide {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

.game-modal-icon {
    font-size: 3.5em;
    text-align: center;
    margin-bottom: 15px;
    animation: bounceIn 0.5s ease;
}

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

.game-modal-title {
    font-size: 1.8em;
    font-weight: 800;
    color: #2d3436;
    text-align: center;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game-modal-message {
    font-size: 1.1em;
    color: #636e72;
    text-align: center;
    margin-bottom: 25px;
    line-height: 1.6;
}

.game-modal-input {
    width: 100%;
    padding: 15px;
    border: 3px solid #dfe6e9;
    border-radius: 12px;
    font-size: 1.1em;
    margin-bottom: 20px;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.8);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
}

.game-modal-input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
    transform: scale(1.02);
}

.game-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-modal-btn {
    padding: 15px 35px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.game-modal-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.game-modal-btn:hover::before {
    width: 300px;
    height: 300px;
}

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

.game-modal-btn-primary {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
    color: white;
}

.game-modal-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.game-modal-btn-secondary {
    background: linear-gradient(135deg, #dfe6e9 0%, #b2bec3 100%);
    color: #2d3436;
}

.game-modal-btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(178, 190, 195, 0.4);
}

.game-modal-btn-success {
    background: linear-gradient(135deg, #00b894 0%, #55efc4 100%);
    color: white;
}

.game-modal-btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
}

/* Winner celebration modal */
.winner-modal .game-modal {
    border-color: #00b894;
    animation: winnerPulse 0.5s ease;
}

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

.winner-modal .game-modal::before {
    background: linear-gradient(90deg, #00b894, #55efc4, #feca57, #ff6b6b);
}

/* Footer styling specific to game_of */
.game_of-game footer {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.game_of-game .footer-section h4 {
    color: #ff6b6b !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game_of-game .footer-section a {
    color: #2d3436 !important;
    font-weight: 600;
}

.game_of-game .footer-section a:hover {
    color: #ff6b6b !important;
}

.game_of-game .footer-bottom {
    color: #2d3436 !important;
    font-weight: 600;
}