/* CSS untuk Portal Belajar Interaktif CKB School */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@600;700;800;900&family=Poppins:wght@400;600;700;800&display=swap');

:root {
    --bg-main: #f0f7ff;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --accent-yellow: #fbbf24;
    --accent-orange: #f97316;
    --accent-green: #10b981;
    --accent-pink: #ec4899;
    --accent-purple: #8b5cf6;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --card-shadow: 0 12px 30px rgba(59, 130, 246, 0.12);
    --btn-shadow: 0 6px 0 #1d4ed8;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Nunito', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #e0f2fe 0%, #fef3c7 50%, #fce7f3 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

/* Background floating bubbles */
.bg-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.decor-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.25;
    animation: floatBubble 18s infinite ease-in-out;
}

@keyframes floatBubble {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
}

/* Container */
.ckb-container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* Header */
.ckb-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    border: 3px solid #ffffff;
}

.school-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.school-logo-badge {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.school-title {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #1e3a8a;
    letter-spacing: 0.5px;
}

.school-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #f59e0b;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Student Badge in Header */
.student-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    padding: 6px 14px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.student-badge:hover {
    transform: translateY(-2px);
    background: #dbeafe;
}

.student-badge-avatar {
    font-size: 24px;
}

.student-badge-info {
    text-align: left;
}

.student-badge-name {
    font-size: 14px;
    font-weight: 800;
    color: #1e3a8a;
    line-height: 1.2;
}

.student-badge-class {
    font-size: 11px;
    font-weight: 700;
    color: #3b82f6;
}

.star-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid #f59e0b;
    padding: 8px 16px;
    border-radius: 50px;
    font-weight: 900;
    font-size: 16px;
    color: #b45309;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
    cursor: pointer;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    transform: scale(1.08);
    background: #e2e8f0;
}

/* Big Action Buttons */
.ckb-btn {
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    padding: 12px 24px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.ckb-btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 6px 0 #1d4ed8, 0 10px 20px rgba(59, 130, 246, 0.4);
}

.ckb-btn-primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1d4ed8;
}

.ckb-btn-yellow {
    background: #f59e0b;
    color: white;
    box-shadow: 0 6px 0 #b45309, 0 10px 20px rgba(245, 158, 11, 0.4);
}

.ckb-btn-yellow:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b45309;
}

.ckb-btn-green {
    background: #10b981;
    color: white;
    box-shadow: 0 6px 0 #047857, 0 10px 20px rgba(16, 185, 129, 0.4);
}

.ckb-btn-green:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #047857;
}

/* Sections */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
}

.view-section.active {
    display: block;
}

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

/* Card Styles */
.hero-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    box-shadow: var(--card-shadow);
    border: 3px solid #ffffff;
    margin-bottom: 28px;
}

.hero-title {
    font-family: 'Fredoka One', cursive;
    font-size: 32px;
    color: #1e3a8a;
    margin-bottom: 8px;
}

.hero-desc {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Step 1: Level Picker Grid */
.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.level-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid #f1f5f9;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.level-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #93c5fd;
    box-shadow: 0 16px 30px rgba(59, 130, 246, 0.18);
}

.level-card-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: inline-block;
}

.level-card-name {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #1e293b;
    margin-bottom: 6px;
    text-transform: capitalize;
}

.level-card-count {
    font-size: 14px;
    font-weight: 800;
    color: #3b82f6;
    background: #eff6ff;
    padding: 4px 12px;
    border-radius: 50px;
    display: inline-block;
}

/* Step 2: Student Picker Grid */
.student-search-bar {
    max-width: 450px;
    margin: 0 auto 24px;
    position: relative;
}

.student-search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border-radius: 50px;
    border: 3px solid #e2e8f0;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
    background: white;
}

.student-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.student-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: #94a3b8;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    max-height: 520px;
    overflow-y: auto;
    padding: 8px 4px;
}

.student-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 18px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.student-card:hover {
    transform: translateY(-5px);
    border-color: #60a5fa;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.15);
}

.student-card-avatar {
    font-size: 42px;
    margin-bottom: 8px;
}

.student-card-name {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.25;
}

.student-card-nis {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 8px;
}

.student-card-stars {
    font-size: 13px;
    font-weight: 800;
    color: #d97706;
    background: #fef3c7;
    padding: 3px 8px;
    border-radius: 50px;
    display: inline-block;
}

/* Step 3: Learning Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 28px 22px;
    cursor: pointer;
    transition: all 0.25s;
    border: 4px solid transparent;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    transform: translateY(-8px);
}

.category-card.cat-animals { border-color: #bbf7d0; background: linear-gradient(180deg, #ffffff 60%, #f0fdf4 100%); }
.category-card.cat-numbers { border-color: #fef08a; background: linear-gradient(180deg, #ffffff 60%, #fefce8 100%); }
.category-card.cat-letters { border-color: #fed7aa; background: linear-gradient(180deg, #ffffff 60%, #fff7ed 100%); }
.category-card.cat-stories { border-color: #ddd6fe; background: linear-gradient(180deg, #ffffff 60%, #faf5ff 100%); }

.category-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    margin-bottom: 16px;
}

.cat-animals .category-icon-box { background: #dcfce7; }
.cat-numbers .category-icon-box { background: #fef9c3; }
.cat-letters .category-icon-box { background: #ffedd5; }
.cat-stories .category-icon-box { background: #ede9fe; }

.category-title {
    font-family: 'Fredoka One', cursive;
    font-size: 22px;
    color: #1e293b;
    margin-bottom: 6px;
}

.category-desc {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 16px;
}

.category-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
}

.category-badge-age {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 50px;
    color: #475569;
}

.category-badge-count {
    color: #3b82f6;
    font-weight: 900;
}

/* Activity List */
.activity-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.activity-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid #f1f5f9;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.activity-card:hover {
    transform: translateY(-5px);
    border-color: #93c5fd;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.15);
}

.activity-card.is-completed {
    border-color: #86efac;
    background: #f0fdf4;
}

.activity-badge-completed {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #10b981;
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 50px;
}

.activity-type-pill {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 10px;
    width: fit-content;
}

.type-quiz { background: #e0e7ff; color: #4338ca; }
.type-matching { background: #fef3c7; color: #b45309; }
.type-tracing { background: #fce7f3; color: #be185d; }
.type-story { background: #ede9fe; color: #6d28d9; }

.activity-card-title {
    font-family: 'Fredoka One', cursive;
    font-size: 19px;
    color: #1e293b;
    margin-bottom: 8px;
}

.activity-card-desc {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.activity-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reward-stars-badge {
    font-size: 13px;
    font-weight: 900;
    color: #d97706;
}

/* ============================================================
   INTERACTIVE GAME CONTAINERS
============================================================ */

.game-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--card-shadow);
    border: 4px solid #ffffff;
    max-width: 850px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px dashed #e2e8f0;
}

.game-title-group h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 26px;
    color: #1e3a8a;
}

.game-instruction-banner {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 16px;
    font-weight: 800;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

/* 1. TRACING CANVAS */
.tracing-arena {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.canvas-wrapper {
    position: relative;
    border: 5px solid #3b82f6;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
    touch-action: none;
    overflow: hidden;
}

#tracingCanvas {
    display: block;
    cursor: crosshair;
}

.tracing-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.color-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-btn.selected {
    transform: scale(1.2);
    border-color: #1e293b;
}

/* 2. MATCHING GAME */
.matching-board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-top: 12px;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.matching-item {
    background: #f8fafc;
    border: 3px solid #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 18px;
    font-size: 18px;
    font-weight: 800;
    color: #334155;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.matching-source:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    transform: scale(1.02);
}

.matching-source.selected {
    background: #3b82f6;
    color: white;
    border-color: #1d4ed8;
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.3);
}

.matching-target.drop-ready {
    border-color: #f59e0b;
    background: #fffbeb;
}

.matching-item.matched {
    background: #dcfce7 !important;
    border-color: #10b981 !important;
    color: #065f46 !important;
    cursor: default;
    opacity: 0.85;
}

/* 3. QUIZ GAME */
.quiz-question-box {
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
    border: 3px solid #e2e8f0;
}

.quiz-question-text {
    font-family: 'Fredoka One', cursive;
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 12px;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.quiz-option-card {
    background: white;
    border: 4px solid #e2e8f0;
    border-radius: var(--radius-xl);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.quiz-option-card:hover {
    transform: translateY(-6px);
    border-color: #60a5fa;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.15);
}

.quiz-option-icon {
    font-size: 48px;
    margin-bottom: 8px;
    display: block;
}

.quiz-option-label {
    font-family: 'Fredoka One', cursive;
    font-size: 18px;
    color: #1e293b;
}

.quiz-option-card.correct {
    background: #dcfce7;
    border-color: #10b981;
    animation: correctBounce 0.4s ease;
}

.quiz-option-card.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    animation: wrongShake 0.4s ease;
}

@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* 4. STORYBOOK */
.storybook-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 32px;
    border: 4px solid #f1f5f9;
    text-align: center;
}

.story-illustration-frame {
    background: linear-gradient(135deg, #eff6ff 0%, #fef3c7 100%);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    font-size: 64px;
    margin-bottom: 24px;
    letter-spacing: 12px;
    box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.05);
}

.story-text-content {
    font-size: 22px;
    line-height: 1.6;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 24px;
    min-height: 90px;
}

.story-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* CELEBRATION MODAL */
.ckb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.ckb-modal-overlay.active {
    display: flex;
}

.ckb-modal-content {
    background: white;
    border-radius: var(--radius-xl);
    padding: 36px 28px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 4px solid #ffffff;
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.modal-icon-congrats {
    font-size: 64px;
    margin-bottom: 12px;
    animation: bounce 1s infinite alternate;
}

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

.modal-title-congrats {
    font-family: 'Fredoka One', cursive;
    font-size: 28px;
    color: #1e3a8a;
    margin-bottom: 8px;
}

.modal-stars-earned {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 36px;
    margin: 16px 0;
}

/* STICKER ALBUM MODAL */
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 20px 0;
}

.sticker-slot {
    background: #f8fafc;
    border: 3px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 16px 8px;
    text-align: center;
    position: relative;
}

.sticker-slot.unlocked {
    background: linear-gradient(135deg, #fef3c7, #fefce8);
    border-style: solid;
    border-color: #fbbf24;
    box-shadow: 0 4px 10px rgba(251, 191, 36, 0.2);
}

.sticker-slot-icon {
    font-size: 36px;
    margin-bottom: 4px;
    filter: grayscale(100%);
    opacity: 0.35;
}

.sticker-slot.unlocked .sticker-slot-icon {
    filter: none;
    opacity: 1;
}

.sticker-slot-name {
    font-size: 11px;
    font-weight: 800;
    color: #64748b;
}

.sticker-slot.unlocked .sticker-slot-name {
    color: #b45309;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .ckb-header {
        flex-direction: column;
        gap: 14px;
        text-align: center;
    }
    .hero-title {
        font-size: 24px;
    }
    .matching-board {
        grid-template-columns: 1fr;
    }
}
