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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #90EE90 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 900px;
    width: 100%;
    text-align: center;
}

/* Başlık */
header {
    margin-bottom: 20px;
}

header h1 {
    color: #2E8B57;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.score-board {
    display: flex;
    justify-content: space-around;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    padding: 10px;
    border-radius: 15px;
    font-size: 1.2em;
    font-weight: bold;
    color: #8B4513;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Oyun Alanı */
.game-area {
    position: relative;
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 70%, #228B22 100%);
    border: 4px solid #8B4513;
    border-radius: 15px;
}

/* Oyun Ekranları */
.start-screen, .game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    z-index: 10;
}

.start-content, .game-over-content {
    background: linear-gradient(135deg, #FFE4B5, #FFEFD5);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 3px solid #DAA520;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: scale(0.5) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.start-content h2, .game-over-content h2 {
    color: #8B4513;
    font-size: 2.2em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.start-content p, .game-over-content p {
    color: #2E8B57;
    font-size: 1.1em;
    margin: 10px 0;
    font-weight: bold;
}

.start-btn, .restart-btn {
    background: linear-gradient(45deg, #32CD32, #228B22);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    font-family: inherit;
}

.start-btn:hover, .restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    background: linear-gradient(45deg, #228B22, #006400);
}

.start-btn:active, .restart-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.new-record {
    color: #FF6347;
    font-size: 1.3em;
    animation: glow 1s infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #FF6347;
    }
    to {
        text-shadow: 0 0 20px #FF6347, 0 0 30px #FF6347;
    }
}

.hidden {
    display: none !important;
}

/* Kontrol Bilgileri */
.controls-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.key {
    background: linear-gradient(45deg, #4169E1, #1E90FF);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9em;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    min-width: 50px;
    text-align: center;
}

.control-item span:last-child {
    color: #2E8B57;
    font-weight: bold;
    font-size: 0.9em;
}

/* Mobil Dokunmatik Kontroller */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 20px;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
}

.mobile-controls-left,
.mobile-controls-right {
    display: flex;
    gap: 15px;
    pointer-events: auto;
}

.mobile-controls-left {
    align-items: flex-end;
}

.mobile-controls-right {
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mobile-btn {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    user-select: none;
    transition: all 0.1s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-appearance: none;
}

.move-btn {
    width: 80px;
    height: 80px;
    background: linear-gradient(145deg, #2196F3, #1976D2);
    font-size: 1.8em;
}

.jump-btn {
    width: 90px;
    height: 90px;
    background: linear-gradient(145deg, #FF9800, #F57C00);
    font-size: 2.2em;
}

.pause-btn {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #9C27B0, #7B1FA2);
    font-size: 1.4em;
}

.mobile-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.mobile-btn:hover {
    transform: scale(1.05);
}

/* iOS Safari özel ayarları */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-overflow-scrolling: touch;
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .mobile-btn {
        -webkit-appearance: none;
        -webkit-border-radius: 50%;
        -webkit-backface-visibility: hidden;
        transform: translateZ(0);
    }
    
    #gameCanvas {
        -webkit-backface-visibility: hidden;
        transform: translateZ(0);
    }
    
    /* Safari bounce scroll önleme */
    .game-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }
}

/* iPhone özel optimizasyonlar */
@media (max-width: 414px) {
    .mobile-controls {
        display: flex;
        bottom: calc(30px + env(safe-area-inset-bottom));
        gap: 25px;
    }
    
    .mobile-btn {
        box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    }
    
    .move-btn {
        width: 100px;
        height: 100px;
        font-size: 2.2em;
    }
    
    .jump-btn {
        width: 110px;
        height: 110px;
        font-size: 2.6em;
    }
    
    .pause-btn {
        width: 80px;
        height: 80px;
        font-size: 1.6em;
    }
    
    .controls-info {
        display: none;
    }
    
    #gameCanvas {
        max-width: 100vw;
        max-height: 55vh;
    }
    
    .game-container {
        padding: 5px;
    }
}

/* Responsive Tasarım */
@media (max-width: 900px) and (min-width: 415px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 800px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .score-board {
        font-size: 1em;
        flex-direction: column;
        gap: 5px;
    }
    
    .controls-info {
        gap: 15px;
    }
    
    /* Mobil kontrolleri göster */
    .mobile-controls {
        display: flex;
    }
}

@media (max-width: 600px) {
    body {
        overflow: hidden;
    }
    
    .game-container {
        margin: 5px;
        padding: 10px;
        height: calc(100vh - 10px);
        display: flex;
        flex-direction: column;
    }
    
    header {
        margin-bottom: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .score-board {
        padding: 8px;
        font-size: 0.9em;
    }
    
    .game-area {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #gameCanvas {
        max-height: calc(100vh - 200px);
        width: auto;
        height: auto;
    }
    
    .start-content, .game-over-content {
        padding: 20px;
        margin: 10px;
        max-width: 90vw;
    }
    
    .start-content h2, .game-over-content h2 {
        font-size: 1.8em;
    }
    
    .controls-info {
        display: none; /* Mobilde klavye kontrollerini gizle */
    }
    
    /* Mobil butonları daha büyük yap */
    .move-btn {
        width: 70px;
        height: 70px;
        font-size: 1.8em;
    }
    
    .jump-btn {
        width: 80px;
        height: 80px;
        font-size: 2em;
    }
    
    .pause-btn {
        width: 60px;
        height: 60px;
        font-size: 1.4em;
    }
}

/* Oyun İçi Animasyonlar */
.pulse {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Mobil Optimizasyonları */
@media (hover: none) and (pointer: coarse) {
    /* Dokunmatik cihazlar için optimizasyonlar */
    .mobile-btn:hover {
        transform: none;
    }
    
    .start-btn:hover, .restart-btn:hover {
        transform: none;
    }
    
    /* Dokunmatik feedback */
    .mobile-btn:active {
        background: linear-gradient(145deg, #388E3C, #2E7D32);
    }
    
    .move-btn:active {
        background: linear-gradient(145deg, #1976D2, #1565C0);
    }
    
    .jump-btn:active {
        background: linear-gradient(145deg, #F57C00, #EF6C00);
    }
    
    .pause-btn:active {
        background: linear-gradient(145deg, #7B1FA2, #6A1B9A);
    }
}

/* Landscape orientation için özel ayarlar */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .game-container {
        padding: 5px;
    }
    
    header h1 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }
    
    .score-board {
        padding: 5px;
        font-size: 0.8em;
    }
    
    .mobile-controls {
        bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    .move-btn {
        width: 70px;
        height: 70px;
        font-size: 1.6em;
    }
    
    .jump-btn {
        width: 80px;
        height: 80px;
        font-size: 1.8em;
    }
    
    .pause-btn {
        width: 60px;
        height: 60px;
        font-size: 1.2em;
    }
    
    #gameCanvas {
        max-height: 45vh;
    }
}

/* iPhone X ve sonrası için safe area desteği */
@media (max-width: 896px) and (orientation: landscape) {
    .mobile-controls {
        bottom: calc(15px + env(safe-area-inset-bottom));
        left: calc(20px + env(safe-area-inset-left));
        right: calc(20px + env(safe-area-inset-right));
    }
}