* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body {
    background: #1a1a2e;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 800px;
    max-height: 600px;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(26, 26, 46, 0.95);
    z-index: 10;
}

.hidden {
    display: none !important;
}

/* Title Screen */
#title-screen h1 {
    font-size: 4rem;
    color: #00ff88;
    text-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88;
    margin-bottom: 10px;
    letter-spacing: 8px;
}

#title-screen .subtitle {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.8;
}

.menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.menu-btn {
    padding: 15px 50px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    border: none;
    border-radius: 30px;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.menu-btn:hover, .menu-btn:active {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.difficulty-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.difficulty-select label {
    color: #fff;
    font-size: 1rem;
    opacity: 0.8;
}

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

.diff-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    background: transparent;
    border: 2px solid #555;
    border-radius: 20px;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
}

.diff-btn:hover {
    border-color: #00ff88;
    color: #00ff88;
}

.diff-btn.selected {
    background: #00ff88;
    border-color: #00ff88;
    color: #1a1a2e;
    font-weight: bold;
}

/* Coin Flip Screen */
#coin-flip-screen h2 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 20px;
}

#coin-flip-screen p {
    color: #aaa;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.color-choice {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.color-btn {
    padding: 20px 40px;
    min-width: 180px;
    font-size: 1.5rem;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

 #penalty-overlay {
     position: absolute;
     inset: 0;
     display: flex;
     flex-direction: column;
     justify-content: center;
     align-items: center;
     gap: 14px;
     z-index: 9;
     pointer-events: none;
 }

 #penalty-overlay .card {
     background: linear-gradient(180deg, #ffd84a, #ffb300);
     color: #1a1a2e;
     font-weight: 900;
     letter-spacing: 2px;
     padding: 18px 28px;
     border-radius: 16px;
     border: 3px solid rgba(0, 0, 0, 0.25);
     box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
     transform: rotate(-6deg);
     animation: popCard 420ms ease-out;
 }

 #penalty-overlay .text {
     background: rgba(0, 0, 0, 0.65);
     border: 1px solid rgba(255, 255, 255, 0.18);
     color: rgba(255, 255, 255, 0.95);
     padding: 10px 16px;
     border-radius: 999px;
     text-transform: uppercase;
     letter-spacing: 0.8px;
     animation: fadeInUp 420ms ease-out;
 }

 @keyframes popCard {
     0% { transform: translateY(14px) scale(0.7) rotate(-10deg); opacity: 0; }
     100% { transform: rotate(-6deg); opacity: 1; }
 }

 @keyframes fadeInUp {
     0% { transform: translateY(10px); opacity: 0; }
     100% { transform: translateY(0); opacity: 1; }
 }

.color-btn.red {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
}

.color-btn.yellow {
    background: linear-gradient(135deg, #ffdd44, #ffaa00);
    color: #333;
}

.color-btn:hover, .color-btn:active {
    transform: scale(1.1);
}

#coin {
    width: 120px;
    height: 120px;
    perspective: 1000px;
    margin-bottom: 30px;
}

.coin-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s;
}

.coin-inner.flipping {
    animation: flip 2s ease-out forwards;
}

@keyframes flip {
    0% { transform: rotateY(0); }
    100% { transform: rotateY(var(--flip-rot, 1800deg)); }
}

.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.red-face {
    background: linear-gradient(135deg, #ff4444, #cc0000);
}

.yellow-face {
    background: linear-gradient(135deg, #ffdd44, #ffaa00);
    transform: rotateY(180deg);
}

#flip-result {
    font-size: 1.8rem;
    font-weight: bold;
    color: #00ff88;
    text-align: center;
}

/* Game UI */
#game-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    z-index: 5;
    pointer-events: none;
}

 #event-banner {
     margin: 10px auto 0;
     width: fit-content;
     max-width: 95%;
     background: rgba(0, 0, 0, 0.6);
     border: 1px solid rgba(255, 255, 255, 0.18);
     padding: 6px 12px;
     border-radius: 999px;
     color: rgba(255, 255, 255, 0.95);
     font-size: 0.9rem;
     letter-spacing: 0.4px;
     text-transform: uppercase;
 }

.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 20px;
    border-radius: 10px;
}

.score .label {
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
}

.score span:last-child {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
}

.player-score {
    border: 2px solid #00ff88;
}

.cpu-score {
    border: 2px solid #ff4444;
}

#turn-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 25px;
    border-radius: 25px;
    color: #00ff88;
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#power-meter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #fff;
}

#power-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff88, #ffdd44, #ff4444);
    transition: width 0.05s;
}

/* Goal Screen */
#goal-screen {
    background: rgba(0, 0, 0, 0.85);
}

#goal-screen h2 {
    font-size: 4rem;
    color: #00ff88;
    text-shadow: 0 0 30px #00ff88;
    animation: goalPulse 0.5s ease-out;
}

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

#goal-scorer {
    font-size: 1.5rem;
    color: #fff;
    margin-top: 20px;
}

/* Game Over Screen */
#game-over-screen h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

#game-over-screen h2.win {
    color: #00ff88;
}

#game-over-screen h2.lose {
    color: #ff4444;
}

#game-over-screen h2.draw {
    color: #ffdd44;
}

#final-score {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 30px;
}

#game-over-screen .menu-btn {
    margin: 10px;
    padding: 12px 30px;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 600px) {
    #title-screen h1 {
        font-size: 2.5rem;
    }
    
    .menu-btn {
        padding: 12px 35px;
        font-size: 1.1rem;
    }
    
    .color-btn {
        padding: 15px 25px;
        min-width: 140px;
        font-size: 1.2rem;
    }
    
    #coin {
        width: 80px;
        height: 80px;
    }
    
    .score span:last-child {
        font-size: 1.5rem;
    }
    
    #turn-indicator {
        font-size: 1rem;
        padding: 8px 15px;
    }
}
