:root {
  --pink: #ff4d6d;
  --pink-dark: #e91e63;
  --orange: #ff9a3c;
  --gradient: linear-gradient(160deg, #ff4d6d 0%, #ff9a3c 100%);
  --bg-light: #fff8f4;
  --text-dark: #2b2b2b;
  --card-radius: 18px;
  --shadow: 0 8px 24px rgba(233, 30, 99, 0.15);
}

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

body {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
}

/* =========================================================
   PHONE FRAME — default mobile-first. Di desktop (>900px)
   berubah jadi layout lebar dengan sidebar, lihat media query
   di bagian bawah file ini.
   ========================================================= */
.phone-frame {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  position: relative;
  box-shadow: var(--shadow);
}

/* ---------- Loading Page ---------- */
.loading-screen {
  height: 100vh;
  background: var(--gradient);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; padding: 20px;
}
.loading-screen img.logo { width: 120px; height: 120px; border-radius: 50%; background: #fff; object-fit: cover; margin-bottom: 20px; animation: pulse 1.6s ease-in-out infinite; }
.loading-screen .app-name { font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-bottom: 30px; }
.progress-bar-outer { width: 70%; height: 6px; background: rgba(255,255,255,0.35); border-radius: 10px; overflow: hidden; }
.progress-bar-inner { width: 0%; height: 100%; background: #fff; border-radius: 10px; animation: loadbar 1.8s ease forwards; }
@keyframes loadbar { to { width: 100%; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- Auth Pages ---------- */
.auth-header { background: var(--gradient); padding: 40px 24px 60px; color: #fff; border-radius: 0 0 40px 40px; }
.auth-header h1 { font-size: 24px; margin-bottom: 6px; }
.auth-header p { font-size: 13px; opacity: 0.9; }
.auth-form { padding: 24px; margin-top: -30px; }
.input-group { margin-bottom: 14px; }
.input-group input, .input-group select { width: 100%; padding: 14px 16px; border: none; border-radius: 30px; background: #ffe4d6; color: var(--text-dark); font-size: 14px; outline: none; }
.input-group input::placeholder { color: #b96b52; }
.btn-primary { width: 100%; padding: 14px; border: none; border-radius: 30px; background: var(--gradient); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: var(--shadow); }
.btn-primary:hover { opacity: 0.92; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-switch a { color: var(--pink-dark); font-weight: 600; text-decoration: none; }
.error-msg { background: #ffe0e0; color: #c0392b; padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }
.success-msg { background: #e0ffe6; color: #1e8449; padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }

/* ---------- Top App Bar ---------- */
.app-bar { background: var(--gradient); padding: 18px 20px; color: #fff; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.app-bar h2 { font-size: 18px; }
.app-bar .profile-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; }

/* ---------- Menu Grid ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 20px; }
.menu-card { background: #fff; border-radius: var(--card-radius); box-shadow: var(--shadow); padding: 20px 12px; text-align: center; text-decoration: none; color: var(--text-dark); border: 1px solid #ffe4d6; transition: transform .15s ease; }
.menu-card:active { transform: scale(0.97); }
.menu-card .icon { display: inline-flex; }
.menu-card .icon.icon-3d { display: flex; }
.menu-card .label { font-weight: 600; font-size: 14px; }

/* ---------- Section list (topik) ---------- */
.section-title { padding: 18px 20px 6px; font-size: 16px; font-weight: 700; color: var(--pink-dark); }
.topic-list { padding: 0 20px; display: flex; flex-direction: column; gap: 12px; }
.topic-card { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: var(--text-dark); border: 1px solid #ffe4d6; }
.topic-card img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #ffe4d6; }
.topic-card .info h4 { font-size: 14px; margin-bottom: 4px; }
.topic-card .info p { font-size: 12px; color: #888; }
.progress-pill { margin-left: auto; font-size: 11px; background: var(--gradient); color: #fff; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }

/* ---------- Comic Panel Viewer (gaya komik ilustrasi + caption box) ---------- */
.comic-reader { padding: 16px; }
.comic-page-num { text-align: center; font-size: 12px; font-weight: 700; color: var(--pink-dark); letter-spacing: 1px; margin-bottom: 12px; }

.comic-panel {
  position: relative;
  border-radius: 14px;
  border: 3px solid #1b1b1b;
  overflow: hidden;
  margin-bottom: 18px;
  min-height: 230px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
  opacity: 0; transform: translateY(14px) scale(0.98);
  transition: opacity .45s ease, transform .45s ease;
}
.comic-panel.show { opacity: 1; transform: translateY(0) scale(1); }
.comic-panel.bg-0 { background: linear-gradient(160deg, #ffe9d6 0%, #ffd7e2 100%); }
.comic-panel.bg-1 { background: linear-gradient(160deg, #d8f0ea 0%, #cfe3ff 100%); }
.comic-panel.bg-2 { background: linear-gradient(160deg, #fff3c4 0%, #ffe0b8 100%); }

.comic-panel img.comic-avatar { width: 46%; max-width: 170px; display: block; margin-bottom: 8px; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.18)); }

.comic-caption {
  position: absolute; top: 12px; left: 12px; right: 12px;
  background: #fff;
  border: 3px solid #1b1b1b;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.45;
  color: #1b1b1b;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}
.comic-caption .speaker-tag { font-weight: 800; margin-right: 4px; }
.comic-caption .speaker-tag.kiri { color: var(--pink-dark); }
.comic-caption .speaker-tag.kanan { color: #178a7c; }

.sound-btn {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 3;
  border: 2px solid #fff;
  cursor: pointer;
  padding: 0;
}
.sound-btn-playing { animation: soundPulse 0.7s ease-in-out infinite; }
@keyframes soundPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.comic-topic-header { text-align: center; padding: 6px 20px 4px; }
.comic-topic-header .badge { display: inline-block; background: #fff3e9; color: #b8860b; font-size: 11px; font-weight: 700; padding: 5px 14px; border-radius: 20px; border: 1px solid #ffe4a3; }
.comic-end-card { margin: 20px 16px 8px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 22px 20px; text-align: center; border: 1.5px solid #ffe4d6; }
.comic-end-card .emoji { font-size: 34px; margin-bottom: 8px; }
.comic-end-card h4 { font-size: 15px; margin-bottom: 6px; color: var(--pink-dark); }
.comic-end-card p { font-size: 12.5px; color: #777; margin-bottom: 16px; }
.comic-nav { display: flex; justify-content: space-between; align-items: center; padding: 6px 20px 24px; gap: 10px; }
.comic-nav button { flex: 1; padding: 12px; border: none; border-radius: 30px; background: var(--gradient); color: #fff; font-weight: 600; }
.comic-nav button:disabled { background: #ddd; color: #999; }
.comic-dots { display: flex; gap: 6px; justify-content: center; padding-bottom: 8px; }
.comic-dots span { width: 7px; height: 7px; border-radius: 50%; background: #ffe4d6; }
.comic-dots span.active { background: var(--pink-dark); }

/* ---------- Games: character select ---------- */
.character-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; padding: 20px; }
.character-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: var(--text-dark); border: 1px solid #ffe4d6; }
.character-card img { width: 100%; height: 120px; object-fit: cover; background: #ffe4d6; }
.character-card .cc-body { padding: 10px; text-align: center; }
.character-card .cc-body h4 { font-size: 13px; margin-bottom: 4px; }
.difficulty-tag { font-size: 10px; background: var(--orange); color: #fff; padding: 2px 8px; border-radius: 10px; }

/* ---------- Games: mode select (Santai/Tantangan) ---------- */
.mode-tabs { display: flex; gap: 8px; padding: 0 20px 16px; }
.mode-tab-btn { flex: 1; padding: 12px; border: 1.5px solid #ffe4d6; background: #fff; border-radius: 14px; font-size: 13px; font-weight: 700; color: #999; cursor: pointer; }
.mode-tab-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }
.mode-panel { padding-bottom: 10px; }
.option-pills { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 20px 6px; }
.pill-btn { padding: 9px 14px; border-radius: 20px; border: 1.5px solid #ffe4d6; background: #fff8f4; font-size: 12px; color: #777; cursor: pointer; font-weight: 600; }
.pill-btn.active { background: var(--gradient); color: #fff; border-color: transparent; }
.mode-badge-bar { text-align: center; background: #fff2a8; color: #7a5c00; font-size: 12px; font-weight: 700; padding: 8px; border-bottom: 2px dashed #d4ac0d; }

/* Pilihan tipe puzzle (Geser / Tempatkan) */
.tipe-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 14px; }
.tipe-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border: 2px solid #ffe4d6; background: #fff; border-radius: 16px; cursor: pointer; text-align: center; color: var(--text-dark); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tipe-card b { font-size: 14px; }
.tipe-card small { font-size: 11px; line-height: 1.4; color: #888; }
.tipe-card.active { border-color: var(--pink-dark); box-shadow: var(--shadow); background: #fff8f4; }
.tipe-card:active { transform: scale(0.98); }

/* Papan puzzle mengikuti proporsi gambar asli (--ar / --arn di-set lewat JS; default potret 3:4) */
.puzzle-wrap { padding: 20px; text-align: center; --ar: 3 / 4; --arn: 0.75; }
.puzzle-board { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; width: min(100%, 340px, calc(60vh * var(--arn))); margin: 16px auto; aspect-ratio: var(--ar); background: #2b2b2b; border-radius: 12px; padding: 4px; }
.puzzle-piece { background-size: 300% 300%; border-radius: 6px; cursor: grab; transition: transform .1s; }
.puzzle-piece.empty { background: transparent; cursor: default; }

/* Tipe Tempatkan: kotak tujuan + tray pecahan (papan dibuat lebih pendek supaya tray ikut terlihat tanpa scroll) */
.puzzle-board.drop-board { width: min(100%, 340px, calc(45vh * var(--arn))); margin: 10px auto; }
.drop-cell { border-radius: 6px; background: rgba(255,255,255,0.08); outline: 2px dashed rgba(255,255,255,0.28); outline-offset: -3px; transition: background-color .15s, outline-color .15s; }
.drop-cell.filled { outline: none; background-color: transparent; }
.drop-cell.targetable { outline-color: #ffd166; animation: targetPulse 1.2s ease-in-out infinite; }
.drop-cell.hover { background: rgba(255,209,102,0.35); outline: 3px solid #ffd166; }
@keyframes targetPulse { 50% { background: rgba(255,209,102,0.18); } }
.drop-cell.pop { animation: popIn .35s ease; }
@keyframes popIn { 0% { transform: scale(0.8); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.drop-cell.shake { outline: 3px solid #e74c3c; background: rgba(231,76,60,0.35); }

.piece-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(100%, 340px); margin: 0 auto 6px; padding: 10px; background: #fff8f4; border: 2px dashed #ffe4d6; border-radius: 14px; min-height: 60px; }
.tray-piece { width: calc((100% - 32px) / 5); aspect-ratio: var(--ar); touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 2px 6px rgba(0,0,0,0.25); border: 2px solid #fff; }
.tray-piece.selected { border-color: var(--pink-dark); transform: scale(1.1); box-shadow: 0 4px 12px rgba(233,30,99,0.45); }
.tray-piece.dragging { opacity: 0.25; }
.tray-empty { font-size: 12px; color: #999; align-self: center; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; box-shadow: 0 10px 24px rgba(0,0,0,0.4); border: 2px solid #fff; transform: scale(1.06) rotate(-3deg); opacity: 0.95; }

.puzzle-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 10px auto; }
.puzzle-actions .btn-primary { width: auto; padding: 11px 18px; font-size: 14px; }
.puzzle-actions .pill-btn { padding: 11px 14px; }

.overlay-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.overlay-box { background: #fff; border-radius: 18px; padding: 30px 24px; text-align: center; max-width: 300px; width: 100%; }
.puzzle-stats { display: flex; justify-content: center; gap: 20px; font-size: 13px; margin-bottom: 10px; color: #666; }
.puzzle-stats b { color: var(--pink-dark); }
.timer-warn, .timer-warn-ready.timer-warn { color: #e74c3c; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* ---------- Quiz ---------- */
.quiz-access-tabs { display: flex; gap: 8px; padding: 16px 20px 0; }
.quiz-access-tabs button { flex: 1; padding: 10px; border: 1px solid #ffe4d6; background: #fff; border-radius: 12px; font-size: 12px; font-weight: 600; color: #999; cursor: pointer; }
.quiz-access-tabs button.active { background: var(--gradient); color: #fff; border: none; }
.quiz-access-panel { padding: 16px 20px; }
#barcode-reader { width: 100%; border-radius: 14px; overflow: hidden; }
.manual-code-box input { text-transform: uppercase; text-align: center; letter-spacing: 2px; font-weight: 700; }
.quiz-question-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 20px; margin: 16px 20px; border: 1px solid #ffe4d6; }
.quiz-question-card .q-count { font-size: 12px; color: var(--pink-dark); font-weight: 700; margin-bottom: 8px; }
.quiz-question-card h3 { font-size: 15px; margin-bottom: 18px; line-height: 1.4; }
.quiz-option { display: block; width: 100%; text-align: left; padding: 12px 16px; margin-bottom: 10px; border-radius: 12px; border: 1.5px solid #ffe4d6; background: #fff8f4; font-size: 13.5px; cursor: pointer; }
.quiz-option.correct { border-color: #2ecc71; background: #e8fff0; }
.quiz-option.wrong { border-color: #e74c3c; background: #ffe8e8; }
.quiz-progress-bar { height: 6px; background: #ffe4d6; border-radius: 10px; margin: 0 20px; overflow: hidden; }
.quiz-progress-bar-inner { height: 100%; background: var(--gradient); transition: width .3s; }
.quiz-result { text-align: center; padding: 40px 24px; }
.quiz-result .score-circle { width: 140px; height: 140px; border-radius: 50%; background: var(--gradient); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 20px; box-shadow: var(--shadow); }
.quiz-result .score-circle .num { font-size: 32px; font-weight: 700; }

/* Pembahasan jawaban */
.pembahasan-box { margin-top: 14px; padding: 14px 16px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; }
.pembahasan-box.pembahasan-benar { background: #e8fff0; border: 1.5px solid #2ecc71; }
.pembahasan-box.pembahasan-salah { background: #fff5e8; border: 1.5px solid #f39c12; }
.pembahasan-title { font-weight: 800; margin-bottom: 6px; font-size: 13px; }
.pembahasan-box.pembahasan-benar .pembahasan-title { color: #1e8449; }
.pembahasan-box.pembahasan-salah .pembahasan-title { color: #b8860b; }
.pembahasan-text { color: #555; }

/* ---------- Progress Page ---------- */
.progress-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 20px; }
.progress-summary .box { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 8px; text-align: center; border: 1px solid #ffe4d6; }
.progress-summary .box .val { font-size: 20px; font-weight: 700; color: var(--pink-dark); }
.progress-summary .box .lbl { font-size: 11px; color: #888; }
.progress-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f2e4dc; }
.progress-item .bar-wrap { flex: 1; height: 8px; background: #ffe4d6; border-radius: 10px; overflow: hidden; }
.progress-item .bar-wrap .fill { height: 100%; background: var(--gradient); }
.progress-item .pct { font-size: 12px; font-weight: 700; color: var(--pink-dark); width: 40px; text-align: right; }

/* ---------- Ikon 3D (glossy gradient badge) ---------- */
.icon-3d {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  box-shadow:
    0 4px 0 rgba(0,0,0,0.18),
    0 8px 14px rgba(0,0,0,0.18),
    inset 0 2px 3px rgba(255,255,255,0.55),
    inset 0 -3px 4px rgba(0,0,0,0.15);
  transition: transform .15s ease, box-shadow .15s ease;
}
.icon-3d::after {
  content: '';
  position: absolute; top: 8%; left: 12%; width: 45%; height: 30%;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  filter: blur(3px);
  pointer-events: none;
}
.icon-3d:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.18), 0 3px 6px rgba(0,0,0,0.15), inset 0 2px 3px rgba(255,255,255,0.5); }

.icon-3d-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
.icon-3d-md { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.icon-3d-lg { width: 60px; height: 60px; border-radius: 16px; font-size: 30px; }

.icon-3d-pink   { background: linear-gradient(160deg, #ff8fa8 0%, #e91e63 60%, #c2185b 100%); }
.icon-3d-orange { background: linear-gradient(160deg, #ffc978 0%, #ff9a3c 60%, #e0781a 100%); }
.icon-3d-teal   { background: linear-gradient(160deg, #6fe0c9 0%, #17a398 60%, #0e7a70 100%); }
.icon-3d-purple { background: linear-gradient(160deg, #c39bff 0%, #8b5cf6 60%, #6b3fd4 100%); }
.icon-3d-red    { background: linear-gradient(160deg, #ff8f7d 0%, #e64848 60%, #c22e2e 100%); }
.icon-3d-gold   { background: linear-gradient(160deg, #ffe28a 0%, #f3c852 60%, #d89b2e 100%); }

.bottom-nav a .icon-3d-sm { margin-bottom: 1px; }

.bottom-nav { position: sticky; bottom: 0; background: #fff; display: flex; justify-content: space-around; padding: 10px 0; box-shadow: 0 -4px 16px rgba(0,0,0,0.06); border-radius: 20px 20px 0 0; }
.bottom-nav a { text-decoration: none; color: #aaa; font-size: 10px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bottom-nav a.active { color: var(--pink-dark); font-weight: 700; }
.bottom-nav a .ic { font-size: 20px; }

/* ---------- Admin panel (sudah desktop-friendly secara default) ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: #2b2b2b; color: #fff; padding: 24px 0; flex-shrink: 0; }
.admin-sidebar h2 { padding: 0 20px 20px; font-size: 16px; color: var(--orange); }
.admin-sidebar a { display: block; padding: 12px 20px; color: #ccc; text-decoration: none; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--pink); color: #fff; }
.admin-content { flex: 1; padding: 28px; background: #faf9f7; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; flex-wrap: wrap; gap: 10px; }
.admin-card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 20px; overflow-x: auto; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-table th, table.admin-table td { padding: 10px 12px; border-bottom: 1px solid #eee; text-align: left; }
table.admin-table th { color: #888; font-weight: 600; }
.btn-sm { padding: 6px 12px; border-radius: 8px; border: none; font-size: 12px; cursor: pointer; }
.btn-edit { background: #fff3cd; color: #856404; text-decoration: none; display: inline-block; }
.btn-delete { background: #f8d7da; color: #721c24; }
.btn-add { background: var(--gradient); color: #fff; padding: 10px 18px; border-radius: 10px; border: none; text-decoration: none; font-size: 13px; font-weight: 600; }
.stat-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 22px; }
.stat-cards .stat { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.stat-cards .stat .num { font-size: 26px; font-weight: 700; color: var(--pink-dark); }
.stat-cards .stat .lbl { font-size: 12px; color: #888; }

/* =========================================================
   RESPONSIVE DESKTOP
   Di layar >= 900px, halaman USER (phone-frame) berhenti
   dipaksa selebar HP: jadi kartu terpusat dengan lebar wajar,
   nav bawah disembunyikan & diganti nav atas horizontal,
   grid konten melebar mengikuti ruang yang tersedia.
   ========================================================= */
/* =========================================================
   RESPONSIVE DESKTOP
   Mobile (default di atas) TIDAK berubah sama sekali.
   Di layar >= 900px, halaman USER berubah jadi tampilan desktop
   yang lega: lebar mengikuti layar (maks 1100px), nav pindah ke
   atas (jadi seperti navbar web biasa), grid melebar lebih banyak
   kolom supaya tidak terasa sempit/dipaksa seperti HP.
   ========================================================= */
@media (min-width: 900px) {
  body { background: linear-gradient(160deg, #fff0e8 0%, #ffe4ea 100%); padding: 24px; }

  .phone-frame {
    max-width: 1100px;
    margin: 0 auto;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    min-height: 100vh;
    background: transparent;
    display: flex;
    flex-direction: column;
  }

  /* Nav dipindah ke atas secara visual (urutan DOM tetap di bawah, tidak perlu ubah PHP) */
  .bottom-nav {
    order: -1;
    position: sticky; top: 0; z-index: 20;
    background: #fff;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    padding: 16px 40px;
    justify-content: flex-start;
    gap: 36px;
    margin-bottom: 24px;
  }
  .bottom-nav a { flex-direction: row; gap: 8px; font-size: 13px; }
  .bottom-nav a .ic { font-size: 18px; }

  .app-bar {
    background: #fff; color: var(--text-dark);
    border-radius: 20px;
    margin-bottom: 24px;
    padding: 24px 32px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  }
  .app-bar h2 { font-size: 24px; color: var(--text-dark); }
  .app-bar a, .app-bar .profile-btn { color: var(--pink-dark) !important; }

  .menu-grid { grid-template-columns: repeat(4, 1fr); padding: 0; gap: 24px; }
  .menu-card { padding: 32px 20px; }
  .menu-card .icon { font-size: 44px; }
  .menu-card .label { font-size: 16px; }

  .character-grid { grid-template-columns: repeat(4, 1fr); padding: 0; gap: 20px; }
  .character-card img { height: 150px; }

  .topic-list { padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .section-title { padding-left: 0; padding-right: 0; font-size: 19px; }
  .quiz-access-panel, .progress-summary { padding-left: 0; padding-right: 0; }
  .progress-summary { grid-template-columns: repeat(3, 1fr); }

  .comic-reader { max-width: 720px; margin: 0 auto; padding: 0 0 20px; }
  .comic-panel { min-height: 320px; }
  .comic-panel img.comic-avatar { max-width: 220px; }

  .puzzle-wrap { padding: 0; max-width: 500px; margin: 0 auto; }
  .puzzle-board { width: min(100%, 420px, calc(66vh * var(--arn))); }
  .puzzle-board.drop-board { width: min(100%, 420px, calc(54vh * var(--arn))); }
  .piece-tray { width: min(100%, 420px); }
  .tipe-cards { padding-left: 0; padding-right: 0; max-width: 500px; margin-left: auto; margin-right: auto; }

  .quiz-question-card { margin: 16px 0; max-width: 700px; margin-left: auto; margin-right: auto; }
  .quiz-progress-bar { margin: 0 auto; max-width: 700px; }

  .auth-header { border-radius: 20px; padding: 50px 40px 70px; margin-bottom: -30px; max-width: 480px; margin-left: auto; margin-right: auto; }
  .auth-form { padding: 32px 40px; max-width: 480px; margin: 0 auto; }

  .mode-tabs, .option-pills { padding-left: 0; padding-right: 0; max-width: 500px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 1200px) {
  .admin-content { padding: 40px 48px; }
  .stat-cards { grid-template-columns: repeat(6, 1fr); }
}

/* Admin panel: sidebar jadi bisa di-collapse di layar sempit (tablet ke bawah) */
@media (max-width: 720px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 12px 0; display: flex; overflow-x: auto; }
  .admin-sidebar h2 { display: none; }
  .admin-sidebar a { padding: 10px 16px; white-space: nowrap; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
