* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 10px;
    /* Pull-to-refresh desteği */
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

/* Yükleme Ekranı */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-heart {
    font-size: 80px;
    animation: heartBeatLoading 1s ease-in-out infinite;
}

@keyframes heartBeatLoading {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.loading-text {
    font-size: 24px;
    color: white;
    margin-top: 20px;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Romantik Arka Plan */
.romantic-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(255, 182, 193, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(255, 105, 180, 0.3) 0%, transparent 50%);
    animation: glow 4s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 1;
}

/* Arka Plan Animasyonları */
.romantic-bg::before,
.romantic-bg::after {
    content: '';
    position: fixed;
    pointer-events: none;
}

.romantic-bg::before {
    content: '🦋';
    font-size: 40px;
    top: 20%;
    left: -50px;
    animation: fly-across 15s linear infinite;
}

.romantic-bg::after {
    content: '✨';
    font-size: 30px;
    top: 60%;
    right: -50px;
    animation: fly-across-reverse 12s linear infinite;
}

@keyframes glow {
    0% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.puzzle-container {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 10px;
    max-width: 800px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    min-height: 100vh;
    justify-content: center;
}

/* Başlık */
.puzzle-header {
    margin-bottom: 10px;
    animation: fadeInDown 1s ease-out;
}

.puzzle-title {
    font-size: 42px;
    color: white;
    text-shadow: 0 4px 15px rgba(255, 20, 147, 0.8);
    margin-bottom: 10px;
    animation: pulse-title 2s ease-in-out infinite;
}

.puzzle-subtitle {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@keyframes pulse-title {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* İpucu Mesajı (Üstte - Küçük) */
.hint-message {
    min-height: 40px;
    margin-bottom: 10px;
    font-size: 16px;
    color: #FFA500;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.8);
    background: rgba(255, 215, 0, 0.2);
    padding: 10px 20px;
    border-radius: 20px;
    display: inline-block;
    animation: hintGlow 2s ease-in-out infinite;
    box-shadow: 0 5px 20px rgba(255, 165, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

@keyframes hintGlow {
    0%, 100% {
        box-shadow: 0 5px 20px rgba(255, 165, 0, 0.3);
    }
    50% {
        box-shadow: 0 8px 30px rgba(255, 165, 0, 0.6);
    }
}

/* Romantik Mesajlar (Ortada - Büyük) */
.romantic-message {
    min-height: 60px;
    margin-bottom: 15px;
    font-size: 26px;
    color: #ff1493;
    font-weight: bold;
    text-shadow: 0 3px 15px rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 230, 240, 0.95) 100%);
    padding: 15px 30px;
    border-radius: 35px;
    display: inline-block;
    animation: messageGlow 2s ease-in-out infinite;
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.6);
    border: 3px solid rgba(255, 105, 180, 0.4);
    transform: scale(1);
    transition: all 0.3s ease;
}

@keyframes messageGlow {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(255, 105, 180, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 12px 40px rgba(255, 105, 180, 0.9);
        transform: scale(1.02);
    }
}

/* Puzzle Tahtası */
.puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.puzzle-piece {
    aspect-ratio: 1;
    background-size: 300% 300%;
    background-position: center;
    background-repeat: no-repeat;
    border: 3px solid white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    /* Mobil için */
    min-height: 80px;
    width: 100%;
}

.puzzle-piece::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.puzzle-piece:hover::before {
    transform: translateX(100%);
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.6);
    border-color: #ff69b4;
}

.puzzle-piece.correct {
    animation: correctPiece 0.6s ease-out;
    border-color: #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

.puzzle-piece.selected {
    border-color: #FFD700;
    box-shadow: 0 0 25px rgba(255, 215, 0, 1);
    transform: scale(1.05);
    animation: selectedPulse 0.8s ease-in-out infinite;
}

@keyframes selectedPulse {
    0%, 100% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 1);
    }
    50% {
        box-shadow: 0 0 35px rgba(255, 215, 0, 1);
    }
}

@keyframes correctPiece {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.puzzle-piece.empty {
    background: rgba(255, 255, 255, 0.3);
    border: 3px dashed rgba(255, 255, 255, 0.5);
    display: none; /* Artık boş parça yok */
}

/* Kontroller */
.puzzle-controls {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 600px;
}

/* Hamle Sayacı */
.move-counter {
    font-size: 16px;
    color: white;
    background: rgba(255, 105, 180, 0.3);
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    flex-shrink: 0;
}

/* İpucu Butonu */
.hint-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
}

.hint-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.7);
}

.hint-button:active {
    transform: translateY(-1px);
}

.hint-icon {
    font-size: 18px;
    animation: hint-pulse 2s ease-in-out infinite;
}

/* Fotoğraf Değiştir Butonu */
.change-photo-button {
    background: linear-gradient(135deg, #9C27B0 0%, #E91E63 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    white-space: nowrap;
    flex-shrink: 0;
}

.change-photo-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.7);
}

.change-photo-button:active {
    transform: translateY(-1px);
}

.change-icon {
    font-size: 18px;
    animation: rotate-icon 2s linear infinite;
}

.change-text {
    display: inline;
}

@keyframes rotate-icon {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes hint-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes fly-across {
    0% {
        transform: translateX(0) translateY(0) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: translateX(50vw) translateY(-30px) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: translateX(110vw) translateY(0) rotate(360deg);
        opacity: 0.7;
    }
}

@keyframes fly-across-reverse {
    0% {
        transform: translateX(110vw) translateY(0) rotate(0deg);
        opacity: 0.7;
    }
    50% {
        transform: translateX(50vw) translateY(30px) rotate(-180deg);
        opacity: 1;
    }
    100% {
        transform: translateX(-50px) translateY(0) rotate(-360deg);
        opacity: 0.7;
    }
}

/* Arka Plan Kelebekler */
.bg-butterfly {
    position: fixed;
    font-size: 35px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.7;
}

.bg-butterfly-1 {
    top: 15%;
    left: -50px;
    animation: fly-across 12s linear infinite;
}

.bg-butterfly-2 {
    top: 70%;
    right: -50px;
    animation: fly-across-reverse 14s linear infinite;
    animation-delay: 3s;
}

/* Arka Plan Yıldızlar */
.bg-star {
    position: fixed;
    font-size: 25px;
    pointer-events: none;
    z-index: 2;
    animation: twinkle-bg 3s ease-in-out infinite;
}

.bg-star-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.bg-star-2 {
    top: 20%;
    right: 15%;
    animation-delay: 1s;
}

.bg-star-3 {
    bottom: 15%;
    left: 20%;
    animation-delay: 2s;
}

.bg-star-4 {
    bottom: 20%;
    right: 10%;
    animation-delay: 1.5s;
}

@keyframes twinkle-bg {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.3) rotate(180deg);
    }
}

/* Arka Plan Kalpler */
.bg-heart {
    position: fixed;
    font-size: 30px;
    pointer-events: none;
    z-index: 2;
    animation: float-bg 3s ease-in-out infinite;
}

.bg-heart-1 {
    top: 25%;
    left: 5%;
    animation-delay: 0s;
}

.bg-heart-2 {
    top: 55%;
    right: 8%;
    animation-delay: 1s;
}

.bg-heart-3 {
    top: 80%;
    left: 15%;
    animation-delay: 1.5s;
}

.bg-heart-4 {
    top: 35%;
    right: 20%;
    animation-delay: 2s;
}

.bg-heart-5 {
    top: 65%;
    left: 25%;
    animation-delay: 0.5s;
}

.bg-heart-6 {
    top: 45%;
    right: 12%;
    animation-delay: 2.5s;
}

@keyframes float-bg {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-25px) rotate(15deg);
        opacity: 0.9;
    }
}

/* Arka Plan Çiçekler */
.bg-flower {
    position: fixed;
    font-size: 28px;
    pointer-events: none;
    z-index: 2;
    animation: rotate-bg 6s linear infinite;
}

.bg-flower-1 {
    top: 50%;
    left: 3%;
    animation-delay: 0s;
}

.bg-flower-2 {
    top: 40%;
    right: 5%;
    animation-delay: 2s;
}

.bg-flower-3 {
    top: 75%;
    right: 18%;
    animation-delay: 4s;
}

@keyframes rotate-bg {
    0% {
        transform: rotate(0deg);
        opacity: 0.6;
    }
    50% {
        opacity: 0.9;
    }
    100% {
        transform: rotate(360deg);
        opacity: 0.6;
    }
}

/* Geri Dön Butonu */
.back-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.back-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Kazanma Ekranı */
.victory-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-out;
}

.victory-screen.show {
    display: flex;
}

.victory-content {
    background: linear-gradient(135deg, #ff1493 0%, #ff69b4 100%);
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 20, 147, 0.8);
    animation: victoryPop 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

@keyframes victoryPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.big-heart {
    font-size: 120px;
    animation: heartBeat 1.5s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes heartBeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.1);
    }
}

.victory-title {
    font-size: 48px;
    color: white;
    margin-bottom: 20px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.victory-text {
    font-size: 24px;
    color: white;
    margin-bottom: 30px;
    line-height: 1.6;
}

.victory-flowers {
    font-size: 50px;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.victory-flowers span {
    animation: flowerBounce 1s ease-in-out infinite;
}

.victory-flowers span:nth-child(1) { animation-delay: 0s; }
.victory-flowers span:nth-child(2) { animation-delay: 0.2s; }
.victory-flowers span:nth-child(3) { animation-delay: 0.4s; }
.victory-flowers span:nth-child(4) { animation-delay: 0.6s; }
.victory-flowers span:nth-child(5) { animation-delay: 0.8s; }

@keyframes flowerBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(10deg);
    }
}

.play-again-btn,
.home-btn {
    display: inline-block;
    background: white;
    color: #ff1493;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    margin: 10px;
    text-decoration: none;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.play-again-btn:hover,
.home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .puzzle-container {
        padding: 5px;
        gap: 10px;
    }
    
    .puzzle-title {
        font-size: 22px;
    }
    
    .puzzle-subtitle {
        font-size: 12px;
    }
    
    .romantic-message {
        font-size: 15px;
        padding: 10px 18px;
    }
    
    .hint-message {
        font-size: 12px;
        padding: 8px 15px;
    }
    
    .puzzle-board {
        max-width: 340px;
        gap: 5px;
        padding: 8px;
    }
    
    .puzzle-controls {
        flex-direction: row !important;
        gap: 6px !important;
        width: 100%;
        max-width: 340px;
        justify-content: center;
        flex-wrap: nowrap !important;
    }
    
    .move-counter {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .hint-button,
    .change-photo-button {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
    }
    
    .hint-icon,
    .change-icon {
        font-size: 16px;
    }
    
    .change-text {
        display: none;
    }
    
    .back-button {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .victory-content {
        padding: 25px 15px;
        margin: 10px;
    }
    
    .big-heart {
        font-size: 60px;
    }
    
    .victory-title {
        font-size: 24px;
    }
    
    .victory-text {
        font-size: 15px;
    }
    
    .victory-flowers {
        font-size: 30px;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .puzzle-container {
        padding: 5px;
        gap: 8px;
    }
    
    .puzzle-title {
        font-size: 18px;
    }
    
    .puzzle-subtitle {
        font-size: 10px;
    }
    
    .romantic-message {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .hint-message {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .puzzle-board {
        max-width: 280px;
        gap: 4px;
        padding: 6px;
    }
    
    .puzzle-controls {
        flex-direction: row !important;
        gap: 4px !important;
        width: 100%;
        max-width: 280px;
        flex-wrap: nowrap !important;
    }
    
    .move-counter {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .hint-button,
    .change-photo-button {
        padding: 6px 10px;
        font-size: 11px;
        gap: 3px;
    }
    
    .hint-icon,
    .change-icon {
        font-size: 14px;
    }
    
    .hint-text,
    .change-text {
        display: none;
    }
    
    .back-button {
        padding: 6px 15px;
        font-size: 12px;
    }
    
    .victory-content {
        padding: 20px 12px;
        margin: 8px;
    }
    
    .big-heart {
        font-size: 50px;
    }
    
    .victory-title {
        font-size: 20px;
    }
    
    .victory-text {
        font-size: 13px;
    }
    
    .victory-flowers {
        font-size: 25px;
    }
    
    .play-again-btn,
    .home-btn {
        padding: 8px 15px;
        font-size: 12px;
    }
}
