/* ==========================================
   Atık Ayrıştırma Oyunu - Stil Dosyası
   ========================================== */

/* Genel Sıfırlama */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: #87CEEB;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Canvas */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

#game-canvas:active {
    cursor: grabbing;
}

/* ==========================================
   INTRO EKRANI
   ========================================== */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a237e 0%, #0d47a1 30%, #01579b 60%, #006064 100%);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.intro-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.intro-container {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
}

/* Sol: 3D Karakter */
.intro-character-area {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#intro-canvas {
    width: 280px;
    height: 350px;
    border-radius: 20px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.intro-character-name {
    font-size: 20px;
    font-weight: 800;
    color: #FFD54F;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

/* Sağ: Anlatım */
.intro-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.intro-title {
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.intro-text-area {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 24px;
    font-size: 17px;
    line-height: 1.7;
    color: #E3F2FD;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-line;
    border: 1px solid rgba(255, 255, 255, 0.15);
    min-height: 200px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.intro-text-area::-webkit-scrollbar {
    width: 6px;
}

.intro-text-area::-webkit-scrollbar-track {
    background: transparent;
}

.intro-text-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.intro-start-button {
    background: linear-gradient(135deg, #66BB6A, #43A047);
    color: white;
    border: none;
    font-size: 22px;
    font-weight: 800;
    padding: 16px 40px;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
    align-self: center;
}

.intro-start-button.visible {
    opacity: 1;
    pointer-events: all;
    animation: introButtonPulse 2s ease-in-out infinite;
}

.intro-start-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 35px rgba(76, 175, 80, 0.6);
}

.intro-start-button:active {
    transform: translateY(0) scale(0.98);
}

@keyframes introButtonPulse {

    0%,
    100% {
        box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
    }

    50% {
        box-shadow: 0 6px 40px rgba(76, 175, 80, 0.8), 0 0 60px rgba(76, 175, 80, 0.3);
    }
}

/* ==========================================
   SKOR PANELİ
   ========================================== */
.score-panel {
    position: fixed;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    pointer-events: none;
}

.score-box {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.score-box .label {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.score-box .value {
    font-size: 28px;
    font-weight: 800;
    color: #FF6F00;
    min-width: 50px;
    text-align: center;
    transition: transform 0.2s ease;
}

.score-box .value.score-pop {
    animation: scorePop 0.35s ease;
}

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

    50% {
        transform: scale(1.4);
        color: #FF1744;
    }

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

.round-box {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.6);
}

.round-box .label {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.round-box .value {
    font-size: 20px;
    font-weight: 700;
    color: #1565C0;
}

/* ==========================================
   SES TOGGLE
   ========================================== */
.sound-toggle {
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle:active {
    transform: scale(0.95);
}

/* ==========================================
   AĞAÇ İLERLEME ÇUBUĞU
   ========================================== */
.tree-progress-panel {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    pointer-events: none;
}

.tree-progress-box {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 12px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.6);
    text-align: center;
}

.tree-progress-box .tree-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.tree-progress-box .tree-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-bottom: 6px;
}

.tree-progress-bar {
    width: 120px;
    height: 12px;
    background: #E0E0E0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.tree-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #66BB6A, #43A047, #2E7D32);
    border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.tree-percent {
    font-size: 14px;
    font-weight: 700;
    color: #2E7D32;
}

/* ==========================================
   DURUM MESAJI
   ========================================== */
.game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: 800;
    padding: 14px 32px;
    border-radius: 20px;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    text-align: center;
    white-space: nowrap;
}

.game-message.visible {
    opacity: 1;
    animation: messageAppear 0.4s ease;
}

.game-message.success {
    background: rgba(76, 175, 80, 0.95);
    color: white;
    box-shadow: 0 6px 30px rgba(76, 175, 80, 0.4);
}

.game-message.error {
    background: rgba(255, 87, 34, 0.95);
    color: white;
    box-shadow: 0 6px 30px rgba(255, 87, 34, 0.4);
}

.game-message.info {
    background: rgba(33, 150, 243, 0.95);
    color: white;
    box-shadow: 0 6px 30px rgba(33, 150, 243, 0.4);
}

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

    60% {
        transform: translate(-50%, -50%) scale(1.1);
    }

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

/* ==========================================
   ATIK ADI
   ========================================== */
.item-name {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    font-weight: 700;
    color: #333;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.6);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.item-name.visible {
    opacity: 1;
}

/* ==========================================
   BİLGİ KARTI (Modal)
   ========================================== */
.info-card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.info-card-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.info-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.info-card-overlay.visible .info-card {
    transform: scale(1) translateY(0);
}

.info-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: #f5f5f5;
    border: none;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.2s, transform 0.2s;
}

.info-close:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.info-title {
    font-size: 24px;
    font-weight: 800;
    color: #333;
    margin-bottom: 20px;
    padding-right: 40px;
}

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-section {
    border-radius: 14px;
    padding: 14px 16px;
}

.info-section.decompose {
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
}

.info-section.harm {
    background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
}

.info-section.benefit {
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
}

.info-section-icon {
    font-size: 22px;
    margin-bottom: 4px;
}

.info-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-section-value {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.5;
}

/* ==========================================
   OVERLAY (Oyun Sonu)
   ========================================== */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.game-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.overlay-card {
    background: white;
    border-radius: 24px;
    padding: 40px 50px;
    text-align: center;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-overlay.visible .overlay-card {
    transform: scale(1);
}

.overlay-card h2 {
    font-size: 32px;
    color: #333;
    margin-bottom: 16px;
    line-height: 1.3;
}

.overlay-card p {
    font-size: 18px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 28px;
    white-space: pre-line;
}

.overlay-card button {
    background: linear-gradient(135deg, #66BB6A, #43A047);
    color: white;
    border: none;
    font-size: 20px;
    font-weight: 700;
    padding: 14px 40px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    font-family: inherit;
}

.overlay-card button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.5);
}

.overlay-card button:active {
    transform: translateY(0) scale(0.98);
}

/* ==========================================
   RESPONSİVE
   ========================================== */

/* Tablet */
@media (max-width: 1024px) {
    .score-box .value {
        font-size: 24px;
    }

    .game-message {
        font-size: 28px;
        padding: 12px 24px;
    }

    .tree-progress-bar {
        width: 100px;
    }

    .overlay-card {
        padding: 30px 36px;
    }

    .overlay-card h2 {
        font-size: 26px;
    }

    .overlay-card p {
        font-size: 16px;
    }

    .intro-container {
        gap: 24px;
    }

    .intro-character-area {
        flex: 0 0 220px;
    }

    #intro-canvas {
        width: 220px;
        height: 280px;
    }

    .intro-title {
        font-size: 28px;
    }

    .intro-text-area {
        font-size: 15px;
    }
}

/* Mobil / Dikey */
@media (max-width: 700px) {
    .intro-container {
        flex-direction: column;
        gap: 16px;
    }

    .intro-character-area {
        flex: 0 0 auto;
    }

    #intro-canvas {
        width: 180px;
        height: 220px;
    }

    .intro-title {
        font-size: 22px;
        text-align: center;
    }

    .intro-text-area {
        font-size: 14px;
        max-height: 180px;
        padding: 16px;
        min-height: 140px;
    }

    .intro-start-button {
        font-size: 18px;
        padding: 14px 30px;
    }

    .intro-character-name {
        font-size: 16px;
    }

    .score-panel {
        top: 8px;
        left: 8px;
        gap: 8px;
    }

    .score-box {
        padding: 8px 14px;
        border-radius: 12px;
    }

    .score-box .label {
        font-size: 11px;
    }

    .score-box .value {
        font-size: 20px;
    }

    .round-box {
        padding: 8px 12px;
        border-radius: 12px;
    }

    .round-box .label {
        font-size: 11px;
    }

    .round-box .value {
        font-size: 16px;
    }

    .tree-progress-panel {
        top: 8px;
        right: 8px;
    }

    .tree-progress-box {
        padding: 8px 12px;
        border-radius: 12px;
    }

    .tree-progress-bar {
        width: 80px;
        height: 10px;
    }

    .tree-progress-box .tree-icon {
        font-size: 22px;
    }

    .game-message {
        font-size: 22px;
        padding: 10px 20px;
        border-radius: 14px;
    }

    .item-name {
        font-size: 16px;
        padding: 8px 18px;
        bottom: 12px;
    }

    .overlay-card {
        padding: 24px 28px;
    }

    .overlay-card h2 {
        font-size: 22px;
    }

    .overlay-card p {
        font-size: 14px;
    }

    .overlay-card button {
        font-size: 17px;
        padding: 12px 30px;
    }

    .info-card {
        padding: 24px 20px;
    }

    .info-title {
        font-size: 20px;
    }

    .info-section-value {
        font-size: 13px;
    }

    .sound-toggle {
        width: 40px;
        height: 40px;
        font-size: 18px;
        bottom: 10px;
        left: 10px;
    }
}

/* Yatay mod küçük ekranlar */
@media (max-height: 500px) {
    .score-panel {
        top: 6px;
        left: 6px;
    }

    .tree-progress-panel {
        top: 6px;
        right: 6px;
    }

    .game-message {
        font-size: 20px;
    }

    .overlay-card {
        padding: 20px 24px;
    }

    .overlay-card h2 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .overlay-card p {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .intro-container {
        flex-direction: row;
    }

    .intro-character-area {
        flex: 0 0 160px;
    }

    #intro-canvas {
        width: 160px;
        height: 200px;
    }

    .intro-text-area {
        max-height: 150px;
    }
}