/* Board Kelas EMAN EMAN — tampilan. Tema terang/gelap lewat [data-theme]. */
:root { --mango:#FFCC00; --ink:#17181C; --bg:#F7F6F1; --surface:#FFFFFF; --surface-2:#F1F0EA; --line:#E2E0D6; --text:#17181C; --muted:#6B6D75; --red:#D6453D; --green:#22A06B;
  --shadow-md:0 10px 30px -12px rgba(23,24,28,.28); --ease:cubic-bezier(.2,.8,.2,1); --font:"Plus Jakarta Sans",system-ui,-apple-system,"Segoe UI",sans-serif; }
:root[data-theme="dark"] { --bg:#101115; --surface:#1A1B21; --surface-2:#23252C; --line:#33353E; --text:#F2F2EE; --muted:#9A9CA6; --shadow-md:0 10px 30px -10px rgba(0,0,0,.7); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; } .ic-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.err { color: var(--red); font-weight: 700; font-size: 13px; min-height: 18px; margin: 4px 0; }

.bd { position: fixed; inset: 0; overflow: hidden; background: var(--bg); }
.bd canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; cursor: default; }
.bd canvas[data-tool="hand"], .bd canvas.pan-ready { cursor: grab; } .bd canvas.grabbing { cursor: grabbing !important; }
.bd canvas[data-tool="pen"], .bd canvas[data-tool="line"], .bd canvas[data-tool="arrow"], .bd canvas[data-tool="rect"], .bd canvas[data-tool="ellipse"], .bd canvas[data-tool="diamond"],
.bd canvas[data-tool="sticky"], .bd canvas[data-tool="eraser"], .bd canvas[data-tool="sheet"], .bd canvas[data-tool="frame"] { cursor: crosshair; }
.bd canvas[data-tool="text"] { cursor: text; }
.glass { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px); border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: 16px; }

.bd-top { position: absolute; z-index: 10; top: 12px; left: 12px; right: 12px; height: 54px; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.bd-logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg,#FFD633,#FFCC00); color: var(--ink); font-weight: 800; font-size: 12px; flex: none; }
.bd-logo.big { width: 54px; height: 54px; border-radius: 16px; font-size: 20px; margin: 0 auto 10px; }
.bd-title { flex: 0 1 300px; min-width: 70px; border: 0; outline: 0; background: transparent; font-weight: 800; font-size: 15px; padding: 6px 8px; border-radius: 8px; letter-spacing: -.01em; }
.bd-title:not(:disabled):hover, .bd-title:focus { background: var(--surface-2); } .bd-title:disabled { opacity: 1; }
.bd-spacer { flex: 1; }
.bd-btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 12.5px; white-space: nowrap; transition: border-color .2s, background .2s, transform .15s; }
.bd-btn:hover { border-color: color-mix(in srgb, var(--mango) 60%, var(--line)); } .bd-btn:active { transform: scale(.97); }
.bd-btn.primary { background: var(--mango); color: var(--ink); border-color: transparent; height: 42px; font-size: 14px; justify-content: center; }
.bd-btn.on { background: var(--mango); color: var(--ink); border-color: transparent; }
.bd-ibtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); font-size: 18px; font-weight: 700; }
.bd-ibtn.sm { width: 30px; height: 30px; } .bd-ibtn:hover { border-color: color-mix(in srgb, var(--mango) 60%, var(--line)); }
.bd-people { display: flex; padding-right: 6px; }
.bd-av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; border: 2px solid var(--surface); margin-left: -8px; position: relative; }
.bd-av:first-child { margin-left: 0; } .bd-av.more { background: var(--surface-2); color: var(--muted); } .bd-av.teacher::after { content: "★"; position: absolute; right: -5px; top: -7px; font-size: 11px; color: var(--mango); text-shadow: 0 0 2px #000; }
.save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: #9aa; } .save-state.saved i { background: var(--green); } .save-state.saving i { background: var(--mango); animation: pulse 1s infinite; } .save-state.error i { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.bd-tools { position: absolute; z-index: 10; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 6px; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; }
.bd-tools::-webkit-scrollbar { display: none; }
.bd-tools .sep { width: 1px; height: 26px; background: var(--line); margin: 0 5px; flex: none; }
.tool { position: relative; flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; transition: background .18s, transform .18s var(--ease); }
.tool:hover { background: var(--surface-2); transform: translateY(-2px); }
.tool.on { background: var(--mango); color: var(--ink); box-shadow: 0 6px 16px -6px rgba(255,204,0,.9); }
.tool kbd { position: absolute; right: 4px; bottom: 2px; font: 700 8.5px ui-monospace, monospace; opacity: .5; }
.tool[hidden] { display: none; }

.bd-props { position: absolute; z-index: 10; left: 12px; top: 50%; transform: translateY(-50%); width: 212px; padding: 14px; display: grid; gap: 13px; max-height: calc(100vh - 220px); overflow-y: auto; }
.pg > span { display: block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.sw-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); padding: 0; transition: transform .15s var(--ease); }
.sw:hover { transform: scale(1.15); } .sw.on { box-shadow: 0 0 0 2.5px var(--text); }
.sw.none { background: var(--surface) linear-gradient(135deg, transparent 45%, #D6453D 45%, #D6453D 55%, transparent 55%); }
.seg { display: flex; gap: 4px; } .seg button { flex: 1; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 11.5px; }
.seg button.on { background: var(--mango); color: var(--ink); border-color: transparent; }
.pg.row { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.mini { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 11.5px; }
.mini.wide { width: 100%; height: 36px; justify-content: center; } .mini.danger { color: var(--red); } .mini:hover { border-color: color-mix(in srgb, var(--mango) 60%, var(--line)); }

.bd-zoom { position: absolute; z-index: 10; right: 12px; bottom: 18px; display: flex; align-items: center; padding: 5px; gap: 2px; }
.bd-zoom button { height: 34px; min-width: 34px; padding: 0 8px; border: 0; background: transparent; border-radius: 10px; font-weight: 700; font-size: 12.5px; display: grid; place-items: center; } .bd-zoom button:hover { background: var(--surface-2); }
.bd-banner { position: absolute; z-index: 9; top: 74px; left: 50%; transform: translateX(-50%); padding: 8px 16px; font-weight: 700; font-size: 13px; max-width: calc(100vw - 24px); }
.bd-text { position: absolute; z-index: 6; resize: none; outline: 0; overflow: hidden; box-sizing: border-box; font-family: var(--font); font-weight: 600; margin: 0; }

/* Perpustakaan Zettel */
.bd-lib { position: absolute; z-index: 12; right: 12px; top: 74px; bottom: 76px; width: 340px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.bd-lib header { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.bd-lib input { height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; outline: none; } .bd-lib input:focus { border-color: var(--mango); }
.bd-lib p { margin: 0; }
.z-list { overflow-y: auto; display: grid; gap: 8px; padding-right: 2px; align-content: start; }
.z-cat { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 8px 2px 0; }
.z-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); }
.z-item .zi { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #17181C; flex: none; }
.z-item .zt { flex: 1; min-width: 0; } .z-item b { display: block; font-size: 13.5px; } .z-item small { color: var(--muted); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-item button { height: 30px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 11.5px; }
.z-item button.go { background: var(--mango); color: var(--ink); border-color: transparent; }

/* Popup */
.zmodal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 14px; background: rgba(16,17,21,.55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fade .18s ease both; }
.zmodal.solid { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.zm-card { width: min(860px, 100%); max-height: calc(100vh - 28px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.55); overflow: hidden; animation: rise .25s var(--ease) both; }
.zm-card.narrow { width: min(520px, 100%); }
.zm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.zm-head small { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.zm-head h2 { margin: 2px 0 2px; font-size: 22px; letter-spacing: -.02em; } .zm-head p { margin: 0; color: var(--muted); font-size: 13px; }
.zm-tools { display: flex; gap: 6px; flex: none; }
.zm-tabs { display: flex; gap: 6px; padding: 10px 20px 0; overflow-x: auto; scrollbar-width: thin; }
.zm-tabs button { flex: none; height: 32px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 12.5px; }
.zm-tabs button.on { background: var(--mango); color: var(--ink); border-color: transparent; }
.zm-body { padding: 16px 20px 22px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.zm-body.form { gap: 12px; } .zm-body.form label { display: grid; gap: 6px; font-weight: 700; font-size: 12.5px; }
.zm-body.form input, .zm-body.form textarea { border: 1px solid var(--line); background: var(--surface-2); border-radius: 11px; padding: 10px 12px; outline: none; font-weight: 500; } .zm-body.form input:focus, .zm-body.form textarea:focus { border-color: var(--mango); }
.zs h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: -.01em; }
.zs .note { margin: 0 0 8px; padding: 10px 13px; border-radius: 12px; background: color-mix(in srgb, var(--mango) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--mango) 45%, var(--line)); font-size: 13px; line-height: 1.5; }
.zt-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.zt { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.zt th { text-align: left; background: var(--ink); color: #fff; padding: 8px 11px; font-size: 11.5px; letter-spacing: .04em; white-space: nowrap; }
:root[data-theme="dark"] .zt th { background: #2c2f38; }
.zt td { padding: 8px 11px; border-top: 1px solid var(--line); vertical-align: top; } .zt tr:nth-child(even) td { background: var(--surface-2); }
.zt td:first-child { font-weight: 700; } .zt .id { color: var(--muted); font-size: 12.5px; }
.zex { display: grid; gap: 7px; } .zex li { list-style: none; display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.zex { padding: 0; margin: 0; } .zex .t { flex: 1; } .zex .de { font-weight: 700; line-height: 1.45; } .zex .idn { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.zex .say, .say { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; padding: 0; } .say:hover { background: var(--mango); color: var(--ink); }
mark { background: color-mix(in srgb, var(--mango) 55%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; } .k-n { color: #3B6FE0; } .k-a { color: #D6453D; } .k-d { color: #0E8B5F; } .k-g { color: #7A5AF8; }
.zm-body .tpl { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.tpl .ti { width: 42px; height: 42px; border-radius: 12px; background: var(--mango); color: var(--ink); display: grid; place-items: center; font-weight: 800; flex: none; } .tpl .tt { flex: 1; } .tpl b { display: block; } .tpl small { color: var(--muted); }
.join { padding: 28px 26px; text-align: center; display: grid; gap: 10px; } .join h2 { margin: 0; font-size: 22px; } .join p { margin: 0; color: var(--muted); }
.join input, .land-card input { height: 46px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface-2); padding: 0 14px; text-align: center; font-weight: 700; font-size: 16px; outline: none; } .join input:focus, .land-card input:focus { border-color: var(--mango); }
.toast-box { position: fixed; z-index: 80; bottom: 86px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 13px; box-shadow: var(--shadow-md); animation: rise .25s var(--ease) both; } .toast.error { background: var(--red); }

body.landing { display: grid; place-items: center; padding: 18px; }
.land-card { width: min(420px, 100%); text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px 26px; box-shadow: var(--shadow-md); display: grid; gap: 10px; }
.land-card h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; } .land-card p { margin: 0; color: var(--muted); } .land-card form { display: grid; gap: 10px; margin-top: 8px; }

@media (max-width: 760px) {
  .bd-top { left: 8px; right: 8px; top: 8px; gap: 5px; padding: 0 6px; } .bd-btn span, .save-state span, .bd-people { display: none; } .bd-btn { padding: 0 10px; } .bd-title { flex: 1 1 auto; }
  .bd-props { top: auto; bottom: 78px; left: 8px; right: 8px; transform: none; width: auto; max-height: 34vh; grid-template-columns: 1fr 1fr; }
  .bd-zoom { bottom: 78px; right: 8px; } .bd-tools { bottom: 10px; } .bd-lib { top: 68px; bottom: 76px; right: 8px; left: 8px; width: auto; max-width: none; }
  .zm-head h2 { font-size: 19px; } .zm-body, .zm-head { padding-left: 14px; padding-right: 14px; } .zm-tabs { padding-left: 14px; }
}

/* Mode hanya-lihat (murid saat papan dikunci) */
.bd.ro .tool:not([data-tool="select"]):not([data-tool="hand"]), .bd.ro .bd-tools .sep { display: none !important; }

/* Menu Zettel di bar atas */
.z-menu { display: flex; gap: 3px; align-items: center; margin: 0 auto; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.z-menu::-webkit-scrollbar { display: none; }
.zm-btn { flex: none; height: 32px; padding: 0 11px; border-radius: 10px; border: 0; background: transparent; font-weight: 700; font-size: 12.5px; display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.zm-btn:hover { background: var(--surface); } .zm-btn.on { background: var(--mango); color: var(--ink); } .zm-btn.search { padding: 0 9px; }
.ic-xs { width: 12px; height: 12px; }
.bd-title { flex: 0 1 200px; }
.z-drop { position: fixed; z-index: 40; overflow-y: auto; padding: 8px; display: grid; gap: 4px; align-content: start; animation: rise .18s var(--ease) both; }
.z-row { display: flex; gap: 6px; align-items: stretch; }
.z-pick { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; border-radius: 12px; border: 1px solid transparent; background: transparent; }
.z-pick:hover, .z-pick:focus-visible { background: var(--surface-2); border-color: var(--line); outline: none; }
.z-pick .zi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 11.5px; color: #17181C; flex: none; }
.z-pick .zt { flex: 1; min-width: 0; width: auto; display: block; font-size: 13px; }
.z-pick b { display: block; font-size: 13.5px; } .z-pick small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-add { width: 34px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 16px; } .z-add:hover { background: var(--mango); color: var(--ink); }
.zm-tools .bd-btn { height: 36px; }

@media (max-width: 1279px) {
  .z-menu { position: absolute; top: calc(100% + 8px); left: 0; right: 0; margin: 0; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px); box-shadow: var(--shadow-md); border-radius: 16px; padding: 5px; }
  .bd-spacer { display: block; } .bd-title { flex: 1 1 auto; }
  .bd-banner { top: 128px; } .bd-lib { top: 128px; }
}
@media (max-width: 760px) {
  .zm-btn { height: 36px; padding: 0 13px; font-size: 13px; }
  .bd-lib { top: 124px; bottom: 76px; }
  .zmodal { padding: 0; align-items: end; } .zm-card { max-height: 92vh; border-radius: 20px 20px 0 0; width: 100%; }
  .zm-card.narrow.join { border-radius: 20px; margin: auto; } .zmodal.solid { align-items: center; padding: 14px; }
  .zt { font-size: 12.5px; } .zt td, .zt th { padding: 7px 8px; }
  .zm-head { flex-wrap: wrap; } .zm-tools { flex-wrap: wrap; }
  .bd-tools { padding: 5px; } .tool { width: 40px; height: 40px; }
  .toast-box { bottom: 140px; }
}
.z-drop { overflow-x: hidden; grid-template-columns: minmax(0, 1fr); }
.z-row { min-width: 0; }
.z-pick .zi, .z-item .zi { overflow: hidden; font-size: 10.5px; letter-spacing: -.02em; text-align: center; line-height: 1.1; padding: 0 2px; }
.join .jk { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #C99700; }

/* Pilihan bahasa */
.lang-drop { z-index: 70; } .z-pick.cur { background: var(--surface-2); border-color: var(--line); }
.bd-btn .lang-code { font-weight: 800; letter-spacing: .04em; }
.land-card, .zm-card.join { position: relative; }
.land-lang, .join-lang { position: absolute; top: 12px; right: 12px; height: 32px; }
@media (max-width: 760px) { .bd-btn .lang-code { display: inline !important; } }
