/* iTutor: tampilan "Buku Kotak" untuk HP. */
:root {
  --ground: #EEF3FB;
  --surface: #FFFFFF;
  --line: #D6DEEC;
  --line-strong: #C3CEE2;
  --grid: #E2EAF8;
  --ink: #18233F;
  --ink-2: #46536F;
  --blue: #2459E0;
  --blue-text: #1B46B8;
  --blue-tint: #E3ECFF;
  --orange: #D9590B;
  --orange-text: #8A3606;
  --orange-tint: #FFE9D6;
  --teal: #0B8A7A;
  --teal-text: #086B5F;
  --teal-tint: #DDF3EE;
  --yellow: #FFE08A;
  --red-text: #A32222;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.icon.small { width: 16px; height: 16px; }
.icon.large { width: 26px; height: 26px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- pieces ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--blue); color: #FFFFFF; }
.brand-name { font-size: 20px; font-weight: 800; }
.brand-large .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
.brand-large .brand-mark .icon { width: 28px; height: 28px; }
.brand-large .brand-name { font-size: 28px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px; border: 1px solid var(--line-strong); border-radius: 26px; background: var(--surface); font-size: 16px; font-weight: 800; }
.button.primary { border-color: var(--blue); background: var(--blue); color: #FFFFFF; }
.button.quiet { min-height: 44px; padding: 0 14px; border-color: transparent; background: transparent; color: var(--ink-2); font-size: 14px; }
.button.wide { width: 100%; }
.round { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); }
.round.primary { border-color: var(--blue); background: var(--blue); color: #FFFFFF; }
.field { min-width: 0; height: 52px; padding: 0 16px; border: 2px solid var(--line-strong); border-radius: 26px; background: var(--surface); font-size: 16px; font-weight: 600; }
.field:focus { border-color: var(--blue); outline: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); font-size: 14px; font-weight: 700; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.card h2 { font-size: 16px; font-weight: 800; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tag { margin-left: 6px; padding: 2px 8px; border-radius: 10px; background: var(--orange-tint); color: var(--orange-text); font-size: 11px; font-weight: 800; }
.banner { padding: 12px 14px; border-radius: 16px; background: var(--orange-tint); font-size: 14px; line-height: 1.45; }
.error { color: var(--red-text); font-size: 14px; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(440px, calc(100vw - 32px)); padding: 12px 18px; border-radius: 16px; background: var(--ink); color: #FFFFFF; font-size: 14px; line-height: 1.4; z-index: 10; }

/* ---- kode akses ---- */
.login { justify-content: center; gap: 14px; padding: 32px 24px; }
.login-title { margin-top: 18px; font-size: 26px; font-weight: 800; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.field-code { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---- beranda ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; }
.home-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px; padding: 0 16px 16px; }
.countdown { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: 22px; background: var(--blue); color: #FFFFFF; }
.countdown-label { font-size: 13px; font-weight: 700; color: #DCE7FF; }
.countdown-days { font-size: 34px; line-height: 1.15; font-weight: 800; }
.countdown-note { font-size: 14px; }
.today { display: flex; align-items: center; gap: 12px; }
.today-title { font-size: 17px; font-weight: 800; }
.glyph { display: flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border-radius: 14px; font-size: 24px; font-weight: 800; }
.glyph-orange { background: var(--orange-tint); color: var(--orange-text); }
.chip-teal { border-color: #BFE3DC; }
.askbar { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ground); border-top: 1px solid var(--line); }
.askbar .field { flex: 1 1 auto; }

/* ---- sesi ---- */
.session { height: 100vh; height: 100dvh; min-height: 0; }
.session-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.session-titles { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.session-kicker { font-size: 12px; font-weight: 800; color: var(--blue-text); }
.session-title { font-size: 17px; line-height: 1.25; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board {
  position: relative; flex: 1 1 0; min-height: 200px; margin: 0 12px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; background-color: var(--surface);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
.board iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.caption { display: flex; flex-direction: column; gap: 2px; min-height: 76px; padding: 10px 16px; }
.caption-who { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.caption-text { font-size: 16px; line-height: 1.4; }
.dock { display: flex; flex-direction: column; gap: 10px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.dock-chips { display: flex; gap: 8px; }
.dock-chips .chip { flex: 1 1 0; justify-content: center; padding: 0 8px; }
.askrow { display: flex; gap: 8px; }
.askrow .field { flex: 1 1 auto; }
.dock-main { display: flex; align-items: center; gap: 10px; }
.tutor { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
.tutor-text { min-width: 0; display: flex; flex-direction: column; }
.tutor-name { font-size: 14px; font-weight: 800; }
.tutor-status { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-side { flex: 1 1 0; display: flex; justify-content: flex-end; }
.mic { width: 60px; height: 60px; }
.mic .mic-off { display: none; }
.mic[aria-pressed="true"] { border-color: var(--orange); background: var(--orange); }
.mic[aria-pressed="true"] .mic-on { display: none; }
.mic[aria-pressed="true"] .mic-off { display: block; }
.voice-note { text-align: center; }

/* Orb: diam, berpikir, bicara, mendengarkan. */
.orb { position: relative; display: flex; align-items: center; justify-content: center; gap: 3px; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--blue); }
.orb i { width: 4px; height: 8px; border-radius: 2px; background: #FFFFFF; }
.orb[data-state="speaking"] i { height: 20px; animation: orb-bar 0.9s ease-in-out infinite; }
.orb[data-state="speaking"] i:nth-child(1) { height: 12px; }
.orb[data-state="speaking"] i:nth-child(2) { animation-delay: 0.15s; }
.orb[data-state="speaking"] i:nth-child(3) { height: 14px; animation-delay: 0.3s; }
.orb[data-state="thinking"] { background: var(--blue-tint); }
.orb[data-state="thinking"] i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: orb-dot 1s ease-in-out infinite; }
.orb[data-state="thinking"] i:nth-child(2) { animation-delay: 0.15s; }
.orb[data-state="thinking"] i:nth-child(3) { animation-delay: 0.3s; }
.orb[data-state="listening"] { background: var(--surface); box-shadow: inset 0 0 0 3px var(--blue); }
.orb[data-state="listening"] i { background: var(--orange); height: 14px; animation: orb-bar 0.7s ease-in-out infinite; }
.orb[data-state="listening"] i:nth-child(2) { animation-delay: 0.12s; }
.orb[data-state="listening"] i:nth-child(3) { animation-delay: 0.24s; }
@keyframes orb-bar { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }
@keyframes orb-dot { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .orb i { animation: none !important; } }

/* Layar lebar: tetap satu kolom seukuran HP, di tengah. */
@media (min-width: 520px) {
  body { background: #E4EBF7; }
  .app { background: var(--ground); box-shadow: 0 0 0 1px var(--line); }
}
