/* ============================================
   Türkçe Okuma Öğretici - Ana Stiller
   Renkli, çocuk dostu, dokunmatik optimize
   ============================================ */

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    background: #f0f4f8;
    color: #333;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* ── Ekranlar ── */
.screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.screen.active {
    display: flex;
}

/* ── Ana Menü ── */
#screen-menu {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 20px;
}

.menu-title {
    text-align: center;
    color: white;
    margin-bottom: 10px;
}
.menu-title h1 {
    font-size: clamp(28px, 6vw, 52px);
    font-weight: 800;
    text-shadow: 2px 3px 6px rgba(0,0,0,0.3);
    line-height: 1.2;
}
.menu-title .subtitle {
    font-size: clamp(14px, 3vw, 22px);
    opacity: 0.9;
    margin-top: 4px;
}
.menu-title .stars-display {
    font-size: clamp(18px, 4vw, 28px);
    margin-top: 8px;
}

.menu-sections {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(10px, 2vw, 20px);
    width: 100%;
    max-width: 600px;
    padding: 0 10px;
}

.menu-section-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(15px, 3vw, 25px);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    color: white;
    font-weight: 700;
    font-size: clamp(14px, 2.8vw, 20px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: transform 0.15s, box-shadow 0.15s;
    gap: 8px;
    min-height: clamp(100px, 20vw, 160px);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.menu-section-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    border-radius: 20px;
    pointer-events: none;
}
.menu-section-btn:active {
    transform: scale(0.95);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.menu-section-btn .icon {
    font-size: clamp(32px, 7vw, 56px);
}
.menu-section-btn .stars-badge {
    position: absolute;
    top: 8px; right: 10px;
    font-size: clamp(12px, 2.5vw, 16px);
    background: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 10px;
}
.menu-section-btn.locked {
    opacity: 0.5;
    pointer-events: none;
}
.menu-section-btn.locked::before {
    content: '🔒';
    position: absolute;
    font-size: 32px;
    z-index: 2;
}

.menu-bottom {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    padding: 0 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.menu-btn-secondary {
    padding: clamp(10px, 2vw, 16px) clamp(16px, 3vw, 30px);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 30px;
    background: rgba(255,255,255,0.15);
    color: white;
    font-size: clamp(13px, 2.5vw, 17px);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    backdrop-filter: blur(5px);
}
.menu-btn-secondary:active {
    transform: scale(0.95);
    background: rgba(255,255,255,0.3);
}

.version-info {
    position: absolute;
    bottom: 8px; right: 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* ── Bölüm Menüsü ── */
#screen-section {
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    padding: 0;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}
.section-header h2 {
    font-size: clamp(20px, 4vw, 30px);
    color: white;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
    flex: 1;
}

.back-btn {
    width: clamp(44px, 8vw, 56px);
    height: clamp(44px, 8vw, 56px);
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: white;
    font-size: clamp(20px, 4vw, 28px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    flex-shrink: 0;
    backdrop-filter: blur(5px);
}
.back-btn:active {
    transform: scale(0.9);
}

.group-selector {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.group-btn {
    padding: 8px 16px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: clamp(13px, 2.5vw, 16px);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.group-btn.active {
    background: white;
    border-color: white;
}
.group-btn.locked {
    opacity: 0.4;
    pointer-events: none;
}

.game-list {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2.5vw, 20px);
    padding: 16px 20px 40px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: clamp(16px, 3vw, 24px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.game-card:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.game-card .game-icon {
    font-size: clamp(36px, 7vw, 52px);
    flex-shrink: 0;
}
.game-card .game-info {
    flex: 1;
}
.game-card .game-info h3 {
    font-size: clamp(16px, 3vw, 22px);
    font-weight: 700;
    color: #333;
}
.game-card .game-info p {
    font-size: clamp(12px, 2.2vw, 15px);
    color: #777;
    margin-top: 2px;
}
.game-card .game-stars {
    font-size: clamp(14px, 2.5vw, 18px);
    color: #999;
    white-space: nowrap;
}

/* ── Oyun Ekranı ── */
#screen-game {
    background: #1a1a2e;
    flex-direction: column;
}

.game-top-bar {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    gap: 6px;
    flex-shrink: 0;
    z-index: 100;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(5px);
}
.game-top-bar .back-btn {
    width: 40px; height: 40px;
    font-size: 20px;
}

#game-container {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* ── Yardım Overlay ── */
.help-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    backdrop-filter: blur(8px);
    cursor: pointer;
}
.help-content {
    background: white;
    border-radius: 28px;
    padding: clamp(24px, 5vw, 40px);
    max-width: 85%;
    width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: fadeIn 0.3s ease-out;
}
.help-content .help-icon {
    font-size: clamp(48px, 10vw, 72px);
    margin-bottom: 12px;
}
.help-content .help-title {
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 800;
    color: #333;
    margin-bottom: 12px;
}
.help-content .help-text {
    font-size: clamp(16px, 3vw, 22px);
    color: #555;
    line-height: 1.6;
    margin-bottom: 20px;
}
.help-content .help-close-btn {
    padding: 12px 40px;
    border: none;
    border-radius: 30px;
    background: #667eea;
    color: white;
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 700;
    cursor: pointer;
}

/* ── Yakında Eklenecek Modal ── */
.coming-soon-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}
.coming-soon-content {
    background: white;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}
.coming-soon-content .cs-icon { font-size: 64px; margin-bottom: 12px; }
.coming-soon-content .cs-title { font-size: 24px; font-weight: 800; color: #333; margin-bottom: 8px; }
.coming-soon-content .cs-text { font-size: 18px; color: #777; margin-bottom: 20px; }
.coming-soon-content .cs-btn {
    padding: 12px 36px; border: none; border-radius: 30px;
    background: #9C27B0; color: white; font-size: 18px; font-weight: 700; cursor: pointer;
}

/* ── Oyun Ortak Stilleri ── */
.game-area {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-prompt {
    text-align: center;
    padding: 16px;
    color: white;
    z-index: 10;
}
.game-prompt .prompt-text {
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 700;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.game-prompt .prompt-letter {
    font-size: clamp(48px, 10vw, 80px);
    font-weight: 800;
    margin: 8px 0;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

.choices-grid {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(10px, 2vw, 20px);
    justify-content: center;
    align-items: center;
    padding: 16px;
    max-width: 100%;
}

.choice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.1s;
    font-family: inherit;
}
.choice-btn:active {
    transform: scale(0.93);
}

/* ── Balon Oyunu ── */
.balloon-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
}
.balloon {
    position: absolute;
    cursor: pointer;
    transition: transform 0.1s;
}
.balloon:active {
    transform: scale(0.9);
}
.balloon.popped {
    pointer-events: none;
}

/* ── Hafıza Oyunu (Kart) ── */
.memory-card {
    perspective: 800px;
    cursor: pointer;
}
.memory-card .card-inner {
    width: 100%; height: 100%;
    position: relative;
    transition: transform 0.5s;
    transform-style: preserve-3d;
}
.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}
.memory-card .card-front,
.memory-card .card-back {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.memory-card .card-back {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 32px;
}
.memory-card .card-front {
    background: white;
    transform: rotateY(180deg);
    border: 3px solid #E0E0E0;
}
.memory-card.matched {
    pointer-events: none;
}
.memory-card.matched .card-inner {
    transform: rotateY(180deg);
}
.memory-card.matched .card-front {
    border-color: #4CAF50;
    background: #E8F5E9;
}

/* ── Boyama Oyunu ── */
.paint-canvas {
    border-radius: 20px;
    cursor: crosshair;
    touch-action: none;
}

/* ── Sürükle Bırak ── */
.draggable {
    cursor: grab;
    touch-action: none;
}
.draggable.dragging {
    cursor: grabbing;
    z-index: 1000;
    opacity: 0.85;
}
.drop-zone {
    border: 3px dashed rgba(255,255,255,0.4);
    border-radius: 16px;
    transition: border-color 0.2s, background 0.2s;
}
.drop-zone.hover {
    border-color: #4CAF50;
    background: rgba(76,175,80,0.2);
}

/* ── Resimli Hikaye ── */
.story-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px 20px;
    width: 100%; height: 100%;
}
.story-image {
    font-size: clamp(80px, 20vw, 160px);
}
.story-text {
    font-size: clamp(24px, 5vw, 40px);
    font-weight: 700;
    color: white;
    text-align: center;
    line-height: 1.4;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.story-text .word-highlight {
    color: #FFD700;
    text-decoration: underline;
    text-decoration-color: rgba(255,215,0,0.4);
}
.story-nav {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}
.story-nav button {
    padding: 14px 32px;
    border: none;
    border-radius: 30px;
    font-size: clamp(16px, 3vw, 22px);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
    color: white;
}
.story-nav button:active {
    transform: scale(0.93);
}
.story-nav .prev-btn { background: #78909C; }
.story-nav .next-btn { background: #4CAF50; }
.story-nav .read-btn { background: #FF9800; }

/* ── Ayarlar Modal ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}
.modal-content {
    background: white;
    border-radius: 24px;
    padding: clamp(20px, 4vw, 40px);
    max-width: 90%;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-content h2 {
    font-size: clamp(20px, 4vw, 28px);
    margin-bottom: 20px;
    text-align: center;
}
.modal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-size: clamp(14px, 2.5vw, 18px);
}
.modal-row:last-child { border-bottom: none; }
.modal-row label { font-weight: 600; }
.modal-row input[type="range"] {
    width: 120px;
    accent-color: #667eea;
}
.modal-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    font-size: clamp(15px, 3vw, 19px);
    font-weight: 700;
    cursor: pointer;
    margin-top: 12px;
    transition: transform 0.15s;
}
.modal-btn:active { transform: scale(0.97); }
.modal-btn-primary { background: #667eea; color: white; }
.modal-btn-danger { background: #EF5350; color: white; }
.modal-btn-secondary { background: #E0E0E0; color: #333; }

/* ── Animasyonlar ── */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-9px) rotate(2deg); }
}
@keyframes floatSlow {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-6px) scale(1.04); }
}
@keyframes floatUp {
    from { transform: translateY(110vh); }
    to { transform: translateY(-150px); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
@keyframes jellyBounce {
    0%, 100% { transform: scale(1, 1); }
    30% { transform: scale(1.22, 0.84); }
    50% { transform: scale(0.88, 1.18); }
    70% { transform: scale(1.08, 0.94); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-7deg); }
    75% { transform: rotate(7deg); }
}
@keyframes sparkle {
    0%, 100% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1); }
}
@keyframes trainMove {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(0); }
}

.animate-float { animation: float 3s ease-in-out infinite; }
.animate-float-slow { animation: floatSlow 2.6s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-jelly { animation: jellyBounce 0.6s ease-in-out; }
.animate-fadeIn { animation: fadeIn 0.4s ease-out; }
.animate-slideIn { animation: slideInUp 0.4s ease-out; }
.animate-wiggle { animation: wiggle 1.2s ease-in-out infinite; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .menu-sections {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (min-width: 768px) and (orientation: landscape) {
    .menu-sections {
        grid-template-columns: repeat(4, 1fr);
    }
    .game-list {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .game-card {
        flex: 1 1 calc(50% - 20px);
    }
}

/* ── PWA Tam Ekran ── */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ── Scrollbar Gizle ── */
.screen::-webkit-scrollbar { display: none; }
.screen { scrollbar-width: none; }

/* ── Çevrimdışı Bildirim / Toast ── */
.offline-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(30, 41, 59, 0.96);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: clamp(13px, 2.5vw, 15px);
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: center;
    max-width: 90vw;
}
.offline-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
