/* Panel dokter — mengikuti design system BISA (Inter, indigo #5b5bf0). */

:root {
  --indigo: #5b5bf0;
  --indigo-dark: #4747d4;
  --ink: #12143a;
  --muted: #5f6485;
  --line: #e5e7f5;
  --bg: #f6f7fc;
  --ok: #2fa97b;
  --warn: #e07b39;
  --err: #d33d5c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* Aman untuk poni & indikator home saat dipasang penuh layar di iPad. */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Tablet dioperasikan dengan jari bersarung, sering di dalam plastik barrier.
   Ketukan harus langsung jadi, tanpa jeda 300 ms, tanpa zoom tak sengaja, dan
   tanpa teks yang ikut terseleksi. */
button, .cue, .mode-card, label {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  touch-action: none;
}
body.in-vr #scene { display: block; }

/* Saat pratinjau, kanvas mengambil bagian atas layar dan panel aba-aba tetap
   bisa dipakai di bawahnya — dokter bisa mencoba tombolnya sambil melihat efeknya. */
/* z-index perlu: tanpa ini, kartu panel yang di-scroll ikut naik menutupi kanvas. */
body.previewing #scene { display: block; height: 58vh; z-index: 10; }
body.previewing .wrap { padding-top: calc(58vh + 20px); }

#preview-bar {
  position: fixed;
  left: 0; right: 0;
  top: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(18, 20, 58, 0.82);
  color: #fff;
  font-size: 12.5px;
  z-index: 20;
  backdrop-filter: blur(6px);
}
body.previewing #preview-bar { display: flex; }
#preview-bar button {
  font: inherit; font-weight: 600;
  background: #fff; color: var(--ink);
  border: 0; border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}

.actions { display: flex; gap: 10px; }
.actions .primary { flex: 1; }
.ghost {
  font: inherit; font-weight: 600; font-size: 14px;
  background: #fff; color: var(--indigo);
  border: 1.5px solid var(--indigo);
  border-radius: 11px;
  padding: 14px 18px;
  cursor: pointer;
  white-space: nowrap;
}
.ghost:hover { background: #f2f2ff; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

.head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--indigo);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 24px;
  flex: none;
}
h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.sub .by {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  border-radius: 999px; background: var(--primary-soft, #eeeefe);
  color: var(--indigo); font-size: 11px; font-weight: 700;
  letter-spacing: .02em; vertical-align: middle;
}

.pill {
  margin-left: auto;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ececf6;
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { background: #e2f6ee; color: var(--ok); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; letter-spacing: -0.01em; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  text-align: left;
  background: #fbfbff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, background .15s;
}
.mode-card:hover { border-color: #c9caf0; }
.mode-card.selected { border-color: var(--indigo); background: #f2f2ff; }
.mode-card .ico { font-size: 26px; }
.mode-card strong { font-size: 15px; }
.mode-card .desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
input[type="text"], select {
  font: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
input[type="range"] { accent-color: var(--indigo); margin-top: 10px; }

.note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 14px 0; }

.primary {
  font: inherit; font-weight: 700; font-size: 15px;
  background: var(--indigo); color: #fff;
  border: 0; border-radius: 11px;
  padding: 14px 22px;
  cursor: pointer;
  width: 100%;
}
.primary:hover:not(:disabled) { background: var(--indigo-dark); }
.primary:disabled { background: #c4c5e4; cursor: not-allowed; }

.status { font-size: 13px; color: var(--muted); margin: 10px 0 0; min-height: 18px; }
.status.err { color: var(--err); }

.cue-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cue {
  font: inherit; font-size: 12.5px; font-weight: 600;
  background: #f4f4fb;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  color: var(--ink);
  line-height: 1.3;
  text-align: center;
  min-height: 78px;
}
.cue:hover { border-color: var(--indigo); background: #f0f0ff; }
.cue:active { transform: scale(0.97); }

/* Sorotan saat monitor menyarankan aba-aba ini. Berdenyut pelan (2 detik) —
   cukup untuk menarik mata, jauh di bawah 3 Hz yang berisiko bagi anak
   sensitif cahaya, dan tidak mengganggu dokter yang sedang bekerja. */
.cue.disarankan {
  border-color: var(--warn);
  background: #fff3e6;
  animation: denyut 2s ease-in-out infinite;
}
@keyframes denyut {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,123,57,0.35); }
  50% { box-shadow: 0 0 0 8px rgba(224,123,57,0); }
}
.cue-ico { font-size: 22px; }
.cue-bicara { background: #fff6ec; }
.cue-selesai { background: #eaf8f2; }
.cue-stop { background: #fdeef1; }
.cue-center, .cue-mulai { background: #eef0ff; }

.sesi { font-size: 13px; font-weight: 600; color: var(--indigo); margin: 14px 0 0; min-height: 18px; }

.log {
  margin-top: 10px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 11.5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.8;
}

/* Peringatan penguncian layar — hanya muncul kalau perangkatnya tidak mendukung. */
.layar-nota {
  display: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 11px;
  background: #fff3e6;
  border: 1px solid #f0c69a;
  color: #8a4b12;
  font-size: 12.5px;
  line-height: 1.55;
}
.layar-nota.tampil { display: block; }

/* --- Sebelum → Sesudah --- */

.banding {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
  background: #fbfbff;
}
.banding-judul { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.banding-isi { display: flex; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.banding-kolom { display: flex; flex-direction: column; }
.banding-kolom span { font-size: 11.5px; color: var(--muted); }
.banding-kolom strong { font-size: 20px; letter-spacing: -0.01em; }
.banding-panah { color: var(--muted); font-size: 18px; }
.banding-delta { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.banding-delta.turun { background: #e2f6ee; color: var(--ok); }
.banding-delta.naik { background: #fdeef1; color: var(--err); }
.banding-nota { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* --- Cermin layar anak --- */

.cermin-baris { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cermin-sakelar { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; }
.cermin-nota { margin: 0; font-size: 11.5px; flex: 1 1 200px; }
.cermin-fps { padding: 6px 10px; font-size: 12.5px; }

.cermin-kotak {
  display: none;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #12143a;
  margin-bottom: 14px;
}
.cermin-kotak.aktif { display: block; }
.cermin-kotak img { width: 100%; height: 100%; object-fit: cover; display: block; }
#cermin-status {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #9096b8; font-size: 12.5px; text-align: center; padding: 12px;
}
.cermin-kotak.ada-gambar #cermin-status { display: none; }

/* --- Monitor fisiologis --- */

.monitor-card h2 { display: flex; align-items: center; gap: 10px; }
.monitor-card h2 .pill { margin-left: auto; }

.mon-head { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.mon-badge {
  font-size: 13px; font-weight: 700;
  padding: 8px 14px; border-radius: 10px;
  background: #ececf6; color: var(--muted);
}

.mon-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mon-sig {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fcfcff;
}
.mon-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mon-label em { font-style: normal; font-weight: 500; opacity: .7; }
.mon-val { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
/* Sinyal tidak layak tampil sebagai "—" yang redup, bukan angka basi. */
.mon-val.mati { color: #c4c5e4; }
.mon-chart { width: 100%; height: 74px; display: block; }
.mon-mutu { font-size: 11px; color: var(--muted); }
.mon-mutu.warn { color: var(--err); font-weight: 600; }

.mon-aksi {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 16px;
}
.mon-aksi .ghost { padding: 11px 16px; font-size: 13.5px; }
.mon-scr { font-size: 13px; color: var(--muted); }
.mon-scr strong { color: var(--ink); }
.mon-auto { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.mon-auto input { width: 20px; height: 20px; accent-color: var(--indigo); }

@media (max-width: 760px) {
  .mon-grid { grid-template-columns: 1fr; }
}

.checklist ul { margin: 0; padding-left: 18px; }
.checklist li { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-bottom: 8px; }
.checklist em { color: var(--ink); font-style: normal; font-weight: 600; }

.foot { text-align: center; font-size: 11.5px; color: #9096b8; margin-top: 24px; }

@media (max-width: 860px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .modes, .grid, .grid-4 { grid-template-columns: 1fr; }
  .cue-grid { grid-template-columns: repeat(3, 1fr); }
}
