/* Focus/scrollIntoView must scroll the app, never the desktop behind it. */
body:has(.paw-app) { overflow: clip; }
.paw-paint-window {
    display: flex;
    flex-direction: column;
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - var(--taskbar-height) - 24px);
    min-width: 320px;
    transition: box-shadow .2s, transform .2s, opacity .2s;
}
.paw-paint-window .window-titlebar { flex-shrink: 0; }
.paw-paint-window .window-content { padding: 0; flex: 1; min-height: 0; height: auto; background: #191822; }
.paw-paint-window.maximized { max-width: none; max-height: none; }
.paw-app { --paw-line: #383441; --paw-muted: #cfc5dc; --paw-accent: #d6bbea; color: #f7f1ed; font: 16px/1.5 'Inter', sans-serif; }
.paw-app [hidden] { display: none !important; }
.paw-app button, .paw-app input { font: inherit; }
.paw-app button { color: inherit; cursor: pointer; border: 1px solid var(--paw-line); background: #25222f; border-radius: 8px; padding: 8px 12px; transition: background .15s, border-color .15s; }
.paw-app button:hover:not(:disabled) { border-color: #ac8bc5; background: #383042; }
.paw-app button:disabled { opacity: .6; cursor: default; }
.paw-app button:focus-visible, .paw-app input:focus-visible, .paw-app canvas:focus-visible { outline: 2px solid #dcc0f3; outline-offset: 3px; }
.paw-app h1, .paw-app h2, .paw-app h3, .paw-app p { margin: 0; }
.paw-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 26px 18px; }
.paw-brand { display: flex; align-items: center; gap: 14px; }
.paw-logo { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: #ecc8ae; font-size: 26px; transform: rotate(-7deg); }
.paw-eyebrow { font: 12px/1.5 'JetBrains Mono', monospace; letter-spacing: 1.8px; color: #c8b4d7; }
.paw-brand h1 { font-size: 30px; letter-spacing: -1.4px; line-height: 1.2; font-weight: 700; }
.paw-period { color: #c9eba9; }
.paw-header > p { font-size: 15px; color: #c9c0cc; text-align: right; }
.paw-tabs { display: flex; gap: 20px; padding: 0 26px; border-bottom: 1px solid var(--paw-line); }
.paw-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; border-radius: 0; padding: 10px 0 13px; color: var(--paw-muted); }
.paw-tabs button[aria-pressed="true"] { color: #e8d0f7; border-bottom-color: #d7b1f0; }
.paw-studio { padding: 20px 26px 0; }
.paw-workspace { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 22px; }
.paw-tools h2 { font: 12px/1.5 'JetBrains Mono', monospace; letter-spacing: 1.1px; color: #c4b9ce; margin: 17px 0 8px; }
.paw-tools h2:first-child { margin-top: 0; }
.paw-tools h2 span { display: block; color: #dfd4e8; font: 13px 'Inter', sans-serif; letter-spacing: 0; margin-top: 3px; }
.paw-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.paw-tool-grid button { display: flex; flex-direction: column; align-items: center; padding: 7px 3px; font-size: 13px; gap: 2px; }
.paw-tool-grid button span { font-size: 21px; line-height: 1.1; }
.paw-app [data-tool][aria-pressed="true"], .paw-sizes button[aria-pressed="true"] { background: #d7bee9; color: #352240; border-color: #d7bee9; }
.paw-app [data-tool][aria-pressed="true"]:hover, .paw-sizes button[aria-pressed="true"]:hover { background: #e9d6f6; color: #352240; }
.paw-sizes { display: flex; gap: 6px; }
.paw-sizes button { display: grid; place-items: center; flex: 1; height: 34px; padding: 3px; }
.paw-sizes span { display: block; background: currentColor; border-radius: 1px; }
.paw-stamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.paw-stamps button { padding: 5px 0; font-size: 17px; }
.paw-palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.paw-palette button { background: var(--swatch) !important; aspect-ratio: 1; padding: 0; border-radius: 4px; border: 1px solid #ffffff26; }
.paw-palette button[aria-pressed="true"] { outline: 2px solid white; outline-offset: 2px; }
.paw-drawing-area { min-width: 0; }
.paw-canvas-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: -3px 0 9px; font: 13px 'JetBrains Mono', monospace; }
.paw-muted { color: var(--paw-muted); }
.paw-canvas-toolbar > div { display: flex; gap: 5px; }
.paw-canvas-toolbar button { padding: 3px 9px; min-height: 29px; }
.paw-canvas-toolbar [aria-label] { font-size: 19px; line-height: 1; }
.paw-canvas-mat { display: flex; flex-direction: column; align-items: center; padding: 18px 22px 10px; background-color: #312c38; background-image: radial-gradient(#514857 1px, transparent 1px); background-size: 12px 12px; border: 1px solid #49414f; border-radius: 10px; }
.paw-canvas { display: block; width: 100%; max-width: 576px; aspect-ratio: 4 / 3; height: auto; background: #fff4df; box-shadow: 3px 5px 0 #15121a66; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.paw-canvas-note { font-size: 13px; letter-spacing: .3px; color: #c7bacb; margin-top: 10px; }
.paw-canvas-footer { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 0; font-size: 13px; color: #b7ccb3; }
.paw-canvas-footer button { background: transparent; font-size: 14px; padding: 5px 9px; color: #ded3e6; }
.paw-canvas-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.paw-canvas-footer [data-action="hang-room"] { background: #403448; border-color: #745b82; color: #edcef6; }
.paw-room-note { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 8px; font-size: 12px; color: var(--paw-muted); padding-bottom: 5px; }
.paw-room-note button { flex-shrink: 0; padding: 4px 7px; font-size: 13px; background: transparent; }
.paw-publish-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr) auto; align-items: end; gap: 10px; padding: 17px 0 8px; border-top: 1px solid var(--paw-line); margin-top: 12px; }
.paw-publish-heading { grid-column: 1 / -1; margin-bottom: 2px; }
.paw-publish-heading h2 { font-size: 18px; font-weight: 600; }
.paw-publish-heading p { margin-top: 3px; font-size: 14px; color: var(--paw-muted); }
.paw-publish-form label { display: flex; flex-wrap: wrap; gap: 5px; font-size: 13px; color: #cfc1d7; }
.paw-publish-form input { width: 100%; min-width: 0; height: 39px; background: #24202c; border: 1px solid #4b4054; border-radius: 7px; padding: 9px 10px; color: #fff4df; font-size: 15px; }
.paw-publish-form input::placeholder { color: #a599ae; }
.paw-app .paw-primary { background: #c5dfa7; color: #29361f; border-color: #c5dfa7; font-size: 15px; font-weight: 600; min-height: 39px; }
.paw-app .paw-primary:hover:not(:disabled) { background: #dbefc5; border-color: #dbefc5; }
.paw-message { margin: 0 26px !important; padding: 9px 0 16px; min-height: 24px; font-size: 15px; color: #c5dfa7; }
.paw-message:empty { padding-top: 0; }
.paw-message.paw-error { color: #ffb4ac; }
.paw-gallery { padding: 22px 26px 0; }
.paw-gallery-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 24px; }
.paw-gallery-heading h2 { font-size: 25px; letter-spacing: -.7px; margin: 4px 0; }
.paw-gallery-heading p { font-size: 15px; color: var(--paw-muted); }
.paw-gallery-heading > button { flex-shrink: 0; font-size: 14px; }
.paw-gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.paw-app .paw-art-card { position: relative; display: flex; flex-direction: column; padding: 10px 10px 14px; border-radius: 10px; background: #282330; text-align: left; overflow: hidden; }
.paw-art-card canvas { width: 100%; height: auto; aspect-ratio: 4 / 3; image-rendering: pixelated; border-radius: 4px; margin-bottom: 12px; }
.paw-art-card strong { display: block; width: 100%; padding: 0 3px; font-size: 16px; overflow-wrap: anywhere; }
.paw-art-card > span { color: var(--paw-muted); font-size: 14px; padding: 3px 3px 0; overflow-wrap: anywhere; }
.paw-art-card time { padding: 6px 3px 0; font: 12px 'JetBrains Mono', monospace; color: #ae9bb8; }
.paw-load-more { display: block; margin: 24px auto 12px; }
.paw-gallery-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 20px; border: 1px dashed #5c4d64; border-radius: 12px; background: #211d29; }
.paw-gallery-state > span { font-size: 35px; margin-bottom: 15px; }
.paw-gallery-state h3 { max-width: 470px; font-size: 17px; font-weight: 500; }
.paw-gallery-state p { margin-top: 8px; color: var(--paw-muted); }
.paw-gallery-state button { margin-top: 22px; }
.paw-art-dialog { margin: auto; width: min(700px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid #7d698c; border-radius: 14px; padding: 42px 18px 20px; background: #25202e; color: #fff4df; overflow: auto; }
.paw-art-dialog::backdrop { background: #0c0916c9; backdrop-filter: blur(5px); }
.paw-art-dialog canvas { width: 100%; height: auto; image-rendering: pixelated; border-radius: 5px; }
.paw-art-dialog h2 { margin-top: 14px; font-size: 21px; overflow-wrap: anywhere; }
.paw-art-dialog p { margin: 4px 0 15px; color: #c7b8d2; overflow-wrap: anywhere; }
.paw-app .paw-dialog-close { position: absolute; right: 8px; top: 6px; border: 0; padding: 0 10px; font-size: 24px; }
@media (min-width: 769px) and (max-height: 850px) {
    .paw-header { padding: 12px 26px 10px; }
    .paw-logo { width: 42px; height: 42px; font-size: 23px; }
    .paw-brand h1 { font-size: 26px; }
    .paw-tabs button { padding: 7px 0 10px; }
    .paw-studio { padding-top: 12px; }
    .paw-tools h2 { margin: 9px 0 5px; font-size: 11px; }
    .paw-tool-grid button { padding: 4px 3px; }
    .paw-tool-grid button span { font-size: 18px; }
    .paw-sizes button { height: 28px; }
    .paw-stamps button { padding: 2px 0; }
    .paw-palette { gap: 5px; }
    .paw-canvas { width: auto; max-width: 100%; height: clamp(180px, calc(100dvh - 450px), 380px); }
    .paw-publish-form { margin-top: 6px; padding-top: 10px; }
    .paw-canvas-footer { padding: 7px 0; }
}
/* Keep publishing visible while the canvas fits the actual desktop window. */
@media (min-width: 769px) {
    .paw-paint-window .window-content { overflow: hidden; }
    .paw-app { display: flex; flex-direction: column; height: 100%; min-height: 0; }
    .paw-header, .paw-tabs, .paw-publish-form, .paw-message { flex-shrink: 0; }
    .paw-studio { display: flex; flex-direction: column; flex: 1; min-height: 0; }
    .paw-workspace { flex: 1; min-height: 0; }
    .paw-tools { min-height: 0; overflow-y: auto; padding: 3px; }
    .paw-drawing-area { display: flex; flex-direction: column; min-height: 0; }
    .paw-canvas-toolbar, .paw-canvas-footer { flex-shrink: 0; }
    .paw-canvas-mat { flex: 1; min-height: 0; container-type: size; justify-content: center; }
    .paw-canvas { width: min(100cqw, max(4px, calc((100cqh - 32px) * 4 / 3)), 768px); height: auto; max-width: 100%; flex-shrink: 0; }
    .paw-gallery { flex: 1; min-height: 0; overflow-y: auto; }
    .paw-message:empty { display: none; }
}
@media (max-width: 768px) {
    .paw-paint-window { left: 8px !important; top: 8px !important; width: calc(100vw - 16px) !important; height: calc(100dvh - var(--taskbar-height) - 16px) !important; max-width: none; max-height: none; min-width: 0; }
    .paw-paint-window .window-titlebar { padding: 10px 12px; }
    .paw-paint-window .window-control { width: 30px; height: 30px; }
    .paw-header { padding: 18px 16px 15px; }
    .paw-brand h1 { font-size: 27px; }
    .paw-header > p { display: none; }
    .paw-tabs { padding: 0 16px; gap: 20px; }
    .paw-tabs button { font-size: 15px; min-height: 44px; }
    .paw-studio { padding: 15px 14px 0; }
    .paw-workspace { grid-template-columns: 1fr; gap: 14px; }
    .paw-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; }
    .paw-tools h2 { display: none; }
    .paw-tool-grid { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); gap: 5px; }
    .paw-tool-grid button { min-height: 44px; padding: 4px 2px; }
    .paw-tool-grid button span { font-size: 18px; }
    .paw-sizes { grid-column: 1; grid-row: 2; gap: 4px; align-items: stretch; }
    .paw-sizes button { min-width: 0; height: 100%; min-height: 44px; }
    .paw-stamps { grid-column: 2; grid-row: 2; grid-template-columns: 1fr 1fr; align-content: center; }
    .paw-stamps button { min-height: 34px; padding: 2px; }
    .paw-palette { grid-column: 1 / -1; grid-row: 3; grid-template-columns: repeat(8, 1fr); gap: 6px; align-content: center; }
    .paw-palette button { min-height: 22px; }
    .paw-canvas-toolbar { font-size: 13px; flex-wrap: wrap; }
    .paw-canvas-toolbar .paw-muted { display: none; }
    .paw-canvas-toolbar button { min-height: 36px; }
    .paw-canvas-mat { padding: 10px 10px 8px; }
    .paw-canvas-note { font-size: 12px; }
    .paw-canvas-footer { flex-wrap: wrap; }
    .paw-canvas-actions { width: 100%; }
    .paw-canvas-actions button { flex: 1; }
    .paw-room-note { align-items: start; }
    .paw-canvas-footer button { min-height: 38px; }
    .paw-publish-form { grid-template-columns: 1fr 1fr; gap: 12px 8px; }
    .paw-publish-form input { font-size: 16px; height: 44px; }
    .paw-publish-form > button { grid-column: 1 / -1; min-height: 44px; }
    .paw-gallery { padding: 18px 14px 0; }
    .paw-gallery-heading { align-items: flex-start; }
    .paw-gallery-heading h2 { font-size: 21px; }
    .paw-gallery-heading .paw-eyebrow { font-size: 11px; letter-spacing: 1px; }
    .paw-gallery-heading p { font-size: 14px; }
    .paw-gallery-heading button { padding: 8px; min-height: 40px; }
    .paw-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .paw-art-card time { position: static; padding: 6px 3px 0; }
    .paw-art-card > span { padding-right: 3px; }
    .paw-app .paw-art-card { padding: 7px 7px 10px; }
    .paw-art-card strong { font-size: 15px; }
    .paw-message { margin: 0 14px !important; }
}
@media (max-width: 360px) { .paw-palette { grid-template-columns: repeat(6, 1fr); } }
@media (prefers-reduced-motion: reduce) { .paw-app button, .paw-paint-window { transition: none; } }
