/* ===== Kuisora Design Tokens =====
   Palette: ink #2B2A4C, paper #FBF8F3, coral #FF6B6B, mint #06D6A0, sun #FFD166, slate #5C5B7A
   Display face: Baloo 2 (playful, rounded) — used for headings & kid-facing UI
   Body face: Inter — dashboards & forms
   Utility face: JetBrains Mono — access codes, room codes (feels like a real code you type in)
*/
@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --ink: #2B2A4C;
  --paper: #FBF8F3;
  --paper-2: #FFFFFF;
  --coral: #FF6B6B;
  --coral-dark: #E8534F;
  --mint: #06B98A;
  --mint-bg: #E3FBF3;
  --sun: #FFD166;
  --sun-bg: #FFF6DF;
  --slate: #6B6A87;
  --line: #E8E4DA;
  --danger: #E14F4F;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(43,42,76,0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--coral); color: #fff; }
:focus-visible { outline: 2.5px solid var(--coral); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4, .display {
  font-family: 'Baloo 2', system-ui, sans-serif;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 .4em;
  line-height: 1.25;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }
a { color: var(--coral-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 1em; }
code, .mono { font-family: 'JetBrains Mono', monospace; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--ink); color: #fff;
  padding: 22px 16px; display: flex; flex-direction: column;
}
.sidebar .brand {
  font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 1.35rem;
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: #fff;
}
.sidebar .role-chip {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  background: rgba(255,255,255,.12); color: #EFE9FF;
  padding: 3px 10px; border-radius: 999px; display: inline-block; margin-bottom: 22px; width: fit-content;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar nav a {
  color: #D8D6EE; text-decoration: none; padding: 10px 12px; border-radius: 10px;
  font-size: .93rem; display: flex; align-items: center; gap: 10px;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.sidebar nav a.active { background: var(--coral); color: #fff; font-weight: 600; }
.sidebar .logout-link { color: #B7B4D6; font-size: .85rem; margin-top: 12px; transition: color .15s; }
.sidebar .logout-link:hover { color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar {
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.3rem; margin: 0; }
.user-pill { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--slate); flex-shrink: 0; }
.user-pill .avatar { font-size: 1.4rem; }
.nav-logout-mobile { display: none; }
.content { padding: 26px 28px; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
a.card:hover, a.card:focus-visible {
  box-shadow: 0 10px 28px rgba(43,42,76,0.14); transform: translateY(-2px);
  border-color: var(--coral); text-decoration: none;
}
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
/* Kartu visual (mata pelajaran, buku) tetap 2 kolom di HP — 1 kolom membuang banyak ruang
   kosong di kiri/kanan untuk kartu berbentuk kotak/potret seperti ini. */
@media (max-width: 640px) { .grid-cards.grid-2, .grid-cards.grid-3, .grid-cards.grid-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 380px) { .grid-cards.grid-2, .grid-cards.grid-3, .grid-cards.grid-4 { gap: 9px; } }

.stat-card { text-align: left; }
.stat-card .num { font-family: 'Baloo 2'; font-size: 2rem; font-weight: 800; color: var(--coral-dark); }
.stat-card .label { color: var(--slate); font-size: .85rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: none; border-radius: 12px; padding: 10px 18px; font-weight: 600; font-size: .92rem;
  cursor: pointer; text-decoration: none; font-family: inherit;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 4px 14px rgba(255,107,107,0.35); }
.btn-primary:hover { background: var(--coral-dark); box-shadow: 0 6px 18px rgba(232,83,79,0.4); }
.btn-mint { background: var(--mint); color: #fff; box-shadow: 0 4px 14px rgba(6,185,138,0.3); }
.btn-mint:hover { background: #059e78; }
.btn-outline { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--coral); color: var(--coral-dark); }
.btn-ghost { background: transparent; color: var(--slate); padding: 8px 10px; }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(225,79,79,0.3); }
.btn-danger:hover { background: #C43D3D; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 5px; color: var(--ink); }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
select { cursor: pointer; }
::placeholder { color: #A9A6BE; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(255,107,107,0.15);
}
.field { margin-bottom: 16px; }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 14px; }
.form-row > * { flex: 1; }

/* ---------- Badges / access code ticket (signature element) ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-mint { background: var(--mint-bg); color: var(--mint); }
.badge-sun { background: var(--sun-bg); color: #9A6D00; }
.badge-coral { background: #FFE9E7; color: var(--coral-dark); }
.badge-slate { background: #EEEDF5; color: var(--slate); }

.code-ticket {
  display: inline-flex; align-items: center; gap: 10px;
  background: repeating-linear-gradient(135deg, #fff, #fff 10px, #FFFDF6 10px, #FFFDF6 20px);
  border: 2px dashed var(--sun); border-radius: 12px; padding: 8px 16px;
}
.code-ticket .mono { font-size: 1.15rem; font-weight: 700; letter-spacing: .12em; color: var(--ink); }
.code-ticket .tag { font-size: .68rem; text-transform: uppercase; color: var(--slate); letter-spacing: .05em; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .9rem; }
.alert-success { background: var(--mint-bg); color: #036B4E; }
.alert-error { background: #FDEAEA; color: #9A2E2E; }
.alert-info { background: #EAF1FF; color: #24437A; }

/* ---------- Table ---------- */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
th { color: var(--slate); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Subject picker (child home) ---------- */
.subject-card {
  border-radius: 18px; padding: 22px; text-align: center; cursor: pointer;
  border: 2px solid var(--line); background: #fff;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  text-decoration: none; color: var(--ink); display: block;
}
.subject-card:hover, .subject-card:focus-visible {
  transform: translateY(-4px); border-color: var(--coral); text-decoration: none;
  box-shadow: 0 12px 26px rgba(43,42,76,0.14);
}
.subject-card .emoji { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.subject-card .name { font-family: 'Baloo 2'; font-weight: 700; font-size: 1.05rem; }

.mode-picker { display: flex; gap: 14px; flex-wrap: wrap; }
.mode-card {
  flex: 1; min-width: 180px; border-radius: 16px; padding: 18px; border: 2px solid var(--line);
  cursor: pointer; background: #fff; text-align: left; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.mode-card:hover { border-color: var(--coral); }
.mode-card.selected { border-color: var(--coral); background: #FFF5F4; box-shadow: 0 6px 18px rgba(255,107,107,0.15); }
.mode-card h4 { margin-bottom: 4px; }
.mode-card p { font-size: .82rem; color: var(--slate); margin: 0; }

/* ---------- Media pada soal (YouTube/gambar/audio) ---------- */
.question-media { margin-bottom: 18px; }
.question-media .video-wrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: 14px; overflow: hidden; background: #000; }
.question-media .video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.question-media img { max-width: 100%; border-radius: 14px; display: block; }
.question-media audio { width: 100%; }

/* ---------- Quiz taking screen ---------- */
.quiz-progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.quiz-progress > div { height: 100%; background: var(--coral); border-radius: 999px; transition: width .3s; }
.quiz-question { font-family: 'Baloo 2'; font-size: 1.3rem; font-weight: 600; margin-bottom: 20px; }
.quiz-options { display: grid; gap: 12px; }
.quiz-option {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; cursor: pointer; font-size: 1rem; text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.quiz-option:hover { border-color: var(--coral); box-shadow: 0 4px 14px rgba(43,42,76,0.08); }
.quiz-option:active { transform: translateY(1px); }
.quiz-option .letter {
  width: 28px; height: 28px; border-radius: 8px; background: var(--paper); display: flex;
  align-items: center; justify-content: center; font-weight: 700; font-family: 'Baloo 2'; flex-shrink: 0;
}
.quiz-option.correct { border-color: var(--mint); background: var(--mint-bg); }
.quiz-option.wrong { border-color: var(--danger); background: #FDEAEA; }
.quiz-option-row { display: flex; align-items: stretch; gap: 8px; }
.quiz-option-row .tts-btn { flex: none; }
.quiz-timer {
  font-family: 'JetBrains Mono'; font-weight: 700; font-size: 1.05rem; color: var(--coral-dark);
  background: #FFE9E7; padding: 4px 12px; border-radius: 999px;
}

/* Score ring */
.score-ring {
  width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Baloo 2'; font-weight: 800; font-size: 1.3rem; color: var(--ink);
  background: conic-gradient(var(--mint) calc(var(--pct, 0) * 1%), var(--line) 0);
  position: relative;
}
.score-ring::before {
  content: ""; position: absolute; inset: 8px; background: #fff; border-radius: 50%;
}
.score-ring span { position: relative; z-index: 1; }

/* ---------- Landing / auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.landing-hero {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px;
}
.landing-hero .display { font-size: 2.6rem; }
.role-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 760px; margin-top: 30px; }
@media (max-width: 800px) { .role-grid { grid-template-columns: repeat(2, 1fr); } }
.role-card {
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 24px 16px;
  text-decoration: none; color: var(--ink); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.role-card:hover, .role-card:focus-visible {
  transform: translateY(-4px); border-color: var(--coral); text-decoration: none;
  box-shadow: 0 12px 26px rgba(43,42,76,0.14);
}
.role-card .emoji { font-size: 2.4rem; display: block; margin-bottom: 8px; }
.role-card .name { font-family: 'Baloo 2'; font-weight: 700; }
.role-card .desc { font-size: .78rem; color: var(--slate); margin-top: 4px; }

.helper-text { color: var(--slate); font-size: .85rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.small { font-size: .82rem; }
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--slate);
  background: var(--paper-2); border: 1.5px dashed var(--line); border-radius: var(--radius);
}
.empty-state .emoji { font-size: 2.6rem; display: block; margin-bottom: 10px; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center; padding: 10px 12px;
    overflow-x: auto; position: sticky; top: 0; z-index: 20; -webkit-overflow-scrolling: touch;
  }
  .sidebar .brand, .sidebar .role-chip, .sidebar .logout-link { display: none; }
  .sidebar nav { flex-direction: row; flex: none; }
  .sidebar nav a { white-space: nowrap; padding: 8px 10px; font-size: .85rem; }
  .sidebar nav a span:last-child { display: none; } /* sembunyikan label teks, sisakan ikon agar hemat tempat */
  .nav-logout-mobile {
    display: flex !important; align-items: center; margin-left: auto; flex-shrink: 0;
    background: #FDEAEA !important; color: var(--danger) !important; border-radius: 10px;
  }
  .user-pill span:not(.avatar) { display: none; } /* sembunyikan nama di topbar, sudah ada tombol keluar di baris ikon */
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 8px; position: static; backdrop-filter: none; background: var(--paper-2); }
  .topbar h1 { font-size: 1.05rem; }
  .content { padding: 16px 14px; }
  .card { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .role-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .landing-hero .display { font-size: 1.9rem; }
  .quiz-question { font-size: 1.1rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  .subject-card { padding: 16px 12px; border-radius: 16px; }
  .subject-card .emoji { font-size: 2.1rem; margin-bottom: 4px; }
  .subject-card .name { font-size: .92rem; }
}

@media (max-width: 480px) {
  .role-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .num { font-size: 1.5rem; }
  .score-ring { width: 76px; height: 76px; font-size: 1rem; }
  .mode-picker { flex-direction: column; }
  .auth-card { max-width: 100%; }
}

/* ===== Materi PDF & Perpustakaan ===== */
.pdf-material { margin-top: 10px; }
.pdf-frame {
  width: 100%;
  height: 70vh;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 10px;
  background: #fff;
}
.book-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(43,42,76,0.14); }
.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  transition: transform .25s ease;
}
.book-card:hover .book-cover { transform: scale(1.03); }
.book-card .book-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.book-card .book-title {
  font-family: 'Baloo 2'; font-weight: 700; font-size: .98rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.book-search-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.book-search-bar .field { flex: 1; min-width: 200px; margin-bottom: 0; }
@media (max-width: 640px) {
  .pdf-frame { height: 60vh; }
  .book-card .book-body { padding: 10px; gap: 4px; }
  .book-card .book-title { font-size: .88rem; }
  .book-card .badge { font-size: .68rem; padding: 2px 8px; }
  .book-card .btn-sm { padding: 6px 9px; font-size: .74rem; }
}

/* ===== Modal preview buku (tombol Baca) ===== */
.book-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(43, 42, 76, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: bookModalFadeIn .18s ease;
}
.book-modal-overlay[hidden] { display: none; }
.book-modal {
  width: 100%;
  max-width: 960px;
  height: 92vh;
  background: var(--paper, #FBF8F3);
  border-radius: var(--radius, 16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bookModalPopIn .2s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes bookModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bookModalPopIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.book-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.book-modal-title {
  font-family: 'Baloo 2', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-modal-close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.book-modal-close:hover { background: var(--coral, #FF6B6B); color: #fff; border-color: transparent; }
.book-modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.book-modal-body iframe { width: 100%; flex: 1; border: 0; }
.book-modal-fallback-link {
  display: block;
  text-align: center;
  padding: 8px;
  color: var(--slate);
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.book-modal-body .book-modal-audio-wrap {
  margin: auto;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.book-modal-body audio { width: 100%; }
@media (max-width: 640px) {
  .book-modal-overlay { padding: 0; }
  .book-modal { height: 100vh; max-width: 100%; border-radius: 0; }
}

/* ===== Toast (notifikasi kecil, dipakai tombol Bagikan) ===== */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  max-width: 90vw;
  background: var(--ink, #2B2A4C);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: .9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1100;
  text-align: center;
}
.app-toast-show { opacity: 1; transform: translate(-50%, 0); }
.app-toast-error { background: var(--coral-dark, #C43D3D); }

/* ===== Kartu notifikasi live (pesan baru / pengumuman / laporan), muncul tanpa refresh halaman ===== */
.notif-live-card {
  position: fixed;
  top: 16px;
  right: 16px;
  max-width: 320px;
  background: var(--paper-2, #fff);
  border: 1.5px solid var(--line, #E8E4DA);
  border-left: 5px solid var(--coral, #FF6B6B);
  border-radius: var(--radius, 16px);
  box-shadow: 0 12px 30px rgba(43,42,76,0.18);
  padding: 14px 34px 14px 16px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 1200;
}
.notif-live-card.notif-live-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.notif-live-title { font-weight: 700; color: var(--ink, #2B2A4C); margin-bottom: 4px; font-size: .92rem; }
.notif-live-body { color: var(--slate, #6B6A87); font-size: .84rem; line-height: 1.4; }
.notif-live-close {
  position: absolute; top: 8px; right: 10px; border: none; background: transparent;
  color: var(--slate, #6B6A87); font-size: .85rem; cursor: pointer; padding: 4px;
}
@media (max-width: 560px) {
  .notif-live-card { left: 12px; right: 12px; max-width: none; }
}

/* ===================== Kuis Animasi (mode game untuk anak PAUD: PG/TK) ===================== */
/* Diaktifkan otomatis berdasarkan jenjang anak (lihat $isAnimatedQuiz di child/quiz.php) —
   tampilan soal & pilihan jawaban jadi lebih besar, berwarna-warni, dan bergerak supaya lebih
   terasa seperti permainan untuk anak usia dini. */
.quiz-animated { border-radius: 26px; }
.quiz-mascot {
  font-size: 4.2rem; text-align: center; line-height: 1; margin-bottom: 6px;
  animation: qaMascotIdle 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 10px rgba(43,42,76,0.15));
}
.quiz-mascot.qa-happy { animation: qaMascotHappy .7s ease; }
.quiz-mascot.qa-sad { animation: qaMascotSad .5s ease; }
@keyframes qaMascotIdle { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(-4deg); } }
@keyframes qaMascotHappy { 0% { transform: scale(1) rotate(0); } 30% { transform: scale(1.35) rotate(12deg); } 60% { transform: scale(1.1) rotate(-8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes qaMascotSad { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-6deg); } 40% { transform: translateX(10px) rotate(6deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }

.quiz-animated .quiz-question { font-size: 1.55rem; text-align: center; }
.quiz-animated .quiz-options { grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 8px; }
@media (max-width: 640px) { .quiz-animated .quiz-options { grid-template-columns: 1fr; } }

.quiz-animated .quiz-option {
  font-size: 1.2rem; font-weight: 700; padding: 24px 16px; border-radius: 22px; border-width: 3px;
  justify-content: center; text-align: center; gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.quiz-animated .quiz-option:hover { transform: scale(1.045) translateY(-2px); box-shadow: 0 10px 22px rgba(43,42,76,0.14); }
.quiz-animated .quiz-option:active { transform: scale(0.96); }
.quiz-animated .quiz-option .letter { width: 38px; height: 38px; font-size: 1.15rem; }
.quiz-animated .quiz-option.correct { animation: qaPopCorrect .55s ease; }
.quiz-animated .quiz-option.wrong { animation: qaShakeWrong .5s ease; }
@keyframes qaPopCorrect { 0% { transform: scale(1); } 45% { transform: scale(1.1) rotate(-2deg); } 100% { transform: scale(1); } }
@keyframes qaShakeWrong { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

/* Warna-warni per pilihan supaya mudah dibedakan anak kecil (huruf tetap ditampilkan sebagai cadangan) */
.quiz-animated .quiz-options > .quiz-option:nth-child(1),
.quiz-animated .quiz-options > .quiz-option-row:nth-child(1) .quiz-option { background: #FFE9E7; border-color: var(--coral); }
.quiz-animated .quiz-options > .quiz-option:nth-child(2),
.quiz-animated .quiz-options > .quiz-option-row:nth-child(2) .quiz-option { background: #E3FBF3; border-color: var(--mint); }
.quiz-animated .quiz-options > .quiz-option:nth-child(3),
.quiz-animated .quiz-options > .quiz-option-row:nth-child(3) .quiz-option { background: #FFF6DF; border-color: var(--sun); }
.quiz-animated .quiz-options > .quiz-option:nth-child(4),
.quiz-animated .quiz-options > .quiz-option-row:nth-child(4) .quiz-option { background: #EEEAFE; border-color: #8B7CF6; }
.quiz-animated .quiz-option.correct { background: var(--mint-bg) !important; border-color: var(--mint) !important; }
.quiz-animated .quiz-option.wrong { background: #FDEAEA !important; border-color: var(--danger, #E8534F) !important; }

/* Progres bintang menggantikan bar tipis polos untuk anak PAUD */
.quiz-star-progress { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.quiz-star-progress span { font-size: 1.5rem; opacity: .28; transition: opacity .25s ease; display: inline-block; }
.quiz-star-progress span.filled { opacity: 1; animation: qaStarPop .4s ease; }
@keyframes qaStarPop { 0% { transform: scale(0.4) rotate(-18deg); } 60% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }

/* ===================== Pesan ke Admin ===================== */
.chat-thread { display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow-y: auto; padding-right: 4px; }
.chat-bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; }
.chat-bubble-user { align-self: flex-end; background: var(--coral); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble-user .chat-bubble-meta { color: rgba(255,255,255,0.85); }
.chat-bubble-admin { align-self: flex-start; background: var(--mint-bg); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-bubble-meta { font-size: .74rem; margin-bottom: 3px; }
.chat-bubble-body { white-space: pre-wrap; word-break: break-word; }

/* ===================== Laporkan Materi/Soal ===================== */
.report-widget { display: inline-block; }
.report-widget summary { cursor: pointer; list-style: none; }
.report-widget summary::-webkit-details-marker { display: none; }
.report-form {
  margin-top: 10px; padding: 12px; border: 1.5px dashed var(--danger, #E14F4F); border-radius: 12px;
  background: #FFF7F7; max-width: 360px;
}
.report-form textarea { width: 100%; margin-top: 6px; resize: vertical; }

/* Badge notifikasi kecil (pesan belum dibaca / laporan belum ditangani) di menu sidebar */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 4px; margin-left: 1px;
  background: var(--coral); color: #fff; border-radius: 999px;
  font-size: .62rem; font-weight: 700; vertical-align: top; position: relative; top: -6px;
}
.sidebar nav a.active .nav-badge { background: #fff; color: var(--coral-dark); }
