/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Prevent callout / text selection on long-press */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Allow text selection inside form inputs */
input, textarea { user-select: text; -webkit-user-select: text; }

/* ── Score board ──────────────────────────────────────────────────────────── */
.score-board {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.8);
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
    z-index: 10;
    pointer-events: auto;
    font-family: monospace;
    min-width: 80px;
    text-align: center;
}

/* ── Info text (top-left) ─────────────────────────────────────────────────── */
.info-text {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.6);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    z-index: 10;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Camera hint ──────────────────────────────────────────────────────────── */
.camera-hint {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    padding: 5px 14px;
    border-radius: 20px;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 1s;
}
.camera-hint.hidden { opacity: 0; }

/* ── Panel toggle button ──────────────────────────────────────────────────── */
.panel-toggle {
    position: absolute;
    bottom: 80px;
    right: 12px;
    z-index: 20;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    /* always visible */
}

/* ── Controls panel ───────────────────────────────────────────────────────── */
.controls-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 15;
    pointer-events: auto;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,215,0,0.3);
    padding: 10px 14px;
    color: #fff;
    transition: transform 0.3s ease;
}

.controls-panel.panel-hidden {
    transform: translateY(100%);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-glow {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    border: none;
    color: #fff;
    font-weight: bold;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 44px;   /* iOS tap target */
}

.btn-glow:hover, .btn-glow:active {
    transform: scale(1.04);
    box-shadow: 0 0 14px rgba(255,215,0,0.5);
    color: #fff;
}

/* ── Status ───────────────────────────────────────────────────────────────── */
.status-running {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
    animation: pulse 1s infinite;
}

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

/* ── CSS2D player username labels ─────────────────────────────────────────── */
.player-label {
    color: #fff;
    background: rgba(0,0,0,0.65);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    border: 1px solid rgba(255,215,0,0.4);
    text-shadow: 0 1px 2px #000;
}

/* ── Bootstrap modal backdrop — semi-transparent so globe shows through ───── */
.modal-backdrop {
    background-color: rgba(5, 11, 26, 0.55) !important;
    opacity: 1 !important;
}

/* ── Auth modal ───────────────────────────────────────────────────────────── */
#authModal .nav-tabs { border-color: rgba(255,215,0,0.3); }
#authModal .nav-link { border-color: transparent; min-height: 44px; }
#authModal .nav-link.active {
    background: rgba(255,215,0,0.15);
    border-color: rgba(255,215,0,0.4) rgba(255,215,0,0.4) transparent;
    color: #ffd700 !important;
}
#authModal .form-control:focus {
    border-color: #ffd700;
    box-shadow: 0 0 0 0.2rem rgba(255,215,0,0.2);
}
/* Larger inputs on mobile for easy tapping */
#authModal .form-control {
    min-height: 44px;
    font-size: 16px;  /* prevents iOS auto-zoom on focus */
}

/* ── Mobile overrides ─────────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .score-board { font-size: 15px; padding: 6px 12px; top: 8px; right: 8px; }
    .info-text   { font-size: 12px; padding: 6px 10px; top: 8px; left: 8px; }

    /* Full-screen modal on phones */
    #authModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }
    #authModal .modal-content {
        border-radius: 0;
        min-height: 100dvh;
    }

    .controls-panel { padding: 8px 10px; }
    .panel-toggle   { bottom: 70px; }

    /* Stack coordinate inputs vertically */
    .controls-panel .input-group {
        flex-wrap: wrap;
        gap: 4px;
    }
    .controls-panel .input-group .form-control { min-width: 0; flex: 1 1 80px; }
    .controls-panel .input-group .btn { width: 100%; margin-top: 4px; }
}

/* ── Tablet (sm–md) ───────────────────────────────────────────────────────── */
@media (min-width: 576px) and (max-width: 991px) {
    .score-board { font-size: 16px; }
    #authModal .modal-dialog { max-width: 480px; }
}

/* ── Intro overlay — floats above the auth modal ──────────────────────────── */
.intro-overlay {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    z-index: 1060;          /* above Bootstrap modal (1050) */
    transition: opacity 0.9s ease;
    width: 90%;
}
.intro-overlay.fading { opacity: 0; }

.intro-title {
    font-size: clamp(24px, 5vw, 56px);
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255,215,0,0.9), 0 2px 6px #000;
    letter-spacing: 2px;
    animation: introPulse 2s ease-in-out infinite;
}
.intro-sub {
    font-size: clamp(12px, 2vw, 20px);
    color: rgba(255,255,255,0.85);
    margin-top: 6px;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 1px 4px #000;
}

@keyframes introPulse {
    0%, 100% { text-shadow: 0 0 20px rgba(255,215,0,0.6), 0 2px 4px #000; }
    50%       { text-shadow: 0 0 60px rgba(255,215,0,1),   0 2px 4px #000; }
}

/* Hide intro overlay on small phones (modal is full-screen, no room) */
@media (max-width: 575px) and (max-height: 700px) {
    .intro-overlay { display: none !important; }
}

/* ── HUD avatar (top-left) ────────────────────────────────────────────────── */
.avatar-hud {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,215,0,0.6);
    cursor: pointer;
    flex-shrink: 0;
    background: #334;
    vertical-align: middle;
}
.avatar-hud img { width: 100%; height: 100%; object-fit: cover; }
.avatar-hud .avatar-initials {
    font-size: 13px; font-weight: 700; color: #fff;
    text-shadow: 0 1px 2px #000;
}

/* ── Profile avatar (large, in modal) ────────────────────────────────────── */
.avatar-large {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,215,0,0.7);
    background: #334;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px #000;
}
.avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ── Profile modal form controls ─────────────────────────────────────────── */
#profileModal .form-control[readonly] {
    opacity: 0.6;
    cursor: default;
}
#profileModal .form-control {
    min-height: 42px;
    font-size: 15px;
}
#profileModal hr { margin: 1.2rem 0; }

/* ── Custom scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track  { background: #1a1a2e; }
::-webkit-scrollbar-thumb  { background: #ffd700; border-radius: 4px; }
