/* =========================================
   1. ROOT DEĞİŞKENLERİ (PREMIUM AYARLAR)
   ========================================= */
:root {
    --img-brightness: 105%;
    --img-contrast: 115%;
    --img-saturate: 125%;
    --img-blur: 0px;
    --bg-color: #020305;
    --accent-color: #6ea4ff;
    --accent-glow: rgba(110, 164, 255, 0.6);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.5);
    --ui-border: rgba(255, 255, 255, 0.05);
    --ui-bg-glass: rgba(10, 15, 25, 0.65);

    --transition-fast: 0.2s cubic-bezier(0.2, 1, 0.2, 1);
    --transition-normal: 0.4s cubic-bezier(0.2, 1, 0.2, 1);
    --transition-slow: 0.8s cubic-bezier(0.2, 1, 0.2, 1);
}

/* =========================================
   2. GENEL SIFIRLAMA VE TEMEL TİPOGRAFİ
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    width: 100%;
    /* 100vw kullanımı taşmaya ve sol kenarın kaymasına yol açıyordu */
    margin: 0;
    position: relative;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    perspective: 1000px;
}

/* Derinlikli Arkaplan Gradienti */
.bg-gradient {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background: radial-gradient(circle at 30% 50%, #0d1624 0%, var(--bg-color) 70%, #000000 100%);
    z-index: 0;
    transition: transform 0.1s ease-out;
}

/* Vignette (Köşe Karartması) */
.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.8) 150%);
    z-index: 10;
    pointer-events: none;
}

/* =========================================
   3. GİRİŞ EKRANI (INTRO)
   ========================================= */
.intro-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #020305;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1.5s ease-in-out, visibility 1.5s;
}

.intro-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.intro-logo {
    font-family: 'Syncopate', sans-serif;
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 15px;
    color: #fff;
    opacity: 0;
    animation: introFadeIn 3s ease forwards 0.5s;
}

.intro-prompt {
    font-weight: 200;
    font-size: 0.9rem;
    letter-spacing: 5px;
    color: var(--text-secondary);
    margin-top: 40px;
    opacity: 0;
    animation: introFadeIn 2s ease forwards 3s, blink 2s infinite 5s;
    cursor: pointer;
}

@keyframes introFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 0.3;
    }
}

/* =========================================
   4. EFEKTLER (PARTİKÜLLER VE DEKORASYON)
   ========================================= */
.ambient-effects {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.1s ease-out;
}

.dust {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(110, 164, 255, 0.3);
    pointer-events: none;
}

@keyframes floatDust {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(-100px) translateX(50px) rotate(360deg);
        opacity: 0;
    }
}

.ui-borders {
    position: fixed;
    /* Absolute yerine fixed kullanılarak viewport'a (kamera/ekran) kilitlendi */
    inset: 35px;
    /* Çerçeve tüm kenarlardan eşit uzaklıkta %100 sağlama alındı */
    border: 1px solid var(--ui-border);
    z-index: 20;
    pointer-events: none;
}

.ui-borders::before,
.ui-borders::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border: 1px solid var(--accent-color);
}

.ui-borders::before {
    top: -1px;
    left: -1px;
    border-right: none;
    border-bottom: none;
}

.ui-borders::after {
    bottom: -1px;
    right: -1px;
    border-left: none;
    border-top: none;
}

.version-text {
    position: absolute;
    bottom: 50px;
    left: 50px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    letter-spacing: 3px;
    z-index: 20;
    text-transform: uppercase;
}

/* =========================================
   5. KARAKTER RENDER ALANI
   ========================================= */
.character-viewport {
    position: absolute;
    right: 8vw;
    /* Fazla ortadaydı, biraz daha sağa alındı */
    bottom: -2vh;
    height: 102vh;
    width: 60vw;
    display: flex;
    justify-content: flex-end;
    /* Tekrar sağa yaslandı */
    align-items: flex-end;
    z-index: 5;
    pointer-events: none;
    perspective: 1000px;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.character-viewport.anim-playing {
    opacity: 1;
}

.character-layer {
    max-height: 105%;
    width: auto;
    object-fit: contain;
    /* JS'den gelen algoritmanın bulduğu gerçek kafa noktasını baz alır (Varsayılan 20%) */
    transform-origin: 50% var(--char-top, 20%);
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.25)) sepia(0.2) hue-rotate(190deg) brightness(var(--img-brightness)) contrast(var(--img-contrast)) saturate(var(--img-saturate)) blur(var(--img-blur)) url(#sharpness-filter);
}

.character-viewport.anim-playing .character-layer {
    animation: cinematicPan 40s ease-in-out infinite;
}

@keyframes cinematicPan {
    0% {
        transform: scale(1.6) translateY(0) rotateY(0deg);
    }

    20% {
        transform: scale(1.6) translateY(calc(-1 * (var(--char-bottom, 80%) - var(--char-top, 20%)) * 0.40)) rotateY(0deg);
    }

    40% {
        transform: scale(1.15) translateY(0) rotateY(0deg);
    }

    45% {
        transform: scale(1.15) translateY(0) rotateY(180deg);
        /* Doğal olarak kendi etrafında yansıtma (Flip) dönüşü yapar */
    }

    65% {
        transform: scale(1.6) translateY(calc(-1 * (var(--char-bottom, 80%) - var(--char-top, 20%)) * 0.40)) rotateY(180deg);
    }

    85% {
        transform: scale(1.15) translateY(0) rotateY(180deg);
    }

    90% {
        transform: scale(1.15) translateY(0) rotateY(0deg);
    }

    100% {
        transform: scale(1.6) translateY(0) rotateY(0deg);
    }
}

/* MOBİL YATAY EKRAN (PORTRAIT) UYARISI */
#mobile-rotate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999999;
    color: white;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'Syncopate', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 5px;
    line-height: 2;
    padding: 20px;
}

@media (orientation: portrait) and (max-width: 768px) {
    #mobile-rotate-overlay {
        display: flex;
        flex-direction: column;
    }
}

/* =========================================
   6. MENÜ ARAYÜZÜ (SOL PANEL)
   ========================================= */
.main-ui {
    position: absolute;
    left: 8vw;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 30;
    pointer-events: none;
    /* Only buttons should have pointer events */
}

.game-title {
    font-family: 'Syncopate', sans-serif;
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: 20px;
    margin-bottom: 60px;
    text-transform: uppercase;

    background: linear-gradient(135deg, #ffffff 0%, var(--accent-color) 40%, #ffffff 60%, var(--accent-glow) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShine 6s linear infinite, float 6s ease-in-out infinite alternate;
    filter: drop-shadow(0px 0px 20px rgba(110, 164, 255, 0.5));
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-10px);
    }
}

@keyframes titleShine {
    to {
        background-position: 200% center;
    }
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 40px;
    position: relative;
    pointer-events: auto;
}

/* Aktif menü öğesini gösteren çizgi */
.menu-indicator {
    position: absolute;
    left: -1px;
    width: 2px;
    height: 35px;
    background: var(--accent-color);
    transition: top var(--transition-fast);
    box-shadow: 0 0 10px var(--accent-glow);
    top: 0;
    opacity: 0;
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 200;
    letter-spacing: 8px;
    text-transform: uppercase;
    cursor: pointer;
    text-align: left;
    position: relative;
    transition: all var(--transition-normal);
    outline: none;
    padding: 5px 0;
}

.menu-btn.active,
.menu-btn:hover {
    color: var(--text-primary);
    font-weight: 400;
    letter-spacing: 12px;
    text-shadow: 0 0 15px var(--accent-glow);
    transform: translateX(10px);
}

.menu-btn::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--accent-color);
    transition: width var(--transition-normal);
}

.menu-btn:hover::after {
    width: 40px;
}

/* =========================================
   7. SAYFALAR / PANELLER (AYARLAR VB.)
   ========================================= */
.panel-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    /* Arkası (Video) Gözüksün Diye Şeffaf */
    backdrop-filter: blur(8px);
    /* Videoyu kapatmamak için blur azaltıldı */
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.panel-container {
    background: var(--ui-bg-glass);
    width: 800px;
    height: 600px;
    border: 1px solid var(--ui-border);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 0 50px rgba(110, 164, 255, 0.05);
    display: flex;
    flex-direction: column;
    transform: translateY(30px) scale(0.98);
    transition: all var(--transition-normal);
    position: relative;
}

.panel-overlay.active .panel-container {
    transform: translateY(0) scale(1);
}

.panel-header {
    padding: 30px 40px;
    border-bottom: 1px solid var(--ui-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-family: 'Syncopate', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 5px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.panel-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.panel-close:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

.panel-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Ayarlar Sekmeleri (Tabs) */
.settings-tabs {
    width: 200px;
    border-right: 1px solid var(--ui-border);
    padding: 30px 0;
    display: flex;
    flex-direction: column;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 15px 30px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-fast);
    border-right: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--accent-color);
    border-right: 2px solid var(--accent-color);
    background: rgba(110, 164, 255, 0.05);
    font-weight: 500;
}

/* Ayarlar İçerik Alanı */
.settings-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input / Slider Stilleri */
.setting-group {
    margin-bottom: 35px;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.setting-header label {
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: #e0e0e0;
    text-transform: uppercase;
}

.setting-val-display {
    font-size: 0.8rem;
    color: var(--accent-color);
    font-family: 'Syncopate', sans-serif;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    border-radius: 1px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 15px var(--accent-glow);
    border-radius: 50%;
    transition: var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.4);
    background: var(--accent-color);
}

/* Select Box Premium Stil */
.premium-select {
    width: 100%;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--ui-border);
    color: var(--text-primary);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 1px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.premium-select:hover {
    border-color: rgba(110, 164, 255, 0.4);
}

.premium-select option {
    background: #0d1624;
    color: #fff;
    padding: 10px;
}

/* Onay Butonları */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 25px;
    font-family: 'Syncopate', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--accent-color);
    color: #000;
    box-shadow: 0 0 20px rgba(110, 164, 255, 0.3);
}

.btn-primary:hover {
    background: #fff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--ui-border);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* =========================================
   8. ÖZEL SCROLLBAR
   ========================================= */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}