* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%); /* Vibrant magical gradient */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
}

#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    background: #111; /* Siyah arkaplan ile letterbox etkisi */
    overflow: hidden;
}

#game-wrapper {
    position: relative;
    /* width ve height JS'den dinamik atanacak */
    box-shadow: 0 0 20px rgba(0,0,0,0.8); /* Ekrana odaklanmayı sağlar */
    overflow: hidden;
}

/* Tam Ekran Butonu */
#fullscreenBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    pointer-events: auto;
    line-height: 1;
}
#fullscreenBtn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.15);
}
#fullscreenBtn:active {
    transform: scale(0.95);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: optimizeSpeed; /* Optimize canvas drawing */
}

/* UI Katmanı */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through to canvas when appropriate */
}

/* Tüm butonlar ve inputlar tıklanabilir olmalı */
#ui-layer button, 
#ui-layer input,
#ui-layer .glass-panel {
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Glassmorphism Paneller */
.glass-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 28px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2), inset 0 0 30px rgba(255, 255, 255, 0.1);
    z-index: 100;
    width: 90%;
    max-width: 500px;
}

/* Tipografi */
.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    color: #fff;
    text-shadow: 0 0 15px rgba(186, 85, 211, 0.8), 0 0 30px rgba(186, 85, 211, 0.6);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    font-family: 'Nunito', sans-serif;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    display: block;
    margin-top: 10px;
}

.game-over-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #ff4757;
    text-shadow: 0 0 15px rgba(255, 71, 87, 0.6);
    margin-bottom: 20px;
}

.highlight-text {
    font-weight: 700;
    color: #ffd700;
    font-size: 1.5rem;
}

/* Input Alanı */
.input-group {
    margin-bottom: 25px;
}

input[type="text"] {
    width: 80%;
    padding: 12px 20px;
    font-size: 1.2rem;
    font-family: 'Nunito', sans-serif;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: #a29bfe;
    box-shadow: 0 0 15px rgba(162, 155, 254, 0.5);
    background: rgba(0, 0, 0, 0.5);
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.error {
    border-color: #ff4757 !important;
    animation: shake 0.5s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}

/* Butonlar */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.btn {
    width: 80%;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(2px) scale(0.95);
}

.btn.primary {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    color: white;
    box-shadow: 0 5px 15px rgba(108, 92, 231, 0.4);
}

.btn.secondary {
    background: linear-gradient(135deg, #81ecec, #00cec9);
    color: #2d3436;
    box-shadow: 0 5px 15px rgba(0, 206, 201, 0.4);
}

.btn.warning {
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    color: #2d3436;
    box-shadow: 0 5px 15px rgba(253, 203, 110, 0.4);
}

/* Kredi Yazısı */
.credits {
    margin-top: 15px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    line-height: 1.4;
    padding: 0 10px;
}
.credits a {
    color: #fdcb6e;
    text-decoration: none;
    font-weight: 800;
}
.credits a:hover {
    text-decoration: underline;
}

/* Oyun İçi Göstergeler (HUD) */
#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 50;
    pointer-events: none;
}

.score-board, .gold-board {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.health-board {
    display: flex;
    gap: 10px;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    padding: 10px 15px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.heart {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* Modallar */
.modal h2 {
    font-family: 'Fredoka One', cursive;
    color: #ffd700;
    margin-bottom: 20px;
}

.story-content {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 25px;
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    max-height: 50vh;
    overflow-y: auto;
}

.story-content p {
    margin-bottom: 12px;
}

.leaderboard-content {
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 250px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 1.2rem;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.rank-1 { color: #ffd700; font-weight: bold; font-size: 1.3rem; }
.rank-2 { color: #c0c0c0; font-weight: bold; }
.rank-3 { color: #cd7f32; font-weight: bold; }

/* Mobil Kontroller */
#mobile-controls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    right: 30px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 150;
}

.control-btn {
    pointer-events: auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(5px);
    border: 3px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

@media (min-width: 769px) {
    #mobile-controls {
        display: none !important;
    }
}