/* ===== Aplikasi Ujian Les - gaya dasar (mobile-first) ===== */
:root {
  --brand: #4f46e5;
  --brand-dark: color-mix(in srgb, var(--brand) 82%, #000);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --brand-soft2: color-mix(in srgb, var(--brand) 18%, #fff);
  --ink: #1e2233;
  --muted: #6b7280;
  --line: #e7e9f1;
  --bg: #f4f5fa;
  --card: #fff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 24, 50, .04), 0 6px 20px rgba(20, 24, 50, .06);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-dark);
}
body { background: var(--bg); color: var(--ink); font-size: 15px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -.01em; }
.text-muted, .text-secondary { color: var(--muted) !important; }
a { text-decoration: none; }

/* Tombol & form */
.btn { border-radius: 12px; font-weight: 600; padding: .6rem 1.1rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-sm { min-height: 36px; padding: .35rem .8rem; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 1.05rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: color-mix(in srgb, var(--brand) 40%, #fff); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border: 0; }
.btn-soft:hover { background: var(--brand-soft2); color: var(--brand-dark); }
.btn-wa { background: #25d366; color: #fff; border: 0; }
.btn-wa:hover { background: #1fb857; color: #fff; }
.form-control, .form-select { border-radius: 12px; border: 1.5px solid var(--line); padding: .65rem .9rem; min-height: 46px; font-size: 16px; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input { width: 2.6em; height: 1.4em; }

/* Kartu */
.card-x { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x .card-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-x .card-head h2, .card-x .card-head h3 { margin: 0; font-size: 1.05rem; }
.card-x .card-body-x { padding: 1.25rem; }
.badge { font-weight: 600; }

/* Statistik */
.stat { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; }
.stat .ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--brand-soft); color: var(--brand); flex: none; }
.stat .num { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: .82rem; }

/* ===== Layout panel ===== */
.app-shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: .6rem 1rem; display: flex; align-items: center; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.brand img, .brand .logo-ph { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.logo-ph { background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.1rem; }
.main { padding: 1rem 1rem 6rem; max-width: 1100px; margin: 0 auto; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1.1rem; }
.page-title h1 { font-size: 1.4rem; margin: 0; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); display: flex; padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(20, 24, 50, .06); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .4rem 0; color: var(--muted); font-size: .7rem; font-weight: 600; border-radius: 12px; }
.bottom-nav a i { font-size: 1.35rem; }
.bottom-nav a.active { color: var(--brand); }
.bottom-nav a.active i { background: var(--brand-soft); border-radius: 12px; padding: 0 .9rem; }

@media (min-width: 992px) {
  .sidebar { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 250px; background: #fff; border-right: 1px solid var(--line); padding: 1.25rem 1rem; z-index: 20; }
  .sidebar .brand { padding: .25rem .5rem 1.25rem; }
  .sidebar nav a { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 12px; color: #4b5163; font-weight: 600; margin-bottom: .25rem; }
  .sidebar nav a:hover { background: var(--bg); }
  .sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
  .sidebar nav a i { font-size: 1.15rem; }
  .sidebar .me { margin-top: auto; border-top: 1px solid var(--line); padding-top: 1rem; }
  .content-wrap { margin-left: 250px; }
  .topbar .brand { display: none; }
  .bottom-nav { display: none; }
  .main { padding: 1.5rem 2rem 3rem; }
}

/* Tab ujian */
.exam-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1.1rem; scrollbar-width: none; }
.exam-tabs::-webkit-scrollbar { display: none; }
.exam-tabs a { white-space: nowrap; padding: .55rem 1rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: #4b5163; font-weight: 600; font-size: .9rem; }
.exam-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Daftar item (kartu pada mobile) */
.item { display: flex; align-items: center; gap: .9rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); color: inherit; }
.item:last-child { border-bottom: 0; }
a.item:hover { background: #fafbff; }
.item .avatar { width: 44px; height: 44px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; flex: none; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: .84rem; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.6rem; color: var(--brand); opacity: .55; display: block; margin-bottom: .5rem; }

/* Soal (admin) */
.q-row { display: flex; gap: .8rem; align-items: flex-start; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); background: #fff; }
.q-row .handle { cursor: grab; color: #aab; font-size: 1.3rem; padding: .25rem; touch-action: none; }
.q-row .no { width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; flex: none; }
.sortable-ghost { opacity: .4; background: var(--brand-soft); }
.opt-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.opt-row .lab { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; display: grid; place-items: center; flex: none; }
.q-img { max-width: 100%; max-height: 260px; border-radius: 12px; border: 1px solid var(--line); }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft2), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 1.75rem 1.5rem; }
.auth-logo { width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 1rem; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 2rem; box-shadow: 0 10px 25px color-mix(in srgb, var(--brand) 35%, transparent); overflow: hidden; }
.auth-logo img { width: 100%; height: 100%; object-fit: cover; }
.seg { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; margin-bottom: 1.25rem; }
.seg button { flex: 1; border: 0; background: transparent; padding: .6rem; border-radius: 11px; font-weight: 700; color: var(--muted); min-height: 44px; }
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 2px 8px rgba(20, 24, 50, .08); }

/* ===== Halaman peserta ===== */
.p-wrap { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 7rem; }
.p-head { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; border-radius: 22px; padding: 1.5rem 1.25rem; margin-bottom: 1rem; box-shadow: 0 12px 30px color-mix(in srgb, var(--brand) 30%, transparent); }
.p-head h1 { font-size: 1.35rem; margin: .25rem 0 .5rem; }
.p-chip { display: inline-flex; align-items: center; gap: .35rem; background: rgba(255, 255, 255, .18); border-radius: 999px; padding: .25rem .75rem; font-size: .82rem; font-weight: 600; margin: 0 .35rem .35rem 0; }
.take-bar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.take-bar .in { max-width: 760px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: .75rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; background: var(--brand-soft); color: var(--brand); padding: .35rem .8rem; border-radius: 12px; }
.timer.warn { background: #fee2e2; color: #dc2626; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.progress { height: 6px; border-radius: 99px; background: var(--line); }
.progress-bar { background: var(--brand); }
.q-card { padding: 1.25rem; }
.q-card .qno { font-size: .8rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.q-card .qbody { font-size: 1.08rem; line-height: 1.6; margin: .35rem 0 1rem; white-space: pre-wrap; }
.choice { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border: 2px solid var(--line); border-radius: 14px; margin-bottom: .6rem; cursor: pointer; background: #fff; min-height: 56px; transition: .12s; }
.choice:active { transform: scale(.99); }
.choice .lab { width: 34px; height: 34px; border-radius: 10px; background: var(--bg); font-weight: 800; display: grid; place-items: center; flex: none; }
.choice.sel { border-color: var(--brand); background: var(--brand-soft); }
.choice.sel .lab { background: var(--brand); color: #fff; }
.choice input { display: none; }
.take-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: #fff; border-top: 1px solid var(--line); padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(20, 24, 50, .06); }
.take-foot .in { max-width: 760px; margin: 0 auto; display: flex; gap: .5rem; }
.navgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: .5rem; }
.navgrid button { height: 46px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; position: relative; }
.navgrid button.ans { background: var(--brand); border-color: var(--brand); color: #fff; }
.navgrid button.flag::after { content: ""; position: absolute; top: 3px; right: 3px; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; border: 2px solid #fff; }
.navgrid button.cur { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.score-ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0); }
.score-ring > div { width: 118px; height: 118px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; color: var(--brand); }
.save-ind { font-size: .78rem; color: var(--muted); }

/* ===== Ruang kelas online ===== */
.room-body { background: #0f1220; }
.room-lobby { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.lobby-video { position: relative; aspect-ratio: 4/3; background: #111827; border-radius: 16px; overflow: hidden; display: grid; place-items: center; }
.lobby-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.lobby-video span { color: #9ca3af; font-size: 3rem; }
.room { position: fixed; inset: 0; height: 100dvh; display: flex; flex-direction: column; color: #fff; }
.room[hidden] { display: none; }
.room-top { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; }
.room-top > div { flex: 1; min-width: 0; }
.room-pill { background: rgba(255, 255, 255, .12); border-radius: 99px; padding: .2rem .7rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.room-pill.bad { background: #dc2626; }
.main-switch { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem; padding: 0 8px 8px; font-size: .8rem; font-weight: 600; }
.main-switch[hidden] { display: none; }
.main-switch button { border: 0; border-radius: 99px; padding: .4rem .9rem; background: rgba(255, 255, 255, .12); color: #fff; font-weight: 700; min-height: 36px; }
.main-switch button.on { background: #059669; }
.tiles { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 8px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.tiles[data-n="2"] { grid-template-columns: 1fr; }
.tiles[data-n="3"], .tiles[data-n="4"], .tiles[data-n="5"], .tiles[data-n="6"], .tiles[data-n="7"] { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 768px) {
  .tiles[data-n="2"], .tiles[data-n="4"] { grid-template-columns: repeat(2, 1fr); }
  .tiles[data-n="3"], .tiles[data-n="5"], .tiles[data-n="6"] { grid-template-columns: repeat(3, 1fr); }
  .tiles[data-n="7"] { grid-template-columns: repeat(4, 1fr); }
}
.tile { position: relative; background: #1b2033; border-radius: 14px; overflow: hidden; min-height: 0; cursor: pointer; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.self video { transform: scaleX(-1); }
.tile.sharing video { object-fit: contain; background: #000; }
.tile.novideo video { opacity: 0; }
.avatar-big { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; background: var(--brand); display: none; place-items: center; font-size: 1.7rem; font-weight: 800; }
.tile.novideo .avatar-big { display: grid; }
.tname { position: absolute; left: 6px; bottom: 6px; max-width: calc(100% - 12px); background: rgba(0, 0, 0, .6); border-radius: 8px; padding: .15rem .55rem; font-size: .75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tname i { color: #f87171; }
.tstate { position: absolute; top: 6px; left: 6px; background: #b45309; border-radius: 8px; padding: .1rem .5rem; font-size: .7rem; }
.tiles.focus { display: flex; flex-wrap: wrap; align-content: flex-start; }
.tiles.focus .tile { width: 110px; height: 80px; order: 2; flex: none; }
.tiles.focus .tile.main { width: 100%; height: calc(100% - 90px); order: 1; }
.tiles.focus[data-n="1"] .tile.main { height: 100%; }
.tiles .tile.main { margin: 0; padding: 0; max-width: none; } /* jangan ikut gaya .main milik panel */
.room-sound { margin: .5rem auto 0; }
.room-bar { display: flex; justify-content: center; gap: .35rem; padding: .6rem .5rem calc(.6rem + env(safe-area-inset-bottom)); }
.rbtn { position: relative; border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: 14px; min-width: 52px; flex: 1; max-width: 92px; padding: .5rem .2rem; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rbtn i { font-size: 1.3rem; }
.rbtn span { font-size: .64rem; font-weight: 600; white-space: nowrap; }
.rbtn.off { background: #fff; color: #dc2626; }
.rbtn.active { background: #059669; }
.rbtn.danger { background: #dc2626; }
.rbtn .dot { position: absolute; top: 6px; right: 12px; width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; }
.chat-msg { background: var(--bg); border-radius: 12px; padding: .45rem .7rem; margin-bottom: .45rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.room-body .zh-fab { bottom: 90px !important; z-index: 1900; }

/* ===== Papan tulis ===== */
.rbtn[hidden], .board[hidden] { display: none !important; }
.rbtn { min-width: 0; }
.board { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 8px; }
.board-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem; padding: .35rem; background: #fff; border-radius: 12px; color: var(--ink); }
.board-tools.readonly .draw { display: none; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--brand); }
.board-tools .bt { width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--bg); display: grid; place-items: center; }
.board-tools .bt.on { background: var(--brand); color: #fff; }
.board-tools .bt span { border-radius: 50%; background: currentColor; }
.board-tools .bt .d1 { width: 5px; height: 5px; } .board-tools .bt .d2 { width: 9px; height: 9px; } .board-tools .bt .d3 { width: 16px; height: 16px; }
.board-sel { height: 36px; border: 0; border-radius: 9px; background: var(--bg); font-weight: 600; font-size: .85rem; padding: 0 .4rem; }
.board-note { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 .4rem; }
.board-note[hidden] { display: none; }
.board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding-top: 8px; overflow: hidden; }
.board-box { position: relative; background: #fff; border-radius: 10px; overflow: hidden; }
.board-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#boardInk.can { touch-action: none; cursor: crosshair; }
#boardInk.can.typing { cursor: text; }
.board-ghost { position: absolute; white-space: pre; line-height: 1.25; font-weight: 600; font-family: "Segoe UI", Arial, "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif; outline: 2px dashed var(--brand); outline-offset: 3px; pointer-events: none; }
.board-ghost[hidden] { display: none; }
.board-ghost img { display: block; opacity: .75; max-width: none; }
#boardInk.can.moving { touch-action: none; cursor: move; }
.board-selbar { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: 8px; flex-wrap: wrap; }
.board-selbar[hidden], .board-frame[hidden] { display: none; }
.board-selbar.is-text .only-img { display: none; }
.board-frame { position: absolute; outline: 2px dashed var(--brand); outline-offset: 2px; pointer-events: none; }
#boardInk.can.typing { touch-action: none; }
.board-text { display: flex; gap: .4rem; margin-top: 8px; }
.board-text[hidden], .board-mark[hidden] { display: none; }
.board-text textarea { resize: none; flex: 1; min-width: 0; }
.board-mark { position: absolute; width: 3px; height: 22px; background: var(--brand); border-radius: 2px; pointer-events: none; animation: pulse 1s infinite; }
/* saat papan terbuka, video menjadi deretan kecil di atas */
.room.board-on .tiles, .room.board-on .tiles.focus { flex: none; display: flex; flex-wrap: nowrap; overflow-x: auto; height: 84px; margin-bottom: 8px; }
.room.board-on .tiles .tile, .room.board-on .tiles.focus .tile, .room.board-on .tiles.focus .tile.main { flex: 0 0 112px; width: 112px; height: 84px; order: 0; }
.room.board-on .avatar-big { width: 40px; height: 40px; font-size: 1.1rem; }

/* ===== Soal di dalam kelas ===== */
.task { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0 8px; background: #fff; border-radius: 12px; overflow: hidden; color: var(--ink); }
.task[hidden] { display: none; }
.task-head { display: flex; align-items: center; gap: .5rem; padding: .45rem .7rem; border-bottom: 1px solid var(--line); }
.task-head .btn { white-space: nowrap; flex: none; }
.task iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.room.task-on .board { display: none !important; }
.room.task-on .tiles { flex: none; display: flex; flex-wrap: nowrap; overflow-x: auto; height: 84px; margin-bottom: 8px; }
.room.task-on .tiles .tile, .room.task-on .tiles.focus .tile.main { flex: 0 0 112px; width: 112px; height: 84px; order: 0; }
.room.task-on .avatar-big { width: 40px; height: 40px; font-size: 1.1rem; }
.task-list { max-height: 34vh; overflow: auto; }
.task-check { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .35rem; cursor: pointer; overflow-wrap: anywhere; }
.task-check input { flex: none; width: 1.2rem; height: 1.2rem; }
.task-card { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; margin-bottom: .6rem; }
.task-row { display: flex; gap: .5rem; padding: .35rem 0; border-top: 1px solid var(--line); color: inherit; font-size: .9rem; }
button.task-row { width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); text-align: left; align-items: center; }
.live-q { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: .75rem .85rem; margin-bottom: .65rem; }
.live-q.here { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.live-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: .5rem; line-height: 1.9; }
.live-opt, .live-text { display: flex; gap: .5rem; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; padding: .4rem .6rem; margin-bottom: .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.live-slot { display: inline-block; border: 1.5px dashed #b6bbd1; border-radius: 8px; padding: 0 .6rem; margin: 0 .15rem; font-weight: 700; }
.live-opt.good, .live-text.good, .live-slot.good { border: 2px solid #10b981; background: #ecfdf5; }
.live-opt.bad, .live-text.bad, .live-slot.bad { border: 2px solid #ef4444; background: #fef2f2; }
.rbtn .num-dot { position: absolute; top: 2px; right: 6px; min-width: 18px; border-radius: 99px; background: #f59e0b; font-size: .65rem; line-height: 18px; }
.rbtn .num-dot[hidden] { display: none; }

/* Lembar soal di dalam kelas: ruangnya sempit, jadi dipadatkan */
.in-class .take-bar .fw-bold { display: none; }
.in-class .take-bar .in { padding: .25rem .8rem; }
.in-class .p-wrap { padding: .6rem .6rem 5rem; }
.in-class .q-card { padding: .85rem; }
.in-class .q-card .qbody { font-size: 1rem; margin-bottom: .7rem; }
.in-class .blank-sentence { font-size: 1.05rem; line-height: 2.5; margin-bottom: .7rem; }
.in-class .choice { min-height: 48px; padding: .6rem .75rem; }

/* ===== Keyboard Mandarin ===== */
.zh-fab { position: fixed; right: 14px; bottom: 84px; z-index: 1900; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #dc2626; color: #fff; font-size: 1.5rem; font-weight: 700; box-shadow: 0 8px 20px rgba(220, 38, 38, .4); }
.zh-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000; background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(20, 24, 50, .25); padding: .6rem .75rem calc(.75rem + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; max-height: 70vh; overflow: auto; }
.zh-head { display: flex; justify-content: space-between; align-items: center; padding: .1rem .25rem .4rem; }
.zh-x { border: 0; background: var(--bg); width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; line-height: 1; }
.zh-tabs { display: flex; gap: .35rem; margin-bottom: .55rem; }
.zh-tabs button { flex: 1; border: 0; background: var(--bg); border-radius: 10px; padding: .4rem; font-weight: 700; font-size: .82rem; color: var(--muted); }
.zh-tabs button.on { background: var(--brand); color: #fff; }
.zh-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; margin-bottom: .35rem; }
.zh-row.wrap { grid-template-columns: repeat(6, 1fr); }
.zh-key { height: 46px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; font-size: 1.35rem; font-weight: 600; box-shadow: 0 2px 0 rgba(20, 24, 50, .06); }
.zh-key:active { transform: translateY(1px); background: var(--brand-soft); }
.zh-actions { display: flex; gap: .35rem; margin-top: .4rem; }
.zh-act { flex: 1; height: 46px; border: 0; background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; font-weight: 700; font-size: .85rem; }
.zh-act[data-a=conv] { flex: 2.4; background: var(--brand); color: #fff; }
.zh-act small { opacity: .85; font-weight: 500; }
.zh-act.on { background: var(--brand-dark); color: #fff; }
.zh-help { font-size: .88rem; }
.zh-help ul { padding-left: 1.1rem; margin: 0; }

/* ===== Isi titik-titik (peserta) ===== */
.blank-sentence { font-size: 1.1rem; line-height: 2.6; margin-bottom: 1rem; overflow-wrap: anywhere; }
.blank-sentence .bt { white-space: pre-wrap; }
.slot { display: inline-flex; align-items: center; justify-content: center; min-width: 96px; min-height: 40px; padding: 0 .75rem; margin: 0 .2rem; vertical-align: middle; border: 2px dashed #b6bbd1; border-radius: 12px; background: #fff; font-weight: 700; line-height: 1.2; transition: .1s; }
.slot .ph { color: #b6bbd1; font-size: .8rem; font-weight: 700; }
.slot.filled { border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand-dark); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.slot.hot { border-color: #10b981; background: #ecfdf5; transform: scale(1.06); }
.bank { display: flex; flex-wrap: wrap; gap: .55rem; padding: .9rem; background: var(--bg); border-radius: 14px; min-height: 64px; }
.wchip { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: .5rem .95rem; min-height: 44px; font-weight: 700; color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; box-shadow: 0 2px 0 rgba(20, 24, 50, .06); }
.wchip:active { transform: scale(.97); }
.wchip.used { opacity: .3; box-shadow: none; cursor: default; }
.wchip.dragging { opacity: .35; }
.wchip.ghost { position: fixed; z-index: 2000; pointer-events: none; transform: translate(-50%, -120%) scale(1.08); border-color: var(--brand); box-shadow: 0 10px 25px rgba(20, 24, 50, .25); cursor: grabbing; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ===== Form pembuat soal ===== */
.step-title { display: flex; align-items: center; gap: .6rem; font-weight: 700; margin-bottom: .9rem; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .8rem; display: grid; place-items: center; flex: none; }
.type-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: .6rem; }
.type-tile { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: .8rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .15rem; text-align: center; transition: .12s; color: var(--ink); }
.type-tile i { font-size: 1.5rem; color: var(--muted); }
.type-tile b { font-size: .85rem; }
.type-tile small { color: var(--muted); font-size: .7rem; line-height: 1.2; }
.type-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--brand) 45%, #fff); }
.type-tile.on { border-color: var(--brand); background: var(--brand-soft); }
.type-tile.on i { color: var(--brand); }
.type-tile:disabled { opacity: .45; }
.dropzone { display: block; border: 2px dashed var(--line); border-radius: 14px; padding: .9rem 1rem; cursor: pointer; text-align: center; transition: .12s; margin: 0; }
.dropzone:hover, .dropzone.hot { border-color: var(--brand); background: var(--brand-soft); }
.dropzone i { color: var(--brand); font-size: 1.2rem; vertical-align: -2px; }
.dropzone #prevImg { max-height: 150px; max-width: 100%; border-radius: 10px; display: block; margin: 0 auto .6rem; }
.img-current { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.img-current img { max-height: 110px; border-radius: 10px; border: 1px solid var(--line); }
.img-current.removed img { opacity: .25; filter: grayscale(1); }
.opt-card { display: flex; align-items: center; gap: .6rem; margin-bottom: .55rem; padding: .35rem; border: 2px solid transparent; border-radius: 14px; transition: .12s; }
.opt-card.ok { border-color: #34d399; background: #ecfdf5; }
.opt-key { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; color: var(--muted); }
.opt-card.ok .opt-key { background: #10b981; border-color: #10b981; color: #fff; }
.ok-badge { display: none; color: #059669; font-weight: 700; font-size: .8rem; white-space: nowrap; }
.opt-card.ok .ok-badge { display: inline; }
@media (max-width: 420px) { .opt-card.ok .ok-badge { display: none; } }
.opt-del { flex: none; min-height: 40px; width: 40px; padding: 0; }
.tf-card { flex: 1; border: 2px solid var(--line); border-radius: 14px; padding: 1rem .5rem; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .1rem; background: #fff; transition: .12s; }
.tf-card i { font-size: 1.8rem; color: #cbd5e1; }
.tf-card small { color: var(--muted); font-size: .72rem; }
.tf-card.on { border-color: #10b981; background: #ecfdf5; }
.tf-card.on i { color: #10b981; }
.tf-card.bad.on { border-color: #ef4444; background: #fef2f2; }
.tf-card.bad.on i { color: #ef4444; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: .4rem; }
.chips:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #ecfdf5; color: #047857; font-weight: 600; border-radius: 999px; padding: .3rem .4rem .3rem .8rem; }
.chip button { border: 0; background: rgba(0, 0, 0, .08); width: 22px; height: 22px; border-radius: 50%; line-height: 1; color: inherit; }
.chip-input { flex: 1; min-width: 140px; border: 0; outline: 0; padding: .4rem .5rem; font-size: 16px; background: transparent; }
.blank-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--brand-soft); border-radius: 12px; padding: .6rem .75rem; margin-bottom: .6rem; }
.blank-item { display: inline-flex; align-items: center; gap: .5rem; background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; border-radius: 999px; padding: .25rem .8rem .25rem .3rem; margin: 0 .4rem .4rem 0; }
.blank-item .n { width: 24px; height: 24px; border-radius: 50%; background: #10b981; color: #fff; font-size: .78rem; font-weight: 800; display: grid; place-items: center; }
.chip.bad { background: #fef2f2; color: #b91c1c; }
.sticky-side { position: sticky; top: 76px; }
.preview { background: linear-gradient(180deg, var(--brand-soft), #fff 70%); }
.preview .qno { font-size: .75rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.preview .qbody { font-size: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 .8rem; }
.choice.pv { min-height: 46px; padding: .6rem .8rem; margin-bottom: .45rem; cursor: default; font-size: .92rem; }
.choice.pv .lab { width: 28px; height: 28px; font-size: .85rem; }
.save-bar { position: fixed; left: 0; right: 0; bottom: 60px; z-index: 35; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: .6rem 1rem; display: flex; gap: .5rem; align-items: center; }
#qform { padding-bottom: 4.5rem; }
@media (min-width: 992px) { .save-bar { bottom: 0; left: 250px; padding: .7rem 2rem; } }

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .exam-tabs { display: none !important; }
  .content-wrap { margin: 0 !important; }
  .main { padding: 0 !important; max-width: none; }
  body { background: #fff; }
  .card-x { box-shadow: none; border: 0; }
}
