/* Blades of Steel CSS */
/* Using Google Fonts instead of downloading the font file */
/* The font is already loaded in main.js */

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

body {
    font-family: 'PressStart2P', monospace;
    background-color: #000;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    width: 800px;
    height: 600px;
    border: 4px solid #fff;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
}

.hidden {
    display: none;
}

/* Start Screen and Player Select Screen */
#start-screen, #player-select-screen {
    background-image: linear-gradient(to bottom, #00843D, #006633);
    text-align: center;
}

#start-screen h1 {
    font-size: 48px;
    margin-bottom: 60px;
    color: #ffffff;
    text-shadow: 4px 4px 0 #003300;
    animation: pulse 2s infinite;
}

#player-select-screen h2 {
    font-size: 36px;
    margin-bottom: 60px;
    color: #ffffff;
    text-shadow: 3px 3px 0 #003300;
}

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

.menu {
    margin-bottom: 40px;
}

.menu-item {
    font-size: 24px;
    margin: 20px 0;
    padding: 10px;
    color: #fff;
}

.menu-item.selected {
    color: #ffff00;
    position: relative;
}

.menu-item.selected::before {
    content: '>';
    position: absolute;
    left: -30px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% { opacity: 0; }
    50%, 100% { opacity: 1; }
}

.instructions {
    margin-top: 30px;
    font-size: 16px;
    width: 100%;
    max-width: 700px;
}

.instructions p {
    margin: 10px 0;
}

.instructions .small {
    font-size: 12px;
    color: #aaaaff;
}

.instructions .highlight {
    color: #ffff00;
    font-weight: bold;
    text-shadow: 0 0 5px #ff9900;
    animation: pulse 2s infinite;
}

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

.controls-container {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    width: 100%;
}

.keyboard-controls, .controller-guide {
    padding: 15px;
    border: 2px solid #aaaaff;
    border-radius: 10px;
    background-color: rgba(0, 0, 128, 0.5);
    width: 45%;
    min-width: 200px;
}

.keyboard-controls h3, .controller-guide h3 {
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    text-decoration: underline;
}

.keyboard-controls .small, .controller-guide .small {
    margin: 8px 0;
    color: #ffff00;
}

/* Game Screen */
#game-screen {
    background-color: #000;
    z-index: 1;
}

#scoreboard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: 
        "team1 time team2"
        "team1 period team2";
    padding: 10px;
    background-color: #00843D;
    border-bottom: 2px solid #fff;
    z-index: 10;
    text-align: center;
}

#game-time {
    grid-area: time;
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 0 #000;
    margin-bottom: 5px;
}

.period {
    grid-area: period;
    font-size: 16px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000;
}

.team {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
}

.home-team {
    grid-area: team1;
    justify-content: flex-start;
}

.away-team {
    grid-area: team2;
    justify-content: flex-end;
}

.team-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.team-name {
    font-size: 16px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000;
    white-space: nowrap;
}

#team1-score, #team2-score {
    font-size: 24px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 2px 2px 0 #000;
    min-width: 30px;
    text-align: center;
}

#player-switch-indicator {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #FFFF00;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    z-index: 1000;
    animation: pulse 1.5s infinite;
    border: 2px solid #FFFF00;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

#player-switch-indicator.hidden {
    display: none !important;
}

/* Game controls */
#game-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 100;
}

/* Hide the restart and exit buttons */
#restart-button, #exit-button {
    display: none;
}

/* Player indicators */
#player-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
}

.player-indicator {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    background-color: rgba(50, 50, 50, 0.7);
    color: #FFFFFF;
    border: 2px solid #FFFFFF;
}

.player-indicator.active {
    background-color: rgba(0, 128, 0, 0.7);
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

#p1-indicator {
    border-color: #FF0000;
}

#p2-indicator {
    border-color: #0000FF;
}

#game-canvas {
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
}

/* Fight Screen */
#fight-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #880000;
    z-index: 1000;
    display: none;
}

#fight-screen.hidden {
    display: none;
}

#fight-screen:not(.hidden) {
    display: block;
}

#fight-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 600px;
    background-color: #880000;
    z-index: 1001;
}

#fight-screen h2 {
    position: absolute;
    top: 20px;
    font-size: 36px;
    color: #ffff00;
    text-shadow: 3px 3px 0 #ff0000;
}

/* Multiplayer Screen */
#multiplayer-screen {
    background-image: linear-gradient(to bottom, #00843D, #006633);
    text-align: center;
}

#multiplayer-screen h2 {
    font-size: 36px;
    margin-bottom: 40px;
    color: #ffffff;
    text-shadow: 3px 3px 0 #003300;
}

.multiplayer-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.multiplayer-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 80%;
    max-width: 500px;
}

.multiplayer-option .instruction {
    color: #ffff00;
    font-style: italic;
    margin-top: 5px;
}

/* Multiplayer Status Screen */
#multiplayer-status {
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #ffffff;
    width: 80%;
    max-width: 500px;
    margin-bottom: 30px;
}

#multiplayer-status h3 {
    color: #ffff00;
    margin-bottom: 15px;
    font-size: 24px;
}

#room-code-display {
    font-size: 28px;
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #ffff00;
}

#players-list {
    text-align: left;
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    min-height: 100px;
}

#waiting-message {
    color: #aaaaff;
    font-style: italic;
    animation: pulse 2s infinite;
    margin-top: 15px;
}

.multiplayer-button {
    background-color: #00843D;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 5px;
    padding: 15px 30px;
    font-family: 'PressStart2P', monospace;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.multiplayer-button:hover {
    background-color: #006633;
    transform: scale(1.05);
}

.multiplayer-button:active {
    transform: scale(0.95);
}

.back-button {
    background-color: #880000;
    margin-top: 20px;
}

.back-button:hover {
    background-color: #aa0000;
}

#join-game-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

#room-code-input {
    background-color: #000033;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 5px;
    padding: 10px;
    font-family: 'PressStart2P', monospace;
    font-size: 16px;
    text-align: center;
    width: 200px;
    text-transform: uppercase;
}

#room-code-input::placeholder {
    color: #aaaaaa;
    opacity: 0.7;
}

#connect-button {
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 800px) {
    .game-container {
        width: 100%;
        height: 100vh;
        border: none;
    }
    
    #start-screen h1 {
        font-size: 32px;
        margin-bottom: 40px;
    }
    
    .menu-item {
        font-size: 18px;
        margin: 15px 0;
    }
    
    .instructions {
        font-size: 14px;
    }
    
    .instructions .small {
        font-size: 10px;
    }
}

/* Touch Controls for Mobile */
.touch-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    width: 100%;
    z-index: 100;
}

.d-pad {
    position: absolute;
    left: 20px;
    bottom: 0;
    width: 150px;
    height: 150px;
}

.d-pad-button {
    position: absolute;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #fff;
}

.d-pad-up { top: 0; left: 50px; transform: translateX(-50%); }
.d-pad-right { right: 0; top: 50px; transform: translateY(-50%); }
.d-pad-down { bottom: 0; left: 50px; transform: translateX(-50%); }
.d-pad-left { left: 0; top: 50px; transform: translateY(-50%); }

.action-buttons {
    position: absolute;
    right: 20px;
    bottom: 0;
    width: 150px;
    height: 150px;
}

.action-button {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
}

.button-a {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 0, 0, 0.5);
}

.button-b {
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 255, 0.5);
}

@media (max-width: 800px) {
    .touch-controls {
        display: block;
    }
}

/* Welcome Modal */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to bottom, #00843D, #006633);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 1s ease-in;
    overflow: hidden;
}

.welcome-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #ffffff;
    padding: 20px;
}

.welcome-content h1 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #ffffff;
    text-shadow: 4px 4px 0 #003300;
    animation: pulse 2s infinite;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 50px;
    margin: 20px 0;
}

.logo-container img {
    max-width: 300px;
    height: auto;
}

.welcome-message {
    margin-top: 40px;
    animation: pulse 2s infinite;
}

.welcome-message p {
    font-size: 24px;
    color: #ffffff;
    text-shadow: 2px 2px 0 #003300;
    margin: 10px 0;
}

.welcome-message p.small {
    font-size: 16px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #003300;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Ensure logo is below fight screen */
.logo {
    z-index: 2;
}

/* Connection Status Indicator */
.connection-status {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    padding: 5px 10px;
    border-radius: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    font-size: 10px;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.connection-status.show {
    display: flex;
}

.connection-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.connection-status .status-text {
    margin-right: 5px;
}

.connection-status .reconnect-button {
    background-color: transparent;
    border: 1px solid #fff;
    color: #fff;
    padding: 2px 5px;
    font-size: 8px;
    cursor: pointer;
    border-radius: 3px;
}

.connection-status.connected .status-dot {
    background-color: #00ff00;
}

.connection-status.disconnected .status-dot {
    background-color: #ff0000;
}

.tv-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    animation: static 0.1s infinite;
    pointer-events: none;
}

.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0, 0, 0, 0.1) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
}

.broadcast-title {
    font-size: 48px;
    margin: 20px 0;
    color: #ffffff;
    text-shadow: 4px 4px 0 #003300;
    animation: broadcastText 2s infinite;
}

@keyframes static {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2px); }
}

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