/* Paint: drawing a Mii's body. A member asked for "an MS Paint style program", so this is a faithful
   Windows 98 Paint: silver chrome with hard pixel bevels, a navy title bar, the 28-color box, the
   teal desktop behind the window on big screens. It's the one place gradients (the title bar) and
   Tahoma belong. See DESIGN.md. */
.pt-desk {
  --pt-face: #c0c0c0; --pt-hi: #ffffff; --pt-lite: #dfdfdf; --pt-shadow: #808080; --pt-dark: #0a0a0a; --pt-navy: #000080;
  --pt-raised: inset -1px -1px var(--pt-dark), inset 1px 1px var(--pt-lite), inset -2px -2px var(--pt-shadow), inset 2px 2px var(--pt-hi);
  --pt-sunken: inset -1px -1px var(--pt-hi), inset 1px 1px var(--pt-shadow), inset -2px -2px var(--pt-lite), inset 2px 2px var(--pt-dark);
  --pt-pressed: inset -1px -1px var(--pt-hi), inset 1px 1px var(--pt-dark), inset -2px -2px var(--pt-lite), inset 2px 2px var(--pt-shadow);
  --pt-check: repeating-conic-gradient(#ffffff 0 25%, #c0c0c0 0 50%) 0 0 / 2px 2px;
  position: fixed; left: 0; right: 0; top: 0; height: var(--app-h, 100dvh); z-index: 90;
  display: grid; place-items: center; background: #008080;
  font: 400 14px/1.2 Tahoma, "MS Sans Serif", Verdana, "Segoe UI", sans-serif; color: #000;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  opacity: 0; transition: opacity .12s;
}
.pt-desk.in { opacity: 1; }
.pt-desk button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.pt-desk :focus-visible { outline: 1px dotted #000; outline-offset: -4px; }

.pt-win { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: var(--pt-face); overflow: hidden; }
@media (min-width: 720px) and (min-height: 560px) {
  .pt-win { width: min(900px, calc(100vw - 48px)); height: min(740px, calc(100% - 48px)); padding: 3px; box-shadow: var(--pt-raised); }
}

/* title bar */
.pt-title { flex: none; display: flex; align-items: center; gap: 5px; padding: 3px 3px 3px 5px; min-height: 28px;
  background: linear-gradient(90deg, #000080, #1084d0); color: #fff; font-weight: 700; }
.pt-win > .pt-title { padding-top: calc(3px + env(safe-area-inset-top)); }
@media (min-width: 720px) and (min-height: 560px) { .pt-win > .pt-title { padding-top: 3px; } }
.pt-appicon { display: grid; place-items: center; width: 18px; height: 18px; }
.pt-title-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-cap { flex: none; display: grid; place-items: center; width: 30px; height: 26px; padding: 0; border: 0; background: var(--pt-face); box-shadow: var(--pt-raised); }
.pt-cap:active { box-shadow: var(--pt-pressed); }
.pt-cap svg { fill: #000; }

/* menu bar */
.pt-menubar { flex: none; display: flex; align-items: center; gap: 0; padding: 2px 4px; }
.pt-menu { min-height: 36px; padding: 4px 9px; border: 0; background: none; font-size: 15px; }
.pt-menu.open, .pt-menu:active { background: var(--pt-navy); color: #fff; }
.pt-grow { flex: 1; }
.pt-b { min-width: 72px; min-height: 34px; padding: 4px 12px; border: 0; background: var(--pt-face); box-shadow: var(--pt-raised); font-size: 15px; }
.pt-b:active { box-shadow: var(--pt-pressed); padding: 5px 11px 3px 13px; }
.pt-done { font-weight: 700; outline: 1px solid #000; outline-offset: -1px; }

/* drop-down menus */
.pt-dd { position: absolute; z-index: 20; min-width: 230px; padding: 3px; background: var(--pt-face); box-shadow: var(--pt-raised), 2px 2px 0 #00000040; }
.pt-dd button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 4px; width: 100%; min-height: 40px; padding: 4px 10px 4px 4px; border: 0; background: none; text-align: left; font-size: 15px; }
.pt-dd button:hover, .pt-dd button:active, .pt-dd button:focus-visible { background: var(--pt-navy); color: #fff; outline: 0; }
.pt-dd hr { margin: 3px 2px; border: 0; border-top: 1px solid var(--pt-shadow); border-bottom: 1px solid var(--pt-hi); }
.pt-chk { text-align: center; }
.pt-key { font-size: 13px; }

/* tool box + work area */
.pt-main { flex: 1; min-height: 0; display: flex; gap: 2px; padding: 0 2px; }
.pt-side { flex: none; width: 84px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; overflow-y: auto; }
.pt-tools { display: grid; grid-template-columns: 38px 38px; gap: 2px; }
.pt-tool { width: 38px; height: 38px; padding: 0; border: 0; display: grid; place-items: center; background: var(--pt-face); box-shadow: var(--pt-raised); }
.pt-tool[aria-pressed="true"] { background: var(--pt-check); box-shadow: var(--pt-pressed); }
.pt-tool svg { width: 20px; height: 20px; }
.pt-opts { width: 78px; min-height: 70px; display: flex; flex-direction: column; gap: 1px; padding: 5px; box-shadow: var(--pt-sunken); }
.pt-opt { width: 100%; min-height: 24px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
.pt-opts.styles .pt-opt { min-height: 30px; }
.pt-opt.on { background: var(--pt-navy); }
.pt-opt i { display: block; background: #000; }
.pt-opt.on i { background: #fff; }
.pt-o-dot { width: var(--s); height: var(--s); border-radius: 50%; }
.pt-o-dot.sq { border-radius: 0; }
.pt-o-line { width: 48px; }
.pt-opt .pt-o-spray { width: calc(var(--r) * 2); height: calc(var(--r) * 2); background: radial-gradient(#000 1px, transparent 1.2px) 0 0 / 4px 4px; border-radius: 50%; }
.pt-opt.on .pt-o-spray { background: radial-gradient(#fff 1px, transparent 1.2px) 0 0 / 4px 4px; }
.pt-opt .pt-o-st { width: 50px; height: 20px; background: none; border: 1px solid #000; }
.pt-opt .pt-o-st.st1 { background: var(--pt-shadow); }
.pt-opt .pt-o-st.st2 { background: var(--pt-shadow); border-color: var(--pt-shadow); }
.pt-opt.on .pt-o-st { border-color: #fff; }
.pt-undo { min-width: 78px; }

.pt-work { flex: 1; min-width: 0; overflow: auto; display: flex; justify-content: center; align-items: flex-start; align-items: safe center; padding: 10px; background: #808080; box-shadow: var(--pt-sunken); }
.pt-stage { position: relative; flex: none; }
.pt-head { position: absolute; z-index: 2; pointer-events: none; }
.pt-head svg { display: block; width: 100%; height: 100%; }
.pt-paper { position: absolute; left: 0; background: #fff; }
.pt-paper::after { content: ""; position: absolute; right: -5px; bottom: -5px; width: 4px; height: 4px; background: var(--pt-navy); }
.pt-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; cursor: crosshair; }
.pt-paper canvas[data-tool="fill"] { cursor: cell; }
.pt-guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .45; }

/* color box */
.pt-colorbox { flex: none; display: flex; align-items: center; gap: 4px; padding: 5px 4px 4px; }
.pt-cur { position: relative; flex: none; width: 46px; height: 46px; background: var(--pt-check); box-shadow: var(--pt-sunken); }
.pt-cur-fg, .pt-cur-bg { position: absolute; width: 20px; height: 20px; box-shadow: inset 0 0 0 1px var(--pt-face), 0 0 0 1px var(--pt-shadow), 1px 1px 0 1px var(--pt-hi); }
.pt-cur-fg { left: 7px; top: 7px; pointer-events: none; }
.pt-cur-bg { right: 7px; bottom: 7px; padding: 0; border: 0; }
.pt-pal { flex: 1; min-width: 0; max-width: 420px; display: grid; grid-template-columns: repeat(14, 1fr); gap: 1px; }
.pt-sw { aspect-ratio: 1 / 1; min-height: 22px; max-height: 30px; width: 100%; padding: 0; border: 0; background: var(--c); box-shadow: var(--pt-sunken); }

/* status bar */
.pt-status { flex: none; display: flex; gap: 2px; padding: 2px 2px calc(2px + var(--sab)); font-size: 13px; }
@media (min-width: 720px) and (min-height: 560px) { .pt-status { padding-bottom: 2px; } }
.pt-cell { padding: 4px 6px; box-shadow: inset -1px -1px var(--pt-hi), inset 1px 1px var(--pt-shadow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 24px; }
.pt-tip { flex: 1; min-width: 0; }
.pt-xy { flex: none; width: 70px; }
.pt-picker { position: absolute; left: 50%; bottom: 60px; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }

/* message boxes */
.pt-modal { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; }
.pt-msg { width: min(380px, 100%); padding: 3px; background: var(--pt-face); box-shadow: var(--pt-raised), 3px 3px 0 #00000040; }
.pt-msg-body { display: flex; gap: 14px; align-items: flex-start; padding: 16px 12px 10px; font-size: 15px; line-height: 1.4; }
.pt-msg-ico { flex: none; width: 34px; height: 34px; display: grid; place-items: center; font: 700 22px/1 "Times New Roman", serif; }
.pt-msg-ico.warn { color: #000; background: #ffff00; clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 10px; }
.pt-msg-ico.info { color: #fff; background: #0000ff; border-radius: 50%; box-shadow: inset -1px -1px #000; }
.pt-msg-t { padding-top: 6px; -webkit-user-select: text; user-select: text; }
.pt-msg-btns { display: flex; justify-content: center; gap: 8px; padding: 6px 8px 10px; }

@media (prefers-reduced-motion: reduce) { .pt-desk { transition: none; } }

/* the editor's way in: a little picture of the drawing */
.ed-paint { display: flex; gap: 14px; align-items: center; padding: 12px; margin-bottom: 8px; border-radius: 16px; border: 2px solid var(--pz-line); background: var(--pz-chrome); }
.ed-paint-thumb { flex: none; width: 96px; height: 77px; padding: 0; border-radius: 10px; border: 2px solid var(--pz-line); overflow: hidden; display: grid; place-items: center;
  background: #fff repeating-conic-gradient(#eef1f4 0 25%, #fff 0 50%) 0 0 / 12px 12px; }
.ed-paint-thumb img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.ed-paint-thumb svg { width: 32px; height: 32px; }
.ed-paint-text { min-width: 0; }
.ed-paint-text p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.4; color: var(--pz-ink-2); }
.ed-paint-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
