/* Spec 024: the drawing studio and the drawings gallery. Colours are tokens only (tokens.css);
   the palette swatches show ink, which is content, set through the CSS object model. */

.crayon-pink {
  background: var(--crayon-pink);
  color: var(--on-crayon);
  text-decoration: none;
}

.drawings-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.drawings-new {
  min-height: calc(var(--touch-kid) * 1.75);
}

.drawings-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.drawing-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-raised);
}

.drawing-open img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

/* Spec 054, 129 and 137: the studio for kids 3 to 9. A grid: the bar, the page, then the tray (a row of paint pots over
   the tools) along the foot, a phone held upright; the page beside a column of the bar over the tray on a wide or
   sideways screen. The page takes every bit of room the rest leaves. Spec 137 (the owner, build 31: "the buttons on top
   are all cluttered"): the bar is one line that never wraps (Done; undo and redo together; More); every tool is a tile
   with its own picture in the colour the child holds, never in a scroller; js/studio-tools.js plans the lines
   (--per-line, --cell) as the phone does. Ink (pots, the tools' colour, size dots, previews) is content, set through the
   CSS object model. */
.view:has(> .studio) {
  max-width: 1480px;
  padding: var(--space-2) var(--space-3) 0;
}

.studio {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "paper" "tray";
  gap: var(--space-2);
  height: calc(100vh - var(--studio-top, 96px));
  height: calc(100dvh - var(--studio-top, 96px));
  min-height: 300px;
}

.studio[data-tools="off"] .studio-tray,
.studio[data-tools="off"] .studio-history,
.studio[data-tools="off"] .studio-more {
  display: none;
}

/* The bar: Done at the start; undo and redo in one capsule and More at the end. One line at every width and in every
   language (tests/web/studio-redesign.test.mjs measures it): only Done has words, and it takes what the buttons leave. */
.studio-top {
  grid-area: top;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.studio-done {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: var(--space-7);
  padding: 0 var(--space-4) 0 var(--space-3);
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-size: var(--font-md);
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: var(--elevation-raised);
}

.studio-done .icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
}

/* Every icon button of the studio is the same round 48 px. */
.bar-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--space-7);
  height: var(--space-7);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.bar-button .icon {
  width: 26px;
  height: 26px;
}

.bar-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.bar-button[hidden] {
  display: none;
}

/* Undo and redo: one capsule, a hairline between them. */
.studio-history {
  display: flex;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--elevation-rest);
}

.studio-history > .bar-button {
  background: transparent;
  box-shadow: none;
}

.studio-history > .bar-button + .bar-button {
  background: linear-gradient(var(--hairline), var(--hairline)) left center / 1px 24px no-repeat;
}

.studio-more[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

/* More's menu: Hide tools, Print (a colouring page) and Start over, each a whole row with its words. */
.studio-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 2 * var(--space-4)));
  padding: 6px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--elevation-float);
}

.studio-menu[hidden],
.menu-item[hidden] {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: 6px var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--font-md);
  font-weight: 700;
  line-height: 1.2;
  text-align: start;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-muted);
}

.menu-item .icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.menu-item.studio-print .icon {
  color: var(--ink-purple);
}

.menu-item.studio-clear,
.menu-item.studio-clear .icon {
  color: var(--danger);
}

/* Spec 052: the paper takes every bit of height the rest leaves; the script sizes the canvas to the
   page's own shape inside it (portrait on a phone held upright). */
.studio-paper {
  grid-area: paper;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.studio-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-raised);
  touch-action: none;
  cursor: crosshair;
}

/* The mirror's line down the middle of the page (the canvas is centred in the paper). */
.mirror-guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  transform: translate(-50%, -50%);
  border-left: 3px dashed var(--accent);
  opacity: 0.55;
  pointer-events: none;
}

/* What happened, floating over the top of the page. */
.studio-status {
  position: absolute;
  top: var(--space-2);
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 2 * var(--space-4));
  margin: 0;
  padding: 6px var(--space-4);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--elevation-raised);
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.studio-status[hidden] {
  display: none;
}

.studio-status[data-kind="error"] {
  color: var(--danger);
}

/* With the tools hidden: one round button at the page's foot brings them back. */
.studio-untuck {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  z-index: 3;
  color: var(--accent);
  box-shadow: var(--elevation-raised);
}

/* The tray: the paint pots, a hairline, then every tool. */
.studio-tray {
  grid-area: tray;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: var(--space-2) 6px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--elevation-raised);
}

.studio[data-tools="closed"] .studio-tray {
  display: none;
}

/* The pots and the dock: square cells in lines; nothing scrolls. */
.dock,
.pots {
  display: grid;
  grid-template-columns: repeat(var(--per-line, 7), var(--cell, 48px));
  grid-auto-rows: var(--cell, 48px);
  gap: 0;
  justify-content: center;
  align-content: start;
  min-width: 0;
  overflow: visible;
}

.pots {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}

.dock-tool {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-width: var(--space-7);
  min-height: var(--space-7);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

/* The tile's face: the tool's own picture (design/tool-art.json) in the colour the child holds; the chosen one sits on
   the accent and pops. */
.tool-face {
  position: absolute;
  inset: 2px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  transition: transform 160ms ease, background-color 120ms ease;
}

.dock-tool:hover .tool-face {
  background: var(--surface-muted);
}

.tool-art {
  width: 78%;
  height: 78%;
  overflow: visible;
  color: var(--ink, var(--accent));
  stroke: var(--text);
  stroke-linejoin: round;
  stroke-linecap: round;
}

.dock-tool[aria-pressed="true"] {
  z-index: 1;
}

.dock-tool[aria-pressed="true"] .tool-face {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 3px var(--accent), var(--elevation-raised);
  transform: translateY(-4px) scale(1.12);
  animation: tool-pop 420ms ease-out;
}

/* The pop: up and large, a wiggle one way, the other, and the spring to rest (js/studio-tools.js POP_FRAMES; the phone's
   StudioMotion.Pop). */
@keyframes tool-pop {
  0% { transform: translateY(0px) scale(1) rotate(0deg); }
  35% { transform: translateY(-8px) scale(1.22) rotate(-9deg); }
  55% { transform: translateY(-6px) scale(1.1) rotate(7deg); }
  75% { transform: translateY(-5px) scale(1.15) rotate(-4deg); }
  100% { transform: translateY(-4px) scale(1.12) rotate(0deg); }
}

/* The chosen tile's badge: its size, in its colour; a second tap opens its choices. */
.tool-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  z-index: 2;
  display: none;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  pointer-events: none;
}

.dock-tool[aria-pressed="true"] .tool-badge {
  display: grid;
}

.badge-dot {
  display: block;
  border-radius: 50%;
  background: var(--text);
}

.badge-dot.eraser {
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--text-secondary);
}

/* The paint pots: round and glossy; the chosen one grows inside a ring. */
.pot {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: var(--space-7);
  min-height: var(--space-7);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.pot-ink {
  display: block;
  width: min(38px, calc(100% - 12px));
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 var(--tile-edge), 0 0 0 2px var(--tile-edge);
  transition: transform 160ms ease;
}

.pot[aria-pressed="true"] .pot-ink {
  transform: scale(1.12);
  box-shadow: inset 0 -4px 0 var(--tile-edge), 0 0 0 3px var(--surface), 0 0 0 6px var(--accent);
  animation: pot-pop 320ms ease-out;
}

@keyframes pot-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.24); }
  100% { transform: scale(1.12); }
}

.more-swirl {
  display: grid;
  place-items: center;
  width: min(38px, calc(100% - 12px));
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--gradient-rainbow);
  color: var(--on-crayon);
  box-shadow: 0 0 0 2px var(--tile-edge);
}

.more-swirl .icon {
  width: 24px;
  height: 24px;
}

.dock-tool:focus-visible,
.pot:focus-visible,
.bar-button:focus-visible,
.studio-done:focus-visible,
.menu-item:focus-visible,
.size:focus-visible,
.choice:focus-visible,
.mirror-switch:focus-visible,
.shade:focus-visible {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: var(--focus-offset);
}

/* The chosen tool's choices, beside it (js/studio-tools.js placeChoices): a card with a pointer at the tool. */
.tool-choices {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(380px, calc(100% - 16px));
  padding: 6px var(--space-3) var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--elevation-float);
  transform-origin: var(--pointer, 50%) 100%;
}

.tool-choices[hidden] {
  display: none;
}

.tool-choices[data-side="right"] {
  transform-origin: 100% var(--pointer, 50%);
}

.tool-choices.is-open {
  animation: choices-fan 260ms ease-out;
}

/* The fan-out: from small and low beside the tool, a spring past its size, then at rest (StudioMotion.Fan). */
@keyframes choices-fan {
  0% { transform: translateY(16px) scale(0.6); opacity: 0; }
  60% { transform: translateY(-3px) scale(1.06); opacity: 1; }
  100% { transform: none; }
}

.choices-pointer {
  position: absolute;
  bottom: -9px;
  left: calc(var(--pointer, 50%) - 8px);
  width: 16px;
  height: 16px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  transform: rotate(45deg);
}

.tool-choices[data-side="right"] .choices-pointer {
  top: calc(var(--pointer, 50%) - 8px);
  right: -9px;
  bottom: auto;
  left: auto;
  border-bottom: 0;
  border-top: 1px solid var(--hairline);
}

.choices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.choices-title {
  margin: 0 0 0 var(--space-1);
  font-size: var(--font-lg);
  color: var(--text);
}

.choices-close {
  background: var(--surface-muted);
  box-shadow: none;
}

/* The sizes on an arch, the middle highest; each fans out a moment after the one before. */
.fan {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding-top: 14px;
}

.fan[hidden],
.tool-choices .choice-grid[hidden],
.mirror-switch[hidden] {
  display: none;
}

.size {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--space-7);
  height: var(--space-7);
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  background: var(--surface-muted);
  cursor: pointer;
  transform: translateY(var(--lift, 0));
}

.is-open .size,
.is-open .choice {
  animation: fan-in 240ms ease-out both;
  animation-delay: calc(var(--i, 0) * 35ms);
}

@keyframes fan-in {
  0% { opacity: 0; transform: translateY(18px) scale(0.4); }
  100% { opacity: 1; }
}

.size[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.size-dot {
  display: block;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 1px var(--tile-edge);
}

/* Spec 138: scoped to the studio's choices; unscoped, it squeezed the book maker's picture cards (books.css) into
   56 px columns, one letter a line. */
.tool-choices .choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 4px;
}

.choice {
  display: grid;
  place-items: center;
  min-width: 56px;
  min-height: 56px;
  padding: 5px;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-purple);
  cursor: pointer;
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice .icon {
  width: 32px;
  height: 32px;
}

.pattern-picture {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--hairline);
}

.sticker-preview {
  width: 90%;
  height: auto;
}

.mirror-switch {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--space-7);
  padding: var(--space-1) var(--space-4);
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mirror-switch .icon {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.mirror-switch[aria-pressed="true"],
.mirror-switch[aria-pressed="true"] .icon {
  background: var(--accent);
  color: var(--on-accent);
}

/* The more-colours sheet: every colour as a strip of shades, light at the top. */
.studio-sheet {
  width: min(600px, calc(100vw - 2 * var(--space-3)));
  max-height: min(88dvh, 820px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--elevation-float);
}

.studio-sheet::backdrop {
  background: var(--page-shade);
}

.studio-sheet[open] {
  display: flex;
  flex-direction: column;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
}

.sheet-head h2 {
  margin: 0;
  font-size: var(--font-xl);
  color: var(--ink-purple);
}

.sheet-close {
  background: var(--surface-muted);
  box-shadow: none;
}

.sheet-body {
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) var(--space-5);
}

.sheet-group + .sheet-group {
  margin-top: var(--space-4);
}

.sheet-group-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-lg);
}

.sheet-bright .sheet-group-title { color: var(--ink-red); }
.sheet-pastel .sheet-group-title { color: var(--ink-pink); }
.sheet-skin .sheet-group-title { color: var(--ink-orange); }
.sheet-earth .sheet-group-title { color: var(--ink-green); }
.sheet-shiny .sheet-group-title { color: var(--ink-blue); }
.sheet-grey .sheet-group-title { color: var(--ink-purple); }

.sheet-strips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.shade-strip {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--hairline);
}

.shade {
  width: 46px;
  height: 36px;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.shade[aria-current="true"] {
  outline: 4px solid var(--accent);
  outline-offset: -4px;
}

/* A phone held upright: a narrow margin, and the tray a sheet along the screen's foot from edge to edge, so seven tiles
   of at least 48 px fit a row from 360 px up. */
@media (max-width: 600px) {
  .view:has(> .studio) {
    padding: var(--space-2) var(--space-2) 0;
  }

  .studio-tray {
    margin-inline: calc(-1 * var(--space-2));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

/* Wide or sideways: the page on the left; on the right the bar over the tray, whose tools and pots stand in columns side
   by side (the dock's lines are columns down the side). Tucked, the column is only the bar. */
@media (min-aspect-ratio: 5/4) and (min-width: 600px) {
  .view:has(> .studio) {
    padding: var(--space-2) var(--space-3) var(--space-3);
  }

  .studio {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "paper top" "paper tray";
    height: calc(100dvh - var(--studio-top, 96px) - var(--space-3));
  }

  .studio-tray {
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: var(--space-2);
    margin: 0;
    padding: var(--space-2);
    border-radius: var(--radius-lg);
  }

  .studio-tray > .dock {
    order: -1;
  }

  .pots {
    padding: 0 0 0 var(--space-2);
    border-bottom: 0;
    border-left: 1px solid var(--hairline);
  }

  .dock,
  .pots {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-template-rows: repeat(var(--per-line, 5), var(--cell, 48px));
    grid-auto-columns: var(--cell, 48px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-face,
  .pot-ink,
  .dock-tool[aria-pressed="true"] .tool-face,
  .pot[aria-pressed="true"] .pot-ink,
  .tool-choices.is-open,
  .is-open .size,
  .is-open .choice {
    animation: none;
    transition: none;
  }

  .dock-tool[aria-pressed="true"] .tool-face,
  .pot[aria-pressed="true"] .pot-ink {
    transform: none;
  }
}

/* Spec 031: colouring pages. The line art is ink on transparent paper, so it sits on the surface. */
.crayon-orange {
  background: var(--crayon-orange);
  color: var(--on-crayon);
  text-decoration: none;
}

.coloring-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.coloring-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.coloring-open {
  display: block;
  padding: var(--space-2);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-raised);
  min-height: var(--touch-kid);
}

.coloring-open img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--surface);
}

/* Spec 112: under each page, a round Print button at the right (the page above still opens the studio). */
.coloring-grid > li {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.coloring-print {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-standard);
  height: var(--touch-standard);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-purple);
  cursor: pointer;
  box-shadow: var(--elevation-rest);
}

.coloring-print .icon {
  width: 24px;
  height: 24px;
}

.coloring-print:focus-visible {
  outline: var(--focus-width) solid var(--focus);
  outline-offset: var(--focus-offset);
}

/* Spec 049: the colouring shelf shows books as covers first; a cover opens that book's pages. */
.coloring-books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Spec 166: the cover on top at one aspect, the title under it (whole, however many lines), and the pages line at the
   card's foot; the grid (.card-grid, css/app.css) makes every card as tall as the tallest. */
.coloring-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: 0 0 var(--space-3);
  background: var(--gradient-tile-ember);
  color: var(--on-crayon);
  border: 3px solid var(--tile-edge);
  border-radius: 10px var(--radius-lg) var(--radius-lg) 10px;
  box-shadow: var(--elevation-raised);
  text-decoration: none;
  overflow: hidden;
}

/* Spec 120: on the Free plan, the kid's own books' colouring is offered with Family (behind the parental gate). Spec 173
   (the owner, 2026-10-15: "Redundant pills and also pills are not same size."): one card, a book card like the others
   (.coloring-cover: the same edge, radius, gradient and height in .card-grid), the newest locked book's cover or the
   knight in its picture's well, and the lock mark of Xocana Books' Family books in the well's corner. No price. */
button.coloring-upsell {
  width: 100%;
  margin: 0;
  font: inherit;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}

.coloring-cover .coloring-upsell-mark {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: 0;
}

.coloring-cover::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 10px;
  background: var(--page-shade);
}

.coloring-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--paper);
}

.coloring-cover img.lines {
  object-fit: contain;
  padding: var(--space-2);
}

.coloring-cover strong,
.coloring-cover span {
  padding: 0 var(--space-3) 0 calc(var(--space-3) + 10px);
}

.coloring-cover strong {
  font-size: var(--font-lg);
  line-height: 1.25;
  overflow-wrap: break-word;
}

.coloring-cover span {
  line-height: 1.3;
}

/* Spec 166: on a phone the covers are two to a row, as My library's and Xocana Books' are (one huge cover a row at 390 px,
   two from 402 px, was the owner's screenshot); the words step down one size so equal rows stay snug at 320 px and in
   German. */
@media (max-width: 420px) {
  .coloring-books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .coloring-cover strong {
    font-size: var(--font-md);
  }

  .coloring-cover span {
    font-size: var(--font-xs);
  }

  .coloring-cover strong,
  .coloring-cover span {
    padding: 0 var(--space-2) 0 calc(var(--space-2) + 10px);
  }
}

/* Spec 081 amendment 2026-10-26 (the owner: "Colouring pages are horrible why?"): no traced page is shown any more. While
   pages are being made the dragon hops beside "Getting your pages ready…" (a book on the list is its faded cover under the
   dragon; a book's pages end with waiting paper tiles); with the family's colouring allowance this month spent, one card
   with a friend and crayons says when new pages come. Every colour from the tokens; still for anyone who asks for less motion. */
.coloring-making,
.coloring-later {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-raised);
}

.coloring-making[hidden],
.coloring-later[hidden] {
  display: none;
}

.coloring-making {
  background: var(--surface);
  color: var(--text);
}

.coloring-making p {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: 600;
}

.coloring-making-friend {
  flex: none;
  width: 64px;
  height: auto;
  animation: coloring-hop 1.4s ease-in-out infinite;
}

.coloring-later {
  background: var(--crayon-purple);
  color: var(--on-crayon);
}

.coloring-later-art {
  position: relative;
  flex: none;
  width: 104px;
  height: 92px;
}

.coloring-later-friend {
  position: absolute;
  left: 8px;
  bottom: 0;
  width: auto;
  height: 88px;
}

.coloring-later-crayons {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 48px;
  height: 48px;
}

.coloring-later-words {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.coloring-later-words strong {
  font-size: var(--font-lg);
  line-height: 1.25;
  overflow-wrap: break-word;
}

.coloring-later-words span {
  line-height: 1.35;
  overflow-wrap: break-word;
}

.coloring-making-well {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--paper);
}

.coloring-making-well img.cover {
  position: absolute;
  inset: 0;
  height: 100%;
  opacity: 0.45;
}

.coloring-making-well .coloring-making-friend {
  position: relative;
  width: 72px;
  height: auto;
  aspect-ratio: auto;
  background: none;
  object-fit: contain;
}

/* As tall as a page's own tile (.coloring-open: the picture at 4:3 inside its padding), not the whole row. */
.coloring-grid > li.coloring-skeleton > .coloring-skeleton-paper {
  flex: none;
}

.coloring-skeleton-paper {
  display: block;
  box-sizing: content-box;
  padding: var(--space-2);
  aspect-ratio: 4 / 3;
  border: 3px solid var(--tile-edge);
  border-radius: var(--radius-lg);
  background: var(--paper);
  animation: coloring-breathe 1.8s ease-in-out infinite;
}

@keyframes coloring-hop {
  0%,
  100% { translate: 0 0; rotate: 0deg; }
  35% { translate: 0 -10px; rotate: -6deg; }
  70% { translate: 0 0; rotate: 5deg; }
}

@keyframes coloring-breathe {
  0%,
  100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .coloring-making-friend,
  .coloring-skeleton-paper {
    animation: none;
  }
}

@media (max-width: 420px) {
  .coloring-later-art {
    width: 80px;
    height: 72px;
  }

  .coloring-later-friend {
    height: 68px;
  }

  .coloring-later-crayons {
    width: 38px;
    height: 38px;
  }
}

.coloring-book-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.coloring-book-head h2 {
  margin: 0;
}

.coloring-open img {
  background: var(--paper);
}

/* Spec 111 (the owner, build 21: "add build a hero in my drawings page too"): My art's "+ Build a hero", right under
   "New drawing": light (a dashed outline, no fill), 56px tall, the whole row the link. */
.art-build-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: var(--space-2) var(--space-4);
  border: 2px dashed var(--text-secondary);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: var(--font-md);
  font-weight: 700;
  text-decoration: none;
}

.art-build-hero[hidden] {
  display: none;
}

.art-build-hero .icon {
  flex: none;
  width: 1.3em;
  height: 1.3em;
}

/* Spec 111: My art's card icons sit on the right under the picture. */
.art-icons {
  justify-content: flex-end;
}

/* Spec 161: "Make a story with this" is the card's worded button under the picture: the accent pill with the sparkle, as
   wide as the card, its words wrapping whole (never cut), a kid's target. */
.art-story-button {
  width: 100%;
  min-height: var(--touch-kid);
  padding: var(--space-2) var(--space-3);
  white-space: normal;
  text-align: start;
  line-height: 1.2;
}

.art-story-button .icon {
  flex: none;
  width: 1.4em;
  height: 1.4em;
}

/* Spec 112: a colouring page's Print. The sheet is never on screen; while a page is printing (js/page-print.js puts
   is-printing-page on <html>) the printer sees only it: the picture fitted inside a thin margin on the paper, turned the
   way the picture lies, its colours kept, the book's page small under it. Nothing loads from elsewhere: the picture is
   an object URL (the CSP's img-src blob:). */
.print-sheet {
  display: none;
}

@page coloring-landscape {
  size: landscape;
  margin: 8mm;
}

@page coloring-portrait {
  size: portrait;
  margin: 8mm;
}

@media print {
  html.is-printing-page body > :not(.print-sheet) {
    display: none !important;
  }

  /* Paper, whatever the screen's theme: the system's own page colours, never the night sky. */
  html.is-printing-page,
  html.is-printing-page body {
    color-scheme: light;
    background: Canvas;
    margin: 0;
    padding: 0;
  }

  html.is-printing-page .print-sheet {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2mm;
    width: 100%;
    height: 100vh;
    break-inside: avoid;
    page: coloring-landscape;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  html.is-printing-page .print-sheet[data-orientation="portrait"] {
    page: coloring-portrait;
  }

  html.is-printing-page .print-sheet img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 8mm);
    width: auto;
    height: auto;
    object-fit: contain;
  }

  html.is-printing-page .print-sheet[data-mono] img {
    filter: grayscale(1);
  }

  html.is-printing-page .print-sheet-caption {
    margin: 0;
    font-size: 8pt;
    color: GrayText;
  }
}
