html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.game-layout {
    max-width: 1220px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1000px) 200px;
    gap: 14px;
    align-items: start;
}

.kill-feed-panel {
    min-height: 220px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 14px;
}

    .kill-feed-panel h4 {
        margin: 0 0 10px 0;
        color: #ffcc00;
    }

    .kill-feed-panel ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .kill-feed-panel li {
        padding: 8px 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 13px;
        color: #d7e6f1;
    }

.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.78);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

    .game-over-overlay.show {
        display: flex;
    }

.game-over-card {
    width: 90%;
    max-width: 430px;
    background: linear-gradient(135deg, #142536, #071019);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 24px;
    padding: 35px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0,0,0,0.65);
}

    .game-over-card h1 {
        margin: 0 0 10px 0;
        font-size: 42px;
        color: #ffcc00;
    }

    .game-over-card h2 {
        margin: 0 0 25px 0;
        color: #00ff99;
    }

    .game-over-card button {
        width: 100%;
        height: 48px;
        border: none;
        border-radius: 14px;
        background: #00ff99;
        color: #061c13;
        font-weight: bold;
        cursor: pointer;
        font-size: 15px;
    }

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .kill-feed-panel {
        max-width: 1000px;
        width: 100%;
        margin: 0 auto;
    }
}

.mobile-controls {
    display: none;
}

@media (max-width: 900px) {
    body {
        overflow-x: hidden;
        touch-action: manipulation;
    }

    .game-page {
        padding: 10px 10px 150px 10px;
    }

    .top-bar {
        gap: 10px;
    }

        .top-bar h2 {
            font-size: 20px;
        }

    .players-panel {
        padding: 10px;
    }

        .players-panel li {
            font-size: 12px;
        }

    .kill-feed-panel {
        min-height: 120px;
    }

        .kill-feed-panel li {
            font-size: 12px;
            padding: 5px 0;
        }

    #gameCanvas {
        border-radius: 12px;
    }

    .help-box {
        font-size: 12px;
        text-align: center;
    }

    .mobile-controls {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 135px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 18px;
        background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0.25));
        z-index: 9998;
        pointer-events: none;
    }

    .move-pad {
        width: 126px;
        height: 112px;
        display: grid;
        grid-template-columns: 42px 42px 42px;
        grid-template-rows: 36px 36px 36px;
        gap: 4px;
        pointer-events: auto;
    }

    .touch-btn,
    .shoot-touch-btn {
        border: 1px solid rgba(255,255,255,0.28);
        background: rgba(255,255,255,0.13);
        color: #fff;
        border-radius: 14px;
        font-weight: bold;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        touch-action: none;
        box-shadow: 0 8px 18px rgba(0,0,0,0.35);
    }

    .touch-btn {
        width: 42px;
        height: 36px;
        font-size: 18px;
    }

        .touch-btn.up {
            grid-column: 2;
            grid-row: 1;
        }

        .touch-btn.left {
            grid-column: 1;
            grid-row: 2;
        }

        .touch-btn.down {
            grid-column: 2;
            grid-row: 3;
        }

        .touch-btn.right {
            grid-column: 3;
            grid-row: 2;
        }

        .touch-btn.active,
        .shoot-touch-btn.active {
            background: #00ff99;
            color: #061c13;
            transform: scale(0.96);
        }

    .shoot-touch-btn {
        width: 92px;
        height: 92px;
        border-radius: 50%;
        font-size: 17px;
        background: rgba(255, 51, 102, 0.82);
        pointer-events: auto;
    }

    .game-over-overlay {
        z-index: 10000;
    }
}

@media (min-width: 901px) {
    .mobile-controls {
        display: none !important;
    }
}

/* ================= SCOREBOARD ================= */

.scoreboard {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 12px;
    margin-bottom: 12px;
}

    .scoreboard h4 {
        margin-bottom: 10px;
        color: #fff;
    }

.score-row {
    display: grid;
    grid-template-columns: 40px 40px 1fr 40px;
    align-items: center;
    padding: 8px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

    .score-row:last-child {
        border-bottom: none;
    }

.rank {
    color: #ffcc00;
    font-weight: bold;
}

.avatar {
    font-size: 20px;
    text-align: center;
}

.info .name {
    font-weight: bold;
}

.info .tank {
    font-size: 11px;
    color: #aaa;
}

.score {
    text-align: right;
    font-weight: bold;
    color: #00ff99;
}

/* ================= TIMER ================= */

.timer {
    font-size: 26px;
    font-weight: bold;
    color: #ffcc00;
}

/* ================= MOBILE ================= */

@media (max-width: 900px) {

    .score-row {
        grid-template-columns: 30px 30px 1fr 30px;
        font-size: 12px;
    }

    .timer {
        font-size: 20px;
    }
}

.quick-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 900;
    font-size: 15px;
    margin-top: 10px;
    background: linear-gradient(135deg, #ffcc00, #ffef85);
    color: #221800;
}

.hud-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

    .hud-action-btn.start {
        background: linear-gradient(135deg, #00ff99, #7dffca);
        color: #061c13;
    }

    .hud-action-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.waiting-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(0,170,255,0.16), transparent 35%), rgba(0,0,0,0.82);
    z-index: 9999;
    padding: 20px;
}

    .waiting-overlay.show {
        display: flex;
    }

.waiting-card {
    width: 90%;
    max-width: 480px;
    background: linear-gradient(135deg, rgba(20,37,54,0.98), rgba(7,16,25,0.98));
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 28px;
    padding: 34px;
    text-align: center;
    box-shadow: 0 30px 100px rgba(0,0,0,0.75);
}

    .waiting-card h1 {
        margin: 16px 0 8px 0;
        font-size: 38px;
    }

    .waiting-card p {
        color: #9fb2c1;
    }

.room-code-box {
    margin: 18px 0;
    padding: 14px;
    border-radius: 16px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    color: #d7e6f1;
}

    .room-code-box b {
        color: #ffcc00;
        letter-spacing: 2px;
    }

.waiting-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

    .waiting-actions button {
        height: 44px;
        padding: 0 18px;
        border: none;
        border-radius: 14px;
        font-weight: 900;
        cursor: pointer;
    }

        .waiting-actions button:first-child {
            background: linear-gradient(135deg, #00aaff, #4cc7ff);
            color: #fff;
        }

        .waiting-actions button:last-child {
            background: linear-gradient(135deg, #00ff99, #7dffca);
            color: #061c13;
        }

        .waiting-actions button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }

.waiting-message {
    margin-top: 16px;
    color: #ffcc00;
    font-weight: bold;
}

@media (max-width: 900px) {
    .hud-info {
        gap: 8px;
    }

    .hud-action-btn {
        flex: 1;
        font-size: 12px;
        padding: 0 8px;
    }

    .waiting-card {
        padding: 24px;
    }

        .waiting-card h1 {
            font-size: 30px;
        }
}