/* Work pad: the same pad as DegreeOS (A4 pages, Apple Pencil and stylus first). */
.pad { position: fixed; inset: 0; z-index: 200; display: grid; grid-template-areas: "bar" "qs" "stage"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); background: var(--paper); padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.padbar { grid-area: bar; min-width: 0; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px 8px; padding: 8px 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-behavior: smooth; background: var(--surface); border-bottom: 1px solid var(--line); }
.padbar .grp { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 12px; background: var(--sunk); }
.tool { display: grid; place-items: center; min-width: 38px; height: 40px; padding: 0 7px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font-size: .84rem; font-weight: 600; }
.tool svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--accent); }
.tool:disabled { opacity: .35; }
.sizedot { width: var(--d); height: var(--d); border-radius: 50%; background: currentColor; }
.inkdot { width: 22px; height: 22px; border-radius: 50%; background: var(--ink-c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
/* The ink in use: a thick white ring with a thin ring of the same colour around it, so it stands out on any background. */
.tool.ink[aria-pressed="true"] { background: transparent; box-shadow: none; }
.tool.ink[aria-pressed="true"] .inkdot { box-shadow: 0 0 0 3.5px #fff, 0 0 0 5.5px var(--ink-c), 0 1px 6px 5px rgba(0, 0, 0, .12); }
.inkdot { transition: box-shadow .15s ease-out; }
.padbar::-webkit-scrollbar { display: none; }
.padbar > * { flex-shrink: 0; }
.barscroll { position: sticky; z-index: 3; flex: 0 0 auto; width: 38px; height: 42px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }
.barscroll.left { left: 0; }
.barscroll.right { right: 0; margin-left: auto; }
.padq { flex: 1 1 0; min-width: 90px; flex-shrink: 1; display: flex; align-items: center; gap: 8px; }
.padq button { min-width: 0; max-width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; padding: 4px 6px; border-radius: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.padq button:hover { background: var(--sunk); }
.pad { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.padside { -webkit-user-select: text; user-select: text; }
.padqs { grid-area: qs; min-width: 0; max-height: 32vh; overflow-y: auto; padding: 8px 14px 10px; background: var(--surface); border-bottom: 1px solid var(--line); display: grid; gap: 6px; -webkit-user-select: text; user-select: text; }
.pqchip { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-family: var(--display); font-weight: 700; cursor: pointer; }
.pqchip[aria-pressed="true"] { background: var(--c-study); border-color: var(--c-study); color: #2A2200; }
.tool.caret { position: relative; padding-right: 14px; }
.tool.caret::after { content: ""; position: absolute; right: 5px; bottom: 9px; border: 3.5px solid transparent; border-top-color: currentColor; opacity: .6; }
.tool .tlabel { font-size: .8rem; font-weight: 600; margin-left: 5px; }
#tool-ask, #pad-pdf { display: inline-flex; align-items: center; }
.menu { position: absolute; z-index: 30; min-width: 210px; padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.menu button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 500; text-align: left; cursor: pointer; }
.menu button > span:first-child.sizedot + span, .menu button svg + span { flex: 1; }
.menu button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu button:hover { background: var(--sunk); }
.menusep { height: 1px; margin: 4px 6px; background: var(--line); }
.menu .sizedot { margin: 0 7px; flex: 0 0 auto; }
.menu button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.selbar { position: absolute; z-index: 4; display: flex; gap: 6px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.padstage { grid-area: stage; position: relative; overflow: hidden; background: var(--pad-paper); touch-action: none; }
.padstage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.padhint { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); color: #8C97B1; font-family: var(--hand); font-size: 1.8rem; pointer-events: none; text-align: center; }
.padside { position: absolute; z-index: 5; top: 10px; right: 10px; bottom: 10px; width: min(440px, calc(100% - 20px)); display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.padside header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.padside .scroll { overflow-y: auto; padding: 14px; display: grid; gap: 12px; align-content: start; grid-auto-rows: max-content; }
.padside .scroll > *, .cgp, .cgp .pagebody > *, .cgp .cg-sec > *, .example > *, .learnbox > *, .steps2 li > *, .msg > *, .tutor > * { min-width: 0; }
.cgp .idea, .cgp .hook, .cgp .cg-body, .msg .txt { overflow-wrap: anywhere; }
.cgp mjx-container:not([display]), .msg .txt mjx-container:not([display]) { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
.padzoom { position: absolute; z-index: 4; left: 50%; top: 10px; transform: translateX(-50%); display: flex; align-items: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.padzoom { transition: opacity .25s ease-out; }
.padzoom.gone { opacity: 0; pointer-events: none; }
.padzoom button { min-width: 44px; height: 38px; padding: 0 10px; border: 0; background: transparent; color: var(--ink); font: 600 .9rem var(--body); cursor: pointer; }
.padzoom button + button { border-inline-start: 1px solid var(--line); }
.padzoom #pad-zout, .padzoom #pad-zin { font-size: 1.15rem; }
.padzoom button:disabled { color: var(--ink-3); cursor: default; }
.padzoom #pad-zoom:disabled { color: var(--ink-2); }
.padscroll { position: absolute; z-index: 4; right: 8px; bottom: 10px; display: grid; gap: 6px; }
.padscroll button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1.1rem; box-shadow: var(--shadow); }
.padsave:empty { display: none; } .padsave::before { content: "· "; } .padsave[data-st="error"] { color: #C0262D; font-weight: 600; }
.padpos { position: absolute; z-index: 4; left: 10px; bottom: 10px; padding: 3px 9px; border-radius: 8px; background: rgba(255, 255, 255, .85); color: #505B76; font-family: var(--mono); font-size: .76rem; pointer-events: none; }
.pqtext { font-size: 1.02rem; }
.padqs .row.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.padside .msg { padding: 12px 14px; }
@media (max-width: 640px) { .padbar { gap: 4px 6px; padding: 6px 8px; } .tool { min-width: 34px; } .padside { top: auto; height: min(62%, 560px); left: 8px; right: 8px; width: auto; bottom: 8px; } }
