:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687087;
  --paper: #fffdf7;
  --accent: #6757d9;
  --accent-soft: #ece9ff;
  --line: #dfe2eb;
  --success: #1d8b5c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f3f2ee; color: var(--ink); }
header { height: 92px; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.84); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; }
h2 { margin-bottom: 10px; font-size: 16px; }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
button { border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); padding: 9px 13px; cursor: pointer; font-weight: 650; }
button:hover { border-color: #b8bccc; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, button.active { background: var(--accent); color: white; border-color: var(--accent); }
.session-controls { display: flex; align-items: center; gap: 9px; }
.language-picker { position: relative; }
.language-picker > button { white-space: nowrap; }
.language-menu { position: absolute; z-index: 20; top: calc(100% + 7px); left: 0; min-width: 205px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 10px 28px rgba(23,32,51,.16); }
.language-menu[hidden] { display: none; }
.language-menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 9px 10px; border: 0; text-align: left; }
.language-menu button[aria-checked="true"] { background: var(--accent-soft); color: #4c3fb0; }
.badge { padding: 7px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eceef3; }
.badge.connected { background: #dbf5e9; color: var(--success); }
.badge.error { background: #ffe2e2; color: #a12727; }
main { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; height: calc(100vh - 92px); padding: 18px; }
.board-panel { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: white; box-shadow: 0 8px 28px rgba(31,36,50,.07); }
.toolbar { min-height: 54px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; overflow-x: auto; overflow-y: hidden; border-bottom: 1px solid var(--line); }
.toolbar label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; }
.toolbar input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; }
.simulation-controls { display: flex; gap: 5px; padding-left: 8px; border-left: 1px solid var(--line); }
.simulation-controls[hidden] { display: none; }
.simulation-controls button { padding: 7px 9px; }
.simulation-controls select { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-weight: 650; }
.breadboard-controls { display: flex; gap: 5px; align-items: center; padding-left: 8px; border-left: 1px solid var(--line); }
.breadboard-controls[hidden] { display: none; }
.breadboard-controls select, .breadboard-controls input { max-width: 92px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.breadboard-controls button { padding: 7px 9px; }
.scope-controls { display: flex; gap: 5px; align-items: center; padding-left: 8px; border-left: 1px solid var(--line); }
.scope-controls[hidden] { display: none; }
.scope-controls label { font-size: 11px; }
.scope-controls select, .scope-controls input { max-width: 76px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: white; }
.spacer { flex: 1; }
#uploadProblemButton.busy { cursor: progress; opacity: .7; }
#boardFrame { position: relative; flex: 1; min-height: 400px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: #9aa4b5 #f1f3f7; background-color: var(--paper); background-image: radial-gradient(#d8d5ca 1px, transparent 1px); background-size: 22px 22px; }
#boardFrame::-webkit-scrollbar { width: 12px; }
#boardFrame::-webkit-scrollbar-track { background: #f1f3f7; }
#boardFrame::-webkit-scrollbar-thumb { border: 3px solid #f1f3f7; border-radius: 10px; background: #9aa4b5; }
#boardSurface { position: relative; width: 100%; min-height: 100%; }
#whiteboard { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: crosshair; }
#teacherPointer { --pointer-x: 50%; --pointer-y: 50%; position: absolute; left: var(--pointer-x); top: var(--pointer-y); display: none; transform: translate(-50%,-50%); transition: left .48s cubic-bezier(.22,.8,.3,1), top .48s cubic-bezier(.22,.8,.3,1); pointer-events: none; z-index: 100; }
#teacherPointer.visible { display: flex; }
.pointer-dot { width: 20px; height: 20px; flex: none; border: 2px solid rgba(220, 20, 45, .82); border-radius: 50%; background: rgba(255, 31, 54, .34); box-shadow: 0 0 0 4px rgba(255, 31, 54, .10); animation: pointerPulse .75s ease-in-out infinite alternate; }
#pointerLabel { display: none; }
@keyframes pointerPulse { to { transform: scale(1.18); background: rgba(255, 31, 54, .22); } }
#boardHint { position: sticky; top: calc(100% - 28px); margin: 0 18px; width: max-content; color: #8b8b85; font-size: 12px; pointer-events: none; z-index: 2; }
aside { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.9); overflow: hidden; }
.tutor-card { display: flex; align-items: center; gap: 12px; }
.tutor-card p { margin: 0; color: var(--muted); font-size: 13px; }
.orb { width: 50px; height: 50px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); }
.orb span { width: 17px; height: 17px; border-radius: 50%; background: var(--accent); }
.orb.speaking span { animation: pulse .8s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.75); opacity: .45; } }
.transcript { height: 240px; overflow: auto; font-size: 13px; line-height: 1.45; }
.transcript p { padding: 8px 9px; margin: 0 0 7px; border-radius: 8px; background: #f4f5f8; }
.transcript p.assistant { background: var(--accent-soft); }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.scene-card { flex: 1; min-height: 120px; }
.lesson-state { display: inline-block; margin: 0 0 14px; padding: 5px 8px; border-radius: 7px; background: var(--accent-soft); color: #4c3fb0; font-size: 12px; font-weight: 750; }
dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); box-shadow: 0 22px 70px rgba(23,32,51,.24); }
dialog::backdrop { background: rgba(23,32,51,.42); backdrop-filter: blur(2px); }
.dialog-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); background: white; }
.dialog-header h2 { margin: 0; font-size: 21px; }
#lessonBankClose { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 24px; line-height: 1; }
.lesson-search, .lesson-import, .material-browser { padding: 19px 20px; }
.lesson-search { border-bottom: 1px solid var(--line); }
.lesson-search > label, .lesson-import label { display: grid; gap: 6px; margin-bottom: 13px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.input-row input, .lesson-import input, .lesson-import select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); font: inherit; }
.lesson-search-status { min-height: 20px; margin: 8px 0 0; }
.material-browser { border-bottom: 1px solid var(--line); background: #fcfcfd; }
.material-browser-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.material-browser-heading h3 { margin: 0 0 3px; font-size: 16px; }
.material-browser-heading p { margin-bottom: 12px; }
#materialStartStatus { max-width: 240px; text-align: right; }
.material-tabs { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: thin; }
.material-tabs button { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 8px 11px; border-radius: 999px; }
.material-tabs button[aria-selected="true"] { color: white; border-color: var(--accent); background: var(--accent); }
.material-tabs button.no-results { opacity: .48; }
.material-tab-count { display: inline-grid; min-width: 21px; height: 21px; padding: 0 6px; place-items: center; border-radius: 999px; background: #eceafc; color: #4c3fb0; font-size: 11px; font-weight: 850; }
.material-tabs button[aria-selected="true"] .material-tab-count { background: rgba(255,255,255,.22); color: white; }
.material-catalog { display: grid; gap: 15px; max-height: min(390px, 48vh); overflow: auto; padding-right: 5px; }
.material-empty { margin: 4px 0 12px; padding: 22px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.material-level h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.material-level h4::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.material-group { margin-bottom: 10px; }
.material-group-title { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.material-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.material-item { min-height: 48px; padding: 9px 10px; text-align: left; line-height: 1.3; background: white; }
.material-item small { display: block; margin-top: 3px; color: var(--muted); font-weight: 550; }
.material-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.lesson-import h3 { margin: 0 0 5px; font-size: 16px; }
/* Pengaturan */
body[data-realtime-voice="off"] #startButton,
body[data-realtime-voice="off"] #stopButton,
body[data-realtime-voice="off"] #connectionBadge { display: none; }
.settings-dialog { width: min(520px, calc(100vw - 32px)); }
.settings-body { padding: 6px 20px 20px; }
.settings-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.settings-section h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.setting-text { display: grid; gap: 4px; }
.setting-text .muted { font-size: 13px; line-height: 1.45; }
.setting-note { margin: 10px 0 0; font-size: 13px; }
.switch { appearance: none; flex: none; position: relative; width: 48px; height: 28px; margin: 0; border-radius: 999px; background: #cfd3de; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(23,32,51,.3); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.account-info { display: grid; gap: 8px; margin: 0 0 14px; }
.account-info div { display: flex; justify-content: space-between; gap: 12px; }
.account-info dt { color: var(--muted); }
.account-info dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; text-align: right; }
.settings-footnote { margin: 14px 0 0; font-size: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
button.danger { background: #c2412d; border-color: #c2412d; color: white; }
.danger-zone h3 { color: #c2412d; }
.danger-zone p { font-size: 13px; }
.danger-zone button.danger { background: white; color: #c2412d; }
.danger-zone button.danger:hover { background: #fdf0ed; }

/* Saldo kredit di header */
.credit-badge { display: inline-block; align-items: center; gap: 4px; white-space: nowrap; background: var(--accent-soft); border-color: transparent; color: #4c3fb0; }
.credit-badge.low { background: #fdeceb; color: #b3321f; }
.credit-badge[hidden] { display: none; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.credit-badge .icon { margin-right: 5px; }

/* Menu akun */
.account-menu { position: relative; }
.account-menu[hidden] { display: none; }
.account-button { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; border-radius: 999px; }
.account-button .chevron { width: 16px; height: 16px; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; font-weight: 800; font-size: 15px; text-transform: uppercase; }
.avatar .icon { width: 18px; height: 18px; }
.account-dropdown { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: 260px; padding: 6px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 12px 32px rgba(23,32,51,.18); }
.account-dropdown[hidden] { display: none; }
.account-summary { display: grid; gap: 3px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.account-summary strong { overflow-wrap: anywhere; font-size: 14px; }
.account-summary .muted { font-size: 13px; }
.account-dropdown button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 9px; background: none; text-align: left; font-weight: 600; }
.account-dropdown button:hover, .account-dropdown button:focus-visible { background: var(--accent-soft); color: #4c3fb0; outline: none; }
.account-dropdown #menuLogout { color: #b3321f; }
.account-dropdown #menuLogout:hover { background: #fdeceb; }

/* Dialog Kredit */
.credits-dialog { width: min(680px, calc(100vw - 32px)); }
.credits-body { padding: 6px 20px 20px; }
.balance-panel { padding: 16px 0; border-bottom: 1px solid var(--line); }
.balance-panel p { margin: 0; }
.balance-amount { margin: 4px 0 6px !important; font-size: 30px; }
.credit-packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.credit-package { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.credit-package h4 { margin: 0; font-size: 15px; }
.credit-package p { margin: 0; }
.package-credits strong { font-size: 22px; }
.package-price { font-weight: 700; }
.credit-package button { margin-top: 6px; }
.credits-message { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.credits-message[data-kind="success"] { background: #e5f5ec; color: var(--success); }
.credits-message[data-kind="error"] { background: #fdeceb; color: #b3321f; }
.credits-note { margin: 10px 0 0; font-size: 12px; }
.credit-expiry { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted, #626b80); }
.credit-expiry li + li { margin-top: 2px; }
.credit-expiry .soon { color: #b3321f; font-weight: 600; }
.table-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger th, .ledger td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.ledger td:nth-child(2) { white-space: normal; min-width: 140px; }
.ledger th:nth-child(n+3), .ledger td:nth-child(n+3) { text-align: right; }
.ledger .positive { color: var(--success); }
.ledger .negative { color: #b3321f; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }

/* Tutup akun */
.close-account-facts { margin: 16px 0; padding-left: 20px; line-height: 1.6; font-size: 14px; }
.confirm-label { display: block; margin-bottom: 6px; font-size: 14px; }
#closeAccountConfirm { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; letter-spacing: .05em; }

/* Masuk / Daftar */
.auth-dialog { width: min(420px, calc(100vw - 32px)); }
.auth-dialog::backdrop { background: rgba(23,32,51,.6); backdrop-filter: blur(4px); }
.auth-card { display: grid; gap: 12px; padding: 24px; }
.auth-card h2 { margin: 0 0 4px; font-size: 22px; }
.auth-card .eyebrow { margin: 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 11px; background: #f1f1f5; }
.auth-tabs button { border: 0; background: transparent; }
.auth-tabs button[aria-selected="true"] { background: white; box-shadow: 0 1px 3px rgba(23,32,51,.15); }
.google-button { padding: 11px 13px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#authForm { display: grid; gap: 10px; }
#authForm[hidden] { display: none; }
#authForm label { display: grid; gap: 5px; font-size: 14px; font-weight: 600; }
#authForm input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-weight: 400; }
.auth-hint { margin: -4px 0 0; font-size: 12px; }
#authForm label[for] { font-size: 14px; font-weight: 600; margin-bottom: -5px; }
#authForm label[hidden], .password-field[hidden], .password-rules[hidden] { display: none; }
.password-field { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.password-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#authForm .password-field input, .password-field input { flex: 1; min-width: 0; border: 0; border-radius: 9px 0 0 9px; outline: none; padding: 10px 12px; font: inherit; }
.password-toggle { border: 0; border-left: 1px solid var(--line); border-radius: 0 9px 9px 0; background: #f6f6f9; padding: 0 12px; font-size: 13px; font-weight: 650; color: var(--accent); cursor: pointer; }
.password-rules { margin: -2px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 12px; color: var(--muted); }
.password-rules .ok { color: var(--success); }
@media (max-width: 420px) { .password-rules { grid-template-columns: 1fr; } }
.auth-verify { display: grid; gap: 8px; }
.auth-verify[hidden] { display: none; }
.auth-verify p { margin: 0; font-size: 14px; line-height: 1.5; }
.link-button { justify-self: start; padding: 4px 0; border: 0; background: none; color: var(--accent); font-weight: 600; }
.link-button[hidden] { display: none; }
.auth-status { min-height: 1.2em; margin: 0; font-size: 14px; color: #b3321f; }
.auth-status[data-kind="info"] { color: var(--muted); }
.auth-status[data-kind="success"] { color: var(--success); }
.auth-note { margin: 0; font-size: 12px; }
.google-button[hidden] { display: none; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
#lessonImportStatus { flex: 1; margin: 0; }
#lessonImportStatus.success { color: var(--success); font-weight: 700; }
#lessonImportStatus.error { color: #a12727; font-weight: 700; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; height: auto; }
  .board-panel { height: 65vh; }
  aside { display: grid; grid-template-columns: 1fr 1fr; }
  .tutor-card { grid-column: 1 / -1; }
  .session-controls { flex-wrap: wrap; justify-content: flex-end; }
  .material-grid { grid-template-columns: 1fr; }
}

#countingBoard { padding: clamp(12px, 3vw, 28px); }
.counting-panels { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; margin-bottom: 16px; }
.counting-panels > div { min-width: 0; padding: 16px; background: #fffdf7; border: 1px solid var(--line); border-radius: 12px; }
.counting-panels h2 { margin: 0 0 12px; font-size: 16px; }
.counting-objects { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(44px, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.counting-objects li { display: grid; justify-items: center; align-content: center; padding: 3px; border: 2px solid transparent; border-radius: 8px; }
.counting-objects .count-focus { border-color: #5042b9; background: #eeeaff; }
.counting-objects img { width: 100%; max-width: 64px; aspect-ratio: 1; object-fit: contain; }
.counting-objects span { font-weight: 700; }
.counting-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.counting-buttons button { min-height: 42px; }
@media (max-width: 620px) {
  .counting-panels { grid-template-columns: 1fr; }
}
dialog.cloud-auth{border:0;border-radius:18px;padding:0;box-shadow:0 24px 70px #17203340;max-width:420px;width:calc(100% - 32px)}
dialog.cloud-auth::backdrop{background:#17203399;backdrop-filter:blur(4px)}
.cloud-auth-card{display:grid;gap:16px;padding:28px}.cloud-auth-card h2,.cloud-auth-card p{margin:0}
.cloud-auth-card label{display:grid;gap:7px;font-weight:700}.cloud-auth-card input{font:inherit;padding:11px 12px;border:1px solid #cfd5e3;border-radius:9px}
.cloud-auth-card>div{display:flex;gap:10px}.cloud-auth-error{color:#b42318;min-height:1.4em}

/* ===== Revamp 2026-11-25: header bermerek, toolbar ikon, maskot tutor, panel pengembang ===== */
header { position: relative; z-index: 40; height: 72px; padding: 12px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); }
/* backdrop-filter membuat stacking context: header perlu z-index agar menu akun/bahasa tidak tertutup isi halaman. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; flex: none; border-radius: 12px; box-shadow: 0 2px 8px rgba(23,32,51,.12); }
.brand h1 { font-size: 20px; line-height: 1.15; }
.brand .eyebrow { font-size: 10px; }
main { height: calc(100vh - 72px); }

/* Ikon (CSS mask) — tetap tampil walau app.js mengganti teks tombol */
.icon-only, .with-icon, #startButton, #stopButton { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.icon-only::before, .with-icon::before, #startButton::before, #stopButton::before {
  content: ""; width: 19px; height: 19px; flex: none; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.icon-only { width: 40px; height: 40px; padding: 0; font-size: 0; border-radius: 10px; }
.with-icon.small { padding: 6px 10px; font-size: 12px; }
.with-icon.small::before { width: 14px; height: 14px; }
.toolbar { gap: 6px; padding: 8px 12px; }
.toolbar .icon-only { border-color: transparent; background: transparent; color: #3d4559; }
.toolbar .icon-only:hover { background: #f1f1f6; border-color: transparent; }
.toolbar .icon-only.active { background: var(--accent); color: white; }
.toolbar .icon-only:disabled { opacity: .55; }
#uploadProblemButton.busy::before, #visionButton:disabled::before { animation: iconPulse .9s ease-in-out infinite alternate; }
@keyframes iconPulse { to { opacity: .25; } }
.tool-sep { width: 1px; height: 24px; margin: 0 4px; background: var(--line); flex: none; }
.tool-field { display: inline-flex; align-items: center; height: 40px; padding: 0 6px; border-radius: 10px; }
.tool-field:hover { background: #f1f1f6; }
.toolbar .tool-field input[type=color] { width: 28px; height: 28px; padding: 0; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.toolbar .tool-field input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.toolbar .tool-field input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.toolbar .tool-field input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
.size-field input { width: 90px; accent-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[data-tool="pen"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M12 20h9%22/%3E%3Cpath d=%22M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z%22/%3E%3C/svg%3E"); }
[data-tool="eraser"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22m7 21-4.3-4.3a1 1 0 0 1 0-1.4l9.6-9.6a1 1 0 0 1 1.4 0l5.6 5.6a1 1 0 0 1 0 1.4L13 21%22/%3E%3Cpath d=%22M22 21H7%22/%3E%3Cpath d=%22m5 11 9 9%22/%3E%3C/svg%3E"); }
#uploadProblemButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%223%22 y=%223%22 width=%2218%22 height=%2218%22 rx=%222%22/%3E%3Ccircle cx=%229%22 cy=%229%22 r=%222%22/%3E%3Cpath d=%22m21 15-3.1-3.1a2 2 0 0 0-2.8 0L6 21%22/%3E%3C/svg%3E"); }
#visionButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M3 7V5a2 2 0 0 1 2-2h2%22/%3E%3Cpath d=%22M17 3h2a2 2 0 0 1 2 2v2%22/%3E%3Cpath d=%22M21 17v2a2 2 0 0 1-2 2h-2%22/%3E%3Cpath d=%22M7 21H5a2 2 0 0 1-2-2v-2%22/%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%221%22/%3E%3Cpath d=%22M18.9 12.4a1 1 0 0 0 0-.8 7.5 7.5 0 0 0-13.8 0 1 1 0 0 0 0 .8 7.5 7.5 0 0 0 13.8 0%22/%3E%3C/svg%3E"); }
#undoButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M9 14 4 9l5-5%22/%3E%3Cpath d=%22M4 9h10.5a5.5 5.5 0 0 1 0 11H11%22/%3E%3C/svg%3E"); }
#clearButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M3 6h18%22/%3E%3Cpath d=%22M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6%22/%3E%3Cpath d=%22M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2%22/%3E%3C/svg%3E"); }
#exportButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4%22/%3E%3Cpath d=%22m7 10 5 5 5-5%22/%3E%3Cpath d=%22M12 15V3%22/%3E%3C/svg%3E"); }
#lessonBankButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20%22/%3E%3Cpath d=%22M8 7h8%22/%3E%3C/svg%3E"); }
#resumeLessonButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22m7 4 13 8-13 8V4z%22/%3E%3C/svg%3E"); }
#startButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M22 16.9v3a2 2 0 0 1-2.2 2 19.8 19.8 0 0 1-8.6-3.1 19.5 19.5 0 0 1-6-6A19.8 19.8 0 0 1 2.1 4.2 2 2 0 0 1 4.1 2h3a2 2 0 0 1 2 1.7c.1 1 .4 1.9.7 2.8a2 2 0 0 1-.5 2.1L8 9.9a16 16 0 0 0 6 6l1.3-1.3a2 2 0 0 1 2.1-.4c.9.3 1.8.6 2.8.7a2 2 0 0 1 1.7 2z%22/%3E%3C/svg%3E"); }
#stopButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%226%22 y=%226%22 width=%2212%22 height=%2212%22 rx=%222%22/%3E%3C/svg%3E"); }

/* Kartu tutor dengan maskot Nonet */
.tutor-card { align-items: flex-start; gap: 14px; padding: 16px; background: linear-gradient(135deg, #fff8e6, #ffffff 60%); }
.tutor-avatar { position: relative; width: 76px; height: 76px; flex: none; }
.tutor-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 14px rgba(180,120,40,.25); position: relative; z-index: 1; }
.tutor-avatar::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid #f4b740; opacity: 0; }
.tutor-avatar.speaking::after { animation: speakRing 1s ease-out infinite; }
.tutor-avatar.speaking img { animation: speakBob .5s ease-in-out infinite alternate; }
@keyframes speakRing { from { opacity: .9; transform: scale(.95); } to { opacity: 0; transform: scale(1.18); } }
@keyframes speakBob { to { transform: translateY(-2px) rotate(-2deg); } }
.tutor-info { min-width: 0; display: grid; gap: 6px; }
.tutor-info h2 { margin: 2px 0 0; font-size: 18px; }
.tutor-info p { font-size: 13px; line-height: 1.45; }
.tutor-info #resumeLessonButton { justify-self: start; }
#lessonChoices { display: grid; gap: 6px; }
#lessonChoices[hidden] { display: none; }
#lessonChoices p { margin: 4px 0 0; }

/* Percakapan mengisi sisa tinggi; panel pengembang disembunyikan secara default */
.transcript-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.transcript-card .transcript { flex: 1; height: auto; min-height: 160px; }
body:not([data-dev-mode="on"]) .dev-only { display: none !important; }
.scene-card { flex: 0 0 auto; max-height: 34%; overflow: auto; }

@media (max-width: 900px) {
  #lessonBankButton .label { display: none; }
  #lessonBankButton { width: 40px; height: 40px; padding: 0; }
  .transcript-card .transcript { height: 220px; flex: none; }
  main { height: auto; }
  .transcript-card { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  header { height: auto; min-height: 64px; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .brand h1 { font-size: 17px; }
  .brand-logo { width: 38px; height: 38px; }
  main { height: auto; }
  .size-field input { width: 56px; }
  .toolbar { gap: 2px; padding: 6px 8px; }
  .toolbar .icon-only { width: 36px; height: 36px; }
  .tool-field { padding: 0 3px; }
  .tool-sep { margin: 0 2px; }
}

/* ===== Suara OpenAI: mic + kotak ketik ===== */
body[data-realtime-voice="off"]:not([data-lesson-paused="on"]) #resumeLessonButton { display: none; }
.composer { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea { flex: 1; min-width: 0; max-height: 160px; padding: 8px 4px; border: 0; outline: none; background: transparent; font: inherit; font-size: 14px; line-height: 1.4; resize: none; overflow-y: auto; }
.mic-button { --level: 0; position: relative; flex: none; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(103,87,217,.35); }
.mic-button::before { content: ""; width: 22px; height: 22px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%229%22 y=%222%22 width=%226%22 height=%2212%22 rx=%223%22/%3E%3Cpath d=%22M19 10v1a7 7 0 0 1-14 0v-1%22/%3E%3Cpath d=%22M12 18v4%22/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%229%22 y=%222%22 width=%226%22 height=%2212%22 rx=%223%22/%3E%3Cpath d=%22M19 10v1a7 7 0 0 1-14 0v-1%22/%3E%3Cpath d=%22M12 18v4%22/%3E%3C/svg%3E") center / contain no-repeat; }
.mic-button::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 3px solid currentColor; opacity: 0; pointer-events: none; }
.mic-button:hover { filter: brightness(1.08); }
body[data-voice-state="recording"] .mic-button { background: #d93b2b; box-shadow: 0 0 0 calc(var(--level) * 14px) rgba(217,59,43,.22), 0 4px 12px rgba(217,59,43,.4); }
body[data-voice-state="recording"] .mic-button::after { color: #d93b2b; animation: micRing 1.1s ease-out infinite; }
body[data-voice-state="thinking"] .mic-button { background: #9a92e6; cursor: progress; opacity: 1; }
body[data-voice-state="thinking"] .mic-button::before { animation: iconPulse .7s ease-in-out infinite alternate; }
body[data-voice-state="speaking"] .mic-button { background: #f4b740; color: #3b2a05; }
body[data-voice-state="speaking"] .mic-button::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%226%22 y=%226%22 width=%2212%22 height=%2212%22 rx=%222%22/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%226%22 y=%226%22 width=%2212%22 height=%2212%22 rx=%222%22/%3E%3C/svg%3E"); }
@keyframes micRing { from { opacity: .8; transform: scale(.95); } to { opacity: 0; transform: scale(1.35); } }
.send-button { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22M22 2 11 13%22/%3E%3Cpath d=%22M22 2 15 22l-4-9-9-4z%22/%3E%3C/svg%3E"); flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--accent); background: transparent; }
.send-button:hover { background: var(--accent-soft); }
.voice-hint { min-height: 1.2em; margin: 6px 4px 0; font-size: 12px; color: var(--muted); }
.voice-hint[data-kind="error"] { color: #b3321f; }
.transcript p.user { background: #f4f5f8; }
.voice-hint-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.voice-hint-row .voice-hint { flex: 1; }
#voiceRetry { padding: 0; font-size: 12px; }

/* Kontrol suara saat Nonet berbicara */
.speech-controls { display: none; flex-wrap: wrap; gap: 6px; }
body[data-voice-state="speaking"] .speech-controls { display: flex; }
#speechResumeButton, body[data-speech-paused="on"] #speechPauseButton { display: none; }
body[data-speech-paused="on"] #speechResumeButton { display: inline-flex; }
#speechPauseButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%226%22 y=%225%22 width=%224%22 height=%2214%22 rx=%221%22/%3E%3Crect x=%2214%22 y=%225%22 width=%224%22 height=%2214%22 rx=%221%22/%3E%3C/svg%3E"); }
#speechResumeButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d=%22m7 4 13 8-13 8V4z%22/%3E%3C/svg%3E"); }
#speechStopButton { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x=%226%22 y=%226%22 width=%2212%22 height=%2212%22 rx=%222%22/%3E%3C/svg%3E"); color: #b3321f; }
#speechStopButton:hover { background: #fdeceb; border-color: #f2c4bd; }
body[data-speech-paused="on"] .tutor-avatar img { filter: saturate(.6); }
.speech-control { width: 36px; height: 36px; border-radius: 50%; }
.speech-control::before { width: 17px; height: 17px; }
body[data-voice-state="recording"][data-mic-quiet="on"] .mic-button { background: #e2766b; }
body[data-voice-state="recording"][data-mic-quiet="on"] .mic-button::after { animation-duration: 2.2s; opacity: .5; }

/* Pilihan setelah materi selesai */
#lessonChoices > button { justify-self: start; min-width: 150px; text-align: left; }
.lesson-choices-more { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.lesson-choices-more .link-button { font-size: 12px; }
.composer { border-radius: 24px; }
.pending-payments { display: grid; gap: 6px; margin-top: 10px; }
.pending-payments[hidden] { display: none; }
.pending-payment { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 1px dashed #e3b341; border-radius: 10px; background: #fffaf0; font-size: 13px; }
/* Halaman selesai pembayaran */
body.payment-finish { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.payment-card { max-width: 420px; padding: 32px 28px; border: 1px solid var(--line); border-radius: 18px; background: white; text-align: center; box-shadow: 0 12px 40px rgba(23,32,51,.1); }
.payment-card img { border-radius: 50%; }
.payment-card h1 { margin: 14px 0 8px; font-size: 22px; }
.payment-card p { color: var(--muted); line-height: 1.55; }
.payment-back { display: inline-block; margin-top: 8px; padding: 11px 18px; border-radius: 10px; background: var(--accent); color: white; font-weight: 700; text-decoration: none; }

/* Mata pelajaran yang dikunci (segera hadir) */
.material-tabs button.locked { opacity: .7; }
.material-tabs button.locked .material-tab-count { background: #fff4dd; color: #8a5a00; }
.material-locked { display: grid; justify-items: center; gap: 10px; padding: 36px 18px; text-align: center; border: 1px dashed #d9d4f5; border-radius: 16px; background: #faf9ff; }
.material-locked span { font-size: 30px; }
.material-locked p { margin: 0; max-width: 34ch; color: #4a5168; line-height: 1.5; }

/* Kirim masukan */
.feedback-button { display: inline-flex; align-items: center; gap: 7px; }
.feedback-button .icon, #menuFeedback .icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feedback-form { display: grid; gap: 16px; padding: 4px 22px 22px; }
.feedback-form > p.muted { margin: 0; line-height: 1.5; }
.feedback-form fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.feedback-form legend { margin-bottom: 8px; font-weight: 750; }
.rating-options { display: flex; gap: 8px; }
.rating-options button { width: 48px; height: 48px; padding: 0; font-size: 24px; border-radius: 14px; transition: transform .15s, background .15s; }
.rating-options button:hover { transform: translateY(-2px); }
.rating-options button[aria-checked="true"] { background: #eeeaff; border-color: var(--accent); box-shadow: 0 0 0 2px #d9d3ff; }
.feedback-category { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feedback-category label { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.feedback-category label:has(input:checked) { border-color: var(--accent); background: #f6f4ff; }
.feedback-message { display: grid; gap: 6px; font-weight: 750; }
.feedback-message textarea { width: 100%; resize: vertical; min-height: 110px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-weight: 400; }
.feedback-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feedback-status { margin: 0; min-height: 1.2em; font-size: 14px; }
.feedback-status.success { color: #17683f; }
.feedback-status.error { color: #b3261e; }
@media (max-width: 900px) {
  .feedback-button .label { display: none; }
  .feedback-button { width: 40px; height: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 620px) { .feedback-category { grid-template-columns: 1fr; } }

/* Login: logo Google dan tombol Batal (kembali ke beranda nonet-ai.com) */
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; }
.google-logo { width: 20px; height: 20px; flex: none; }
.auth-cancel { display: block; width: 100%; margin-top: 14px; padding: 11px 13px; color: #4a5168; }
.auth-cancel:hover { background: #f4f4f8; color: #172033; }

/* Kunci ruang belajar sampai pengguna login (kelas auth-pending ada di HTML sejak awal; dibuka cloud-client.js). */
.auth-gate { display: none; }
html.auth-pending .auth-gate { display: flex; position: fixed; inset: 0; z-index: 40; align-items: center; justify-content: center; background: rgba(247,245,239,.55); }
.auth-gate > div { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-radius: 16px; background: #fff; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(23,32,54,.12); font-weight: 650; }
.auth-gate-spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: auth-gate-spin .8s linear infinite; }
@keyframes auth-gate-spin { to { transform: rotate(360deg); } }
html.auth-pending body > :not(dialog):not(.auth-gate):not(script) { pointer-events: none; user-select: none; -webkit-user-select: none; filter: blur(2px); }
@media (prefers-reduced-motion: reduce) { .auth-gate-spinner { animation: none; } }

/* Halaman tautan email akun (akun.html): verifikasi email, reset kata sandi. */
body.account-action-page { min-height: 100vh; height: auto; overflow: auto; display: block; background: #f7f5ef; }
.account-action { max-width: 460px; margin: 0 auto; padding: 48px 16px; display: grid; gap: 20px; }
.account-action-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; color: #172033; text-decoration: none; }
.account-action-brand img { border-radius: 50%; }
.account-action-card { display: grid; gap: 12px; padding: 26px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 50px rgba(23,32,54,.08); }
.account-action-card h1 { margin: 0; font-size: 22px; }
.account-action-card > p { margin: 0; line-height: 1.6; }
.account-action-card > p.error { color: #b3321f; }
.account-action-card form { display: grid; gap: 10px; }
.account-action-card form[hidden], .account-action-button[hidden] { display: none; }
.account-action-card label { font-size: 14px; font-weight: 600; margin-bottom: -5px; }
.account-action-button { display: block; text-align: center; text-decoration: none; padding: 12px; border-radius: 10px; }
.account-action-button.primary { background: var(--accent); color: #fff; font-weight: 700; }
.account-action-page main.account-action { display: grid; grid-template-columns: 1fr; height: auto; gap: 20px; padding: 48px 16px; }
