/**
 * common.css
 * Ortak Web Uygulaması ve Mobil Altyapı CSS Kütüphanesi
 * Mobil zorlama, taşmama, esnek sığdırma ve genel bileşen stilleri
 */

/* ==========================================================================
   1. RESET & GENEL AYARLAR
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 0%, #202538 0%, #0c0f16 70%);
    /* eski background: #090d16; */
    color: #f8fafc;
    touch-action: none;
}

/* ==========================================================================
   2. MOBİL SIKIŞTIRMA VE ANA SARMALAYICI (CANVAS)
   ========================================================================== */
.game-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 
        max(16px, env(safe-area-inset-top))
        max(16px, env(safe-area-inset-right))
        max(16px, env(safe-area-inset-bottom))
        max(16px, env(safe-area-inset-left));
}

/* ==========================================================================
   3. BAĞIMSIZ ÜST KATMANLAR VE BAŞLIKLAR
   ========================================================================== */
/* Sağ Üst Sabit Katman (Bakiye, Skor vs. için) */
.wallet-layer {
    position: absolute;
    top: max(14px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 9999;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(56, 189, 248, 0.15);
    padding: 5px 12px;
    border-radius: 12px;
    font-weight: 700;
    color: #38bdf8;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

/* Merkez Başlık Stili */
.lobby-center-title {
    text-align: center;
    font-size: clamp(0.95rem, 2.5vh, 1.25rem);
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.lobby-center-title i {
    color: #38bdf8;
}

/* İçerik Taşıyıcı Alan - Esnek Dağılım */
.main-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 10px;
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* ==========================================================================
   4. AKSİYON ALANLARI VE BUTONLAR
   ========================================================================== */
.action-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 15px;
}

/* Minimalist Ana Buton Stili (START / KAPAT vs.) */
.btn-race {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    padding: 10px 32px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-race:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-race:active {
    transform: scale(0.97);
}

.btn-race:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==========================================================================
   5. MODAL (PENCERE) SİSTEMİ
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-panel {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 24px;
    width: 92%;
    max-width: 420px;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-panel {
    transform: scale(1);
}

/* Köşe Kapatma Butonu */
.modal-close-corner {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}

.modal-close-corner:hover {
    color: #f1f5f9;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
    padding-right: 24px;
}

/* ==========================================================================
   6. RESPONSIVE (YATAY MOBİL OPTİMİZASYONLARI)
   ========================================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content { gap: 8px; }
    .action-container { padding-top: 8px; }
    .modal-panel { max-height: 90vh; gap: 6px; padding: 12px; }
    .modal-header { padding-bottom: 6px; }
}