/* CLINED — Ergonomi Beranda & Buat Soal (v1)
   Dimuat PALING AKHIR. Target: layar HP, jempol, area sentuh >= 44px. */

/* ───────────── BERANDA ───────────── */

/* Jarak antar blok seragam */
html body #home > .card,
html body #home > section,
html body #home > .stats,
html body #home > .home-quick-row,
html body #home > a.feedback-card { margin: 0 0 12px !important; }

/* Peta belajar: dipadatkan agar aksi utama cepat terlihat */
html body #home .duo-learning-map { padding: 12px 14px 10px !important; margin-bottom: 12px !important; }
html body #home .duo-map-header h3 { font-size: 17px !important; margin: 0 0 8px !important; }
html body #home .duo-unit-card { padding: 10px 12px !important; margin-bottom: 8px !important; }
html body #home .duo-node { width: 64px !important; }
html body #home .duo-node span { width: 46px !important; height: 46px !important; }
html body #home .duo-node small { font-size: 10px !important; }

/* Strip statistik: 4 kolom rata, label tidak terpotong */
html body #home .duo-reward-strip { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px !important; margin: 0 0 12px !important; }
html body #home .duo-reward-item { flex-direction: column !important; justify-content: center !important; align-items: center !important; gap: 2px !important; padding: 9px 4px !important; min-height: 68px; text-align: center; min-width: 0; }
html body #home .duo-reward-item > div { display: flex; flex-direction: column; align-items: center; min-width: 0; }
html body #home .duo-reward-icon { width: auto !important; height: auto !important; flex: none !important; font-size: 18px !important; background: none !important; }
html body #home .duo-reward-item b { font-size: 15px !important; line-height: 1.1; }
html body #home .duo-reward-item small { font-size: 9px !important; white-space: nowrap; overflow: visible !important; text-overflow: clip !important; letter-spacing: .02em !important; }

/* Latihan Hari Ini = aksi utama, naik ke atas */
html body #home .daily-home-card { padding: 14px !important; }

/* Pilih ujian: dua tombol besar, tinggi wajar */
html body #home .exam-launcher.card { padding: 12px 12px 14px !important; }
html body #home .exam-launcher .section-title { margin: 0 0 8px !important; font-size: 15px !important; }
html body #home .exam-launcher-grid { gap: 10px !important; margin: 0 !important; }
html body #home .exam-launch-card,
html body #home .exam-launch-card.uab,
html body #home .exam-launch-card.upi { min-height: 84px !important; padding: 10px !important; display: grid !important; place-items: center !important; }
html body #home .exam-launch-card .exam-launch-icon { width: 64px !important; height: 64px !important; font-size: 18px !important; border-radius: 18px !important; }

/* Baris cepat: Materi + Buat Soal sejajar, ukuran sama */
html body #home .home-quick-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html body #home .home-quick-row > .home-quick-tile,
html body #home #openMaterialsPage,
html body #home #userBankBtn {
  margin: 0 !important; width: 100% !important; min-width: 0 !important; min-height: 76px !important;
  padding: 12px !important; border-radius: 18px !important;
  display: flex !important; align-items: center !important; justify-content: flex-start !important;
  background: var(--card) !important; color: var(--text) !important;
  border: 2px solid var(--line) !important; border-bottom-width: 4px !important;
  text-align: left !important; font-size: 14px !important; font-weight: 800 !important;
}
html body #home .home-quick-tile .home-materials-leading { width: 100% !important; justify-content: flex-start !important; gap: 10px !important; }
html body #home .home-quick-tile .home-materials-icon { display: grid !important; width: 40px !important; height: 40px !important; flex: 0 0 40px !important; font-size: 21px !important; border-radius: 13px !important; background: rgba(88,204,2,.16) !important; }
html body #home #userBankBtn .home-materials-icon { background: rgba(28,176,246,.16) !important; }
html body #home .home-quick-tile b { display: block !important; font-size: 15px !important; font-weight: 900 !important; line-height: 1.15 !important; color: var(--text) !important; }
html body #home .home-quick-tile small { display: block !important; margin-top: 2px !important; font-size: 11px !important; font-weight: 700 !important; opacity: .7 !important; line-height: 1.2 !important; }

/* Papan peringkat mini: judul tidak membungkus aneh */
html body #home .leaderboard-teaser-card { padding: 12px 14px !important; }
html body #home .leaderboard-teaser-head { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 10px !important; }
html body #home .leaderboard-teaser-head > span { flex: 1; min-width: 0; font-size: 13.5px !important; line-height: 1.25; white-space: normal; }
html body #home .leaderboard-see-all { flex: none !important; min-height: 38px !important; padding: 0 12px !important; font-size: 12px !important; white-space: nowrap; }

/* Progress: streak sudah ada di strip atas → sembunyikan duplikat */
html body #home .player-card .daily-streak-card { display: none !important; }
html body #home .player-card { padding: 14px !important; }

/* Statistik ringkas: 4 kolom */
html body #home .stats { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px !important; padding: 0 !important; background: none !important; border: 0 !important; overflow: visible !important; }
html body #home .stats .stat { padding: 10px 2px !important; min-width: 0; text-align: center; }
html body #home .stats .stat b { font-size: 17px !important; }
html body #home .stats .stat span { font-size: 9.5px !important; white-space: normal !important; line-height: 1.15; }

/* MENU: kisi 2 kolom, ikon di atas, tinggi seragam */
html body #home #menuSectionContent.menu-grid,
html body #home #menuSection .menu-section-content { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
html body #home #menuSectionContent .menu-item,
html body #home #menuSectionContent .menu-item:last-child {
  flex-direction: column !important; justify-content: center !important; align-items: center !important; text-align: center !important;
  gap: 5px !important; min-height: 84px !important; padding: 10px 6px !important; border-radius: 16px !important;
}
html body #home #menuSectionContent .menu-item::after { display: none !important; }
html body #home #menuSectionContent .menu-icon { flex: none !important; width: 38px !important; height: 38px !important; min-width: 0 !important; display: grid !important; place-items: center; font-size: 20px !important; border-radius: 12px !important; }
html body #home #menuSectionContent .menu-item > span:last-child { flex: none !important; font-size: 12.5px !important; font-weight: 800 !important; line-height: 1.2 !important; text-align: center !important; overflow: visible !important; text-overflow: clip !important; }
html body #home .menu-section-toggle { min-height: 48px; }

/* Pesan & Kesan */
html body #home .feedback-card { min-height: 64px; }

/* Tombol kartu (FAB): pojok kanan bawah, di atas nav — tidak menimpa konten */
.card-shop-fab { left: auto; right: 14px; top: auto; bottom: calc(100px + env(safe-area-inset-bottom)); width: 46px; min-height: 54px; padding: 5px 2px; gap: 1px; border-radius: 15px; opacity: .94; box-shadow: 0 4px 0 #4c1d95, 0 6px 14px rgba(124,58,237,.3); }
.card-shop-fab .fab-dia { font-size: 9px !important; padding: 1px 5px !important; }
.card-shop-fab .fab-basket-img { width: 24px; height: 24px; }
body.quiz-context .card-shop-fab { display: none; }

/* ───────────── BUAT SOAL ───────────── */
#userBankPage .ub-head { padding: 8px !important; margin-bottom: 0 !important; }
#userBankPage .ub-head .topline { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 8px; }
#userBankPage .ub-head .back { min-height: 44px !important; padding: 0 14px !important; border-radius: 14px !important; font-size: 14px !important; white-space: nowrap; flex: none; }
#userBankPage .ub-head #ubTitle { flex: 1; min-width: 0; text-align: right; font-size: 15px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#userBankPage .ub-body { gap: 12px; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
#userBankPage .ub-hero { padding: 12px 14px; border-radius: 18px; }
#userBankPage .ub-hero-ico { width: 40px; height: 40px; flex-basis: 40px; font-size: 21px; }
#userBankPage .ub-hero small { font-size: 12.5px; }

/* Semua tombol di halaman ini: besar, terbaca, rata */
#userBankPage .ub-body button { min-height: 48px; font-size: 14px !important; font-weight: 900; border-radius: 14px; padding: 0 14px; line-height: 1.2; }
#userBankPage .ub-body .small-btn { min-height: 44px; }
#userBankPage .ub-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#userBankPage .ub-actions > button { min-width: 0; width: 100%; }
#userBankPage .ub-actions-main { grid-template-columns: 1fr 1fr; }
#userBankPage .ub-body button { white-space: nowrap; }
#userBankPage .ub-head.card { padding: 6px 8px !important; min-height: 0 !important; }
#userBankPage .ub-actions > button:only-child { grid-column: 1 / -1; }

/* Input ≥16px agar iOS tidak zoom sendiri */
#userBankPage .ub-body textarea,
#userBankPage .ub-body input[type=text],
#userBankPage .ub-body select { font-size: 16px; padding: 12px 14px; min-height: 48px; }
#userBankPage .ub-body textarea { min-height: 96px; }
#userBankPage .ub-paste { min-height: 240px !important; font-size: 14px !important; }

/* Tab: kontrol segmen dua kolom */
#userBankPage .ml-chips { display: grid !important; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); }
#userBankPage .ml-chips .ml-chip { min-height: 44px; margin: 0; border-radius: 12px; font-size: 13.5px; justify-content: center; text-align: center; }
#userBankPage .ub-practice .ml-chips { grid-template-columns: repeat(4, 1fr); }

/* Daftar deck */
#userBankPage .ub-deck { flex-direction: column; align-items: stretch; gap: 10px; }
#userBankPage .ub-deck-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#userBankPage .ub-deck-btns > button { width: 100%; }

/* Kartu soal */
#userBankPage .ub-q-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#userBankPage .ub-q-actions > button { width: 100%; min-width: 0; }

/* Editor soal */
#userBankPage .ub-editor { padding: 14px; }
#userBankPage .ub-lab { margin: 12px 0 6px; font-size: 13.5px; }
#userBankPage .ub-lab:first-child { margin-top: 0; }
#userBankPage .ub-lab-row small { display: block; margin-top: 2px; font-size: 11.5px; }
#userBankPage .ub-opt-row { gap: 10px; margin-bottom: 8px; }
#userBankPage .ub-opt-key { position: relative; flex: none; width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#userBankPage .ub-opt-key input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#userBankPage .ub-opt-key .ub-letter { width: 44px; height: 44px; font-size: 16px; font-weight: 950; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); transition: background .15s, color .15s, border-color .15s; }
#userBankPage .ub-opt-key input:checked + .ub-letter { background: #58cc02; border-color: #3a9c00; color: #fff; }
#userBankPage .ub-opt-key input:focus-visible + .ub-letter { outline: 3px solid rgba(28,176,246,.5); outline-offset: 2px; }
#userBankPage .ub-opt-row > .ub-letter { width: 32px; height: 32px; font-size: 13px; }
#userBankPage .ub-more { margin-top: 12px; padding: 0 12px; }
#userBankPage .ub-more > summary { min-height: 48px; display: flex; align-items: center; font-size: 13.5px; }

/* Tombol simpan editor: menempel di bawah layar, di atas nav melayang */
#userBankPage .ub-editor-actions,
#userBankPage .ub-save .ub-actions:last-of-type {
  position: sticky; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 30;
  margin: 14px -6px 0; padding: 10px 6px; background: var(--card);
  border-top: 2px solid var(--line); box-shadow: 0 -10px 16px -10px rgba(0,0,0,.18);
}
#userBankPage .ub-editor-actions { grid-template-columns: 1fr 1.6fr; }
#userBankPage .ub-save { padding: 14px; }
#userBankPage .ub-summary { position: sticky; top: 4px; z-index: 20; }

@media (max-width: 360px) {
  html body #home .duo-reward-item b { font-size: 13px !important; }
  #userBankPage .ub-actions-main { grid-template-columns: 1fr; }
  #userBankPage .ub-practice .ml-chips { grid-template-columns: repeat(2, 1fr); }
}

/* Mode gelap */
:root.dark html body #home .home-quick-tile, :root.dark #home .home-quick-tile { background: #1c1c1e !important; border-color: rgba(255,255,255,.13) !important; }
:root.dark #userBankPage .ub-editor-actions, :root.dark #userBankPage .ub-save .ub-actions:last-of-type { background: #1c1c1e; }

/* ───────── v3: kartu "lanjutkan" ringkas (kuis tersimpan + latihan materi) ───────── */
html body #home .resume-card {
  display: grid !important; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 8px; row-gap: 2px; align-items: center;
  padding: 10px 12px !important; margin: 0 0 8px !important; border-width: 2px !important; box-shadow: none !important;
}
html body #home .resume-card[hidden] { display: none !important; }
html body #home .resume-card .section-title { grid-column: 1 / -1; margin: 0 !important; font-size: 12px !important; font-weight: 900; letter-spacing: .03em; text-transform: uppercase; color: var(--ios-blue, #1cb0f6); }
html body #home .resume-card #resumeText,
html body #home .resume-card .ml-resume-info { grid-column: 1; grid-row: 2; min-width: 0; margin: 0 !important; }
html body #home .resume-card #resumeText { font-size: 13px !important; font-weight: 800; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html body #home .resume-card .ml-resume-info b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; line-height: 1.3; }
html body #home .resume-card .ml-resume-info small { display: block; margin-top: 2px; font-size: 11.5px; opacity: .75; }
html body #home .resume-card .ml-progress { grid-column: 1 / -1; grid-row: 3; margin: 6px 0 0 !important; height: 5px; }
html body #home .resume-card .resume-actions { display: contents !important; }
html body #home .resume-card .resume-actions .primary { grid-column: 2; grid-row: 2; width: auto !important; min-width: 0; min-height: 44px !important; padding: 0 16px !important; font-size: 13.5px !important; border-radius: 14px !important; white-space: nowrap; margin: 0 !important; }
html body #home .resume-card .resume-actions .resume-del { grid-column: 3; grid-row: 2; width: 44px !important; min-width: 44px !important; height: 44px !important; min-height: 44px !important; padding: 0 !important; font-size: 16px !important; border-radius: 14px !important; margin: 0 !important; display: grid; place-items: center; }

/* Clinical Progress: dipadatkan karena sekarang di atas */
html body #home .player-card { padding: 12px 14px !important; }
html body #home .player-card .player-top { margin-bottom: 8px; }
html body #home .player-card .xp-track { margin: 6px 0 4px; }
html body #home .player-card .player-badges:empty { display: none; }
html body #home .player-card .xp-total b { font-size: 20px; }

/* Tombol kartu memudar saat scroll agar tidak menutupi tombol */
.card-shop-fab { transition: opacity .25s ease, transform .25s ease; }
.card-shop-fab.fab-idle { opacity: .28; transform: scale(.92); }
.sp-today-chips{display:none!important}
#todayPracticeCard{display:none!important}

/* v4: kalender ujian menggantikan "Target" di strip atas */
html body #home button.duo-reward-item.duo-cal {
  appearance: none; -webkit-appearance: none; font: inherit; color: inherit; cursor: pointer; width: 100%;
  background: var(--card) !important; border: 2px solid var(--line) !important; border-bottom-width: 4px !important;
  box-shadow: none; -webkit-tap-highlight-color: transparent; transition: transform .1s;
}
html body #home button.duo-reward-item.duo-cal:active { transform: translateY(2px); border-bottom-width: 2px !important; }
html body #home button.duo-reward-item.duo-cal b { color: var(--text); }
:root.dark html body #home button.duo-reward-item.duo-cal { background: #1c1c1e !important; }
#materiLatihanResumeCard{display:none!important}

/* v5: kalender ujian — ikon halaman kalender + warna urgensi */
html body #home .duo-cal .duo-reward-icon.cal-ico { display: grid !important; grid-template-rows: 11px 1fr; width: 30px !important; height: 30px !important; border-radius: 9px !important; overflow: hidden; background: #fff !important; border: 1.5px solid rgba(0,0,0,.14); box-shadow: 0 2px 0 rgba(0,0,0,.1); font-size: 18px !important; place-items: center; }
html body #home .duo-cal .cal-ico:not(:has(.cal-mo)) { display: flex !important; background: none !important; border: 0; box-shadow: none; justify-content: center; align-items: center; }
html body #home .duo-cal .cal-mo { display: block; width: 100%; font-style: normal; font-size: 7.5px; font-weight: 900; line-height: 11px; text-align: center; letter-spacing: .06em; color: #fff; background: #ff4b4b; }
html body #home .duo-cal .cal-dy { display: block; font-style: normal; font-size: 14px; font-weight: 900; line-height: 17px; text-align: center; color: #1f2937; }
html body #home .duo-cal b { font-size: 19px !important; }
html body #home .duo-cal small { font-weight: 900 !important; }
html body #home button.duo-cal[data-urg=far]  { border-color: #58cc02 !important; background: linear-gradient(180deg, rgba(88,204,2,.10), var(--card) 70%) !important; }
html body #home button.duo-cal[data-urg=near] { border-color: #1cb0f6 !important; background: linear-gradient(180deg, rgba(28,176,246,.12), var(--card) 70%) !important; }
html body #home button.duo-cal[data-urg=soon] { border-color: #ff9600 !important; background: linear-gradient(180deg, rgba(255,150,0,.16), var(--card) 70%) !important; }
html body #home button.duo-cal[data-urg=soon] b { color: #e07b00 !important; }
html body #home button.duo-cal[data-urg=near] b { color: #1493d1 !important; }
html body #home button.duo-cal[data-urg=far] b  { color: #46a302 !important; }
html body #home button.duo-cal[data-urg=past] { border-color: #ff4b4b !important; }
html body #home button.duo-cal[data-urg=none] { border-style: dashed !important; }
:root.dark html body #home .duo-cal .cal-ico { background: #2c2c2e !important; border-color: rgba(255,255,255,.2); }
:root.dark html body #home .duo-cal .cal-dy { color: #f2f2f7; }

/* v6: FAB gacha tanpa background — hanya keranjang + diamond */
html body .card-shop-fab, html body .card-shop-fab.is-visible {
  background: none !important; border: 0 !important; box-shadow: none !important; backdrop-filter: none !important;
  width: 56px !important; min-height: 60px !important; padding: 0 !important; gap: 0 !important; border-radius: 0 !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
html body .card-shop-fab .fab-basket-img { width: 44px !important; height: 44px !important; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)) !important; }
html body .card-shop-fab .fab-dia {
  background: none !important; padding: 0 !important; margin-top: -2px; border-radius: 0 !important;
  font: 900 12px system-ui, sans-serif !important; color: var(--text, #1f2937) !important; white-space: nowrap;
  text-shadow: 0 0 3px var(--card, #fff), 0 0 3px var(--card, #fff), 0 0 6px var(--card, #fff);
}
:root.dark html body .card-shop-fab .fab-dia { color: #f2f2f7 !important; text-shadow: 0 0 3px #000, 0 0 6px #000; }
html body .card-shop-fab:active { transform: scale(.94); }

/* v7: keranjang gacha lebih besar */
html body .card-shop-fab, html body .card-shop-fab.is-visible { width: 72px !important; min-height: 78px !important; }
html body .card-shop-fab .fab-basket-img { width: 64px !important; height: 64px !important; }
html body .card-shop-fab .fab-dia { font-size: 14px !important; margin-top: -4px; }

/* v7: tombol Lanjutkan & hapus tidak boleh menempel */
html body #home .resume-card { column-gap: 12px; }
html body #home .resume-card .resume-actions { display: flex !important; grid-column: 2 / 4 !important; grid-row: 2; align-items: center; gap: 12px !important; }
html body #home .resume-card .resume-actions .primary,
html body #home .resume-card .resume-actions .resume-del { grid-column: auto !important; grid-row: auto !important; margin: 0 !important; }
html body #home .resume-card .resume-actions .resume-del { flex: 0 0 44px; }
html body #home .resume-card .resume-actions .primary { flex: 0 0 auto; }
html body #home .resume-card { grid-template-columns: minmax(0, 1fr) auto !important; }
html body #home .resume-card .resume-actions { grid-column: 2 !important; flex-wrap: nowrap !important; }
html body #home .resume-card { overflow: hidden; }
html body #home .resume-card .resume-actions { min-width: 0; max-width: 100%; gap: 10px !important; }
html body #home .resume-card .resume-actions .primary { flex: 0 1 auto !important; min-width: 0 !important; width: auto !important; max-width: 118px; padding: 0 12px !important; font-size: 13px !important; overflow: hidden; text-overflow: ellipsis; }
html body #home .resume-card .resume-actions .resume-del { flex: 0 0 44px !important; width: 44px !important; min-width: 44px !important; }
html body #home .resume-card #resumeText { max-width: 100%; }

/* v8: baris cepat 3 kolom — Materi, Buat Soal, Duel (ikon di atas, tanpa subteks) */
html body #home .home-quick-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px !important; }
html body #home .home-quick-row > .home-quick-tile,
html body #home #openMaterialsPage, html body #home #userBankBtn, html body #home #socialBtn {
  min-height: 84px !important; padding: 10px 4px !important; justify-content: center !important; position: relative;
}
html body #home .home-quick-tile .home-materials-leading { flex-direction: column !important; justify-content: center !important; align-items: center !important; gap: 6px !important; text-align: center; }
html body #home .home-quick-tile .home-materials-leading > span:last-child { display: block; }
html body #home .home-quick-tile b { font-size: 13.5px !important; text-align: center; }
html body #home .home-quick-tile small { display: none !important; }
html body #home #socialBtn .home-materials-icon { background: rgba(255,150,0,.18) !important; }

/* v9: baris cepat 4 kolom — Materi, Buat Soal, Duel, Sosial */
html body #home .home-quick-row { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px !important; }
html body #home .home-quick-row > .home-quick-tile, html body #home #openMaterialsPage, html body #home #userBankBtn, html body #home #socialBtn, html body #home #hubBtn { min-height: 78px !important; padding: 8px 2px !important; position: relative; }
html body #home .home-quick-tile b { font-size: 12.5px !important; white-space: nowrap; }
html body #home .home-quick-tile .home-materials-icon { width: 36px !important; height: 36px !important; flex-basis: 36px !important; font-size: 19px !important; }
html body #home #hubBtn .home-materials-icon { background: rgba(124,92,255,.18) !important; }
