@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&family=Comic+Neue:wght@700&family=Press+Start+2P&family=VT323&display=swap');

:root {
    --primary: #3b82f6;
}

body {
    font-family: 'Poppins', system-ui, sans-serif;
    color: #1f2937;
}

.fun-font {
    font-family: 'Comic Neue', cursive;
}

.math-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.math-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.question-card {
    animation: fadeInUp 0.4s ease forwards;
}

.question-media-list {
    max-width: 100%;
}

.question-media {
    margin: 0;
    padding: 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #f8fafc;
    overflow: hidden;
}

.question-media img {
    display: block;
    width: 100%;
    max-width: 36rem;
    max-height: min(52vh, 420px);
    margin: 0 auto;
    height: auto;
    object-fit: contain;
}

.option-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-media {
    margin: 0;
    padding: 0.4rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    max-width: 100%;
    overflow: hidden;
}

.option-media img {
    display: block;
    width: auto;
    max-width: min(100%, 16rem);
    max-height: 9rem;
    height: auto;
    object-fit: contain;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option-btn {
    transition: all 0.2s ease;
}

.option-btn:hover {
    transform: translateX(6px);
    box-shadow: 0 10px 15px -3px rgb(59 130 246 / 0.2);
}

.option-btn.selected {
    border-color: #3b82f6;
    background-color: #dbeafe;
}

.option-btn-multi.selected .multi-check {
    border-color: #2563eb;
    background-color: #2563eb;
    color: #fff;
}

.option-btn-multi.selected .multi-check i {
    opacity: 1 !important;
}

.kategori-choice.selected {
    border-color: #3b82f6;
    background-color: #dbeafe;
    color: #1e40af;
}

.kategori-choice.correct {
    background-color: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #166534;
}

.kategori-choice.incorrect {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #991b1b;
}

.correct {
    background-color: #dcfce7 !important;
    border-color: #22c55e !important;
    color: #166534;
}

.incorrect {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
    color: #991b1b;
}

.chapter-header {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6 45%, #ec4899);
}

.star {
    animation: pop 0.3s ease forwards;
}

.math-bg {
    background-image:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(244, 114, 182, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 50% 75%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
}

.nav-active {
    background-color: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

#quiz-screen,
#results-screen,
#menu-screen,
#subject-screen,
#class-screen {
    padding-bottom: 5.5rem;
}

.passage-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #6366f1;
    border-radius: 1rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.passage-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4f46e5;
    margin-bottom: 0.35rem;
}

.passage-body {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #334155;
    max-height: min(42vh, 22rem);
    overflow-y: auto;
    white-space: pre-wrap;
}

.passage-box summary.passage-title {
    margin-bottom: 0;
}

.passage-box summary {
    cursor: pointer;
    font-weight: 700;
    color: #4338ca;
    list-style: none;
}

.passage-box summary::-webkit-details-marker {
    display: none;
}

.soal-number {
    background: linear-gradient(135deg, #22c55e, #3b82f6, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.colorful-card {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 52%, #db2777 100%);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 16px 26px -14px rgba(124, 58, 237, 0.55);
}

.option-btn {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

@media (max-width: 640px) {
    body {
        font-size: 13.5px;
        padding-bottom: 36px;
    }

    /* —— Header lebih ringkas —— */
    header.sticky > div {
        padding-top: 0.45rem !important;
        padding-bottom: 0.45rem !important;
        gap: 0.35rem !important;
        align-items: center !important;
    }

    header h1 {
        font-size: 0.92rem !important;
        line-height: 1.15 !important;
    }

    header #header-subtitle {
        display: none;
    }

    header #active-student-school {
        display: none;
    }

    header .w-10.h-10 {
        width: 2rem !important;
        height: 2rem !important;
        border-radius: 0.65rem !important;
    }

    header .w-10.h-10 svg {
        width: 1.15rem !important;
        height: 1.15rem !important;
    }

    /* Tombol header: ikon saja biar muat */
    header .flex.items-center.gap-1\.5 > a span.font-medium,
    header .flex.items-center.gap-1\.5 > div span.font-medium {
        display: none !important;
    }

    header .flex.items-center.gap-1\.5 > a,
    header .flex.items-center.gap-1\.5 > div[onclick] {
        padding: 0.4rem 0.55rem !important;
        border-radius: 0.65rem !important;
        min-width: 2rem;
        justify-content: center;
    }

    /* —— Halaman beranda / menu —— */
    #home-screen,
    #class-screen,
    #subject-screen,
    #menu-screen,
    #results-screen {
        padding-top: 0.65rem !important;
        padding-bottom: 3.25rem !important;
    }

    #quiz-screen {
        padding-top: 0.5rem !important;
        padding-bottom: 2.75rem !important;
    }

    #home-screen > .text-center,
    #class-screen > .text-center,
    #menu-screen > .text-center {
        margin-bottom: 0.65rem !important;
    }

    #home-screen h2,
    #class-screen h2,
    #subject-title,
    #menu-title {
        font-size: 1.35rem !important;
        margin-bottom: 0.25rem !important;
    }

    .tka-promo-detail {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.7rem !important;
        line-height: 1.35 !important;
    }

    .jenjang-card {
        padding: 0.65rem 0.55rem !important;
        border-radius: 0.85rem !important;
    }

    .jenjang-card .text-2xl {
        font-size: 1.35rem !important;
    }

    .math-card {
        border-radius: 0.9rem !important;
    }

    .math-card:hover {
        transform: none;
        box-shadow: 0 6px 12px -4px rgb(0 0 0 / 0.12);
    }

    #class-grid,
    #subject-grid,
    #bab-grid,
    #tka-home-grid .grid {
        gap: 0.5rem !important;
    }

    #bab-grid {
        gap: 0.5rem !important;
    }

    #subject-grid .math-card,
    #bab-grid .math-card,
    #class-grid .math-card,
    #tka-home-grid .math-card {
        padding: 0.7rem 0.75rem !important;
    }

    #subject-grid .w-12,
    #bab-grid .w-12,
    #tka-home-grid .w-12 {
        width: 2.35rem !important;
        height: 2.35rem !important;
        border-radius: 0.7rem !important;
    }

    #subject-grid .text-2xl,
    #bab-grid .text-2xl,
    #tka-home-grid .text-2xl {
        font-size: 1.05rem !important;
    }

    #subject-grid .text-lg,
    #bab-grid .text-lg,
    #tka-home-grid .text-lg {
        font-size: 0.95rem !important;
        line-height: 1.25 !important;
    }

    #student-welcome-card {
        margin-bottom: 0.75rem !important;
        padding: 0.75rem 0.85rem !important;
        border-radius: 1rem !important;
    }

    #student-welcome-card h3 {
        font-size: 1.1rem !important;
    }

    #student-welcome-card .w-14 {
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.1rem !important;
    }

    .tka-jenjang-block {
        margin-bottom: 0.25rem;
    }

    .tka-jenjang-block h3 {
        font-size: 0.88rem !important;
    }

    /* —— Layar soal —— */
    #quiz-screen > .bg-white {
        border-radius: 1rem !important;
        box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.28) !important;
        /* Jangan pakai overflow hidden + sticky: tombol Jawab bisa nutupi opsi */
        overflow: visible !important;
    }

    #quiz-screen .min-h-\[220px\] {
        min-height: 0 !important;
    }

    .chapter-header {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 0.55rem 0.75rem !important;
    }

    #quiz-bab-title {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
        max-width: 11.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    #quiz-score {
        font-size: 1.35rem !important;
    }

    #quiz-screen .bg-slate-50.px-4 {
        padding: 0.45rem 0.75rem !important;
    }

    #question-container {
        padding: 0 !important;
    }

    #quiz-screen .p-4 {
        padding: 0.7rem 0.75rem !important;
    }

    .question-card .soal-number {
        font-size: 1.65rem !important;
        line-height: 1 !important;
        margin-top: 0.1rem;
    }

    .question-card .text-base {
        font-size: 0.92rem !important;
        line-height: 1.4 !important;
    }

    .question-card .mt-4 {
        margin-top: 0.65rem !important;
    }

    .question-card .gap-3 {
        gap: 0.4rem !important;
    }

    .option-btn {
        border-radius: 0.75rem !important;
        padding: 0.55rem 0.7rem !important;
        border-width: 1.5px !important;
        gap: 0.45rem !important;
    }

    .option-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .option-btn .w-6 {
        width: 1.35rem !important;
        height: 1.35rem !important;
    }

    .kategori-row {
        padding: 0.55rem 0.65rem !important;
        border-radius: 0.75rem !important;
        border-width: 1.5px !important;
    }

    .kategori-list {
        gap: 0.4rem !important;
    }

    .kategori-choice {
        padding: 0.3rem 0.55rem !important;
        border-radius: 0.55rem !important;
        font-size: 0.7rem !important;
    }

    .passage-box {
        padding: 0.55rem 0.7rem;
        margin-bottom: 0.5rem;
        border-radius: 0.75rem;
    }

    .passage-body {
        font-size: 0.82rem;
        line-height: 1.5;
        max-height: min(28vh, 12rem);
    }

    .question-media {
        padding: 0.4rem;
        border-radius: 0.65rem;
    }

    .question-media img {
        max-height: min(36vh, 220px);
    }

    .option-media img {
        max-height: 5.5rem;
    }

    /* Tombol Jawab/Lanjut mengikuti alur konten (di bawah opsi), tidak mengambang */
    #quiz-screen .border-t.bg-slate-50 {
        position: static !important;
        padding: 0.5rem 0.75rem !important;
        gap: 0.4rem !important;
        background: #f8fafc !important;
    }

    #btn-submit,
    #btn-next {
        padding: 0.55rem 1rem !important;
        border-radius: 0.75rem !important;
        font-size: 0.85rem !important;
    }

    #feedback-area {
        font-size: 0.78rem !important;
    }

    #feedback-area .p-4 {
        padding: 0.55rem 0.7rem !important;
    }

    #feedback-area .text-2xl {
        font-size: 1.15rem !important;
    }

    /* Modal siswa & info TKA */
    #student-form-overlay > div,
    #tka-pg-info-overlay > div {
        border-radius: 1.1rem !important;
        max-height: 88vh;
    }

    #student-form-overlay .px-6,
    #tka-pg-info-overlay .px-5,
    #tka-pg-info-overlay .px-6 {
        padding-left: 0.9rem !important;
        padding-right: 0.9rem !important;
    }

    #student-form-overlay .py-5,
    #tka-pg-info-overlay .py-4,
    #tka-pg-info-overlay .py-5 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    #student-form-overlay h3,
    #tka-pg-info-overlay h3 {
        font-size: 1.15rem !important;
    }

    #student-form-overlay .p-6,
    #tka-pg-info-overlay .p-5,
    #tka-pg-info-overlay .p-6 {
        padding: 0.85rem !important;
    }

    #student-form-overlay input {
        padding: 0.55rem 0.75rem !important;
        border-radius: 0.75rem !important;
    }

    #results-screen .text-\[90px\] {
        font-size: 3.5rem !important;
    }
}

.jenjang-card {
    border: 0;
}

.jenjang-card:focus-visible {
    outline: 3px solid #1d4ed8;
    outline-offset: 3px;
}

/* Kartu dukungan Saweria, gaya pixel retro */
.saweria-retro {
    position: relative;
    overflow: hidden;
    background: #24160f;
    color: #ffe7c2;
    border: 4px solid #120c09;
    box-shadow: 8px 8px 0 #120c09;
}

.saweria-retro::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0 3px,
        rgba(0, 0, 0, 0.16) 3px 4px
    );
}

.saweria-retro-bar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #ff813f;
    color: #1a100c;
    border-bottom: 4px solid #120c09;
}

.saweria-pixel-dot {
    width: 10px;
    height: 10px;
    background: #1a100c;
}

.saweria-retro-brand {
    margin-left: auto;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    letter-spacing: 1px;
}

.saweria-retro-body {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
}

.saweria-mug {
    flex: 0 0 auto;
    width: 54px;
    height: 40px;
    margin-top: 8px;
    background: #ffb067;
    border: 4px solid #1a100c;
    box-shadow: 14px 8px 0 -4px #ffb067, 18px 8px 0 #1a100c;
    position: relative;
}

.saweria-mug span {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 10px;
    height: 8px;
    background: #7a3e12;
    box-shadow: 0 8px 0 #c46a2e;
}

.saweria-retro-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #ffb067;
    margin-bottom: 8px;
}

.saweria-retro-copy {
    font-family: 'VT323', monospace;
    font-size: 22px;
    line-height: 1.15;
    color: #ffe7c2;
    max-width: 46rem;
}

.saweria-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.saweria-chips span {
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    padding: 7px 8px;
    background: #3a2418;
    color: #ffd7a8;
    border: 3px solid #ff813f;
}

.saweria-pixel-btn {
    display: inline-block;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    line-height: 1.4;
    text-decoration: none;
    color: #1a100c;
    background: #ff813f;
    border: 4px solid #1a100c;
    box-shadow: 4px 4px 0 #000;
    padding: 10px 12px;
}

.saweria-pixel-btn:hover,
.saweria-pixel-btn:focus {
    color: #1a100c;
    background: #ffb067;
    transform: translate(-1px, -1px);
}

.saweria-pixel-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .saweria-retro {
        border-width: 3px;
        box-shadow: 4px 4px 0 #120c09;
    }

    .saweria-retro-bar {
        padding: 6px 10px;
    }

    .saweria-retro-body {
        flex-direction: row;
        gap: 8px;
        padding: 10px;
    }

    .saweria-mug {
        width: 36px;
        height: 28px;
        margin-top: 2px;
        margin-right: 12px;
        box-shadow: 8px 6px 0 -4px #ffb067, 11px 6px 0 #1a100c;
    }

    .saweria-retro-title {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .saweria-retro-copy {
        font-size: 16px;
        line-height: 1.1;
    }

    .saweria-chips {
        gap: 4px;
        margin: 8px 0;
    }

    .saweria-pixel-btn {
        font-size: 8px;
        padding: 8px 10px;
    }
}

/* ===================== FOOTER FIX + RUNNING TEXT ===================== */
body {
    padding-bottom: 44px;
}

.app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: linear-gradient(90deg, #1d4ed8, #0ea5e9, #6366f1);
    color: #ffffff;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.18);
}

.app-footer strong {
    font-weight: 800;
}

.footer-link {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.footer-link:hover,
.footer-link:focus {
    color: #fde68a;
}

/* Jeda jalannya teks saat disentuh/hover agar tautan mudah diklik */
.footer-marquee:hover .footer-track,
.footer-marquee:active .footer-track {
    animation-play-state: paused;
}

.footer-marquee {
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: center;
}

.footer-track {
    display: inline-flex;
    align-items: center;
    will-change: transform;
}

.footer-track span {
    display: inline-block;
    padding: 9px 28px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Desktop / tablet: teks statis di tengah, salinan kedua disembunyikan */
@media (min-width: 641px) {
    .footer-track {
        transform: none !important;
        animation: none !important;
    }

    .footer-track span:nth-child(2) {
        display: none;
    }
}

/* Mobile: running text (marquee) berjalan terus */
@media (max-width: 640px) {
    .footer-marquee {
        justify-content: flex-start;
    }

    .footer-track {
        animation: footer-marquee 16s linear infinite;
    }

    .footer-track span {
        font-size: 11px;
        padding: 7px 20px;
    }
}

@keyframes footer-marquee {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}
