/* Controller Styles - Mobile Optimized */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    background: #111;
    color: #fff;
    font-family: 'Courier New', monospace;
}

body {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Status Bar */
#statusBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    font-size: 12px;
    min-height: 36px;
    flex-shrink: 0;
}

#connectionStatus {
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.status-connected {
    background: #1a4d1a;
    color: #4cff4c;
}

.status-disconnected {
    background: #4d1a1a;
    color: #ff4c4c;
}

.status-connecting {
    background: #4d4d1a;
    color: #ffff4c;
}

#playerInfo {
    font-weight: bold;
    font-size: 13px;
}

#livesDisplay {
    color: #ff4444;
    font-size: 14px;
}

#scoreDisplay {
    color: #ffcc00;
    font-size: 13px;
}

/* Join Screen */
#joinScreen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.join-container {
    text-align: center;
    padding: 30px;
    width: 90%;
    max-width: 400px;
}

.join-container h1 {
    font-size: 36px;
    color: #00ffcc;
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.5);
    margin-bottom: 10px;
    letter-spacing: 4px;
}

.join-subtitle {
    color: #888;
    margin-bottom: 30px;
    font-size: 14px;
}

#joinForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#nameInput {
    padding: 16px 20px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    background: #222;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

#nameInput:focus {
    border-color: #00ffcc;
}

#joinBtn {
    padding: 18px 30px;
    font-size: 20px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #00ffcc;
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 2px;
    transition: transform 0.1s, background 0.2s;
}

#joinBtn:active {
    transform: scale(0.95);
    background: #00cc99;
}

/* Waiting Screen */
#waitingScreen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waiting-container {
    text-align: center;
    padding: 30px;
}

.waiting-container h2 {
    font-size: 24px;
    color: #ffcc00;
    margin-bottom: 15px;
}

#waitingMessage {
    color: #aaa;
    font-size: 16px;
    margin-bottom: 20px;
}

.pulse-dot {
    width: 20px;
    height: 20px;
    background: #00ffcc;
    border-radius: 50%;
    margin: 0 auto;
    animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

/* Controls Screen */
#controlsScreen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.controls-layout {
    flex: 1;
    display: flex;
    gap: 10px;
}

.controls-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Control Buttons */
.ctrl-btn {
    flex: 1;
    min-height: 80px;
    border: none;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.05s, filter 0.05s;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
}

.ctrl-btn:active,
.ctrl-btn.pressed {
    transform: scale(0.95);
    filter: brightness(1.3);
}

.rotate-btn {
    background: #2a2a5a;
    color: #8888ff;
    border: 2px solid #4444aa;
    font-size: 40px;
}

.rotate-btn:active,
.rotate-btn.pressed {
    background: #3a3a7a;
    border-color: #6666cc;
}

.thrust-btn {
    background: #2a4a2a;
    color: #44ff44;
    border: 2px solid #338833;
}

.thrust-btn:active,
.thrust-btn.pressed {
    background: #3a6a3a;
    border-color: #55bb55;
}

.fire-btn {
    background: #4a2a2a;
    color: #ff4444;
    border: 2px solid #883333;
}

.fire-btn:active,
.fire-btn.pressed {
    background: #6a3a3a;
    border-color: #bb5555;
}

/* Special Button */
#specialContainer {
    padding: 10px 10px 0 10px;
    flex-shrink: 0;
}

.special-btn {
    width: 100%;
    min-height: 60px;
    background: #4a3a1a;
    color: #ffcc00;
    border: 2px solid #886600;
}

.special-btn:active,
.special-btn.pressed {
    background: #6a5a2a;
    border-color: #bbaa33;
}

/* Dead Screen */
#deadScreen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dead-container {
    text-align: center;
    padding: 30px;
}

.dead-container h2 {
    font-size: 28px;
    color: #ff4444;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

#deadMessage {
    color: #aaa;
    font-size: 16px;
}

/* Game Over Screen */
#gameOverScreen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gameover-container {
    text-align: center;
    padding: 30px;
    width: 90%;
}

.gameover-container h2 {
    font-size: 28px;
    color: #ffcc00;
    margin-bottom: 20px;
}

#controllerResults {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 20px;
    color: #ccc;
}

.gameover-container p {
    color: #888;
    font-size: 14px;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Landscape orientation adjustments */
@media (orientation: landscape) {
    .controls-layout {
        flex-direction: row;
    }

    .controls-left,
    .controls-right {
        flex-direction: row;
    }

    .ctrl-btn {
        min-height: 60px;
    }
}

/* Larger phones */
@media (min-height: 700px) {
    .ctrl-btn {
        min-height: 100px;
        font-size: 20px;
    }

    .rotate-btn {
        font-size: 48px;
    }
}
