/* ===================================
   STYLES FOR MY FOOTBALL GAME
   =================================== */

/* This makes the whole page look nice */
body {
    /* Put everything in the center */
    text-align: center;
    
    /* Dark background color */
    background-color: #1a1a2e;
    
    /* White text color */
    color: white;
    
    /* Nice font for the text */
    font-family: Arial, sans-serif;
    
    /* Remove the default spacing */
    margin: 0;
    padding: clamp(12px, 3vw, 20px);
    padding-bottom: calc(clamp(12px, 3vw, 20px) + env(safe-area-inset-bottom));
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior: none;
}

.game-shell {
    width: min(960px, 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.game-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* This styles the game title */
h1 {
    /* Big text */
    font-size: 32px;
    
    /* Yellow color like a trophy! */
    color: #ffd700;
    
    /* Space below the title */
    margin-bottom: 10px;
}

/* Difficulty selector styles */
#difficulty-selector {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#difficulty-selector p {
    font-size: 24px;
    margin: 0 0 10px 0;
}

#difficulty-selector button {
    font-size: 20px;
    padding: 15px 30px;
    margin: 5px 10px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
    min-width: 220px;
    width: min(100%, 360px);
}

#difficulty-selector button:hover {
    transform: scale(1.1);
}

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

#medium-btn {
    background-color: #f1c40f;
    color: black;
}

#hard-btn {
    background-color: #e74c3c;
    color: white;
}

/* Mode selector styles */
#mode-selector {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#mode-selector p {
    font-size: 22px;
    margin: 0 0 10px 0;
    color: #ffd700;
}

#mode-selector button {
    font-size: 18px;
    padding: 12px 25px;
    margin: 5px 10px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s, box-shadow 0.1s;
    min-width: 220px;
    width: min(100%, 360px);
}

#mode-selector button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

#single-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

/* This styles the score and time display */
#game-info {
    /* Space around the text */
    margin-bottom: 10px;
    
    /* Bigger text */
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

/* This adds space between score and time */
#game-info span {
    /* Space on the sides */
    margin: 0;
    
    /* Make the text bold */
    font-weight: bold;
}

/* This makes the score green */
#score-display {
    color: #00ff00;
}

/* This makes the time yellow */
#time-display {
    color: #ffff00;
}

/* This makes the enemy score red */
#enemy-score-display {
    color: #ff6347;
}

#net-status {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    max-width: 720px;
    width: 100%;
    box-sizing: border-box;
}

/* Power bar container */
#power-container {
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 720px;
}

#power-bar {
    width: 150px;
    height: 20px;
    background-color: #333;
    border: 2px solid white;
    border-radius: 10px;
    overflow: hidden;
}

#power-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.05s;
}

#power-text {
    color: #f1c40f;
    font-weight: bold;
    min-width: 40px;
}

/* This styles the game canvas (the playing field) */
#gameCanvas {
    /* Black border around the field */
    border: 4px solid white;
    
    /* Rounded corners */
    border-radius: 10px;
    
    /* Show as a block element */
    display: block;
    
    /* Center the canvas */
    margin: 0 auto;
    
    /* Prevent touch actions on canvas */
    touch-action: none;
    width: 100%;
    max-width: 720px;
    height: auto;
    aspect-ratio: 5 / 6;
    max-height: 70vh;
}

.canvas-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Touch controls for mobile */
#touch-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding: 20px 22px;
    gap: 18px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 880px;
    background: linear-gradient(160deg, rgba(38, 41, 56, 0.9), rgba(16, 18, 28, 0.92));
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    box-shadow:
        0 20px 34px rgba(0, 0, 0, 0.48),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 14px 24px rgba(20, 100, 200, 0.08);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

#dpad {
    display: grid;
    grid-template-columns: repeat(3, minmax(52px, 72px));
    grid-template-rows: repeat(3, minmax(52px, 72px));
    gap: 9px;
    align-items: center;
    justify-items: center;
    flex: 1;
    max-width: 240px;
}

#dpad-middle {
    display: contents;
}

#up-btn { grid-column: 2; grid-row: 1; }
#left-btn { grid-column: 1; grid-row: 2; }
#down-btn { grid-column: 2; grid-row: 3; }
#right-btn { grid-column: 3; grid-row: 2; }

.dpad-btn {
    width: 100%;
    height: 100%;
    font-size: 22px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    background: linear-gradient(145deg, #3f4759, #1c1f29);
    color: #eaf6ff;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.08),
        inset 0 -3px 5px rgba(0, 0, 0, 0.45),
        0 6px 14px rgba(0, 0, 0, 0.35),
        0 0 14px rgba(0, 196, 255, 0.18);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    transition: transform 0.05s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.dpad-btn:active {
    background: linear-gradient(145deg, #2a2f3a, #14161d);
    transform: translateY(1px);
    box-shadow:
        inset 0 2px 2px rgba(255, 255, 255, 0.05),
        inset 0 -2px 3px rgba(0, 0, 0, 0.45),
        0 4px 9px rgba(0, 0, 0, 0.26);
}

#action-buttons {
    display: flex;
    flex-direction: row;
    gap: 18px;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    max-width: 340px;
}

.action-btn {
    width: clamp(74px, 18vw, 96px);
    height: clamp(74px, 18vw, 96px);
    font-size: 14px;
    font-weight: 800;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    color: #fff;
    letter-spacing: 0.6px;
    box-shadow:
        inset 0 4px 0 rgba(255, 255, 255, 0.16),
        0 12px 0 rgba(0, 0, 0, 0.38),
        0 22px 30px rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

#kick-btn {
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35) 0 22%, transparent 24%), linear-gradient(145deg, #ff7b5f, #ff2f4f);
    box-shadow:
        inset 0 4px 0 rgba(255, 255, 255, 0.16),
        0 12px 0 rgba(0, 0, 0, 0.38),
        0 22px 30px rgba(0, 0, 0, 0.32),
        0 0 18px rgba(255, 90, 90, 0.35);
}

#kick-btn:active {
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.12),
        0 6px 0 rgba(0, 0, 0, 0.35),
        0 12px 18px rgba(0, 0, 0, 0.25);
    transform: translateY(1px);
}

.action-btn.power {
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35) 0 22%, transparent 24%), linear-gradient(145deg, #8c7bff, #48c8ff);
    box-shadow:
        inset 0 4px 0 rgba(255, 255, 255, 0.16),
        0 12px 0 rgba(64, 50, 143, 0.65),
        0 22px 30px rgba(0, 0, 0, 0.32),
        0 0 18px rgba(128, 118, 255, 0.35);
}

.action-btn.power:active {
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.12),
        0 6px 0 rgba(84, 36, 143, 0.6),
        0 12px 18px rgba(0, 0, 0, 0.25);
    transform: translateY(1px);
}

/* This styles the instructions text */
#instructions {
    /* Bigger text */
    font-size: 18px;
    
    /* Space above the text */
    margin-top: 15px;
    
    /* Light blue color */
    color: #87ceeb;
    
    /* Space between lines */
    line-height: 1.8;
}

button {
    touch-action: manipulation;
}

/* Hide touch controls on desktop */
@media (min-width: 800px) {
    #touch-controls {
        display: none !important;
    }
}

/* Show touch controls on mobile/tablet */
@media (max-width: 799px) {
    #instructions {
        display: none;
    }
    
    h1 {
        font-size: 24px;
        margin: 8px 0;
    }
    
    #gameCanvas {
        max-width: 100%;
        max-height: 62vh;
    }
    
    #mode-selector button,
    #difficulty-selector button {
        width: 100%;
    }
    
    #touch-controls {
        gap: 14px;
        padding: 14px 12px;
    }
    
    #dpad {
        grid-template-columns: repeat(3, minmax(48px, 60px));
        grid-template-rows: repeat(3, minmax(48px, 60px));
        max-width: 200px;
    }
    
    .dpad-btn {
        font-size: 20px;
        border-radius: 10px;
    }
    
    #action-buttons {
        gap: 12px;
        justify-content: center;
        max-width: none;
    }
    
    .action-btn {
        font-size: 13px;
    }
}

@media (max-width: 520px) {
    h1 {
        font-size: 22px;
    }
    
    #game-info {
        font-size: 17px;
    }
    
    #touch-controls {
        justify-content: center;
        gap: 10px;
    }
    
    #dpad {
        grid-template-columns: repeat(3, minmax(44px, 54px));
        grid-template-rows: repeat(3, minmax(44px, 54px));
        max-width: 180px;
    }
    
    .dpad-btn {
        font-size: 18px;
    }
    
    #action-buttons {
        width: 100%;
        justify-content: space-evenly;
    }
    
    .action-btn {
        width: 72px;
        height: 72px;
        font-size: 12px;
        box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 5px 0 rgba(0, 0, 0, 0.6);
    }
}

/* ===================================
   ONLINE MULTIPLAYER / QR CODE STYLES
   =================================== */

#online-btn {
    background: linear-gradient(135deg, #06d6a0, #118ab2);
    color: white;
}

/* Room lobby styles */
#room-lobby {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#room-lobby p {
    font-size: 24px;
    margin: 0 0 10px 0;
    color: #06d6a0;
}

#room-lobby button {
    font-size: 18px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s, box-shadow 0.1s;
    min-width: 220px;
    width: min(100%, 320px);
}

#room-lobby button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(6, 214, 160, 0.4);
}

#create-room-btn {
    background: linear-gradient(135deg, #06d6a0, #05b384);
    color: white;
}

#join-room-btn {
    background: linear-gradient(135deg, #118ab2, #0d6e8a);
    color: white;
}

#back-to-modes-btn {
    background: linear-gradient(135deg, #555, #444);
    color: white;
    font-size: 14px !important;
    padding: 10px 20px !important;
}

/* QR Modal styles */
#qr-modal {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: linear-gradient(145deg, rgba(6, 214, 160, 0.1), rgba(17, 138, 178, 0.1));
    border-radius: 20px;
    border: 2px solid #06d6a0;
    box-shadow: 0 0 30px rgba(6, 214, 160, 0.2);
}

#qr-modal p {
    margin: 0;
    font-size: 20px;
    color: #ffd700;
}

#qr-code {
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#qr-code canvas {
    display: block;
}

#room-code-display {
    font-size: 28px !important;
    font-weight: bold;
    color: #06d6a0 !important;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
}

#room-url-display {
    color: #888 !important;
    max-width: 280px;
}

#waiting-text {
    color: #ffd166 !important;
    animation: pulse 1.5s ease-in-out infinite;
}

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

#qr-modal button {
    font-size: 16px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
    min-width: 160px;
}

#copy-link-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

#cancel-room-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

/* Join Modal styles */
#join-modal {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(145deg, rgba(17, 138, 178, 0.1), rgba(6, 214, 160, 0.1));
    border-radius: 20px;
    border: 2px solid #118ab2;
}

#join-modal p {
    margin: 0;
    font-size: 22px;
    color: #118ab2;
}

#room-code-input {
    font-size: 32px;
    padding: 16px 24px;
    text-align: center;
    border: 3px solid #118ab2;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: #06d6a0;
    font-family: 'Courier New', monospace;
    letter-spacing: 8px;
    width: 180px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#room-code-input:focus {
    border-color: #06d6a0;
    box-shadow: 0 0 20px rgba(6, 214, 160, 0.3);
}

#room-code-input::placeholder {
    color: #555;
    letter-spacing: 4px;
}

#join-modal button {
    font-size: 18px;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.1s;
    min-width: 140px;
}

#join-btn {
    background: linear-gradient(135deg, #06d6a0, #05b384);
    color: white;
}

#cancel-join-btn {
    background: linear-gradient(135deg, #555, #444);
    color: white;
}

/* Connected status styling */
.connected-status {
    color: #06d6a0 !important;
    font-weight: bold;
}

