@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #222;
    font-family: 'Press Start 2P', monospace;
    user-select: none;
}

#game-container {
    width: 800px;
    height: 600px;
    position: relative;
    overflow: hidden;
    touch-action: none; /* Mobilde kaydırma/yakınlaştırmanın oyunu bozmasını engeller */
    border: 8px solid #333;
    border-radius: 8px; /* Pixel art havasını bozmadan oyunu çerçeveleme */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 10px rgba(0,0,0,0.5);
    background-color: #87CEEB; /* Fallback gökyüzü rengi */
}

/* ==================== HİKAYE / GİRİŞ EKRANI ==================== */
#story-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
#story-screen.fade-out {
    animation: storyFadeOut 0.8s forwards;
}
@keyframes storyFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}
/* Sinematik siyah barlar */
#story-top-bar, #story-bottom-bar {
    position: absolute;
    left: 0; width: 100%;
    height: 70px;
    background: #000;
    z-index: 2;
}
#story-top-bar    { top: 0; }
#story-bottom-bar { bottom: 0; }
/* Arkaplan gradient */
#story-screen::before {
    content: '';
    position: absolute;
    inset: 70px;
    background: radial-gradient(ellipse at center, #080820 0%, #000 80%);
    z-index: 0;
}
#story-content {
    position: relative;
    z-index: 3;
    width: 90%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}
#story-speaker {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #F8E71C;
    background: rgba(0,0,0,0.85);
    border: 2px solid #F8E71C;
    padding: 6px 14px;
    letter-spacing: 1px;
    text-shadow: 0 0 8px #F8E71C;
    min-height: 28px;
    border-radius: 3px 3px 0 0;
}
#story-box {
    background: rgba(0, 0, 0, 0.88);
    border: 3px solid #F8E71C;
    border-top: 2px solid #c8b800;
    padding: 20px 22px;
    width: 100%;
    min-height: 110px;
    position: relative;
    box-shadow: 0 0 20px rgba(248,231,28,0.15), inset 0 0 30px rgba(0,0,0,0.5);
}
#story-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    color: #fff;
    line-height: 2;
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 0 #000;
    white-space: pre-wrap;
    word-break: break-word;
    display: inline;
}
#story-cursor {
    display: inline;
    color: #F8E71C;
    font-size: 14px;
    animation: cursorBlink 0.5s infinite;
    vertical-align: middle;
}
@keyframes cursorBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
#story-hint {
    align-self: flex-end;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    color: rgba(255,255,255,0.4);
    animation: hintPulse 1.5s ease-in-out infinite;
    margin-top: 4px;
}
@keyframes hintPulse {
    0%, 100% { opacity: 0.3; }
    50%       { opacity: 0.9; }
}
#story-hint.hidden { display: none !important; }
#story-skip-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    border: 2px solid #555;
    color: #aaa;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 8px 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: border-color 0.2s, color 0.2s;
}
#story-skip-btn:hover {
    border-color: #F8E71C;
    color: #F8E71C;
}
.story-star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    animation: starTwinkle var(--dur, 3s) var(--delay, 0s) infinite;
    z-index: 1;
    pointer-events: none;
}
@keyframes starTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50%       { opacity: var(--op, 0.6); transform: scale(1); }
}
/* ==================== HİKAYE EKRANI SONU ==================== */

/* Nokia Modu Efekti */
#game-container.nokia-mode {
    filter: sepia(100%) hue-rotate(40deg) saturate(2) contrast(1.2);
}
#game-container.nokia-mode #background {
    filter: brightness(0.8);
    background-color: #9cb640; /* Klasik Nokia yeşili */
    background-blend-mode: multiply;
}

#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('gorseller/arkaplan.png');
    background-size: cover;
    background-position: center bottom;
    z-index: 1;
    image-rendering: pixelated; 
    transition: background 0.5s ease;
}

#background.bg-uzay {
    background-image: none;
    background: radial-gradient(circle at center, #1b0036 0%, #000000 100%);
}

#background.bg-dunya {
    background-image: none;
    background: linear-gradient(to bottom, #4cb8c4, #3cd3ad);
}

#background.bg-cilgin {
    background-image: none;
    background: linear-gradient(45deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 300% 300%;
    animation: rainbowShift 3s ease infinite;
}

#background.bg-savas {
    background-image: none;
    background: radial-gradient(circle at center, #3a0000 0%, #000000 100%);
}

#background.bg-zombi {
    background-image: none;
    background: linear-gradient(to bottom, #113311, #000000);
}

#background.bg-amerika {
    background-image: none;
    background: linear-gradient(to right, #002868, #ffffff, #bf0a30);
}

#background.bg-almanya {
    background-image: none;
    background: linear-gradient(to bottom, #000000, #dd0000, #ffcc00);
}

#background.bg-istanbul {
    filter: sepia(0.6) hue-rotate(-20deg) saturate(1.5);
}

#background.bg-sanal {
    background-image: none;
    background: linear-gradient(135deg, #001100, #00ff00, #001100);
    background-size: 200% 200%;
    animation: rainbowShift 5s ease infinite;
}

@keyframes rainbowShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#player {
    position: absolute;
    width: 80px;
    left: 100px; 
    z-index: 10;
    image-rendering: pixelated; 
    transform-origin: center;
}

#score-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    color: white;
    text-shadow: 2px 2px 0 #000;
    font-size: 14px;
}

#lives-container {
    margin-bottom: 15px;
    display: flex;
    gap: 5px;
}

.heart {
    width: 25px;
    height: 25px;
    background-color: #ff0040;
    position: relative;
    display: inline-block;
    image-rendering: pixelated;
    box-shadow: inset -3px -3px 0 #800020, 2px 2px 0 #000;
}

/* Minecraft kalp şekli simülasyonu */
.heart::before, .heart::after {
    content: "";
    position: absolute;
    width: 25px;
    height: 25px;
    background-color: #ff0040;
}
.heart::before { top: -10px; left: 0; }
.heart::after { left: 10px; top: 0; }
/* Kaybedilen kalp */
.heart.lost {
    background-color: #444;
    box-shadow: inset -3px -3px 0 #222, 2px 2px 0 #000;
}
.heart.lost::before, .heart.lost::after { background-color: #444; }

#score-container p {
    margin: 3px 0;
}

/* UI Ekranları (Başlangıç ve Bitiş) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-shadow: 4px 4px 0 #000, -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000;
    text-align: center;
}

#start-screen {
    justify-content: flex-start;
    padding-top: 60px;
    gap: 12px;
}

/* Sağ Üst Duraklat Butonu */
#pause-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 25;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.6);
    border: 3px solid #F8E71C;
    color: #F8E71C;
    font-size: 22px;
    cursor: pointer;
    border-radius: 6px;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(248, 231, 28, 0.3), 3px 3px 0 #000;
    transition: transform 0.1s, background 0.15s;
    pointer-events: auto;
    line-height: 1;
}
#pause-btn:hover {
    background: rgba(248, 231, 28, 0.2);
    transform: scale(1.1);
}
#pause-btn:active {
    transform: scale(0.95);
    box-shadow: none;
}
/* Oyun oynamıyorken butonu gizle */
#pause-btn.hidden {
    display: none !important;
}

/* Duraklat / Pause Menüsü */
#pause-screen .pixel-btn {
    width: 250px;
    text-align: center;
    padding: 12px 20px;
    font-size: 12px;
    margin: 6px 0;
}
#pause-screen h1 {
    font-size: 32px;
    margin-bottom: 20px;
}

.screen h1 {
    font-size: 50px;
    margin-bottom: 40px;
    color: #F8E71C;
    letter-spacing: 2px;
    line-height: 1.5;
}

#game-over-screen {
    background-color: rgba(60, 0, 0, 0.85); /* Hafif kırmızı tonlu karanlık arka plan */
    border: 10px solid #800;
}

#game-over-screen h1 {
    color: #ff0000;
    text-shadow: 4px 4px 0 #000, 0 0 20px rgba(255, 0, 0, 0.5);
    animation: deathPulse 2s infinite;
}

@keyframes deathPulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.05); filter: brightness(1.2); }
}

#game-over-screen .pixel-btn {
    width: 280px;
    margin: 10px 0;
    transition: all 0.2s;
}

#restart-btn {
    background-color: #73BF2E; /* Yeşil - Yeniden Başla */
    color: white;
}

#game-over-menu-btn {
    background-color: #555; /* Gri - Menü */
    color: white;
}

#game-over-screen .pixel-btn:hover {
    transform: scale(1.1);
    box-shadow: 6px 6px 0 #000;
}

.screen p {
    font-size: 14px;
    line-height: 2;
    color: #FFF;
    text-shadow: 3px 3px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
}

/* Dikkat çekmek için yanıp sönen yazı efekti */
.screen .blink-text {
    animation: blink 1.2s infinite;
    color: #FFD700;
}

/* Ses Ayar UI Kontrolleri */
#volume-control {
    margin-top: 30px;
    background: rgba(0,0,0,0.6);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #555;
    z-index: 40;
    pointer-events: auto;
}

#volume-control label {
    font-size: 10px;
    display: block;
    margin-bottom: 10px;
    color: #FFF;
}

/* Ayarlar Ekranı */
.settings-section {
    background: rgba(255,255,255,0.05);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 15px 25px;
    margin-bottom: 15px;
    width: 85%;
    text-align: center;
}

.settings-label {
    display: block;
    font-size: 10px;
    color: #F8E71C;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

#language-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.lang-btn {
    background: rgba(255,255,255,0.08);
    border: 2px solid #555;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-align: center;
}

.lang-btn:hover {
    background: rgba(248, 231, 28, 0.2);
    border-color: #F8E71C;
}

.lang-btn.active {
    background: rgba(248, 231, 28, 0.3);
    border-color: #F8E71C;
    color: #F8E71C;
}

#settings-screen {
    gap: 8px;
    padding: 20px;
    overflow-y: auto;
}

#bgm-volume {
    cursor: pointer;
    width: 150px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hidden {
    display: none !important;
}

/* Madalya Tasarımı */
#medal-display {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#medal-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    border: 4px solid #000;
    image-rendering: pixelated;
}

.medal-gold { background: linear-gradient(135deg, #ffd700, #ff8c00); box-shadow: 0 0 15px #ffd700; }
.medal-silver { background: linear-gradient(135deg, #c0c0c0, #808080); box-shadow: 0 0 15px #c0c0c0; }
.medal-bronze { background: linear-gradient(135deg, #cd7f32, #8b4513); box-shadow: 0 0 15px #cd7f32; }

#medal-text {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

/* Market & Pixel Buttons */
.pixel-btn {
    background-color: #f8e71c;
    border: 4px solid #000;
    padding: 15px 30px;
    color: #000;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 4px 4px 0 #888;
    margin: 20px 0;
    pointer-events: auto;
}

.pixel-btn:active {
    box-shadow: none;
    transform: translate(4px, 4px);
}

#skin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    width: 90%;
    margin-bottom: 20px;
}

.skin-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border: 2px solid #555;
    cursor: pointer;
    font-size: 10px;
    pointer-events: auto;
}

.skin-item:hover { background: rgba(255, 255, 255, 0.2); }
.skin-item.owned { border-style: solid; background: rgba(0, 255, 0, 0.1); }
.skin-item.owned::after { content: ' (SAHİPSİN)'; font-size: 8px; color: #73BF2E; }
.skin-item.selected::after { content: ' (SEÇİLDİ)'; color: #F8E71C; }
.skin-item.selected { border-color: #f8e71c; background: rgba(248, 231, 28, 0.3); border-width: 4px; }

/* Kostüm Seçenekleri Filtreleri (Daha Belirgin) */
.skin-fb-classic { filter: sepia(1) saturate(5) hue-rotate(190deg); } /* Çubuklu - Sarı/Lacivert Efekti */
.skin-fb-white   { filter: brightness(1.5) contrast(1.2) grayscale(1); } /* Beyaz */
.skin-fb-navy    { filter: brightness(0.5) sepia(1) hue-rotate(200deg) saturate(3); } /* Lacivert */
.skin-tadic      { filter: contrast(1.5) brightness(1.2) drop-shadow(0 0 5px #F8E71C); } /* Tadic - Parlaklık */
.skin-dzeko      { filter: saturate(2) brightness(0.9) hue-rotate(45deg); }
.skin-fred       { filter: invert(0.2) sepia(1) hue-rotate(300deg) saturate(4); }

/* Diğer Takım Formaları (Zümrüt Shop) - Renk filtreleri daha belirginleştirildi */
.skin-gs { filter: hue-rotate(340deg) saturate(5) contrast(1.2); }   /* GS - Sarı/Kırmızı */
.skin-bjk { filter: grayscale(1) contrast(3) brightness(0.8); }      /* BJK - Siyah/Beyaz */
.skin-ts { filter: hue-rotate(290deg) saturate(3) brightness(0.7); }  /* TS - Bordo/Mavi */
.skin-rm { filter: brightness(2) contrast(1.1) saturate(0.5); }       /* Real Madrid - Saf Beyaz */
.skin-barca { filter: hue-rotate(210deg) saturate(4) contrast(1.5); } /* Barca - Koyu Mavi/Kırmızı */
.skin-mc { filter: hue-rotate(190deg) saturate(2) brightness(1.5); }  /* Man City - Açık Mavi */

/* Tasarım Boruları (Pipes) - Pixel Art Görünümü İçin CSS İle Çizildi */
.pipe {
    position: absolute;
    width: 120px; /* Genişlik 80px'den 120px'e yükseltildi */
    background-color: #73BF2E;
    border: 6px solid #558022;
    z-index: 5;
    box-shadow: inset -5px 0 0 rgba(0,0,0,0.2), inset 5px 0 0 rgba(255,255,255,0.4);
}

/* Boruların Başlıkları (Uç Kısımları) */
.pipe::after {
    content: '';
    position: absolute;
    width: 132px; /* Dışa taşan genişlik 92px'den 132px'e yükseltildi */
    height: 40px;
    background-color: #73BF2E;
    border: 6px solid #558022;
    left: -12px; /* Konumlandırma */
    box-shadow: inset -5px -5px 0 rgba(0,0,0,0.2), inset 5px 5px 0 rgba(255,255,255,0.4);
}

.pipe-top::after {
    bottom: -6px; /* Üst borunun başlığı alttadır */
}

.pipe-bottom::after {
    top: -6px; /* Alt borunun başlığı üsttedir */
}

/* Kupa Yolu Stilleri */
#trophy-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 350px;
    overflow-y: auto;
    width: 90%;
    margin-bottom: 20px;
    padding: 10px;
}

.milestone-item {
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid #444;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.milestone-item.locked {
    opacity: 0.6;
    filter: grayscale(1);
}

.milestone-item.claimable {
    border-color: #F8E71C;
    background: rgba(248, 231, 28, 0.1);
    animation: pulse-border 1s infinite alternate;
}

.milestone-item.claimed {
    border-color: #73BF2E;
    background: rgba(115, 191, 46, 0.1);
}

.milestone-info {
    text-align: left;
}

.milestone-title {
    font-size: 12px;
    color: #F8E71C;
    margin-bottom: 5px;
}

.milestone-reward {
    font-size: 10px;
    color: #FFF;
}

@keyframes pulse-border {
    from { box-shadow: 0 0 5px #F8E71C; }
    to { box-shadow: 0 0 15px #F8E71C; }
}

/* Günlük Çark Stilleri */
.wheel-box {
    position: relative;
    width: 250px;
    height: 250px;
    margin: 20px auto;
}

.pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    color: #FF0000;
    text-shadow: 2px 2px 0 #FFF, -2px -2px 0 #FFF, 2px -2px 0 #FFF, -2px 2px 0 #FFF, 0 0 10px #000;
    z-index: 10;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid #F8E71C;
    box-shadow: 0 0 15px #FFD700, inset 0 0 20px rgba(0,0,0,0.8);
    background: #222;
    position: relative;
    overflow: hidden;
    transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99); /* Smooth spin effect */
}

.wheel-slice {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.wheel-slice-text {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #FFF;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    white-space: nowrap;
    text-align: center;
}
