/* ═══════════════════════════════════════════════════════════════════════════
   🛰️ Faz E — YENİ LOBİ (lobby.js): sol vitrin + sağ oyun paneli + alt gemi şeridi.
   Eski hangar/mini-tutorial gizlenir; taşınan eski öğeler (#usernameInput, .game-modes-container,
   #auth-btn, başlık, rehber) burada yeniden biçimlenir. En son yüklenir; eski mobil/duyarlı
   kurallar !important kullandığı için kimlik (#lobby-v2) ile güçlendirilmiş seçiciler kullanılır.
   ═══════════════════════════════════════════════════════════════════════════ */

body.lobby-v2 #overlay > .mini-tutorial,
body.lobby-v2 #overlay > .hangar-wrapper,
body.lobby-v2 #scroll-right-btn,
body.lobby-v2 #scroll-left-btn { display: none !important; }

#overlay > #lobby-v2 {
    position: absolute !important; left: 0; right: 0; top: 56px; bottom: 0; z-index: 2;
    display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px;
    padding: 0 max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    --lb-c: #00eaff;
    font-family: 'Orbitron', sans-serif; color: #e8fbff; text-align: left;
}
#lobby-v2 .lb-main { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr); gap: 14px; min-height: 0; }

/* ── Vitrin ─────────────────────────────────────────────────────────── */
#lobby-v2 .lb-show {
    position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: center; gap: 6px; padding: 10px 16px 10px 6px; overflow: hidden;
    background: linear-gradient(135deg, rgba(8, 22, 38, 0.82), rgba(3, 9, 18, 0.88));
    border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 20px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
    animation: lb-in 0.45s ease-out both;
}
#lobby-v2 .lb-show::before { /* gemi rengiyle hafif aura */
    content: ''; position: absolute; left: -10%; top: -20%; width: 70%; height: 140%; pointer-events: none;
    background: radial-gradient(ellipse at center, color-mix(in srgb, var(--lb-c) 22%, transparent), transparent 65%);
    opacity: 0.9;
}
#lobby-v2 .lb-stage { position: relative; height: 100%; min-height: 0; }
#lobby-v2 .lb-pad {
    position: absolute; left: 50%; top: 56%; width: 86%; aspect-ratio: 2.6; transform: translate(-50%, -50%);
    border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.1);
    background: radial-gradient(ellipse, rgba(0, 234, 255, 0.14), transparent 70%);
}
#lobby-v2 .lb-ship { position: relative; width: 100%; height: 100%; display: block; animation: lb-float 3.6s ease-in-out infinite; will-change: transform; }
#lobby-v2 .lb-info { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#lobby-v2 .lb-badges { display: flex; flex-wrap: wrap; gap: 6px; min-height: 18px; }
#lobby-v2 .lb-role, #lobby-v2 .lb-pow {
    font-size: 9.5px; font-weight: 900; letter-spacing: 1.5px; padding: 3px 9px; border-radius: 10px;
    color: var(--lb-c); border: 1px solid var(--lb-c); background: rgba(0, 0, 0, 0.35);
}
#lobby-v2 .lb-role.elite { color: #ffd36b; border-color: #ffd36b; }
#lobby-v2 .lb-pow { color: var(--crystal, #7ff6ff); border-color: rgba(127, 246, 255, 0.5); }
#lobby-v2 .lb-name {
    margin: 0 !important; font-size: clamp(20px, 6.2vh, 36px); font-weight: 900; letter-spacing: 2px; line-height: 1.05; color: #fff;
    text-shadow: 0 0 18px color-mix(in srgb, var(--lb-c) 60%, transparent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    background: none !important; transform: none !important; box-shadow: none !important;
}
#lobby-v2 .lb-desc {
    margin: 0; font-family: 'Segoe UI', Roboto, system-ui, sans-serif; font-size: clamp(11px, 2.8vh, 13.5px);
    color: rgba(232, 251, 255, 0.62); line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
#lobby-v2 .lb-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
#lobby-v2 .lb-stat { display: flex; align-items: center; gap: 8px; }
#lobby-v2 .lb-stat span { width: 74px; flex: none; font-size: 9px; letter-spacing: 1px; color: rgba(232, 251, 255, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lobby-v2 .lb-stat i { position: relative; flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
#lobby-v2 .lb-stat b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--lb-c); /* eski WebView yedeği (color-mix yok) */ background: linear-gradient(90deg, color-mix(in srgb, var(--lb-c) 55%, transparent), var(--lb-c)); transition: width 0.35s ease; }
#lobby-v2 .lb-stat u { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #7ff6ff, #b98cff); box-shadow: 0 0 8px rgba(127, 246, 255, 0.7); transition: width 0.35s ease, left 0.35s ease; }
#lobby-v2 .lb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
#lobby-v2 .lb-btn {
    height: 40px; padding: 0 16px; border-radius: 12px; border: none; cursor: pointer;
    font-family: 'Orbitron', sans-serif; font-size: 12px; font-weight: 900; letter-spacing: 1px;
    display: inline-flex; align-items: center; gap: 7px; transition: transform 0.12s, box-shadow 0.2s;
}
#lobby-v2 .lb-btn:active { transform: scale(0.96); }
#lobby-v2 .lb-garage { color: #021018; background: linear-gradient(135deg, #7ff6ff, #3aa0ff); box-shadow: 0 0 16px rgba(127, 246, 255, 0.35); }
#lobby-v2 .lb-garage.can-up { animation: gr-badge 1.6s ease-in-out infinite; }
#lobby-v2 .lb-buy { color: #021018; background: linear-gradient(135deg, #00eaff, #0090ff); box-shadow: 0 0 16px rgba(0, 200, 255, 0.35); }
#lobby-v2 .lb-buy .crystal-ic { filter: none; background: linear-gradient(135deg, #ffffff, #1b3a66); -webkit-background-clip: text; background-clip: text; }
#lobby-v2 .lb-buy s { opacity: 0.55; font-weight: 400; }
#lobby-v2 .lb-buy.poor { color: rgba(232, 251, 255, 0.6); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 80, 110, 0.4); box-shadow: none; }
#lobby-v2 .lb-buy.poor .crystal-ic { background: linear-gradient(135deg, #f0ffff, #6ff3ff 42%, #b98cff); -webkit-background-clip: text; background-clip: text; }
#lobby-v2 .lb-buy.shake { animation: gr-shake 0.35s; }
#lobby-v2 .lb-ad { color: #fff; background: linear-gradient(135deg, #00aa55, #006633); height: 34px; font-size: 10.5px; }
#lobby-v2 .lb-selected { font-size: 11px; letter-spacing: 1.5px; color: #3dff8f; display: inline-flex; align-items: center; gap: 6px; }

/* ── Sağ panel: başlık, pilot adı, modlar ─────────────────────────────── */
#lobby-v2 .lb-side {
    min-height: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 10px;
    animation: lb-in 0.45s 0.08s ease-out both;
}
#lobby-v2 .lb-side > h1 {
    position: static !important; transform: none !important; background: none !important; box-shadow: none !important;
    margin: 0 0 4px !important; padding: 0 !important; text-align: center !important;
    font-size: clamp(22px, 7.5vh, 42px) !important; letter-spacing: 4px !important; color: #fff !important;
    text-shadow: 0 0 20px rgba(0, 234, 255, 0.75), 0 0 46px rgba(0, 140, 255, 0.35) !important;
    -webkit-text-fill-color: #fff !important;
}
#lobby-v2 .lb-side #usernameInput {
    position: static !important; transform: none !important; margin: 0 !important;
    width: 100% !important; max-width: none !important; height: 44px !important; padding: 0 14px !important;
    font-size: 15px !important; letter-spacing: 3px !important; text-align: center !important;
    background: rgba(0, 0, 0, 0.45) !important; color: #fff !important;
    border: 1px solid rgba(0, 234, 255, 0.4) !important; border-radius: 12px !important; box-shadow: none !important;
}
#lobby-v2 .lb-side .game-modes-container {
    position: static !important; transform: none !important; margin: 0 !important;
    display: flex !important; flex-direction: column !important; gap: 8px !important; width: 100% !important; max-width: none !important;
    height: auto !important; min-height: 0 !important; /* eski düzende sabit 68px → düğmeler eziliyordu */
    background: none !important; border: none !important; box-shadow: none !important; padding: 0 !important;
}
#lobby-v2 .lb-side .mode-divider { display: none !important; }
#lobby-v2 .lb-side .mode-btn {
    flex: 0 0 auto !important;
    width: 100% !important; height: clamp(46px, 13vh, 66px) !important; margin: 0 !important; padding: 0 18px !important;
    clip-path: none !important; transform: none !important; border-radius: 14px !important;
    display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 12px !important;
    font-family: 'Orbitron', sans-serif !important; font-size: clamp(13px, 3.6vh, 17px) !important; font-weight: 900 !important; letter-spacing: 2px !important;
    border: none !important; cursor: pointer;
}
#lobby-v2 .lb-side .mode-btn i { font-size: 1.2em !important; margin: 0 !important; }
#lobby-v2 .lb-side .survival-btn { color: #021018 !important; background: linear-gradient(135deg, #00eaff, #0078ff) !important; box-shadow: 0 0 24px rgba(0, 180, 255, 0.4) !important; }
#lobby-v2 .lb-side .tdm-btn { color: #fff !important; background: linear-gradient(135deg, #ff6a2a, #c81e4a) !important; box-shadow: 0 0 20px rgba(255, 80, 60, 0.3) !important; }
#lobby-v2 .lb-side .mode-btn:active { transform: scale(0.97) !important; }
#lobby-v2 .lb-side #auth-btn { position: static !important; transform: none !important; margin: 0 !important; width: 100% !important; max-width: none !important; }
#lobby-v2 .lb-side .guide-link-btn { position: static !important; margin: 0 auto !important; font-size: 10px !important; opacity: 0.7; }

/* Lobide FPS göstergesi gizli (oyun içi teşhis); yasal bağlantılar şeridin üstüne binmesin → üst orta */
body.lobby-v2:not(.in-game) #statsPanel { display: none !important; }
body.lobby-v2:not(.in-game) .legal-footer {
    top: max(14px, env(safe-area-inset-top)) !important; bottom: auto !important; right: auto !important;
    left: 50% !important; transform: translateX(-50%) !important;
}

/* ── Gemi şeridi ─────────────────────────────────────────────────────── */
#lobby-v2 .lb-strip { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; animation: lb-in 0.45s 0.15s ease-out both; }
#lobby-v2 .lb-strip::-webkit-scrollbar { display: none; }
#lobby-v2 .lb-track { display: flex; gap: 8px; padding: 6px 2px 2px; width: max-content; }
#lobby-v2 .lb-chip {
    position: relative; width: 84px; flex: none; padding: 4px 4px 6px; border-radius: 14px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-family: 'Orbitron', sans-serif; color: #e8fbff;
    background: linear-gradient(180deg, rgba(10, 26, 42, 0.9), rgba(4, 10, 20, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.1); transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
#lobby-v2 .lb-chip canvas { width: 54px; height: 54px; }
#lobby-v2 .lb-chip-name { font-size: 9px; font-weight: 900; letter-spacing: 0.5px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lobby-v2 .lb-chip-foot { font-size: 8.5px; color: rgba(232, 251, 255, 0.7); min-height: 11px; }
#lobby-v2 .lb-chip-foot .fa-circle-check { color: #3dff8f; font-size: 11px; }
#lobby-v2 .lb-chip.locked canvas { filter: grayscale(0.55) brightness(0.75); }
#lobby-v2 .lb-chip.elite { border-color: rgba(255, 211, 107, 0.3); }
#lobby-v2 .lb-chip.elite .lb-chip-name { color: #ffe09a; }
#lobby-v2 .lb-chip.sel { border-color: rgba(61, 255, 143, 0.65); }
#lobby-v2 .lb-chip.view { border-color: var(--lb-c); transform: translateY(-4px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 16px color-mix(in srgb, var(--lb-c) 45%, transparent); }
#lobby-v2 .lb-loading { padding: 18px; font-size: 12px; opacity: 0.7; }

/* ── Kısa ekran (yatay telefon) ─────────────────────────────────────── */
@media (max-height: 430px) {
    #overlay > #lobby-v2 { top: 44px; gap: 6px; padding-bottom: max(6px, env(safe-area-inset-bottom)); }
    #lobby-v2 .lb-main { gap: 10px; }
    #lobby-v2 .lb-show { padding: 6px 12px 6px 4px; border-radius: 16px; }
    #lobby-v2 .lb-info { gap: 4px; }
    #lobby-v2 .lb-stats { gap: 3px; }
    #lobby-v2 .lb-stat span { width: 60px; font-size: 8px; }
    #lobby-v2 .lb-stat i { height: 5px; }
    #lobby-v2 .lb-btn { height: 34px; padding: 0 12px; font-size: 10.5px; }
    #lobby-v2 .lb-side { gap: 7px; }
    #lobby-v2 .lb-side #usernameInput { height: 36px !important; font-size: 13px !important; }
    #lobby-v2 .lb-chip { width: 68px; padding: 3px 3px 4px; border-radius: 11px; }
    #lobby-v2 .lb-chip canvas { width: 40px; height: 40px; }
    #lobby-v2 .lb-chip-name { font-size: 7.5px; }
    #lobby-v2 .lb-chip-foot { font-size: 7.5px; min-height: 9px; }
    #lobby-v2 .lb-side .guide-link-btn { display: none !important; }
}
/* Büyük ekran (bilgisayar/tablet): yazı ve düğmeler orantılı büyür */
@media (min-height: 600px) {
    #overlay > #lobby-v2 { top: 70px; gap: 14px; }
    #lobby-v2 .lb-info { gap: 10px; }
    #lobby-v2 .lb-role, #lobby-v2 .lb-pow { font-size: 12px; padding: 4px 12px; }
    #lobby-v2 .lb-desc { font-size: 15px; }
    #lobby-v2 .lb-stats { gap: 7px; }
    #lobby-v2 .lb-stat span { width: 96px; font-size: 11px; }
    #lobby-v2 .lb-stat i { height: 8px; border-radius: 4px; }
    #lobby-v2 .lb-btn { height: 50px; padding: 0 22px; font-size: 14px; border-radius: 14px; }
    #lobby-v2 .lb-selected { font-size: 13px; }
    #lobby-v2 .lb-side { gap: 14px; max-width: 460px; justify-self: center; width: 100%; }
    #lobby-v2 .lb-side #usernameInput { height: 52px !important; font-size: 17px !important; }
    #lobby-v2 .lb-chip { width: 104px; padding: 6px 6px 8px; }
    #lobby-v2 .lb-chip canvas { width: 70px; height: 70px; }
    #lobby-v2 .lb-chip-name { font-size: 10.5px; }
    #lobby-v2 .lb-chip-foot { font-size: 10px; }
}
@media (max-height: 340px) {
    #lobby-v2 .lb-desc { display: none; }
    #lobby-v2 .lb-side > h1 { display: none !important; }
}

@keyframes lb-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lb-float { 0%, 100% { transform: translateY(-4px); } 50% { transform: translateY(5px); } }

/* v2.16: Betikler inene kadar (body.booting, game.js initLobbyUI kaldırır) lobi düğmeleri soluk ve basılamaz —
   eskiden görünüp tepki vermiyordu (ayarlar düğmesi ReferenceError veriyordu). */
body.booting #overlay button, body.booting #overlay .mode-btn, body.booting #topRightControls {
    pointer-events: none !important; opacity: 0.55 !important; transition: opacity 0.25s;
}

/* v2.16: Uzun stat etiketleri (DE FEUERRATE, PT BLINDAGEM, RU Скорострельность) kesiliyordu → sütun genişler,
   etiket sığmazsa yazı küçülür (kesilmez). */
#lobby-v2 .lb-stat span { width: auto !important; min-width: 74px; max-width: 46%; overflow: visible !important; text-overflow: clip !important; }
#lobby-v2:lang(ru) .lb-stat span, html[lang="ru"] #lobby-v2 .lb-stat span,
html[lang="de"] #lobby-v2 .lb-stat span, html[lang="pt"] #lobby-v2 .lb-stat span, html[lang="es"] #lobby-v2 .lb-stat span { letter-spacing: 0.3px; }
@media (max-height: 430px) { #lobby-v2 .lb-stat span { min-width: 60px; } }
/* Orbitron'da Kiril/Asya harfi yok → yer tutucu tırnaklı (serif) yedeğe düşüyordu: yedek zinciri sans-serif */
#lobby-v2 #usernameInput, #lobby-v2 #usernameInput::placeholder { font-family: 'Orbitron', 'Segoe UI', Roboto, 'Noto Sans', Arial, sans-serif !important; }
html[lang="ru"] #lobby-v2 .mode-btn, html[lang="de"] #lobby-v2 .mode-btn { letter-spacing: 0.5px !important; }
/* Google Play rozeti (sadece web): yeni lobide sağ alttaki gemi şeridinin üstüne biniyordu → sol üst boşluk */
/* v2.17: rozet lobby.js ile .top-left-controls sırasına taşınır (seviye + kristalin yanı), akışta durur.
   Dar ekranda sadece Play simgesi (yazı gizli) → üst ortadaki yasal bağlantılara yetişmez. */
body.lobby-v2 .top-left-controls #playstore-badge { position: static !important; bottom: auto !important; right: auto !important; top: auto !important; left: auto !important; transform: none !important; align-self: center; flex: none; }
@media (max-width: 1000px), (max-height: 430px) {
    body.lobby-v2 .top-left-controls #playstore-badge { padding: 0 !important; width: 30px; height: 30px; justify-content: center; border-radius: 8px; }
    body.lobby-v2 .top-left-controls #playstore-badge .ps-text { display: none !important; }
}
/* Görev rozeti düğme simgesini örtüyordu → küçük, köşede */
#quest-btn .quest-btn-badge { top: -3px !important; right: -3px !important; min-width: 13px !important; height: 13px !important; line-height: 13px !important; font-size: 0.5rem !important; padding: 0 2px !important; }
/* v2.20 Pilot rütbesi kartı (lobi sağ panel, pilot adının üstünde) */
#lobby-v2 #lb-rank {
    display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
    padding: 6px 10px; margin: 2px 0 6px; border-radius: 12px;
    background: linear-gradient(90deg, rgba(255, 207, 64, 0.10), rgba(0, 234, 255, 0.05));
    border: 1px solid rgba(255, 207, 64, 0.35);
}
#lobby-v2 #lb-rank .rank-badge { width: 40px; height: 40px; flex: 0 0 40px; filter: drop-shadow(0 0 6px rgba(255, 207, 64, 0.45)); }
.rk-txt { flex: 1 1 auto; min-width: 0; text-align: left; }
.rk-name { font-family: Orbitron, sans-serif; font-size: 0.95rem; letter-spacing: 1.5px; color: #ffe08a; white-space: nowrap; }
.rk-lvl { font-size: 0.7rem; color: #9fb3c8; letter-spacing: 1px; margin-left: 4px; }
.rk-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); margin: 4px 0 2px; overflow: hidden; }
.rk-bar > b { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ffb340, #ffe08a); box-shadow: 0 0 6px rgba(255, 207, 64, 0.6); }
.rk-next { font-size: 0.68rem; color: #9fb3c8; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-gain { font-family: Orbitron, sans-serif; font-size: 0.75rem; color: #7dff9a; letter-spacing: 1px; }
@media (max-height: 500px) {
    #lobby-v2 #lb-rank { padding: 3px 8px; margin: 0 0 4px; gap: 8px; }
    #lobby-v2 #lb-rank .rank-badge { width: 30px; height: 30px; flex-basis: 30px; }
    .rk-name { font-size: 0.8rem; }
}
