/**
 * Capacitor / APK — zorunlu üst siyah şerit + yan sekmeler + Sütlaç
 * Ana sayfa: #student-panel padding yeterli.
 * Yan sekmeler (görev/kitap/…): position:fixed;top:0 → şeridin ALTINA kaydırılmalı.
 */
html.is-capacitor,
html.is-native-app {
    --mp-safe-top: 36px;
    --mp-safe-bot: env(safe-area-inset-bottom, 0px);
}

html.is-capacitor::before,
html.is-native-app::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mp-safe-top);
    background: #000;
    z-index: 2147483000;
    pointer-events: none;
}

/* Ana kabuklar */
html.is-capacitor #student-panel,
html.is-native-app #student-panel,
html.is-capacitor #teacher-panel,
html.is-native-app #teacher-panel,
html.is-capacitor #login-screen,
html.is-native-app #login-screen,
html.is-capacitor #parent-panel,
html.is-native-app #parent-panel,
html.is-capacitor #rehberlik-panel,
html.is-native-app #rehberlik-panel {
    padding-top: var(--mp-safe-top) !important;
    box-sizing: border-box !important;
}

/*
 * Yan sekmeler — home-islands `top:0` ezilir.
 * İçerik siyah şeridin altından başlar (ana sayfa ile aynı pay).
 */
html.is-capacitor #student-panel.is-side-tab .s-panel-tab:not(.hidden),
html.is-native-app #student-panel.is-side-tab .s-panel-tab:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-quest-tab.s-quest-bento:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-quest-tab.s-quest-bento:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-library-tab.s-lib-bento:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-library-tab.s-lib-bento:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-homework-tab.s-hw-bento:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-homework-tab.s-hw-bento:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-testbank-tab.s-tb-bento:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-testbank-tab.s-tb-bento:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-exams-tab.s-exam-dash:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-exams-tab.s-exam-dash:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-shop-tab.s-shop-vault:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-shop-tab.s-shop-vault:not(.hidden),
html.is-capacitor #student-panel.is-side-tab #s-gym-tab.s-panel-tab:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-gym-tab.s-panel-tab:not(.hidden) {
    top: var(--mp-safe-top) !important;
    height: calc(100svh - var(--mp-safe-top)) !important;
    max-height: calc(100svh - var(--mp-safe-top)) !important;
    padding-top: 0.35rem !important;
}

/* Öğretmen ayarlar paneli — siyah şerit altına */
html.is-capacitor #teacher-settings-panel,
html.is-native-app #teacher-settings-panel {
    padding-top: var(--mp-safe-top) !important;
    box-sizing: border-box !important;
    width: min(18.5rem, 72vw) !important;
    max-width: 18.5rem !important;
}

/* Mesajlar / dilek — tam ekran app */
html.is-capacitor #student-message-modal:not(.hidden),
html.is-native-app #student-message-modal:not(.hidden),
html.is-capacitor #wish-modal:not(.hidden),
html.is-native-app #wish-modal:not(.hidden) {
    padding-top: var(--mp-safe-top) !important;
    box-sizing: border-box !important;
}
html.is-capacitor #student-message-modal .s-wa-app,
html.is-native-app #student-message-modal .s-wa-app,
html.is-capacitor #wish-modal .s-wa-app,
html.is-native-app #wish-modal .s-wa-app {
    top: var(--mp-safe-top) !important;
    height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
    max-height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
    box-sizing: border-box !important;
}
html.is-capacitor.mp-kb-open #student-message-modal .s-wa-app,
html.is-native-app.mp-kb-open #student-message-modal .s-wa-app,
html.is-capacitor.mp-kb-open #wish-modal .s-wa-app,
html.is-native-app.mp-kb-open #wish-modal .s-wa-app {
    top: calc(var(--mp-vv-top, 0px) + var(--mp-safe-top)) !important;
    height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
    max-height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
}

/* Bildirim / pano inbox — siyah şeridin altından, tabana kadar */
html.is-capacitor .s-inbox-modal:not(.hidden),
html.is-native-app .s-inbox-modal:not(.hidden),
html.is-capacitor #student-panel .s-inbox-modal:not(.hidden),
html.is-native-app #student-panel .s-inbox-modal:not(.hidden) {
    top: var(--mp-safe-top, 36px) !important;
    bottom: 0 !important;
    height: auto !important;
    max-height: none !important;
    padding:
        0.55rem
        0.65rem
        calc(env(safe-area-inset-bottom, 0px) + 0.65rem) !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}
html.is-capacitor .s-inbox-sheet,
html.is-native-app .s-inbox-sheet,
html.is-capacitor #student-panel .s-inbox-sheet,
html.is-native-app #student-panel .s-inbox-sheet {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Sütlaç kök — şeridin altından */
html.is-capacitor #sutlac-root.is-open,
html.is-native-app #sutlac-root.is-open {
    top: var(--mp-safe-top) !important;
    bottom: 0 !important;
    height: auto !important;
}
html.is-capacitor #sutlac-root.is-open .sutlac-sheet,
html.is-native-app #sutlac-root.is-open .sutlac-sheet {
    max-height: calc(92dvh - var(--mp-safe-top)) !important;
    padding-top: 0.55rem !important;
    box-sizing: border-box !important;
}

/* Kitap / günlük program / rutin — siyah şeridin altına */
html.is-capacitor #book-detail-modal:not(.hidden),
html.is-native-app #book-detail-modal:not(.hidden),
html.is-capacitor #study-overview-modal:not(.hidden),
html.is-native-app #study-overview-modal:not(.hidden),
html.is-capacitor #study-session-detail-modal:not(.hidden),
html.is-native-app #study-session-detail-modal:not(.hidden),
html.is-capacitor #study-log-modal:not(.hidden),
html.is-native-app #study-log-modal:not(.hidden),
html.is-capacitor #study-topic-picker-modal:not(.hidden),
html.is-native-app #study-topic-picker-modal:not(.hidden),
html.is-capacitor #routine-tasks-modal:not(.hidden),
html.is-native-app #routine-tasks-modal:not(.hidden) {
    padding-top: calc(var(--mp-safe-top) + 0.35rem) !important;
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
}
html.is-capacitor #book-detail-modal .rdash-shell,
html.is-native-app #book-detail-modal .rdash-shell {
    max-height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top) - 1rem) !important;
}

/* Akıl oyunları modal — tam ekran, şerit altı */
html.is-capacitor #gym-game-modal.gym-game-modal:not(.hidden),
html.is-native-app #gym-game-modal.gym-game-modal:not(.hidden) {
    top: var(--mp-safe-top) !important;
    height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
    max-height: calc(var(--mp-vv-h, 100dvh) - var(--mp-safe-top)) !important;
    padding: 0.35rem !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}
html.is-capacitor #gym-game-modal .gym-game-modal-shell,
html.is-native-app #gym-game-modal .gym-game-modal-shell {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 1.1rem !important;
}

/* Oyun hub — krem zemin yerine koyu; kartlar üst üste binmesin */
html.is-capacitor #student-panel.is-side-tab #s-gym-tab.s-panel-tab:not(.hidden),
html.is-native-app #student-panel.is-side-tab #s-gym-tab.s-panel-tab:not(.hidden),
#student-panel.is-side-tab #s-gym-tab.s-panel-tab:not(.hidden) {
    background: #0b1220 !important;
    color: #e2e8f0 !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-hub {
    max-width: 100% !important;
    width: 100% !important;
    gap: 0.7rem !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-bento-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.55rem !important;
    align-items: stretch !important;
    isolation: isolate !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-game-card {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    inset: auto !important;
    margin: 0 !important;
    transform: none !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 6.75rem !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
    z-index: 0 !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-game-title,
#student-panel.is-side-tab #s-gym-tab .gym-game-sub,
#student-panel.is-side-tab #s-gym-tab .gym-game-ico {
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    max-width: 100% !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-game-title {
    font-size: 0.82rem !important;
    line-height: 1.25 !important;
    white-space: normal !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-game-sub {
    font-size: 0.7rem !important;
    line-height: 1.3 !important;
}
#student-panel.is-side-tab #s-gym-tab .gym-leader-card {
    position: relative !important;
    transform: none !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Ödev krem zemin — tüm açık metinleri koyulaştır */
#student-panel.is-side-tab #s-homework-tab.s-hw-bento,
#student-panel.is-side-tab #s-homework-tab {
    color: #0f172a !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-island-head h2,
#student-panel.is-side-tab #s-homework-tab .s-hw-group-head h3,
#student-panel.is-side-tab #s-homework-tab .s-hw-calismalar-head h3,
#student-panel.is-side-tab #s-homework-tab .s-hw-work-title,
#student-panel.is-side-tab #s-homework-tab .s-hw-card-title,
#student-panel.is-side-tab #s-homework-tab .s-hw-island-label,
#student-panel.is-side-tab #s-homework-tab .s-hw-duo-card strong,
#student-panel.is-side-tab #s-homework-tab .s-hw-duo-card em,
#student-panel.is-side-tab #s-homework-tab h2,
#student-panel.is-side-tab #s-homework-tab h3,
#student-panel.is-side-tab #s-homework-tab label,
#student-panel.is-side-tab #s-homework-tab p {
    color: #0f172a !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-hint,
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-hint strong,
#student-panel.is-side-tab #s-homework-tab .s-hw-group-head p,
#student-panel.is-side-tab #s-homework-tab .s-hw-calismalar-head p,
#student-panel.is-side-tab #s-homework-tab .s-hw-mesh .s-hw-empty,
#student-panel.is-side-tab #s-homework-tab .text-fuchsia-100,
#student-panel.is-side-tab #s-homework-tab .text-cyan-200,
#student-panel.is-side-tab #s-homework-tab .text-cyan-300,
#student-panel.is-side-tab #s-homework-tab .text-lime-300,
#student-panel.is-side-tab #s-homework-tab .text-slate-400,
#student-panel.is-side-tab #s-homework-tab .text-white {
    color: #475569 !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-topics-island,
#student-panel.is-side-tab #s-homework-tab .s-hw-send-island,
#student-panel.is-side-tab #s-homework-tab .s-hw-duo-card,
#student-panel.is-side-tab #s-homework-tab .s-hw-send-drop {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.12) !important;
    color: #0f172a !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-switch {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-switch button {
    color: #64748b !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-switch button.is-active {
    color: #0f172a !important;
    background: linear-gradient(135deg, #e0f2fe, #e0e7ff) !important;
}

/* Splash */
html.is-capacitor #app-splash-video,
html.is-native-app #app-splash-video,
#app-splash-screen.is-native-static #app-splash-video {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
html.is-capacitor #app-splash-poster,
html.is-native-app #app-splash-poster,
#app-splash-screen.is-native-static .app-splash-poster {
    display: block !important;
    visibility: visible !important;
    width: min(12rem, 55vw);
    height: auto;
    margin: auto;
    background: #fff;
}

@keyframes mpSplashRise {
    0% { transform: translateY(8vh) scale(0.92); opacity: 0.7; }
    28% { transform: translateY(0) scale(1); opacity: 1; }
    62% { transform: translateY(0) scale(1.02); opacity: 1; }
    100% { transform: translateY(-38vh) scale(0.86); opacity: 0.9; }
}
#app-splash-screen.is-native-rise .app-splash-poster {
    animation: mpSplashRise 1.65s cubic-bezier(0.77, 0, 0.175, 1) forwards;
    will-change: transform, opacity;
}

html.is-capacitor #login-screen.is-kb-open .mp-login-scale,
html.is-native-app #login-screen.is-kb-open .mp-login-scale,
html.mp-kb-open .mp-login-scale,
#login-screen.is-kb-open .mp-login-scale {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Sütlaç + klavye: top = vv + safe; yükseklik = vv - safe */
@media (max-width: 767px) {
    html.mp-kb-open #sutlac-root.is-open .sutlac-sheet,
    #sutlac-root.is-open.is-kb .sutlac-sheet,
    body.sutlac-kb #sutlac-root.is-open .sutlac-sheet {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: var(--mp-vv-top, 0px) !important;
        bottom: auto !important;
        width: 100% !important;
        height: var(--mp-vv-h, 100dvh) !important;
        max-height: var(--mp-vv-h, 100dvh) !important;
        min-height: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
        padding-bottom: 0.35rem !important;
    }
    html.is-capacitor.mp-kb-open #sutlac-root.is-open,
    html.is-native-app.mp-kb-open #sutlac-root.is-open,
    html.is-capacitor #sutlac-root.is-open.is-kb,
    html.is-native-app #sutlac-root.is-open.is-kb {
        top: 0 !important;
        bottom: 0 !important;
    }
    html.is-capacitor.mp-kb-open #sutlac-root.is-open .sutlac-sheet,
    html.is-native-app.mp-kb-open #sutlac-root.is-open .sutlac-sheet,
    html.is-capacitor #sutlac-root.is-open.is-kb .sutlac-sheet,
    html.is-native-app #sutlac-root.is-open.is-kb .sutlac-sheet,
    html.is-capacitor body.sutlac-kb #sutlac-root.is-open .sutlac-sheet,
    html.is-native-app body.sutlac-kb #sutlac-root.is-open .sutlac-sheet {
        /* Alttan boşluk bırakma: safe-top iç padding; height = tam vv */
        top: var(--mp-vv-top, 0px) !important;
        height: var(--mp-vv-h, 100dvh) !important;
        max-height: var(--mp-vv-h, 100dvh) !important;
        padding-top: min(var(--mp-safe-top), 28px) !important;
        padding-bottom: 0.25rem !important;
    }
    html.mp-kb-open #sutlac-root.is-open .sutlac-footer,
    #sutlac-root.is-open.is-kb .sutlac-footer,
    body.sutlac-kb #sutlac-root.is-open .sutlac-footer {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
}

/* —— Ödev / Görev: Ana Sayfa geri + koyu başlık (krem zemin) —— */
.s-hw-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    margin: 0 0 0.35rem;
}
.s-hw-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    background: transparent;
    padding: 0.15rem 0;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    color: #334155;
}
#student-panel.is-side-tab #s-quest-tab .s-hw-back,
#student-panel.is-side-tab #s-gym-tab .s-hw-back {
    color: #cbd5e1;
}
#student-panel.is-side-tab #s-exams-tab .s-hw-back {
    color: #334155;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-page-title,
#student-panel.is-side-tab #s-homework-tab .s-hw-island-head h2,
#student-panel.is-side-tab #s-homework-tab .s-hw-island-head h2 i,
html.mp-student-side-scroll #s-homework-tab .s-hw-page-title,
html.mp-student-side-scroll #s-homework-tab .s-hw-island-head h2,
html.mp-student-side-scroll #s-homework-tab .s-hw-island-head h2 i {
    color: #0f172a !important;
    text-shadow: none !important;
}
#student-panel.is-side-tab #s-homework-tab .s-hw-mode-hint,
html.mp-student-side-scroll #s-homework-tab .s-hw-mode-hint {
    color: #475569 !important;
}

/* Duygu paneli — siyah şerit altı */
html.is-capacitor #mood-panel-modal:not(.hidden),
html.is-native-app #mood-panel-modal:not(.hidden) {
    padding-top: calc(var(--mp-safe-top) + 0.45rem) !important;
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
    padding-bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px)) !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
}
html.is-capacitor #mood-panel-modal .mood-lab-shell,
html.is-native-app #mood-panel-modal .mood-lab-shell {
    max-height: calc(100svh - var(--mp-safe-top) - 1rem) !important;
    height: 100% !important;
}

/* Sıralamam Nerede — sekmeler üst üste binmesin */
#game-leaderboard-modal.s-lb-modal {
    align-items: stretch !important;
    justify-content: center !important;
}
html.is-capacitor #game-leaderboard-modal.s-lb-modal:not(.hidden),
html.is-native-app #game-leaderboard-modal.s-lb-modal:not(.hidden) {
    padding-top: calc(var(--mp-safe-top) + 0.45rem) !important;
    padding-left: 0.55rem !important;
    padding-right: 0.55rem !important;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
}
.s-lb-shell {
    width: 100% !important;
    max-width: 26rem !important;
    max-height: min(88dvh, 40rem) !important;
}
html.is-capacitor .s-lb-shell,
html.is-native-app .s-lb-shell {
    max-height: calc(100svh - var(--mp-safe-top) - 1.4rem) !important;
}
.s-lb-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
    padding: 0.65rem 0.75rem !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.9);
    flex-shrink: 0;
    overflow: visible !important;
}
.s-lb-tab {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.25rem !important;
    margin: 0 !important;
    padding: 0.42rem 0.7rem !important;
    border-radius: 999px !important;
    border: 1.5px solid #334155 !important;
    background: #0f172a !important;
    color: #94a3b8 !important;
    font-size: 0.68rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 0 !important;
}
.s-lb-tab.is-active {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.18) !important;
    color: #fcd34d !important;
}
.s-lb-summit {
    text-align: center;
    padding: 0.85rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: linear-gradient(145deg, rgba(245, 158, 11, 0.18), rgba(15, 23, 42, 0.9));
}
.s-lb-summit-kicker {
    display: block;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fcd34d;
    margin-bottom: 0.25rem;
}
.s-lb-summit-score {
    display: block;
    font-size: 1.45rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.15;
}
.s-lb-summit-score em {
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}
.s-lb-meta {
    text-align: center;
    font-size: 0.65rem;
    color: #64748b;
    margin: 0 0 0.65rem;
}
.s-lb-empty {
    text-align: center;
    font-size: 0.78rem;
    color: #94a3b8;
    font-style: italic;
    padding: 0.85rem;
    border-radius: 0.9rem;
    border: 1px solid #1e293b;
    background: #020617;
}
.s-lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.65rem 0.8rem;
    margin-bottom: 0.4rem;
    border-radius: 0.85rem;
    border: 1px solid #1e293b;
    background: #020617;
}
.s-lb-row.is-you {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
}
.s-lb-row-label {
    font-size: 0.72rem;
    font-weight: 800;
    color: #94a3b8;
    min-width: 0;
}
.s-lb-row.is-you .s-lb-row-label { color: #fcd34d; }
.s-lb-row-score {
    font-size: 0.78rem;
    font-weight: 900;
    color: #e2e8f0;
    flex-shrink: 0;
}
@media (max-width: 767px) {
    #mood-panel-modal {
        padding-top: calc(var(--mp-safe-top, 0px) + 0.45rem) !important;
    }
    #game-leaderboard-modal.s-lb-modal {
        padding-top: calc(var(--mp-safe-top, 0px) + 0.45rem) !important;
    }
}
