/* dot.fm · Desain final (Design C + panel mengambang di HP)
   Nilai mengikuti section Figma 70:57457 di file KdPpR8tbvzljxKaY2SktRd.
   Dipakai Font Studio dan PNG to Font. */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: light;
  --page: #f7f7f7;
  --card: #ffffff;
  --line: #eeeeee;
  --ink: #0a0a0a;
  --ink-2: #222222;
  --text-3: #4d4d4d;
  --text-4: #666666;
  --text-5: #7b7b7b;
  --guide: #dddddd;
  --guide-strong: #aaaaaa;
  --chip: #f2f2f2;
  --soft: #ededed;
  --board: #e9e9e9;
  --dark: #303030;
  --red: #ff395c;
  --red-deep: #eb032c;
  --tint-pink: #f9d5de;
  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-sheet: 1px 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 2px 20px rgba(0, 0, 0, 0.16);
  --inset-dark: inset 0 -2px 4px rgba(255, 255, 255, 0.25);
  /* tombol utama: hitam dan merah dengan tepi terang di atas yang hilang ke bawah */
  --ink-body: #0e0e0e;
  --ink-rim: linear-gradient(180deg, #c3c3c3, #303030 50%, #181818);
  --red-body: radial-gradient(70% 70% at 50% 35%, #ff5b78, #e0022a);
  --red-rim: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.1));
  --font-ui: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
}

html, body { background: var(--page); }
body { font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--dark); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.on-phone { display: none; }

/* ---------- ikon: bentuk dari file Figma, warna dari teks ---------- */
.icon { display: inline-block; flex: none; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i) center / 100% 100% no-repeat; mask: var(--i) center / 100% 100% no-repeat; }
.icon-20 { width: 20px; height: 20px; }
.icon-24 { width: 24px; height: 24px; }
.i-menu { --i: url("icons-c/menu.svg"); }
.i-close { --i: url("icons/close.svg"); }
.i-cursor-text { --i: url("icons-c/cursor-text.svg"); }
.i-brightness { --i: url("icons-c/brightness.svg"); }
.i-file-download { --i: url("icons-c/file-download.svg"); }
.i-eye { --i: url("icons-c/eye.svg"); }
.i-square-letter-a { --i: url("icons-c/square-letter-a.svg"); }
.i-arrows-cross { --i: url("icons-c/arrows-cross.svg"); }
.i-hand-stop { --i: url("icons-c/hand-stop.svg"); }
.i-paint { --i: url("icons-c/paint.svg"); }
.i-trash-x { --i: url("icons-c/trash-x.svg"); }
.i-restore { --i: url("icons-c/restore.svg"); }
.i-copy-plus { --i: url("icons-c/copy-plus.svg"); }
.i-stack-pop { --i: url("icons-c/stack-pop.svg"); }
.i-stack-push { --i: url("icons-c/stack-push.svg"); }
.i-eraser { --i: url("icons-c/eraser.svg"); }
.i-category { --i: url("icons-c/category.svg"); }
.i-chalkboard { --i: url("icons-c/chalkboard.svg"); }
.i-sliders { --i: url("icons-c/sliders.svg"); height: 18px; }
.i-spacing-horizontal { --i: url("icons-c/spacing-horizontal.svg"); }
.i-arrows-diagonal { --i: url("icons-c/arrows-diagonal.svg"); }
.i-sparkles { --i: url("icons-c/sparkles.svg"); }
.i-check { --i: url("icons-c/check.svg"); }
.i-x { --i: url("icons-c/x.svg"); }
.i-plus { --i: url("icons-c/plus.svg"); }
.i-minus { --i: url("icons-c/minus.svg"); }
.i-chevron { --i: url("icons-c/chevron.svg"); }
.i-arrow-left { --i: url("icons-c/arrow-left.svg"); }
.i-arrow-right { --i: url("icons-c/arrow-right.svg"); }
.i-help { --i: url("icons-c/help.svg"); }
.i-upload { --i: url("icons-c/upload.svg"); }
.i-file { --i: url("icons-c/file.svg"); }
.i-zip { --i: url("icons-c/zip.svg"); }
.i-arrows-horizontal { --i: url("icons-c/arrows-horizontal.svg"); }
.i-copy { --i: url("icons-c/copy.svg"); }

/* ---------- kartu ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; }
.card-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 14px; line-height: 18px; color: var(--ink); white-space: nowrap; }
.card-title .icon { color: var(--text-4); }
.hint { font-size: 12px; line-height: 18px; color: var(--text-5); white-space: nowrap; }
/* Preview: salin sebagai PNG. Margin negatif menjaga tinggi kepala kartu tetap sama. */
#card-preview .hint { margin-left: auto; }
.copy-png { position: relative; flex: none; display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 72px; height: 26px; margin: -4px 0 -4px 8px; padding: 0 9px 0 7px; background: var(--chip); border: 1px solid var(--line); border-radius: 100px; font-size: 12px; line-height: 18px; color: var(--ink-2); white-space: nowrap; cursor: pointer; }
.copy-png .icon { width: 14px; height: 14px; }
.copy-png:disabled { opacity: 0.6; cursor: default; }
.copy-png.done .icon { --i: url("icons-c/check.svg"); }
@media (hover: hover) {
  .copy-png:not(:disabled):hover { background: var(--soft); }
}

/* ---------- navbar ---------- */
.nav { display: flex; align-items: center; gap: 24px; height: 64px; padding: 12px; }
.brand { display: flex; align-items: center; gap: 6px; flex: none; }
.brand-home { display: flex; align-items: center; gap: 6px; }
.logo { display: block; transition: filter 0.2s ease, transform 0.15s ease; }
.logo:hover { filter: drop-shadow(0 0 5px rgba(255, 57, 92, 0.55)); }
.logo:active { transform: scale(0.86); }
.is-generating .logo { animation: logo-glow 1.2s ease-in-out infinite; }
@keyframes logo-glow { 50% { filter: drop-shadow(0 0 7px rgba(255, 57, 92, 0.75)); } }
@media (prefers-reduced-motion: reduce) { .logo { transition: none; } .logo:active { transform: none; } .is-generating .logo { animation: none; } }
.logo-sm, .nav .menu-btn { display: none; }
.wordmark { font-family: var(--font-display); font-size: 26px; line-height: 28px; color: var(--ink); white-space: nowrap; }
.type-input { flex: 1 1 0; min-width: 0; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 1000px; cursor: text; }
.type-input .icon { color: var(--text-4); }
.type-input input { flex: 1 1 0; width: 0; min-width: 0; border: 0; outline: 0; background: none; font-size: 14px; line-height: 20px; color: var(--ink); }
.type-input:focus-within { border-color: var(--guide-strong); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tool-toggle { display: flex; align-items: center; gap: 2px; height: 40px; padding: 4px; background: var(--card); border-radius: 1000px; }
.tool { display: flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 1000px; font-size: 14px; line-height: 20px; color: var(--text-3); white-space: nowrap; }
.tool.active { background: var(--soft); color: var(--ink); font-weight: 500; }
.tool:not(.active):hover { background: var(--page); }
.round { display: flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; background: var(--card); border-radius: 1000px; color: var(--text-4); }
.theme[aria-disabled="true"] { cursor: not-allowed; }
.btn-dark { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 15.5px 0 11.5px; background: linear-gradient(var(--ink-body), var(--ink-body)) padding-box, var(--ink-rim) border-box; border: 1.5px solid transparent; border-radius: 100px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22); font-weight: 500; font-size: 14px; line-height: 20px; color: #ffffff; white-space: nowrap; }
.btn-dark:hover { --ink-body: #1f1f1f; }
.btn-dark:active { --ink-rim: linear-gradient(#c3c3c3, #c3c3c3); }
.btn-dark:disabled { opacity: 0.6; cursor: default; }

/* ---------- tata letak utama ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; height: clamp(600px, calc(100vh - 64px), 800px); padding: 0 12px 12px; }
.workspace { position: relative; min-width: 0; min-height: 0; }

/* ---------- Polish ---------- */
.polish { position: relative; display: flex; flex-direction: column; height: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 2px 2px rgba(0, 0, 0, 0.08); overflow: hidden; }
.polish-controls { position: absolute; z-index: 4; top: 80px; right: 12px; width: 232px; display: flex; flex-direction: column; gap: 8px; padding: 11px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-card); }
.polish-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.polish-head .card-title { flex: 0 0 100%; }
.chips { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 3.5px; }
.chips .btn { flex: 1 1 0; min-width: 0; height: 26px; display: flex; align-items: center; justify-content: center; background: var(--chip); border: 1px solid var(--line); border-radius: 100px; font-size: 12px; line-height: 18px; color: var(--ink-2); white-space: nowrap; }
.chips .btn.active { background: var(--dark); border-color: var(--dark); box-shadow: var(--inset-dark); color: #ffffff; font-weight: 500; }
.polish-actions { display: flex; align-items: center; gap: 8px; }
.letter-chip { flex: none; min-width: 32px; height: 32px; padding: 0 6px; display: flex; align-items: center; justify-content: center; background: var(--soft); border-radius: 1000px; font-weight: 600; font-size: 14px; line-height: 20px; color: var(--ink); }
.reroll { flex: 1 1 0; min-width: 0; height: 32px; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--soft); border-radius: 1000px; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink); white-space: nowrap; }
.reroll:hover { background: var(--board); }

/* ---------- kanvas ---------- */
.canvas { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; background: var(--card); }
.stage-wrap { position: absolute; inset: 0; touch-action: none; }
#stage { display: block; width: 100%; height: 100%; overflow: visible; touch-action: none; user-select: none; -webkit-user-select: none; }
#stage.brush { cursor: crosshair; }
#stage .inst { cursor: grab; }
#stage.brush .inst { cursor: crosshair; }
.guide { stroke: var(--guide); stroke-width: 1; }
.guide.dash { stroke-dasharray: 6 4; }
.guide.solid { stroke: var(--guide-strong); }
.guide-labels { position: absolute; inset: 0; pointer-events: none; }
.guide-labels span { position: absolute; left: calc(min(300px, 34%) + 24px); font-weight: 500; font-size: 10px; line-height: 16px; color: var(--text-5); white-space: nowrap; }
.sel-ring { fill: none; stroke: var(--dark); stroke-width: 1.5; }
.sel-stalk { stroke: var(--dark); stroke-width: 1.5; }
.sel-handle { fill: #ffffff; stroke: var(--dark); stroke-width: 1.5; }
[data-handle="rotate"] { cursor: grab; }
[data-handle="scale"] { cursor: nwse-resize; }

/* ---------- pil alat ---------- */
.pill { position: absolute; z-index: 3; display: flex; align-items: center; gap: 2px; height: 40px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 1000px; box-shadow: var(--shadow-card); }
.mode { left: 12px; bottom: 12px; }
.letter { right: 12px; bottom: 12px; }
.tool-btn { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; border-radius: 1000px; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink-2); white-space: nowrap; }
.tool-btn:hover { background: var(--page); }
.tool-btn.active, .tool-btn.active:hover { background: var(--dark); box-shadow: var(--inset-dark); color: #ffffff; }
.tool-btn.quiet { color: var(--text-5); }
.tool-btn.quiet:hover { color: var(--ink-2); }
.obj-bar { left: 0; top: 0; z-index: 5; will-change: transform; }
/* tetap ikut tata letak supaya ikonnya sudah termuat dan ukurannya bisa diukur */
.obj-bar.off { visibility: hidden; }
/* ukuran kuas belum ada di Figma: pil kecil di atas pil mode */
.brush-size { left: 12px; bottom: 60px; gap: 8px; padding: 0 12px; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink-2); }
.brush-size input { -webkit-appearance: none; appearance: none; width: 110px; height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--dark) var(--pct, 50%), var(--soft) var(--pct, 50%)); }
.brush-size input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #ffffff; border: 1.5px solid var(--dark); cursor: pointer; }
.brush-size input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #ffffff; border: 1.5px solid var(--dark); cursor: pointer; }

/* ---------- strip huruf ---------- */
.char-strip { order: -1; flex: none; display: flex; gap: 4px; height: 68px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); overflow-x: auto; scrollbar-width: none; }
.char-strip::-webkit-scrollbar { display: none; }
.char-tile { flex: 0 0 max(48px, calc((100% - 60px) / 16)); height: 52px; display: flex; align-items: center; justify-content: center; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; font-weight: 500; font-size: 16px; line-height: 20px; color: var(--text-5); }
.char-tile:hover { border-color: var(--guide); }
.char-tile.active, .char-tile.active:hover { border: 2px solid var(--red); padding: 3px; color: var(--ink); }
.tile-glyph { display: block; width: 100%; height: 100%; }

/* ---------- Preview ---------- */
.preview { position: absolute; z-index: 4; top: 81px; left: 13px; width: min(300px, 34%); padding: 11px; display: flex; flex-direction: column; gap: 8px; }
.preview-body { position: relative; display: flex; justify-content: center; height: 128px; overflow: hidden auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-t, 0px), #000 calc(100% - var(--fade-b, 0px)), transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-t, 0px), #000 calc(100% - var(--fade-b, 0px)), transparent 100%); }
.preview-body::-webkit-scrollbar { display: none; }
.type-canvas { flex: none; display: inline-flex; align-items: flex-end; height: 128px; white-space: nowrap; font-family: var(--font-display); font-size: 120px; line-height: 128px; color: var(--ink); }
/* teks panjang di desktop: beberapa baris, tetap di tengah selama muat */
.type-canvas.is-lines { display: flex; flex-direction: column; align-items: center; width: 100%; height: auto; margin: auto 0; }
.type-line { flex: none; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.type-canvas svg { display: block; flex: none; }
.type-canvas .sp { display: inline-block; flex: none; height: 1px; }
.preview-overlay { display: none; }

/* ---------- panel ---------- */
.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }

/* Things: kartu kelompok, isinya di halaman sendiri */
.things-card { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; padding: 11px 11px 0; overflow: hidden; }
.things-card.picking { border: 1.5px solid var(--dark); padding: 10.5px 10.5px 0; }
.things-head { flex: none; align-items: flex-start; height: 26px; }
.in-page:not(.picking) .things-head { display: none; }
.things-head .i-chalkboard, .picking .things-head .i-category { display: none; }
.pick-done { flex: none; height: 26px; margin-top: -5px; padding: 0 12px; background: var(--dark); border-radius: 13px; box-shadow: var(--inset-dark); font-weight: 500; font-size: 12px; line-height: 18px; color: #ffffff; }
.pick-head { display: none; }
.things-body { flex: 1 1 0; min-height: 0; }
.page-in { animation: page-in 0.18s ease-out; }
.page-back { animation: page-back 0.18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes page-back { from { opacity: 0; transform: translateX(-16px); } }
@media (prefers-reduced-motion: reduce) { .page-in, .page-back { animation: none; } }

.cat-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; height: 100%; padding-bottom: 11px; }
.cat-card { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px; background: var(--page); border-radius: 14px; text-align: left; }
.cat-peek { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; pointer-events: none; }
.cat-peek svg { flex: none; width: 56px; height: 56px; margin-left: -24px; }
.cat-peek svg:first-child { margin-left: 0; }
.cat-name { display: block; font-weight: 500; font-size: 13px; line-height: 16px; color: var(--ink); white-space: nowrap; }
.cat-count { display: block; margin-top: 1px; font-size: 11px; line-height: 14px; color: var(--text-5); white-space: nowrap; }
.cat-badge { position: absolute; top: 8px; right: 8px; min-width: 20px; height: 20px; padding: 0 5px; background: var(--dark); border-radius: 10px; font-weight: 500; font-size: 11px; line-height: 20px; color: #ffffff; text-align: center; pointer-events: none; }
.cat-own { position: relative; grid-column: 1 / -1; flex: none; height: 53px; border: 1px dashed var(--guide); border-radius: 14px; }
.cat-own .cat-badge { top: 15px; right: 11px; }
.cat-own-open { display: block; width: 100%; height: 100%; padding: 0 11px 0 49px; border-radius: 13px; text-align: left; }
.cat-plus { position: absolute; z-index: 1; top: 11.5px; left: 11px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--chip); border-radius: 50%; color: var(--ink-2); }

/* layar pendek: kartu kelompok ikut mengecil supaya kalimat dan Generate tetap terlihat */
@media (min-width: 901px) and (max-height: 780px) {
  .cat-card { padding: 7px 12px 8px; }
  .cat-peek { margin-bottom: 3px; }
  .cat-peek svg { width: 44px; height: 44px; margin-left: -18px; }
  .cat-peek svg:first-child { margin-left: 0; }
}
@media (min-width: 901px) and (max-height: 700px) {
  .cat-peek svg { width: 36px; height: 36px; margin-left: -14px; }
}

.cat-page { display: flex; flex-direction: column; height: 100%; padding-bottom: 11px; }
.cat-page > .cat-own { margin-bottom: 24px; }
.cat-head { position: relative; z-index: 1; flex: none; display: flex; align-items: center; gap: 8px; height: 28px; margin: -6px 0 10px -4px; }
.picking .cat-head { margin-top: 0; }
.cat-back { flex: none; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--chip); border-radius: 50%; color: var(--ink-2); }
.cat-title { font-weight: 500; font-size: 14px; line-height: 18px; color: var(--ink); white-space: nowrap; }
.cat-total { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--text-5); white-space: nowrap; }
/* ruang di sekeliling kisi supaya nama benda saat hover tidak terpotong */
.cat-scroll { flex: 1 1 0; min-height: 0; margin: -16px -11px 0; padding: 16px 11px 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }

/* makin sedikit bendanya, makin besar tampilannya */
.tray-grid { --thing: 56px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(72px, 1fr); height: 100%; }
.tray-grid.mid { --thing: 72px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(92px, 1fr); }
.tray-grid.big { --thing: 104px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(120px, 1fr); }
.tray-cell { position: relative; min-width: 0; }
.tray-item { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 12px; }
.tray-item svg, .tray-item img { display: block; width: var(--thing); height: var(--thing); object-fit: contain; pointer-events: none; transition: transform 0.12s ease; }
.tray-item.selected { box-shadow: inset 0 0 0 1.5px var(--dark); }
.tray-item.in-mix { background: var(--chip); box-shadow: inset 0 0 0 2px var(--card); }
.tray-item.fresh { box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3.5px var(--red); }
.tray-check { position: absolute; top: 5px; right: 6px; display: flex; align-items: center; justify-content: center; width: 14px; height: 14px; background: var(--dark); border-radius: 50%; color: #ffffff; }
.tray-check .icon { width: 9px; height: 9px; }
.tray-cell .del { position: absolute; top: 0; right: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--dark); color: #ffffff; font-size: 9px; line-height: 16px; }
@media (hover: hover) {
  .cat-card:hover, .cat-own-open:hover { background: var(--chip); }
  .cat-back:hover, .cat-plus:hover { background: var(--soft); }
  .tray-item:not(.in-mix):not(.selected):hover { background: var(--page); }
  .tray-item:hover svg, .tray-item:hover img { transform: translateY(-2px) scale(1.06); }
  .tray-item:hover::after, .stack-item:hover::after { content: attr(data-name); position: absolute; z-index: 3; left: 50%; bottom: calc(100% - 4px); padding: 4px 8px; transform: translateX(-50%); background: var(--dark); border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); font-weight: 500; font-size: 11px; line-height: 16px; color: #ffffff; white-space: nowrap; pointer-events: none; }
  .tray-item:hover::after { bottom: calc(50% + var(--thing) / 2 - 2px); }
  .stack-item:hover::after { bottom: calc(100% + 8px); }
  .tok:not([aria-expanded="true"]):hover { background: #e4e4e4; }
  .tok-things:hover .stack-item { margin-left: 0; }
}
/* Mix penuh: benda lain redup, ketukannya hanya memberi tahu batasnya */
.picking.mix-full .tray-item:not(.in-mix) { background: none; cursor: default; }
.picking.mix-full .tray-item:not(.in-mix) svg, .picking.mix-full .tray-item:not(.in-mix) img { opacity: 0.45; transform: none; }

/* Kalimat: Make A–Z out of (benda) spaced −15% at 95% size. */
.sentence-card { position: relative; z-index: 2; flex: none; display: flex; flex-direction: column; height: 288px; }
.sentence { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 17px 15px 0; }
.sentence-row { display: flex; align-items: center; gap: 8px; height: 40px; }
.word { flex: none; font-family: var(--font-display); font-size: 32px; line-height: 40px; color: var(--ink); white-space: nowrap; }
.tok { flex: none; display: inline-flex; align-items: center; height: 38px; padding: 0 12px; background: var(--chip); border-radius: 12px; font-weight: 500; font-size: 14px; line-height: 20px; color: var(--ink-2); white-space: nowrap; transition: background 0.12s; }
.tok[aria-expanded="true"], .tok.scrubbing { background: var(--dark); box-shadow: var(--inset-dark); color: #ffffff; }
.tok-things { gap: 8px; padding: 0 12px 0 8px; }
.tok-things .icon { width: 14px; height: 14px; color: var(--text-3); }
.tok-things[aria-expanded="true"] .icon { color: #ffffff; }
.stack { display: flex; }
.stack-item { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-left: -8px; background: #ffffff; border: 1px solid var(--line); border-radius: 50%; transition: margin 0.15s; }
.stack-item:first-child { margin-left: 0; }
.stack-item svg, .stack-item img { display: block; width: 78%; height: 78%; object-fit: contain; }
.stack-more { font-size: 12px; line-height: 16px; color: var(--text-3); }
.tok-things[aria-expanded="true"] .stack-more { color: #ffffff; }
.scrub-hint { display: none; flex: none; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--text-5); white-space: nowrap; }
.tok.scrubbing + .scrub-hint { display: flex; }
.scrub-mark { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; background: #ffffff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); color: var(--ink); }
.is-scrubbing, .is-scrubbing * { cursor: ew-resize !important; user-select: none; -webkit-user-select: none; }

.sentence-foot { flex: 1 1 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 11px 0; padding-right: 3px; border-top: 1px solid var(--line); }
.foot-left { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.replace { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; line-height: 18px; color: var(--text-3); cursor: pointer; }
.replace-note { font-size: 12px; line-height: 18px; color: var(--text-5); }
.replace-note.warn { font-weight: 500; color: var(--red-deep); }
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 32px; height: 18px; background: var(--guide); border-radius: 9px; cursor: pointer; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16); transition: transform 0.15s; }
.switch:checked { background: var(--dark); }
.switch:checked::after { transform: translateX(14px); }
.generate-btn { position: relative; display: flex; align-items: center; justify-content: center; flex: none; width: 50px; height: 50px; background: var(--red-body) padding-box, var(--red-rim) border-box, var(--red-body) border-box; border: 1.5px solid transparent; border-radius: 32px; box-shadow: 0 3px 8px rgba(235, 3, 44, 0.35); color: #ffffff; }
.generate-btn:hover { box-shadow: 0 4px 12px rgba(235, 3, 44, 0.5); }
.generate-btn:active { --red-rim: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)); transform: scale(0.92); }
.generate-btn.done .icon { --i: url("icons-c/check.svg"); }
/* cincin: kalimat sudah berubah, huruf belum mengikuti */
.generate-btn.pending::after { content: ""; position: absolute; inset: -9.5px; border: 2px solid var(--red); border-radius: 50%; opacity: 0.5; pointer-events: none; }
.is-generating .sentence, .is-generating .foot-left { opacity: 0.35; pointer-events: none; }

/* pengaturan tiap kata: popover di atas atau di bawah kata, tidak menutupi tombol merah */
.pop { position: absolute; z-index: 5; left: 11px; right: 11px; height: 104px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float); overflow: hidden; }
.pop[hidden] { display: none; }
.pop-letters { top: 59px; padding: 7px 7px 0; }
.pop-things { top: 107px; padding: 7px 7px 0; }
#pop-spacing { top: 7px; }
#pop-size { top: 55px; }
.scope { display: flex; gap: 4px; }
.scope label { flex: 1 1 0; min-width: 0; cursor: pointer; }
.scope input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scope span { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 54px; background: var(--chip); border-radius: 12px; white-space: nowrap; }
.scope b { font-weight: 500; font-size: 13px; line-height: 18px; color: var(--ink-2); }
.scope small { font-size: 11px; line-height: 16px; color: var(--text-5); }
.scope label:hover span { background: var(--soft); }
.scope input:checked + span { background: var(--dark); box-shadow: var(--inset-dark); }
.scope input:checked + span b { color: #ffffff; }
.scope input:checked + span small { color: var(--guide); }
.scope input:focus-visible + span { outline: 2px solid var(--dark); outline-offset: 2px; }
.pop-foot { display: flex; align-items: center; justify-content: space-between; height: 26px; margin-top: 5px; padding: 0 2px; }
.pop-total { font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink-2); white-space: nowrap; }
.pop-total.warn, .pop-hint.warn { font-weight: 500; color: var(--red-deep); }
.pop-hint { font-size: 11px; line-height: 16px; color: var(--text-5); white-space: nowrap; }
.pop-all { flex: none; width: 40px; height: 24px; background: var(--chip); border-radius: 8px; font-size: 11px; line-height: 16px; color: var(--ink-2); }
.pop-all:hover { background: var(--soft); }
.pop-all.on { background: var(--dark); box-shadow: var(--inset-dark); font-weight: 500; color: #ffffff; }
.mix { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.mix::-webkit-scrollbar { display: none; }
.mix-tile { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; background: var(--chip); border-radius: 12px; }
.mix-tile svg, .mix-tile img { display: block; width: 76%; height: 76%; object-fit: contain; }
.mix-tile.fresh { box-shadow: inset 0 0 0 2px var(--red); }
.mix-x { position: absolute; top: 2px; right: 2px; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; background: #ffffff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); color: var(--text-3); }
.mix-x .icon { width: 9px; height: 9px; }
.pop-num { display: flex; gap: 12px; padding: 7px; }
.num-sample { position: relative; flex: none; width: 88px; height: 88px; background: var(--page); border-radius: 10px; overflow: hidden; }
.sample-thing { position: absolute; left: 50%; top: 50%; min-width: 2px; aspect-ratio: 1; }
.sample-thing svg, .sample-thing img { display: block; width: 100%; height: 100%; object-fit: contain; }
.num-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.num-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 16px; margin-top: 1px; font-weight: 500; font-size: 12px; line-height: 16px; color: var(--text-3); }
.num-word { font-weight: 400; font-size: 11px; line-height: 14px; color: var(--text-5); white-space: nowrap; }
.num-word.warn { font-weight: 500; color: var(--red-deep); }
.num-step { flex: none; display: flex; align-items: center; height: 32px; margin-top: 5px; }
.num-step button { flex: none; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: var(--chip); border-radius: 10px; color: var(--ink-2); }
.num-step button:hover { background: var(--soft); }
.num-step button:active { background: var(--guide); }
.num-step button.off { color: var(--guide); cursor: default; }
.num-step input { flex: 1 1 0; width: 0; min-width: 0; height: 32px; margin: 0 4px; border: 0; outline: 0; background: none; border-radius: 8px; font-weight: 600; font-size: 15px; line-height: 20px; color: var(--ink); text-align: center; }
.num-step input:focus { box-shadow: inset 0 0 0 1px var(--dark); }
.num-track { position: relative; flex: none; height: 16px; margin-top: 4px; }
.num-track.has-zero::before { content: ""; position: absolute; top: 3px; left: 83.33%; width: 2px; height: 10px; background: var(--guide-strong); border-radius: 1px; pointer-events: none; }
.num-slider { -webkit-appearance: none; appearance: none; position: relative; display: block; width: 100%; height: 16px; margin: 0; background: none; cursor: pointer; }
.num-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--dark) var(--pct, 50%), var(--soft) var(--pct, 50%)); }
.num-slider::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--dark) var(--pct, 50%), var(--soft) var(--pct, 50%)); }
.num-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border: 1px solid var(--guide); border-radius: 50%; background: #ffffff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }
.num-slider::-moz-range-thumb { box-sizing: border-box; width: 16px; height: 16px; border: 1px solid var(--guide); border-radius: 50%; background: #ffffff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18); }
.num-limits { flex: none; display: flex; justify-content: space-between; font-size: 10px; line-height: 12px; color: var(--text-5); }

/* seret benda: kanvas dan kelompok benda di kalimat sama-sama jadi tujuan */
.thing-drag .canvas::after { content: ""; position: absolute; inset: 4px; z-index: 6; border: 1.5px dashed var(--red); border-radius: 14px; pointer-events: none; }
.thing-drag .word, .thing-drag .tok:not(.tok-things), .thing-drag .foot-left { opacity: 0.35; }
.thing-drag .tok-things { background: var(--tint-pink); outline: 1.5px dashed var(--red); outline-offset: -1.5px; }
.thing-drag .tok-things .icon { color: var(--red-deep); }
.tok-things.drop-over { transform: scale(1.05); }

/* kolom angka dipakai PNG to Font */
.field { flex: 1 1 0; min-width: 0; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 8px; background: var(--chip); border-radius: 10px; color: var(--text-5); cursor: text; }
.field:focus-within { box-shadow: inset 0 0 0 1.5px var(--dark); }
.field input { flex: 1 1 0; width: 0; min-width: 0; border: 0; outline: 0; background: none; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink-2); }
.scrub { cursor: ew-resize; touch-action: none; }

/* ---------- khusus HP ---------- */
.toolbar, .sheet-head, .sheet-help, .obj-done, .dock-neck { display: none; }
/* di desktop bungkus tombol ini tidak ikut tata letak */
.dock-seg { display: contents; }

/* ---------- footer ---------- */
.foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 81px 12px 48px; border-top: 1px solid var(--line); }
/* layar sangat tinggi: tinggi kerja berhenti di 800, sisanya diisi footer */
@media (min-width: 901px) {
  body { display: flex; flex-direction: column; min-height: 100vh; }
  .foot { flex: 1 0 auto; justify-content: center; }
}
.foot-word { font-family: var(--font-display); font-size: 104px; line-height: 104px; color: var(--ink); white-space: nowrap; }
.foot-copy { font-size: 12px; line-height: 18px; color: var(--text-5); text-align: center; }
.foot-copy a:hover, .foot-copy a:focus-visible { color: var(--ink); text-decoration: underline; }

/* ---------- pesan singkat (hasil Generate) ---------- */
.toast { position: fixed; z-index: 30; left: 50%; bottom: 24px; pointer-events: none; max-width: min(420px, calc(100vw - 32px)); padding: 8px 14px; transform: translateX(-50%); background: var(--dark); border-radius: 12px; box-shadow: var(--shadow-float); font-weight: 500; font-size: 12px; line-height: 18px; color: #ffffff; text-align: center; }

/* ---------- panel Menu: turun dari atas, sama di semua halaman (Figma 601:817501, 643:821365) ----------
   Baris atasnya sama dengan navbar: ✕ di tempat ☰, logo, dan di halaman situs Start making.
   Lalu tiga halaman bertulisan besar. Tombol ☰ hanya muncul di layar 900 px ke bawah. */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; background: rgba(0, 0, 0, 0.24); }
body.menu-open { overflow: hidden; }
.drawer { width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; padding: 0 0 28px; background: var(--card); border-radius: 0 0 24px 24px; box-shadow: var(--shadow-float); }
.drawer-head { flex: none; display: flex; align-items: center; gap: 5px; height: 56px; padding: 8px 12px; }
.drawer-brand { display: flex; align-items: center; gap: 5px; }
.drawer-brand img { display: block; }
.drawer-head .site-start { margin-left: auto; }
.drawer .menu-btn { background: var(--page); }
.drawer-nav { display: flex; flex-direction: column; margin: 16px 20px 0; border-top: 1px solid var(--soft); }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 80px; border-bottom: 1px solid var(--soft); font-family: var(--font-display); font-size: 44px; line-height: 52px; color: var(--ink); }
.nav-item .icon { color: var(--ink); }
.nav-item[aria-current="page"] { color: var(--text-5); }
.nav-item[aria-current="page"] .icon { display: none; }
.drawer-foot { padding: 21px 20px 0; font-size: 12px; line-height: 18px; color: var(--text-5); }
.drawer-foot a { text-decoration: underline; }

/* ---------- popup Download ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.24); }
.modal-field { display: flex; flex-direction: column; gap: 8px; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--text-3); }
.modal-field input[type="text"] { height: 40px; padding: 0 12px; background: var(--chip); border: 1px solid var(--line); border-radius: 10px; font-weight: 400; font-size: 14px; line-height: 20px; color: var(--ink); }
.btn-soft { height: 40px; padding: 0 16px; background: var(--soft); border-radius: 100px; font-weight: 500; font-size: 14px; line-height: 20px; color: var(--ink); }
.btn-soft:hover { background: var(--board); }
body.dl-open { overflow: hidden; }
.dl { width: 480px; max-width: 100%; max-height: calc(100vh - 32px); padding: 24px; overflow-y: auto; background: var(--card); border-radius: 20px; box-shadow: var(--shadow-float); }
.dl-state { display: flex; flex-direction: column; gap: 16px; }
.dl-head { display: flex; align-items: center; justify-content: space-between; }
.dl h2 { font-weight: 600; font-size: 20px; line-height: 24px; letter-spacing: -0.44px; color: var(--ink); }
.dl-close { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; background: var(--chip); border-radius: 50%; color: var(--ink-2); }
.dl-close:hover { background: var(--soft); }
.dl-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-weight: 400; }
.dl-opt { position: relative; min-width: 0; display: flex; flex-direction: column; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.dl-opt:hover { border-color: var(--guide); }
.dl-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dl-opt:has(input:checked) { border-color: var(--dark); box-shadow: inset 0 0 0 0.5px var(--dark); }
.dl-opt:has(input:focus-visible) { outline: 2px solid var(--dark); outline-offset: 2px; }
.dl-visual { display: flex; align-items: center; justify-content: center; height: 64px; margin-bottom: 8px; }
.dl-visual img { display: block; flex: none; max-width: 60px; max-height: 60px; object-fit: contain; }
.dl-visual .mono { filter: brightness(0); }
.dl-visual .over { margin-left: -12px; }
.dl-opt b { font-weight: 500; font-size: 14px; line-height: 20px; color: var(--ink); }
.dl-opt small { font-size: 12px; line-height: 16px; color: var(--text-5); }
.dl-tick { position: absolute; top: 8px; right: 8px; display: none; align-items: center; justify-content: center; width: 20px; height: 20px; background: var(--dark); border-radius: 50%; color: #ffffff; }
.dl-tick .icon { width: 12px; height: 12px; }
.dl-opt:has(input:checked) .dl-tick { display: flex; }
.dl-files { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--page); border-radius: 12px; }
.dl-file { display: flex; align-items: center; gap: 8px; }
.dl-file > .icon { color: var(--text-4); }
.dl-file-name { min-width: 0; }
.dl-file-name b { display: block; overflow: hidden; text-overflow: ellipsis; font-weight: 500; font-size: 12px; line-height: 18px; color: var(--ink-2); white-space: nowrap; }
.dl-file-name small { display: block; font-size: 12px; line-height: 16px; color: var(--text-5); }
.dl-file-end { flex: none; margin-left: auto; font-size: 12px; line-height: 16px; color: var(--text-5); }
.dl-file-end.icon { color: var(--ink); }
.dl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dl-count { min-width: 0; font-size: 12px; line-height: 18px; color: var(--text-5); }
.dl-count.error { color: var(--red-deep); }
.dl-actions { flex: none; display: flex; gap: 8px; }
.dl-end { justify-content: flex-end; }
.dl-progress { display: flex; flex-direction: column; gap: 8px; }
.dl-track { height: 6px; overflow: hidden; background: var(--soft); border-radius: 3px; }
.dl-fill { width: 0; height: 100%; background: var(--dark); border-radius: 3px; transition: width 0.2s ease-out; }
.dl-step { font-size: 12px; line-height: 18px; color: var(--text-4); }
.dl-note { font-size: 12px; line-height: 18px; color: var(--text-5); }
.dl-done-head { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; text-align: center; }
.dl-done-head p { font-size: 14px; line-height: 20px; color: var(--text-4); }
.dl-check { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; background: var(--dark); border-radius: 24px; color: #ffffff; }
.dl-check .icon { width: 24px; height: 24px; }
.dl-finish { padding: 0 16px; }

/* ==========================================================================
   HP: Preview di atas, kanvas penuh, tombol mengambang di bawah, dan tiap alat
   membuka lembarnya sendiri. Halaman tidak digulir. Lembar mengambang di atas
   kanvas, jadi kanvas tidak tertekan; huruf menyesuaikan ruang di atas lembar.
   Nilai mengikuti section Figma 162:526267.
   ========================================================================== */
@media (max-width: 900px) {
  .on-desktop { display: none; }
  .on-phone { display: inline; }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  .foot { display: none; }

  .nav { flex: none; justify-content: space-between; gap: 8px; height: 56px; padding: 8px 12px; }
  .brand, .brand-home { gap: 5px; }
  .nav .menu-btn { display: flex; }
  .logo-lg { display: none; }
  .logo-sm { display: block; }
  .wordmark { font-size: 24px; line-height: 26px; }
  .type-input, .tool-toggle { display: none; }
  .nav-actions .btn-dark { gap: 6px; padding: 0 11.5px 0 9.5px; }

  .app { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 0; height: auto; padding: 0; }
  .workspace { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }

  /* ---------- Preview: diketuk untuk mengetik, kolomnya tidak terlihat ---------- */
  .preview { position: relative; top: auto; left: auto; z-index: auto; flex: none; width: auto; height: 148px; margin: 0 12px; gap: 6px; cursor: pointer; }
  .preview:focus-within { border-color: var(--guide-strong); }
  .copy-png::before { content: ""; position: absolute; inset: -9px -4px; }
  .copy-png:active { background: var(--soft); }
  .preview-body { flex: none; align-items: center; justify-content: flex-start; height: 100px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%); }
  .type-canvas { margin: 0 auto; }
  .type-caret { flex: none; align-self: center; width: 2px; height: 80%; margin-left: 4px; background: var(--red-deep); border-radius: 1px; animation: caret 1s steps(1) infinite; }
  .preview-overlay { position: absolute; left: 0; top: 0; display: block; width: 100%; height: 100%; padding: 0; opacity: 0; border: 0; outline: 0; background: none; pointer-events: none; font-size: 16px; }

  /* ---------- kanvas ---------- */
  .polish { flex: 1 1 0; min-height: 0; height: auto; background: var(--page); border: 0; border-radius: 0; box-shadow: none; }
  .char-strip { order: 0; border-bottom: 0; background: var(--page); }
  .char-tile { flex: 0 0 48px; }
  .canvas { order: 1; }
  .stage-wrap { inset: 44px 0 calc(143px + env(safe-area-inset-bottom)); }
  .guide-labels span { left: 8px; }
  .polish-controls { position: absolute; top: 76px; left: 12px; right: 12px; width: auto; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .polish-head { flex: none; }
  .polish-head .card-title, .letter-chip { display: none; }
  .chips { flex: none; gap: 4px; }
  .chips .btn { flex: none; width: 44px; height: 28px; }
  .polish-actions { min-width: 0; }
  .reroll { flex: none; height: 28px; padding: 0 10px; }
  .mode, .letter { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .mode .tool-btn, .letter .tool-btn { padding: 0 10px 0 8px; }
  .brush-size { bottom: calc(132px + env(safe-area-inset-bottom)); }
  .canvas:has(.brush-size:not(.hidden)) .guide-labels span:last-child { visibility: hidden; }

  /* ---------- lembar: pop-up dari bawah layar, kanvas di belakangnya tidak berubah ---------- */
  .panel { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: none; flex-direction: column; gap: 0; max-height: calc(100dvh - 216px); padding-bottom: calc(84px + env(safe-area-inset-bottom)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; background: var(--card); border-radius: 22px 22px 0 0; box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18); animation: sheet-up 0.22s ease-out; }
  .panel::-webkit-scrollbar { display: none; }
  body.has-sheet .panel { display: flex; }
  .sheet-head { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: block; height: 40px; touch-action: none; }
  .sheet-head::before { content: ""; position: absolute; top: 8px; left: calc(50% - 18px); width: 36px; height: 4px; background: var(--guide); border-radius: 2px; }
  .panel > .card { display: none; flex: none; height: auto; min-height: 0; min-width: 0; gap: 8px; margin: 0; padding: 18px 12px 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
  .panel > .card.sheet-on { display: flex; flex-direction: column; }
  .sheet-help { display: block; font-size: 13px; line-height: 18px; color: var(--text-5); }

  /* Things: kartu dan isinya lebih ringkas supaya huruf tetap terlihat di atas lembar */
  .panel > .things-card { gap: 0; overflow: visible; }
  .things-head { display: none; }
  .things-card.picking { padding: 18px 12px 0; border: 0; }
  .picking .things-head { display: flex; align-items: center; }
  .picking .things-head .i-chalkboard { display: inline-block; }
  .pick-done { height: 30px; margin-top: 0; padding: 0 14px; border-radius: 15px; font-size: 13px; }
  .picking .pick-head { display: block; margin-bottom: 10px; }
  .pick-head .mix { gap: 8px; margin-top: 6px; }
  .pick-head .mix-tile { width: 52px; height: 52px; }
  .things-body { flex: none; min-height: 0; }
  .cat-list { grid-template-rows: 106px 106px auto; height: auto; padding-bottom: 8px; }
  .cat-card { padding: 10px 12px 11px; }
  .cat-peek { margin-bottom: 6px; }
  .cat-peek svg { width: 50px; height: 50px; margin-left: -20px; }
  /* setinggi daftar kartu, jadi lembar tidak melompat saat masuk ke satu kelompok */
  .cat-page { height: auto; min-height: 289px; padding-bottom: 8px; }
  .cat-page > .cat-own { margin-bottom: 8px; }
  .cat-head { height: 32px; margin: -4px 0 9px -2px; }
  .picking .cat-head { margin-top: 0; }
  .cat-back { position: relative; width: 32px; height: 32px; }
  .cat-back::before { content: ""; position: absolute; inset: -6px; }
  .cat-scroll { flex: 1 1 auto; display: grid; margin: 0; padding: 0; overflow: visible; }
  .tray-grid { --thing: 48px; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(64px, 1fr); height: auto; }
  .tray-grid.mid { --thing: 56px; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: minmax(64px, 1fr); }
  .tray-grid.big { --thing: 80px; grid-auto-rows: minmax(96px, 1fr); }
  .tray-item { border-radius: 10px; }
  /* layar sentuh: hover menempel setelah diketuk, jadi tandanya hanya saat ditekan */
  .tray-item:active, .cat-card:active { background: var(--soft); }
  .tray-check { top: 3px; right: 3px; }
  .tray-cell .del { right: auto; left: 0; }

  /* Setup: kalimat lebih besar; pengaturan muncul di bawah kalimat supaya dekat jempol */
  .panel > .sentence-card { gap: 0; padding: 0; }
  .sentence { gap: 4px; padding: 22px 16px 0; }
  .sentence-row { gap: 10px; height: 48px; }
  .word { font-size: 36px; line-height: 48px; }
  .tok { height: 44px; padding: 0 14px; border-radius: 14px; font-size: 15px; line-height: 22px; }
  .tok-things { gap: 12px; padding: 0 12px 0 10px; }
  .tok-things .icon { width: 16px; height: 16px; }
  .stack-item { width: 30px; height: 30px; margin-left: -9px; }
  .stack-more { margin-left: -4px; font-size: 13px; line-height: 18px; }
  .sentence-foot { flex: none; display: block; margin: 10px 12px 0; padding: 13px 0 0; }
  .sentence-foot .generate-btn { display: none; }
  .sentence-card[data-open]:not([data-open=""]) .sentence-foot { display: none; }
  .replace { display: flex; justify-content: space-between; font-size: 14px; line-height: 20px; }
  .replace-note { font-size: 13px; }
  .pop { position: static; height: auto; margin: 10px 12px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; overflow: visible; }
  .pop-letters { padding: 9px 0 0; }
  .scope { gap: 6px; }
  .scope span { height: 60px; }
  .scope b { font-size: 14px; line-height: 20px; }
  .scope small { font-size: 12px; }
  .pop-foot { height: 28px; margin-top: 8px; padding: 0; }
  .pop-total { font-size: 14px; line-height: 20px; }
  .pop-all { width: 44px; height: 28px; font-size: 12px; }
  .pop-num { padding: 11px 0 8px; }
  .num-sample { width: 96px; height: 96px; border-radius: 12px; }
  .num-top { height: 18px; margin-top: 0; font-size: 13px; line-height: 18px; }
  .num-word { font-size: 12px; line-height: 16px; }
  .num-step { height: 44px; margin-top: 6px; }
  .num-step button { width: 44px; height: 44px; border-radius: 12px; }
  .num-step button .icon { width: 18px; height: 18px; }
  .num-step input { height: 44px; font-size: 18px; line-height: 26px; }
  .num-track { height: 20px; margin-top: 6px; }
  .num-track.has-zero::before { top: 5px; }
  .num-slider { height: 20px; }
  .num-slider::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; }
  .num-slider::-moz-range-thumb { width: 20px; height: 20px; }
  .num-limits { display: none; }
  /* mengetik angka: lembar naik di atas papan ketik, hanya kolom angka yang tersisa */
  body.num-typing .panel { bottom: var(--kb, 0px); max-height: calc(100dvh - var(--kb, 0px) - 56px); padding-bottom: 12px; }
  body.num-typing .toolbar { display: none; }
  .num-typing .num-sample, .num-typing .num-track, .num-typing .num-word, .num-typing .num-step button { display: none; }
  .num-typing .pop-num { padding-top: 4px; border-top: 0; }
  .num-typing .num-main { flex-direction: row; align-items: center; height: 44px; padding: 0 14px; border: 1px solid var(--dark); border-radius: 12px; }
  .num-typing .num-top { flex: none; font-weight: 400; font-size: 14px; color: var(--text-5); }
  .num-typing .num-step { flex: 1 1 0; height: 42px; margin: 0; }
  .num-typing .num-step input { height: 42px; margin: 0; font-size: 16px; text-align: right; box-shadow: none; }

  /* kolom angka PNG to Font */
  .field { flex: none; height: 40px; gap: 6px; padding: 0 6px 0 12px; }
  .field .icon { color: var(--text-4); }
  .field input { order: 2; font-size: 16px; transform: scale(0.8125); transform-origin: right center; text-align: right; }

  /* ---------- tombol mengambang ---------- */
  .toolbar { position: fixed; z-index: 6; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; width: min(100% - 16px, 301px); height: 60px; transform: translateX(-50%); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3)); }
  .toolbar.dock-two { width: 244px; }
  body.is-typing .toolbar, body.has-obj .toolbar { display: none; }
  /* tepinya bukan border: border dibulatkan browser sehingga tebalnya bisa beda dengan tepi di leher */
  .dock-seg { position: relative; display: flex; flex: 1 1 0; min-width: 0; padding: 5px; background: var(--ink-rim); border-radius: 30px; }
  .dock-seg::before { content: ""; position: absolute; inset: 1.5px; background: var(--ink-body); border-radius: 28.5px; pointer-events: none; }
  .dock-seg :focus-visible { outline-color: #ffffff; outline-offset: -3px; }
  /* leher menutup tepi pil di sambungan dan meneruskan tepinya sendiri, isi pil tetap di atasnya */
  .dock-neck { position: relative; z-index: 1; display: block; flex: none; width: 36px; height: 60px; margin: 0 -14px; pointer-events: none; }
  .dock-seg > * { position: relative; z-index: 2; }
  /* ketukan cepat tidak memperbesar halaman, tahan lama tidak memunculkan menu gambar */
  .panel, .toolbar, .obj-bar { touch-action: manipulation; }
  .toolbar, .obj-bar, .preview, .tray-grid, .cat-list, .mix { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .dock-things { flex: 0 0 114px; }
  /* Setup dan Generate satu pil, ujung pil ikut bisa diketuk */
  .dock-auto { gap: 5px; }
  .tb-generate { width: 44px; height: 44px; margin: 3px 3px 3px 0; }
  .tb-generate::before { content: ""; position: absolute; inset: -9.5px -9.5px -9.5px -6px; border-radius: 0 30px 30px 0; }
  .tb-generate.pending::after { inset: -5px; border-width: 1.5px; opacity: 0.85; }
  .tb { position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 25px; font-weight: 500; font-size: 14px; line-height: 20px; color: #ffffff; white-space: nowrap; }
  .tb.active { background: #ffffff; color: var(--ink); }
  .tb-icon { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; }
  .tb-icon .icon { width: 20px; height: 20px; }
  .tb-icon .i-sliders { height: 22.5px; }
  .tb-icon svg, .tb-icon img { display: block; width: 20px; height: 20px; object-fit: contain; }

  /* benda dipilih: alatnya menggantikan tombol mengambang dengan bentuk yang sama */
  .obj-bar { position: fixed; z-index: 7; left: 50%; right: auto; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); align-items: stretch; gap: 0; width: min(100% - 24px, 420px); height: 60px; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; transform: translateX(-50%); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3)); will-change: auto; }
  .obj-bar.off, body.is-typing .obj-bar { display: none; }
  .obj-tools { flex: 251 1 0; justify-content: space-between; padding: 5px 19px; }
  .obj-finish { flex: 62 1 0; }
  .obj-tools .tool-btn { flex: none; gap: 4px; height: 50px; padding: 0; font-size: 13px; line-height: 20px; color: #ffffff; }
  .obj-tools .tool-btn:hover { background: none; }
  .obj-tools .tool-btn:active { opacity: 0.6; }
  .obj-tools .tool-btn .icon { width: 18px; height: 18px; }
  .obj-done { display: flex; flex: 1 1 0; min-width: 0; height: 50px; padding: 0; background: #ffffff; border: 0; border-radius: 25px; box-shadow: none; font-size: 13px; color: var(--ink); }
  .obj-done:hover { background: #ffffff; }

  .modal-field input[type="text"] { font-size: 16px; }
  #export-modal { align-items: flex-end; padding: 0; }
  .dl { width: 100%; max-width: none; max-height: 92dvh; padding: 20px 12px calc(12px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .dl-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .dl-actions > * { flex: 1 1 0; min-width: 0; }
  .dl-end > * { flex: 1 1 0; }
  .dl-opt small { font-size: 11px; line-height: 15px; }

  /* pesan singkat di dekat atas kanvas: tidak menutupi tombol maupun isi lembar */
  .toast { top: 316px; bottom: auto; }
}

/* layar pendek: Preview lebih rendah */
@media (max-width: 900px) and (max-height: 700px) {
  .preview { height: 108px; gap: 0; }
  .preview-body { height: 67px; }
  .stage-wrap { inset: 38px 0 calc(146px + env(safe-area-inset-bottom)); }
  .toast { top: 276px; }
}

/* layar sangat pendek: kalimat lebih kecil supaya pengaturannya ikut terlihat */
@media (max-width: 900px) and (max-height: 640px) {
  .cat-list { grid-template-rows: 88px 88px auto; }
  .cat-card { padding: 7px 12px 8px; }
  .cat-peek { margin-bottom: 3px; }
  .cat-peek svg { width: 42px; height: 42px; margin-left: -17px; }
  .cat-own { height: 48px; }
  .cat-plus { top: 9px; }
  .cat-page { min-height: 248px; }
  .tray-grid, .tray-grid.mid { --thing: 44px; grid-auto-rows: minmax(50px, 1fr); }
  .tray-grid.big { --thing: 64px; grid-auto-rows: minmax(75px, 1fr); }
  .sentence { gap: 2px; padding-top: 20px; }
  .sentence-row { height: 40px; }
  .word { font-size: 30px; line-height: 40px; }
  .tok { height: 38px; border-radius: 12px; font-size: 14px; line-height: 20px; }
  .sentence-foot { margin-top: 6px; padding-top: 10px; }
  .pop { margin-top: 6px; }
}

/* layar sempit: alat dirapatkan supaya tetap muat */
@media (max-width: 340px) {
  .mode .tool-btn, .letter .tool-btn { gap: 4px; padding: 0 8px 0 6px; font-size: 11px; }
  .mode .tool-btn .icon, .letter .tool-btn .icon { width: 14px; height: 14px; }
  .obj-tools { padding: 5px 10px; }
  .obj-tools .tool-btn { gap: 2px; font-size: 12px; }
  .obj-tools .tool-btn .icon { width: 16px; height: 16px; }
}

@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none !important; } .type-caret { animation: none; } }
