/* Fredoka cut to Latin, one width, weights 400 to 700: 28 KB, not 84 (round 21b,
   tools/font-subset.py). The pages load this in place of PerzKit's fonts.css, whose
   full Fredoka was still fetched for any character the cut lacks. */
@font-face { font-family: 'Lilita One'; src: url('../vendor/perzkit/playable-objects/public/assets/LilitaOne-Regular.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: Fredoka; src: url('../demo/assets/fonts/Fredoka-latin.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
/* The paint tool's UI on PerzKit (vendor/perzkit, unedited): a slim top bar,
   one compact toolbar along the bottom, and a "More" panel above it for the
   rest. The kit's secondary control for repeated actions, its tactile button
   for Submit. Shared names with demo/style.css. */
html, body { margin: 0; height: 100%; overflow: hidden; }
body.perz { background: #5cc8ff; -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* a drag that starts on the dragon and runs over a label must not select its text */
.wash-card, #hatch-steps, #hatch-say, #toast, .toolbar, #bar { -webkit-user-select: none; user-select: none; }
.perz p { margin: 0; }

/* compact secondary control: the kit's .secondary at tool size */
.perz .secondary.compact { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.perz .secondary.compact.icon-button { min-width: 36px; padding: 4px; font-size: 20px; line-height: 1; }
.perz .secondary.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.perz .secondary.wide { flex: 1; justify-content: flex-start; }
.perz .secondary[aria-pressed="true"], .perz .secondary[aria-selected="true"] { background: var(--perz-blue-face); border-color: var(--perz-blue-rim); color: var(--perz-on-accent); }
.perz .secondary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.perz .check { min-height: 36px; gap: 10px; font-size: 14px; cursor: pointer; }

/* ---------------------------------------------------------------- top bar */
#bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); pointer-events: none; }
#bar > * { pointer-events: auto; }
.perz #bar .title-pill { margin: 0; font-size: 22px; padding: 6px 18px; border-radius: 999px; background: var(--perz-surface); border: 2px solid var(--perz-border); box-shadow: 0 4px 0 var(--perz-outline); }
#bar .spacer { flex: 1; }
#bar .sound { background: var(--perz-surface); border: 2px solid var(--perz-border); box-shadow: 0 4px 0 var(--perz-outline); }
#bar .secondary { background: var(--perz-surface); }

/* ---------------------------------------------------------------- the toolbar */
.toolbar { position: fixed; left: 50%; bottom: 16px; translate: -50% 0; display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: var(--perz-radius-panel); background: var(--perz-surface); border: 2px solid var(--perz-border); box-shadow: 0 var(--perz-effect-panel-depth) 0 var(--perz-outline); color: var(--perz-text); font-size: 14px; max-width: calc(100vw - 32px); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* tools: icon over a small label, the selected one on the blue face */
.tools { display: flex; gap: 6px; }
.tool { display: grid; justify-items: center; align-content: center; gap: 1px; width: 54px; height: 54px; padding: 0; border-radius: var(--perz-radius-compact); background: var(--perz-control-surface); border: 2px solid var(--perz-control-border); color: var(--perz-text); font-size: 11px; font-weight: 500; transition: background-color var(--perz-feedback-duration) var(--perz-ease-out), border-color var(--perz-feedback-duration) var(--perz-ease-out); }
.tool svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .tool:hover { border-color: var(--perz-text); } }
.tool[aria-pressed="true"] { background: var(--perz-blue-face); border-color: var(--perz-blue-rim); color: var(--perz-on-accent); }

/* colour chips: two rows of small round chips, the chosen one ringed in cream */
.swatches { display: grid; grid-template-columns: repeat(12, 22px); gap: 5px; padding: 4px; }
.chip { width: 22px; height: 22px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid var(--perz-outline); }
.chip[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--perz-surface), 0 0 0 4px var(--perz-text); }

.bar-end { display: grid; gap: 6px; }
.bar-end .row { flex-wrap: nowrap; }
.slide { display: grid; grid-template-columns: 40px 120px; align-items: center; gap: 8px; }
.slider { width: 100%; accent-color: var(--perz-blue-rim); cursor: pointer; }
.more-btn { gap: 4px; }
.more-btn > span:first-child { display: flex; }
.perz .secondary.crest { min-width: 38px; justify-content: center; }
.perz .secondary:disabled { opacity: 0.45; cursor: default; }

/* ---------------------------------------------------------------- More */
#more { position: fixed; left: 50%; bottom: 142px; translate: -50% 0; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 220px); overflow: auto; padding: 8px 20px 18px; font-size: 14px; box-shadow: 0 var(--perz-effect-panel-depth) 0 var(--perz-outline); }
#more[hidden] { display: none; }
.more-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -8px; background: var(--perz-surface); padding: 8px 0; z-index: 1; }
.perz .more-head h2 { font-size: 20px; margin: 0; }
#more section { border-top: 1px solid var(--perz-border); padding: 4px 0 10px; }
.perz #more h3 { font-size: 16px; margin: 10px 0 6px; }
#more .slide { grid-template-columns: 74px 1fr; margin-top: 4px; }
#more .row { margin-top: 8px; }
.free { display: flex; align-items: center; gap: 10px; }
.free-input { -webkit-appearance: none; appearance: none; width: 32px; height: 32px; padding: 0; border: 2px solid var(--perz-outline); border-radius: 50%; background: conic-gradient(#ff6fae, #ffd36f, #6fe39b, #3fc6c0, #7e8cff, #ff6fae); cursor: pointer; }
.free-input::-webkit-color-swatch-wrapper { padding: 0; }
.free-input::-webkit-color-swatch { border: 0; border-radius: 50%; opacity: 0; }
.current::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; border: 1px solid var(--perz-text); background: var(--c); vertical-align: -1px; }
.perz .muted { font-size: 13px; }
#more .muted { margin-top: 6px; }
.layer { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 6px; }
.pill-select { min-height: 36px; padding: 6px 10px; border-radius: var(--perz-radius-compact); border: 2px solid var(--perz-field-border); background: var(--perz-canvas); color: var(--perz-text); }

/* ---------------------------------------------------------------- the wash meter, while washing */
.wash-card { position: fixed; top: 76px; right: 16px; width: 220px; padding: 12px 16px; font-size: 14px; box-shadow: 0 var(--perz-effect-panel-depth) 0 var(--perz-outline); }
.wash-card[hidden] { display: none; }
.meter { height: 12px; border-radius: 999px; border: 2px solid var(--perz-border); background: var(--perz-quiet); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; background: var(--perz-blue-rim); transition: width .3s var(--perz-ease-out); }
.meter-text { display: block; font-family: var(--perz-font-display); font-size: 18px; }
.regions { list-style: none; margin: 8px 0 0; padding: 0; display: grid; font-size: 13px; }
.regions li { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid var(--perz-border); }
.regions li.done b { color: var(--perz-blue-rim); }

/* ---------------------------------------------------------------- status, toast, loading */
#status:not(:empty) { position: fixed; left: 50%; translate: -50% 0; bottom: 124px; max-width: 46ch; padding: 6px 14px; border-radius: var(--perz-radius-compact); background: var(--perz-surface); border: 2px solid var(--perz-border); font-size: 14px; }
#toast { position: fixed; left: 50%; top: 80px; translate: -50% -8px; padding: 8px 18px; border-radius: 999px; background: var(--perz-surface); border: 2px solid var(--perz-outline); box-shadow: 0 4px 0 var(--perz-outline); font-family: var(--perz-font-display); font-size: 18px; display: flex; align-items: center; gap: 10px; opacity: 0; pointer-events: none; transition: opacity .25s var(--perz-ease-out), translate .25s var(--perz-ease-out); }
#toast .star { width: 12px; height: 12px; color: var(--perz-blue-rim); }
#toast.show { opacity: 1; translate: -50% 0; }

/* ---------------------------------------------------------------- the preview */
#preview-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: none; gap: 16px; align-items: center; padding: 6px 16px 6px 6px; border-radius: 999px; background: var(--perz-surface); border: 2px solid var(--perz-border); box-shadow: 0 4px 0 var(--perz-outline); }
#preview-bar .secondary { border-radius: 999px; white-space: nowrap; }
#bar button { white-space: nowrap; }
body.previewing .toolbar, body.previewing #more, body.previewing #bar, body.previewing .wash-card { display: none; }
body.previewing #preview-bar { display: flex; }

/* tags over dragons in the preview: yours on the blue face, others as the roost's nameplate */
.tag { position: fixed; left: 0; top: 0; z-index: 3; padding: 4px 14px; border-radius: 999px; background: var(--perz-blue-face); color: var(--perz-on-accent); border: 2px solid var(--perz-outline); box-shadow: inset 0 0 0 2px var(--perz-blue-rim), 0 4px 0 var(--perz-outline); font-family: var(--perz-font-display); font-size: 17px; transform: translate(-50%, -100%); pointer-events: none; }
.tag.dark { background: var(--perz-surface); box-shadow: 0 4px 0 var(--perz-outline); font-family: var(--perz-font-body); font-size: 14px; }
.tag[hidden] { display: none; }

/* ---------------------------------------------------------------- phone: the toolbar as a bottom sheet */
@media (max-width: 700px) {
  .toolbar { left: 0; right: 0; bottom: 0; translate: none; max-width: none; flex-wrap: wrap; justify-content: center; gap: 8px 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: var(--perz-radius-panel) var(--perz-radius-panel) 0 0; border-bottom: 0; box-shadow: none; }
  .tools { width: 100%; justify-content: space-between; }
  .tool { flex: 1; height: 50px; }
  .swatches { grid-template-columns: repeat(12, 1fr); width: 100%; gap: 6px; padding: 2px; }
  .chip { width: auto; aspect-ratio: 1; height: auto; }
  .bar-end { width: 100%; grid-template-columns: 1fr auto; align-items: center; }
  /* a finger's size: undo, redo and the crests */
  .bar-end .icon-button, .perz .secondary.crest { min-width: 44px; min-height: 44px; }
  .slide { grid-template-columns: 40px 1fr; }
  #more { left: 0; right: 0; bottom: 210px; translate: none; width: auto; max-height: calc(100vh - 290px); border-radius: var(--perz-radius-panel); margin: 0 8px; }
  .perz #bar .title-pill { display: none; }
  /* the top bar fits one line on a phone: "See it" and "Save picture" */
  #bar .wide-only { display: none; }
  #status:not(:empty) { bottom: 220px; }
  .wash-card { top: 84px; right: 8px; width: 180px; }
}
@media (prefers-reduced-motion: reduce) { .meter i, #toast { transition: none; } }

/* the wash hint: a soft glow over the muddiest spot after 20 s with no progress */
.wash-hint { position: fixed; z-index: 3; left: -48px; top: -48px; width: 96px; height: 96px; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(circle, transparent 38%, color-mix(in srgb, var(--perz-yellow, #ffd166) 70%, transparent) 46%, color-mix(in srgb, var(--perz-yellow, #ffd166) 30%, transparent) 58%, transparent 70%); }
.wash-hint.show { opacity: 1; animation: wash-hint 1.1s ease-in-out infinite; }
@keyframes wash-hint { 50% { scale: 1.18; } }
@media (prefers-reduced-motion: reduce) { .wash-hint.show { animation: none; } }

/* ---------------------------------------------------------------- the hatchery (?hatch, round 13) */
.hatch #see, .hatch #submit, .perz.hatch #bar .title-pill, .hatch .more-btn, .hatch .tool[data-tool="wash"], .hatch #more { display: none !important; }
#hatch-nav { display: flex; gap: 10px; align-items: center; }
#hatch-nav [hidden] { display: none; }
#hatch-steps { position: fixed; z-index: 4; top: 14px; left: 50%; translate: -50% 0; display: flex; gap: 6px; margin: 0; padding: 6px; list-style: none; border-radius: 999px; background: var(--perz-surface); border: 2px solid var(--perz-border); box-shadow: 0 4px 0 var(--perz-outline); }
.hatch-step { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 999px; color: var(--perz-text-secondary); font-size: 14px; font-weight: 600; white-space: nowrap; }
.hatch-step .n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; font-size: 12px; }
.hatch-step.on { background: var(--perz-blue-rim); color: #fff; }
.hatch-step .say { display: none; }
.hatch-step.done { color: var(--perz-text); }
#hatch-say { position: fixed; z-index: 4; top: 64px; left: 50%; translate: -50% 0; margin: 0; padding: 6px 16px; border-radius: 999px; background: color-mix(in srgb, var(--perz-surface) 92%, transparent); border: 2px solid var(--perz-border); color: var(--perz-text); font-size: 14px; white-space: nowrap; }
#hatch-say:empty { display: none; }
.hatch #toast { top: 112px; }
/* the wash and the name steps keep the toolbar away; painting has it */
.hatch[data-step="1"] #toolbar, .hatch[data-step="3"] #toolbar, .hatch[data-step="4"] #toolbar { display: none; }
.hatch-card { position: fixed; z-index: 6; left: 50%; bottom: 24px; translate: -50% 0; width: min(380px, calc(100vw - 24px)); box-sizing: border-box; padding: 18px 22px 20px; text-align: center; box-shadow: 0 var(--perz-effect-panel-depth) 0 var(--perz-outline); }
.hatch-card[hidden] { display: none; }
.perz .hatch-card h2 { font-size: 22px; margin: 0 0 12px; }
.hatch-field input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 8px 16px; border: 2px solid var(--perz-field-border, var(--perz-border)); border-radius: 999px; background: var(--perz-canvas); color: var(--perz-text); font: 500 18px/1.2 var(--perz-font-body); text-align: center; }
.hatch-field input:focus-visible { outline: var(--perz-control-focus-width) solid var(--perz-text); outline-offset: 2px; }
.hatch-tag { margin: 12px 0 0; min-height: 30px; }
.hatch-big { font: 400 24px/1.2 var(--perz-font-display); color: var(--perz-text); margin: 0 0 6px; }
.hatch-tag .disc, .hatch-big .disc { font-family: var(--perz-font-body); font-weight: 500; font-size: 16px; color: var(--perz-text-secondary); margin-left: 2px; }
.hatch-err { margin: 4px 0 0; min-height: 1.3em; font-size: 14px; color: var(--perz-pink, #ff8fbf); }
.hatch-sub { margin: 10px 0 6px; font-size: 13px; }
.hatch-crests { display: flex; justify-content: center; gap: 8px; }
.hatch-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 14px 0 4px; }
@media (max-width: 700px) {
  #hatch-steps { top: 70px; padding: 4px; gap: 2px; max-width: calc(100vw - 24px); box-sizing: border-box; }
  .hatch-step { padding: 4px 8px 4px 4px; font-size: 12px; }
  /* Round 21 (REVIEW-21): one row at the top. The say line folds into the
     active step's pill; the other steps show their number only. */
  #hatch-say { display: none; }
  .hatch-step:not(.on) .label { display: none; }
  .hatch-step:not(.on) { padding: 4px; }
  .hatch-step.on:has(.say:not(:empty)) .label { display: none; }
  .hatch-step.on .say { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
  .hatch #toast { top: 118px; }
  /* the clean meter on a phone: a 4 px line under the steps bar (round 21) */
  .hatch .wash-card { top: 108px; bottom: auto; left: 50%; right: auto; translate: -50% 0; width: min(300px, calc(100vw - 48px)); padding: 0; border: 0; background: none; box-shadow: none; }
  .hatch .wash-card .regions, .hatch .wash-card .meter-text { display: none; }
  .hatch .wash-card .meter { height: 4px; border: 0; margin: 0; }
  .hatch-card { bottom: 12px; }
  #hatch-nav .secondary, #hatch-nav .tactile { min-height: 44px; }
}
