/* ==========================================
   RESET & TEMEL AYARLAR
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    overflow: hidden;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    /* Karanlık modern teknoloji arka planı */
    color: #fff;
    width: 100vw;
    height: 100vh;
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
    opacity: 0.15;
    /* Arka planda kamerayı çok hafif gösterebiliriz ya da kapalı tutabiliriz */
}

.output_canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 60;
    position: relative;
    pointer-events: none;
}

/* UI Katmanı */
.ui-layer {
    position: relative;
    z-index: 80;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1.5rem 3rem;
    position: relative;
    flex-shrink: 0;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.left-panel .status-panel {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.glass-panel {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.score-panel {
    min-width: 140px;
    text-align: center;
}

.label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #94a3b8;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.value {
    font-size: 3rem;
    font-weight: 800;
    color: #4ade80;
    /* Doğa yeşili */
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
    transition: transform 0.1s;
}

.value.bump {
    transform: scale(1.2);
    color: #22c55e;
}

.speed-panel {
    min-width: 120px;
    text-align: center;
}

.status-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
    transition: all 0.3s;
}

.status-indicator.active {
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
}

#statusText {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

/* TIMER STİLİ */
.timer-panel {
    text-align: center;
    min-width: 130px;
}

.timer-value {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    transition: color 0.3s, text-shadow 0.3s;
    display: block;
}

.timer-value.urgent {
    color: #ef4444;
    text-shadow: 0 0 24px rgba(239, 68, 68, 0.9);
    animation: heartbeat 0.75s ease-in-out infinite;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.15);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.1);
    }

    70% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}

/* ==========================================
   YÜRÜYEN BANT (CONVEYOR BELT) ALANI
   ========================================== */
.conveyor-container {
    height: 15vh;
    width: 100vw;
    margin-top: 2vh;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    border-top: 2px solid rgba(255, 255, 255, 0.05);
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    z-index: 20;
}

.conveyor-belt {
    width: 200%;
    height: 100%;
    background: repeating-linear-gradient(-45deg,
            rgba(255, 255, 255, 0.03),
            rgba(255, 255, 255, 0.03) 20px,
            transparent 20px,
            transparent 40px);
    animation: moveBelt 12s linear infinite;
    /* Çöplerin geliş hızıyla tutarlı olması için 4s -> 12s yapıldı */
}

@keyframes moveBelt {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ==========================================
   ÇÖP ÜRETİM KATI (Trash Layer)
   ========================================== */
#trash-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 30;
    pointer-events: none;
    overflow: hidden;
}

.trash-item {
    position: absolute;
    transform-origin: center;
    pointer-events: none;
    will-change: transform;
    /* Çöpekler SVG/PNG olacak, boyutu script içinden verilebilir */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.5));
}

.trash-item.dragged {
    /* Sürüklenirken gölgesi büyür ve obj kalkıyormuş hissi verir */
    filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.7));
    transform: scale(1.15);
    z-index: 100;
    /* Sürüklenirken hep en üstte kalır */
}

/* ==========================================
   ÇÖP KUTULARI (BINS)
   ========================================== */
.bins-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8vw;
    padding-bottom: 1vh;
    /* Kutuları ekranın en altına yaklaştırmak için 5vh -> 1vh yapıldı */
    z-index: 40;
}

.bin-wrapper {
    position: relative;
    width: 200px;
    /* Kutuların ortalama boyutu */
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

/* 
  Kutuların PNG dosyaları ImageMagick ile aynı boyuta getirildi.
  Artık CSS ile küçültmeye gerek yok.
*/

.bin-img {
    position: absolute;
    bottom: 0;
    /* Alt hizaya kilitle */
    width: 100%;
    /* Konteyner genisligine esit */
    height: auto;
    /* Yuksekligi serbest birak - kapak yukari dogru buyuyecek */
    transition: opacity 0.2s;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.6));
}

.bin-open {
    opacity: 0;
    /* Açıldığında hafif büyüsün efektini KADIRIYORUZ. Görseller artık kalıp gibi oturmalı */
}

/* Drag over efekti (El çöp ile üstüne geldiğinde) */
.bin-wrapper.drag-over .bin-closed {
    opacity: 0;
}

.bin-wrapper.drag-over .bin-open {
    opacity: 1;
}

/* ==========================================
   PINCH CURSOR (EL İMLECİ)
   ========================================== */
#pinch-cursor {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    /* Modalların (300) üzerinde olması için yüksek değer */
    display: none;
    /* Kamera algıladığında block olacak */
    transition: width 0.1s, height 0.1s;
}

.pinch-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.pinch-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Parmaklar pinch (kapanma) moduna geçince cursor değişimi */
#pinch-cursor.pinching .pinch-ring {
    transform: scale(0.6);
    border-color: #4ade80;
    /* Yeşile döner */
    border-width: 5px;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.6);
}

#pinch-cursor.pinching .pinch-dot {
    background: #4ade80;
}

/* ==========================================
   EFEKTLER (FLOATING SCORE)
   ========================================== */
.floating-score {
    position: absolute;
    font-size: 2.5rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 100;
    animation: floatUp 1s ease-out forwards;
}

.floating-score.positive {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}

.floating-score.negative {
    color: #ef4444;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

@keyframes floatUp {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -100%) scale(1.2);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -200%) scale(1);
        opacity: 0;
    }
}

/* ==========================================
   MODAL STİLLERİ
   ========================================== */
.game-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.88);
    transition: opacity 0.4s ease;
}

.game-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    text-align: center;
    max-width: 600px;
    width: 90%;
    padding: 3rem;
    background: rgba(15, 23, 42, 0.6);
    pointer-events: auto;
}

.game-title {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
    color: #fff;
}

.highlight {
    color: #4ade80;
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.4);
}

.subtitle {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-bottom: 2rem;
    letter-spacing: 2px;
}

.instruction-box {
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.rule-item {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.rule-item:last-child {
    margin-bottom: 0;
}

.rule-item strong {
    color: #fff;
    font-weight: 600;
}

/* SYSTEM LOADING BADGE */
.loading-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(234, 179, 8, 0.2);
    /* Sarı uyarımsı ton */
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: #fde047;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    transition: opacity 0.3s, transform 0.3s;
}

.loading-badge.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
}

.loading-badge .spinner {
    display: inline-block;
    animation: spinSlow 3s linear infinite;
    font-size: 1.2rem;
}

@keyframes spinSlow {
    100% {
        transform: rotate(360deg);
    }
}

.action-btn {
    appearance: none;
    border: none;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    padding: 1rem 3rem;
    border-radius: 50px;
    cursor: default;
    /* Elden algılanıyor */
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.4);
    transition: all 0.2s;
    letter-spacing: 2px;
}

.action-btn.hovered {
    transform: scale(1.05);
    box-shadow: 0 15px 35px rgba(34, 197, 94, 0.6);
    background: linear-gradient(135deg, #4ade80 0%, #15803d 100%);
}

/* Modallardaki hover statüsü oyun içinden (pinch ile) tetiklenir */
.action-btn.active-pinch {
    transform: scale(0.95);
    background: linear-gradient(135deg, #16a34a 0%, #14532d 100%);
}

.btn-hint {
    margin-top: 0.7rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
}

.privacy-notice {
    margin-top: 1.2rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    text-align: left;
    line-height: 1.5;
    letter-spacing: 0.3px;
}

.final-score-box {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.final-score-box .label {
    color: #4ade80;
    margin-bottom: 0.5rem;
}

.final-score-value {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 30px rgba(74, 222, 128, 0.7);
}

.rank-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    font-size: 1.5rem;
    color: #cbd5e1;
    font-weight: 600;
}

.rank-icon {
    font-size: 2.5rem;
}