:root {
    --bg-color: #F9F7F7;
    --card-bg: #DBE2EF;
    --primary-color: #3F72AF;
    --primary-hover: #2A5282;
    --text-color: #112D4E;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
}

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

/* ========================================================
   EN ÜST TAM GENİŞLİK MİNİMAL SAYAÇ DOLUM BARI
   Kalan Zaman: Kırmızı (#dc2626) | Geçen Zaman: Yeşil (#16a34a)
   ======================================================== */
#school-progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 18px;
    background-color: #dc2626; /* Kalan zaman (Kırmızı zemin) */
    z-index: 99999;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    user-select: none;
    pointer-events: none;
}

#school-progress-fill {
    height: 100%;
    background-color: #16a34a; /* Geçen zaman (Yeşil dolum) */
    width: 0%;
    transition: width 0.4s linear;
}

#school-progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    padding: 0 6px;
}

body {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh; /* Eski tarayıcılar için yedek */
    min-height: 100dvh; /* Mobil navigasyon çubuklarını hesaplayan dinamik yükseklik */
    -webkit-font-smoothing: antialiased;
    padding-top: 18px; /* Üstteki minimal bar için boşluk */
}

#app-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-color);
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
    color: var(--text-color);
}

/* Daha İnce ve Estetik Banner */
header {
    background-color: var(--primary-color);
    color: #fff;
    padding: 18px 20px; /* İncelttik */
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    z-index: 10;
    cursor: pointer;
    transition: background 0.3s;
    border-bottom-left-radius: 24px; /* Soft tasarım için köşeler yumuşatıldı */
    border-bottom-right-radius: 24px;
}

header:hover {
    background-color: var(--primary-hover);
}

header a {
    text-decoration: none;
    color: inherit;
    display: block;
}

header .title {
    font-size: 22px; /* Küçültüldü */
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

header .subtitle {
    font-size: 13px; /* Estetik duruş için hafif küçültüldü */
    font-weight: 400;
    opacity: 0.85;
}

/* Ana Menü Kartları */
.grid-menu {
    display: flex;
    flex-direction: column;
    padding: 20px 25px; /* Dikey boşluklar esnek olması için hafif kısıldı */
}

.menu-card {
    background-color: #fff;
    border-radius: 28px; /* Daha oval, köşesiz soft görünüm */
    padding: 40px 20px;
    margin-bottom: 25px; /* Kartlar arası boşluk garanti altına alındı */
    text-align: center;
    box-shadow: 0 8px 25px rgba(17, 45, 78, 0.06);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    color: var(--primary-color);
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(17, 45, 78, 0.12);
    border-color: var(--primary-color);
}

.menu-card h3 {
    color: var(--text-color);
    font-size: 22px;
    font-weight: bold;
}

/* Haftanın Kazanımı Kartı */
.weekly-outcome-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 22px;
    box-shadow: 0 8px 20px rgba(17, 45, 78, 0.05);
    border: 1px solid rgba(63, 114, 175, 0.15);
    border-top: 4px solid var(--primary-color);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.weekly-outcome-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(17, 45, 78, 0.09);
}

.weekly-outcome-card.tatil {
    border-top-color: #ea580c;
    background: #fffaf5;
}

.weekly-outcome-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    text-align: center;
}

.weekly-outcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(63, 114, 175, 0.1);
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 5px 14px;
    border-radius: 20px;
    text-transform: uppercase;
}

.weekly-outcome-badge.tatil {
    background: #ffedd5;
    color: #ea580c;
}

.weekly-outcome-date {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.3px;
}

.weekly-outcome-body {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.6;
    text-align: center;
}

/* İçerik Alanı */
.content-area {
    flex: 1;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom)); /* Alt kısımdaki çentik/navigasyon boşluğu */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.module-content {
    display: none;
    animation: fadeIn 0.4s;
    width: 100%;
}

.module-content.active {
    display: block;
}

/* Ana menünün dikey olarak tam ortalanması için */
.module-content.grid-menu.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}



@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Notlar / Konu Anlatımı */
.note-item {
    background-color: #fff;
    border: 1px solid var(--card-bg);
    border-radius: 24px; /* Köşeler yumuşatıldı */
    padding: 18px 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(17, 45, 78, 0.05);
    transition: transform 0.2s;
    text-decoration: none;
    color: var(--text-color);
}

.note-item:active {
    transform: scale(0.98);
}

.note-icon {
    font-size: 26px;
    margin-right: 18px;
    color: var(--primary-color);
}

.note-title {
    font-size: 16px;
    font-weight: 600;
    word-break: break-all;
}

/* Sınav UI */
.quiz-setup {
    text-align: center;
    margin-top: 15px;
    background: #fff;
    padding: 35px 25px;
    border-radius: 28px; /* Soft görünüm */
    box-shadow: 0 6px 20px rgba(17, 45, 78, 0.06);
}

.quiz-setup h3 {
    margin-bottom: 25px;
    color: var(--text-color);
    font-size: 20px;
}

.quiz-setup input {
    width: 120px;
    padding: 15px;
    font-size: 22px;
    text-align: center;
    border: 2px solid var(--card-bg);
    border-radius: 16px;
    margin-bottom: 30px;
    color: var(--text-color);
    outline: none;
}

.quiz-setup input:focus {
    border-color: var(--primary-color);
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 24px; /* Daha yuvarlak butonlar */
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.btn:hover {
    background-color: var(--primary-hover);
}

#quiz-container {
    display: none;
}

.question-card {
    background: #fff;
    padding: 30px 25px;
    border-radius: 28px; /* Soft görünüm */
    box-shadow: 0 6px 20px rgba(17, 45, 78, 0.06);
    margin-bottom: 25px;
}

.question-text {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.6;
}

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 2px solid var(--card-bg);
    border-radius: 16px; /* Soft görünüm */
    background: #fff;
    color: var(--text-color);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.option-btn:hover {
    background-color: var(--card-bg);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background-color: rgba(63, 114, 175, 0.1);
}

/* Sınav Sonuç */
.result-container {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 6px 20px rgba(17, 45, 78, 0.06);
}

.score-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    border: 8px solid var(--primary-color);
}

.score-circle span {
    font-size: 46px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Admin Giriş */
.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background-color: var(--bg-color);
}
.admin-card {
    background: #fff;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(17, 45, 78, 0.1);
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: bold; }
.form-group input, .form-group select { width: 100%; padding: 12px; border: 1px solid var(--card-bg); border-radius: 12px; outline:none; }
.form-group input:focus { border-color: var(--primary-color); }
.alert { padding: 15px; border-radius: 12px; margin-bottom: 20px; }
.alert-success { background-color: #d4edda; color: #155724; }
.alert-danger { background-color: #f8d7da; color: #721c24; }
.alert-info { background-color: #d1ecf1; color: #0c5460; }

/* Duyuru Pop-Up (Modal) Tasarımı */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65); /* Daha koyu, silik arka plan */
    backdrop-filter: blur(6px); /* Arka planı bulanıklaştır */
    -webkit-backdrop-filter: blur(6px); /* Safari desteği */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fff;
    width: 85%;
    max-width: 420px; /* Biraz daha geniş */
    border-radius: 30px;
    padding: 35px 30px; /* Daha ferah iç boşluk */
    box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 5px rgba(63, 114, 175, 0.15); /* Çok daha belirgin bir gölge ve hale */
    position: relative;
    text-align: center;
    color: var(--text-color);
    transform: scale(1.02); /* Dikkat çekmesi için minimal bir büyüme */
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 26px; /* Daha büyük başlık */
    font-weight: 800;
}

.modal-content p {
    font-size: 18px; /* Daha okunaklı ve büyük metin */
    line-height: 1.7;
    margin-bottom: 25px;
    font-weight: 600;
    color: #222; /* Daha koyu ve keskin metin rengi */
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px; /* Daha belirgin kapatma tuşu */
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger-color);
}

/* --- YENİ OYUNLAŞTIRILMIŞ SINAV STİLLERİ --- */
.quiz-progress-container {
    width: 100%;
    height: 8px;
    background-color: var(--card-bg);
    border-radius: 4px;
    margin-bottom: 25px;
    overflow: hidden;
}

.quiz-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3f72af, #6366f1);
    border-radius: 4px;
    transition: width 0.3s ease-in-out;
}

/* Mod Seçici Tasarımı */
.quiz-mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
}

.mode-option {
    flex: 1;
    max-width: 160px;
    padding: 12px;
    border: 2px solid var(--card-bg);
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-color);
    transition: all 0.2s;
    text-align: center;
    outline: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.mode-option:hover {
    background-color: var(--card-bg);
}

.mode-option.active {
    border-color: var(--primary-color);
    background-color: rgba(63, 114, 175, 0.08);
    color: var(--primary-color);
}

/* Doğru / Yanlış Cevap Vurguları */
.option-btn.correct-choice {
    border-color: #22c55e !important;
    background-color: rgba(34, 197, 94, 0.1) !important;
    color: #15803d !important;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.15);
}

.option-btn.wrong-choice {
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: #b91c1c !important;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* Sonuç İstatistikleri */
.stats-row {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    background: var(--bg-color);
    padding: 15px 10px;
    border-radius: 16px;
    border: 1px solid var(--card-bg);
}

.stat-card .val {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-card.correct .val { color: #22c55e; }
.stat-card.wrong .val { color: #ef4444; }
.stat-card.score .val { color: var(--primary-color); }

.stat-card .lbl {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

/* Detaylı Soru Analizi */
.analysis-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin: 35px 0 15px;
    text-align: left;
    border-bottom: 2px solid var(--card-bg);
    padding-bottom: 8px;
}

.analysis-item {
    background: #fff;
    border: 1px solid var(--card-bg);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 15px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(17, 45, 78, 0.02);
}

.analysis-item .num {
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: block;
}

.analysis-item .q-txt {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.analysis-item .ans-row {
    font-size: 14px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-item .ans-row i {
    font-size: 16px;
}

/* Mobil Cihazlar İçin Sınav Mod Seçici Uyumlaştırması */
@media (max-width: 480px) {
    .quiz-mode-selector {
        flex-direction: column;
        align-items: center;
        gap: 10px !important;
    }
    .mode-option {
        width: 100% !important;
        max-width: 100% !important;
        padding: 14px 20px !important;
        flex-direction: row !important;
        gap: 12px !important;
        justify-content: center;
    }
    .mode-option i {
        margin-bottom: 0 !important;
        font-size: 1.3rem !important;
    }
}

/* ========================================================
   RASTGELE ÖĞRENCİ SEÇİCİ (OYUN MODÜLÜ ENTEGRASYONU)
   ======================================================== */
.btn-student-picker {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    font-size: 0.92rem !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-student-picker:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4) !important;
}

.compact-student-picker-bar {
    background: transparent;
    border-radius: 8px;
    padding: 2px 8px;
    margin-bottom: 6px;
    border: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: fadeInSlide 0.15s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.csp-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.csp-dice {
    font-size: 1.1rem;
    color: #10b981;
}

.csp-select {
    padding: 3px 6px !important;
    border-radius: 6px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    outline: none !important;
    cursor: pointer !important;
    color: #1e293b !important;
}

.csp-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.csp-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.csp-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.csp-btn-roll {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 1px 4px rgba(16, 185, 129, 0.25);
    transition: all 0.15s ease;
}

.csp-btn-roll:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
}

.csp-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.csp-btn-close:hover {
    background: #fee2e2;
    color: #ef4444;
}

.in-page-student-picker-container {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    animation: fadeInSlide 0.25s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.in-page-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.in-page-picker-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #ecfdf5;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.in-page-close-btn {
    background: #f1f5f9;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.in-page-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.in-page-student-box {
    padding: 20px !important;
    min-height: 120px !important;
    margin-bottom: 16px !important;
}

.student-picker-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    background: #fff;
    outline: none;
    cursor: pointer;
}

.chosen-student-box {
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    border: 2px dashed #38bdf8;
    border-radius: 16px;
    padding: 30px 20px;
    margin-bottom: 20px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chosen-student-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.chosen-student-avatar.girl {
    background: #db2777;
    box-shadow: 0 4px 10px rgba(219, 39, 119, 0.25);
}

.chosen-student-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
    margin-bottom: 6px;
}

.chosen-student-meta {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 600;
}

.student-rolling-anim {
    animation: pulseRolling 0.1s infinite alternate;
}

@keyframes pulseRolling {
    from { transform: scale(0.98); opacity: 0.8; }
    to { transform: scale(1.02); opacity: 1; }
}

