/* ============================================
   ZİHİN USTASI - HAFIZA OYUNU CSS
   ============================================ */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    user-select: none;
    -webkit-user-select: none;
}

/* ============================================
   BAŞLANGIÇ EKRANI
   ============================================ */

#start-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#start-content {
    text-align: center;
    max-width: 900px;
    width: 95%;
}

#start-content h1 {
    font-size: 3.2em;
    margin-bottom: 8px;
    text-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.3em;
    color: #aaa;
    margin-bottom: 40px;
}

#start-content h2 {
    font-size: 1.4em;
    margin-bottom: 25px;
    color: #e0e0e0;
}

.mode-cards {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-card {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 18px;
    padding: 35px 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 220px;
    text-align: center;
}

.mode-card:hover {
    background: rgba(255,255,255,0.12);
    border-color: #e94560;
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(233, 69, 96, 0.25);
}

.mode-card.selected {
    background: rgba(233, 69, 96, 0.2);
    border-color: #e94560;
}

.mode-icon {
    font-size: 3em;
    margin-bottom: 12px;
}

.mode-card h3 {
    font-size: 1.2em;
    margin-bottom: 6px;
}

.mode-card p {
    font-size: 0.9em;
    color: #aaa;
}

/* ============================================
   OYUN EKRANI
   ============================================ */

#game-screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

#game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
    min-height: 56px;
    flex-shrink: 0;
}

#game-topbar .btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 7px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.2s ease;
}

#game-topbar .btn:hover {
    background: rgba(255,255,255,0.2);
}

#topbar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

#game-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 0.95em;
    font-weight: 600;
}

#level-display, #score-display {
    background: linear-gradient(135deg, #e94560, #c93650);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    letter-spacing: 0.3px;
}

#timer-bar-wrap {
    width: 200px;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

#timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    border-radius: 8px;
    transition: width 0.1s linear;
}

#stars-display {
    font-size: 1.4em;
    letter-spacing: 2px;
}

/* Sağ köşe hazine kutusu */
#star-treasure {
    position: fixed;
    top: 70px;
    right: 18px;
    z-index: 50;
}

.treasure-box {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #1a1a2e;
    padding: 8px 16px;
    border-radius: 16px;
    font-weight: 900;
    font-size: 1.2em;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4), inset 0 2px 6px rgba(255,255,255,0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 3px solid rgba(255,255,255,0.4);
    animation: treasure-wiggle 3s ease-in-out infinite;
}

.treasure-box .treasure-star {
    font-size: 1.3em;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.7));
}

.treasure-box .treasure-number {
    font-size: 1.35em;
    min-width: 24px;
    text-align: center;
}

@keyframes treasure-wiggle {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    25% { transform: rotate(3deg) translateY(-2px); }
    50% { transform: rotate(-2deg) translateY(0); }
    75% { transform: rotate(2deg) translateY(-1px); }
}

/* Uçan yıldız animasyonu */
.flying-star {
    position: fixed;
    z-index: 200;
    font-size: 1.6em;
    pointer-events: none;
    animation: star-fly 0.8s ease-in forwards;
}

@keyframes star-fly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    50% { transform: translate(var(--fly-x), var(--fly-y)) scale(1.3); opacity: 1; }
    100% { transform: translate(var(--fly-x), var(--fly-y)) scale(0.5); opacity: 0; }
}

/* ============================================
   KART ALANI
   ============================================ */

#game-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}

#cards-grid {
    display: grid;
    gap: 8px;
    perspective: 1000px;
    transform-origin: center center;
}

/* Kart */
.card {
    width: 100px;
    height: 130px;
    position: relative;
    cursor: pointer;
    perspective: 600px;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s ease;
    border-radius: 12px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.matched .card-inner {
    transform: rotateY(180deg);
}

.card.matched .card-front {
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.5);
    border-color: rgba(74, 222, 128, 0.6);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Kart ön yüzü (kapalı) */
.card-front {
    background: linear-gradient(135deg, #2a2a4a, #1a1a3a);
    border: 2px solid rgba(255,255,255,0.15);
    font-size: 2em;
    transition: all 0.2s ease;
}

.card-front::before {
    content: "❔";
    opacity: 0.6;
}

.card:hover .card-front {
    border-color: #e94560;
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.3);
}

/* Kart arka yüzü (açık) */
.card-back {
    background: linear-gradient(135deg, #f8f8ff, #e8e8f0);
    border: 2px solid rgba(0,0,0,0.1);
    transform: rotateY(180deg);
    overflow: hidden;
}

.card-back canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.card.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* ============================================
   PEEK OVERLAY
   ============================================ */

#peek-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    pointer-events: none;
}

#peek-message {
    background: rgba(0,0,0,0.7);
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.3em;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* ============================================
   TAMAMLANDI MODAL
   ============================================ */

#complete-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#complete-modal {
    background: linear-gradient(135deg, #16213e, #0f3460);
    border: 2px solid #e94560;
    border-radius: 20px;
    padding: 35px 40px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#complete-modal h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

#complete-modal p {
    font-size: 1.05em;
    color: #ccc;
    margin-bottom: 15px;
}

#complete-stats {
    margin: 15px 0;
    font-size: 1.1em;
    color: #ffd700;
}

.complete-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.complete-buttons .btn {
    background: #e94560;
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
}

.complete-buttons .btn-icon {
    font-size: 2em;
    padding: 14px 18px;
    min-width: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.complete-buttons .btn:hover {
    background: #c93650;
    transform: translateY(-2px);
}

/* ============================================
   CONFETTI
   ============================================ */

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -20px;
    z-index: 10001;
    opacity: 1;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(105vh) rotate(var(--confetti-spin)) scale(0.4); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    #start-content h1 {
        font-size: 2.2em;
    }

    .mode-card {
        width: 160px;
        padding: 25px 20px;
    }

    .mode-icon {
        font-size: 2.4em;
    }

    #game-info {
        gap: 8px;
        font-size: 0.8em;
    }

    #level-display, #score-display {
        padding: 3px 10px;
        font-size: 0.8em;
    }

    #cards-grid {
        gap: 6px;
    }

    #timer-bar-wrap {
        width: 140px;
    }
}

@media (max-width: 480px) {
    .card-front::before {
        font-size: 0.7em;
    }
}
