/* =========================================================
   TAP OR CRASH — RESPONSIVE PORTRAIT WEBGL LAYOUT
   Desktop: Ortalanmış 9:16 oyun ekranı
   Mobile: Ekrana sığan tam boy görünüm
   ========================================================= */

:root {
    --game-aspect-width: 9;
    --game-aspect-height: 16;
    --desktop-max-width: 520px;
    --page-padding: 16px;
    --page-background: #090b14;
}

/* Genel sıfırlama */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--page-background);
    font-family: Arial, Helvetica, sans-serif;
}

/* =========================================================
   ANA UNITY KONTEYNERİ
   ========================================================= */

#unity-container {
    margin: 0;
    padding: 0;
}

/* Masaüstü görünümü */

#unity-container.unity-desktop {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    padding: var(--page-padding);

    transform: none;
    background: var(--page-background);
}

/* Mobil görünüm */

#unity-container.unity-mobile {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    margin: 0;
    padding: 0;

    background: #000;
}

/* =========================================================
   UNITY CANVAS
   ========================================================= */

#unity-canvas {
    display: block;

    margin: 0;
    padding: 0;

    background: #231f20;

    outline: none;
    border: 0;

    /* Tap or Crash dikey oyun oranı */
    aspect-ratio: 9 / 16;

    /* Tarayıcıda görüntünün gerilmesini engeller */
    object-fit: contain;

    /* Masaüstü genişlik sınırı */
    width: min(
        var(--desktop-max-width),
        calc(100vw - (var(--page-padding) * 2)),
        calc((100vh - (var(--page-padding) * 2)) * 9 / 16)
    ) !important;

    height: auto !important;

    /* Yüksekliği ekranı aşmasın */
    max-height: calc(100vh - (var(--page-padding) * 2)) !important;

    /* Görüntü netliği */
    image-rendering: auto;

    /* Hafif görsel çerçeve */
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Unity'nin mobil sınıfı canvas'ı zorla genişletmesin */

.unity-mobile #unity-canvas {
    width: min(
        100vw,
        calc(100vh * 9 / 16)
    ) !important;

    height: min(
        100vh,
        calc(100vw * 16 / 9)
    ) !important;

    max-width: 100vw !important;
    max-height: 100vh !important;

    aspect-ratio: 9 / 16;
    object-fit: contain;

    box-shadow: none;
}

/* =========================================================
   YÜKLEME EKRANI
   ========================================================= */

#unity-loading-bar {
    position: fixed;
    left: 50%;
    top: 50%;

    z-index: 100;

    display: none;

    width: 180px;

    transform: translate(-50%, -50%);
    text-align: center;
}

#unity-logo {
    width: 154px;
    height: 130px;

    margin: 0 auto;

    background:
        url("unity-logo-dark.png")
        no-repeat
        center;
}

#unity-progress-bar-empty {
    width: 141px;
    height: 18px;

    margin: 10px auto 0;

    background:
        url("progress-bar-empty-dark.png")
        no-repeat
        center;
}

#unity-progress-bar-full {
    width: 0%;
    height: 18px;

    margin: 0;

    background:
        url("progress-bar-full-dark.png")
        no-repeat
        left center;
}

/* =========================================================
   ALT UNITY BARINI GİZLE
   Oyun ekranının gereksiz yere küçülmesini engeller.
   ========================================================= */

#unity-footer {
    display: none !important;
}

#unity-logo-title-footer,
#unity-build-title,
#unity-fullscreen-button {
    display: none !important;
}

/* =========================================================
   UYARI MESAJLARI
   ========================================================= */

#unity-warning {
    position: fixed;
    top: 16px;
    left: 50%;

    z-index: 1000;

    display: none;

    width: min(520px, calc(100vw - 32px));

    padding: 12px 16px;

    transform: translateX(-50%);

    color: #111;
    background: #fff;

    border-radius: 8px;

    text-align: center;
    font-size: 14px;
    line-height: 1.4;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* =========================================================
   KÜÇÜK EKRANLAR
   ========================================================= */

@media screen and (max-width: 600px) {
    :root {
        --page-padding: 0px;
    }

    #unity-container.unity-desktop {
        padding: 0;
        background: #000;
    }

    #unity-canvas {
        width: min(100vw, calc(100vh * 9 / 16)) !important;
        height: min(100vh, calc(100vw * 16 / 9)) !important;

        max-width: 100vw !important;
        max-height: 100vh !important;

        border-radius: 0;
        box-shadow: none;
    }
}

/* =========================================================
   YATAY TUTULAN TELEFON
   Dikey oyun oranını korur.
   ========================================================= */

@media screen and (orientation: landscape) and (max-height: 600px) {
    #unity-canvas,
    .unity-mobile #unity-canvas {
        width: calc(100vh * 9 / 16) !important;
        height: 100vh !important;

        max-width: 100vw !important;
        max-height: 100vh !important;
    }
}