.pf-draw-layer { position:fixed; left:0; top:0; z-index:50; pointer-events:none; overflow:hidden; }
.pf-draw-panel [hidden] { display:none !important; }
html.is-paint-mode, html.is-paint-mode body, .pf.is-paint-mode { overscroll-behavior:none; }
html.is-paint-mode body { overflow:hidden; }
.pf.is-paint-mode { overflow:hidden; }
.pf .pf-wrap, .pf .pf-personal-backdrop, .pf .pf-top { transition:opacity .28s ease, visibility 0s linear 0s; }
.pf.is-paint-mode .pf-wrap, .pf.is-paint-mode .pf-personal-backdrop, .pf.is-paint-mode .pf-top,
html.is-paint-mode .study-controls, html.is-paint-mode > header { opacity:0; visibility:hidden; pointer-events:none; transition:opacity .28s ease, visibility 0s linear .28s; }
.pf-paint-toggle { position:fixed; z-index:80; right:16px; bottom:calc(16px + env(safe-area-inset-bottom)); width:56px; height:56px; padding:0; border:1px solid #cfb382; border-radius:50%; background:#151718f2; color:#e9e5dc; font:600 13px/1.1 system-ui,sans-serif; box-shadow:0 8px 28px #0008; cursor:pointer; }
.pf-draw-panel .pf-paint-toggle { position:static; width:auto; height:auto; min-height:44px; padding:8px 14px; border-radius:999px; box-shadow:none; }
.pf-paint-public, .pf-draw-remote { position:absolute; z-index:-1; pointer-events:none; }
.pf-draw-layer.is-editing { pointer-events:auto; touch-action:none; cursor:crosshair; }
.pf-draw-layer.is-editing[data-blocked="true"] { cursor:not-allowed; }
body:has(dialog[open]) > .pf-draw-layer { visibility:hidden; }
.pf-draw-cursor { pointer-events:none; }

.pf-draw-bed { position:absolute; top:0; left:0; right:0; z-index:-1; overflow:hidden; pointer-events:none; transition:opacity .5s ease, filter .5s ease; }

.pf-draw-bed.is-resting { opacity:.55; filter:saturate(.8); }
.pf-draw-tile { position:absolute; width:128px; height:128px; }
.pf-draw-glints { transition:opacity .5s ease; }
.pf-draw-glints.is-resting { opacity:.6; }
.pf-draw-panel { position:fixed; z-index:70; bottom:18px; left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100vw - 32px); padding:14px 18px; border:1px solid #c8b48e66; border-radius:12px; background:#151718f5; color:#e9e5dc; box-shadow:0 12px 48px #0009; font:13px/1.5 system-ui,sans-serif; }
.pf-draw-panel[hidden], .pf-draw-layer[hidden] { display:none; }
.pf-draw-heading { display:flex; justify-content:space-between; gap:32px; margin-bottom:10px; align-items:baseline; }
.pf-draw-heading strong { font:600 21px/1.2 'Cormorant Garamond',Georgia,serif; }
.pf-draw-heading span { color:#b9b5ac; font-size:12px; }
.pf-draw-slots { display:flex; gap:4px; margin-right:auto; margin-left:-16px; }
.pf-draw-panel .pf-draw-slots button { min-height:28px; min-width:30px; padding:2px 8px; font-variant-numeric:tabular-nums; }
.pf-draw-panel .pf-draw-slots button[data-empty="true"]:not([aria-pressed="true"]) { color:#8f918c; }

.pf-bg-switch { display:inline-flex; align-items:center; gap:6px; color:var(--pf-meta,#b9b5ac); font-size:12px; }
.pf-bg-switch button { width:26px; height:26px; padding:0; border:1px solid rgba(233,229,220,.2); border-radius:50%; background:transparent; color:inherit; font:inherit; font-variant-numeric:tabular-nums; cursor:pointer; }
.pf-bg-switch button:hover { border-color:rgba(233,229,220,.45); }
.pf-bg-switch button[aria-pressed="true"] { border-color:#cfb382; background:#39352c; color:#e9dcc0; }
.pf-bg-switch button[data-empty="true"]:not([aria-pressed="true"]) { opacity:.55; }
.pf-bg-switch button:focus-visible { outline:2px solid #e4c68e; outline-offset:2px; }
.pf-draw-tools { display:flex; align-items:center; gap:7px; }
.pf-draw-tools [data-draw-tool] { display:flex; align-items:center; gap:6px; white-space:nowrap; }
.pf-draw-tools [data-draw-tool] svg,.pf-draw-tools [data-draw-tool] canvas { flex:none; color:#d8bc87; }
.pf-draw-panel button,.pf-draw-panel summary { box-sizing:border-box; min-height:40px; padding:8px 11px; border:1px solid #e9e5dc30; border-radius:6px; background:#202426; color:#e9e5dc; cursor:pointer; font:12px/1.5 system-ui,sans-serif; }
.pf-draw-panel button:hover:not(:disabled),.pf-draw-panel summary:hover { background:#303638; }
.pf-draw-panel button[aria-pressed="true"] { border-color:#cfb382; background:#39352c; }
.pf-draw-panel [data-draw-brushes] summary[data-active="true"] { border-color:#cfb382; background:#39352c; }
.pf-draw-panel [data-draw-brush-name] { color:#cbb995; font-size:11px; }
.pf-draw-panel .pf-draw-brush-options { width:min(300px, calc(100vw - 32px)); display:grid; gap:6px; max-height:calc(100dvh - 190px); overflow:auto; }
.pf-draw-panel .pf-draw-brush-options button { width:100%; gap:12px; text-align:left; padding:12px; white-space:normal; }
.pf-draw-brush-options small { display:block; margin-top:3px; color:#b9b5ac; font-size:11px; }
.pf-draw-brush-options svg,.pf-draw-brush-options canvas { background:#151615; border-radius:5px; }
.pf-draw-panel button:disabled { opacity:.4; cursor:default; }
.pf-draw-panel :focus-visible { outline:2px solid #e4c68e; outline-offset:3px; }
.pf-draw-panel [data-draw-action="done"] { background:#dcd6c9; color:#17191a; border-color:#dcd6c9; }
.pf-draw-panel details { position:relative; }
.pf-draw-panel summary { list-style:none; display:flex; align-items:center; gap:7px; }
.pf-draw-panel summary::-webkit-details-marker { display:none; }
.pf-draw-colour-dot { display:inline-block; width:14px; height:14px; border-radius:50%; background:var(--draw-colour,#c9aa72); border:1px solid #e9e5dc88; }
.pf-draw-popover { position:absolute; bottom:calc(100% + 12px); left:0; width:min(300px, calc(100vw - 32px)); max-height:min(320px, calc(100dvh - 190px)); overflow:auto; box-sizing:border-box; background:#1b2023; border:1px solid #c8b48e66; border-radius:9px; padding:14px; box-shadow:0 8px 30px #0008; }
.pf-draw-popover p { margin:8px 0 14px; color:#b9b5ac; font-size:12px; }
.pf-draw-popover p:last-child { margin-bottom:0; }
.pf-draw-guide { display:flex; align-items:center; gap:8px; cursor:pointer; }
.pf-draw-guide input { width:16px; height:16px; margin:0; accent-color:#c9aa72; }
.pf-draw-palette { display:grid; grid-template-columns:repeat(4,1fr); gap:6px; margin-bottom:12px; }
.pf-draw-palette button { min-width:40px; padding:9px; }
.pf-draw-palette i { display:block; width:20px; height:20px; border-radius:50%; background:var(--swatch); }
.pf-draw-custom { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.pf-draw-custom input { width:48px; height:32px; padding:2px; background:transparent; border:1px solid #c8b48e66; cursor:pointer; }
.pf-draw-size { display:flex; align-items:center; gap:8px; padding:0 5px; }
.pf-draw-size input { width:75px; accent-color:#c9aa72; }
.pf-draw-size output { width:22px; font-variant-numeric:tabular-nums; }
.pf-draw-actions { display:flex; gap:7px; border-left:1px solid #e9e5dc30; padding-left:12px; margin-left:5px; }
.pf-draw-note { display:flex; justify-content:space-between; gap:20px; margin-top:10px; color:#abaea9; font-size:11px; }
.pf-draw-note [role="status"] { color:#ded2b7; }
.pf-draw-notice { position:fixed; z-index:72; left:50%; bottom:20px; transform:translateX(-50%); padding:10px 16px; background:#171b1e; border:1px solid #c8b48e66; border-radius:8px; color:#e9e5dc; font:13px/1.5 system-ui,sans-serif; pointer-events:none; }
.pf-draw-notice:empty { display:none; }
@media(min-width:960px) and (max-height:480px) {
 .pf-draw-panel { bottom:8px; padding:10px 12px; }
 .pf-draw-heading { margin-bottom:6px; }
 .pf-draw-note { margin-top:6px; }
 .pf-draw-panel .pf-draw-popover { max-height:calc(100dvh - 160px); }
}
@media(max-width:959px) {
 .pf-draw-slots { display:none!important; }
 .pf-draw-panel { left:0; right:0; bottom:0; transform:none; width:100%; max-width:none; box-sizing:border-box; border-radius:16px 16px 0 0; padding:12px 12px calc(12px + env(safe-area-inset-bottom)); max-height:min(46dvh, 420px); overflow:auto; }
 .pf-draw-heading { flex-direction:column; gap:6px; align-items:flex-start; }
 .pf-draw-tools { flex-wrap:wrap; overflow-x:auto; gap:8px; }
 .pf-draw-panel button, .pf-draw-panel summary, .pf-draw-panel .pf-paint-toggle { min-height:44px; min-width:44px; }
 .pf-draw-actions { border:0; padding:0; margin:0; }
 .pf-draw-panel [data-draw-action="undo"], .pf-draw-panel [data-draw-action="redo"], .pf-draw-panel [data-draw-action="who"] { display:inline-flex; }
 .pf-draw-note { flex-direction:column; gap:4px; }
 .pf-draw-panel .pf-draw-popover, .pf-draw-panel .pf-draw-brush-options { position:fixed; left:8px; right:8px; bottom:calc(88px + env(safe-area-inset-bottom)); width:auto; max-height:min(50dvh, 360px); }
}
@media(min-width:960px) {
 .pf-paint-toggle { display:none; }
}
