/* Where's Rocko? — Coloring Book (tap-to-fill).
   Loaded by /color/ on TOP of the shared /styles.css design tokens — same
   layering pattern as /spot/spot.css and /reveal/reveal.css. Warm "Creative
   Library" system (paper / surface / ink / brand #F04E37).
   Category is CREATE, so accents use the create hue. This is Create & Chill:
   no timer, no score, no win/lose — just color.
   The coloring "paper" (the canvas + gallery thumbs) is ALWAYS light in both
   themes, like a real coloring book page; the chrome around it adapts. */
:root {
  /* create-category hue, mirrored from home.css so /color/ stands alone */
  --c-create:  #E4589B;
  --paper-page:#FFFDF8;   /* the coloring canvas — always light */
  --ink-line:  #2C2722;   /* the printed black outline */
}
@media (prefers-color-scheme: dark) {
  :root { --c-create: #FF82BC; }
}

body.color main { max-width: 1000px; margin: 0 auto; padding: 0 20px 64px; }

/* ============ gallery hero ============ */
.color-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 30px; flex-wrap: wrap;
  margin: 26px 0 30px; padding: 34px 36px; border-radius: 26px;
  background: radial-gradient(120% 150% at 100% 0%,
    color-mix(in srgb, var(--c-create) 18%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.color-hero-art {
  flex: 0 0 auto; width: 116px; height: 116px;
  filter: drop-shadow(0 10px 20px rgba(30,22,14,.18));
}
.color-hero-copy { flex: 1 1 300px; min-width: 0; }
.color-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--c-create); padding: 4px 11px; border-radius: 999px; margin: 0 0 12px;
}
.color-hero h1 { font-size: clamp(1.9rem, 4.8vw, 3rem); margin: 0 0 .26em; }
.color-hero h1 .accent { color: var(--brand); }
.color-hero .lede { font-size: 1.06rem; font-weight: 700; color: var(--ink-soft); margin: 0; max-width: 52ch; }
.color-hero .lede strong { color: var(--ink); }

/* ============ page gallery ============ */
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.page-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  font: inherit; color: inherit; cursor: pointer; overflow: hidden; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.page-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.page-card:focus-visible { outline: 3px solid var(--c-create); outline-offset: 2px; }
.page-thumb {
  position: relative; display: grid; place-items: center;
  height: 150px; padding: 10px; background: var(--paper-page);
  border-bottom: 1px solid var(--line);
}
.page-thumb svg { width: 100%; height: 100%; display: block; }
.page-meta { padding: 12px 15px 14px; display: flex; flex-direction: column; gap: 2px; }
.page-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.page-tag { color: var(--ink-soft); font-size: .86rem; font-weight: 700; }
.tier-chip {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-body); font-size: .62rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 999px; color: #fff;
}
.tier-chip.little { background: color-mix(in srgb, var(--c-create) 78%, #fff); }
.tier-chip.big    { background: color-mix(in srgb, var(--c-create) 55%, #7b3f8f); }
.saved-dot {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--brand-ink); background: var(--surface);
  padding: 4px 9px 4px 7px; border-radius: 999px; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.saved-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

.color-fine { margin-top: 24px; }

/* ============ HUD (color view) ============ */
.hud { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 14px; }
.hud-back {
  font: inherit; font-weight: 800; cursor: pointer; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 15px;
}
.hud-back:hover { border-color: var(--brand); color: var(--brand-ink); }
.hud-title { font-family: var(--font-display); font-weight: 700; font-size: 1.16rem; }
.hud-tier {
  font-size: .64rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: #fff; background: var(--c-create); padding: 4px 10px; border-radius: 999px;
}
.hud-tier.big { background: color-mix(in srgb, var(--c-create) 55%, #7b3f8f); }
.hud-spacer { flex: 1 1 auto; }

/* ============ palette ============ */
.palette {
  display: flex; flex-wrap: wrap; gap: 9px; justify-content: center;
  padding: 12px 14px; margin: 0 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.swatch {
  width: 38px; height: 38px; padding: 0; border-radius: 12px; cursor: pointer;
  border: 2px solid rgba(0,0,0,.14);
  box-shadow: 0 1px 2px rgba(30,22,14,.14), inset 0 0 0 1.5px rgba(255,255,255,.35);
  transition: transform .1s ease, box-shadow .1s ease;
}
.swatch:hover { transform: translateY(-2px) scale(1.05); }
.swatch.sel {
  transform: translateY(-1px) scale(1.12);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--c-create), 0 4px 10px rgba(30,22,14,.2);
}
@media (max-width: 480px) { .swatch { width: 34px; height: 34px; } }

/* ============ caption ============ */
.color-caption {
  text-align: center; color: var(--ink-soft); font-weight: 800; margin: 0 0 12px; font-size: .98rem;
}
.color-caption b { color: var(--ink); }
.cap-dot {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border-radius: 5px; border: 1.5px solid rgba(0,0,0,.18); margin: 0 1px;
}

/* ============ stage (the coloring canvas) ============ */
.color-stage {
  padding: 12px; background: var(--paper-page);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.page-svg {
  width: 100%; height: auto; display: block; aspect-ratio: 4 / 3; max-height: 68vh;
  margin: 0 auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.page-svg .fill { cursor: pointer; transition: fill .14s ease; }
@media (hover: hover) { .page-svg .fill:hover { filter: brightness(.955); } }
.page-svg .ink, .page-svg .bg { pointer-events: none; }
.page-svg .fill.pop { animation: cpop .32s ease; transform-box: fill-box; transform-origin: center; }
@keyframes cpop { 0% { transform: scale(.86); } 55% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ============ tools ============ */
.tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.tool {
  display: inline-flex; align-items: center; gap: .5em;
  font: inherit; font-family: var(--font-display); font-weight: 600; font-size: 1rem; cursor: pointer;
  padding: 11px 20px; border-radius: 999px;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); box-shadow: var(--shadow);
  transition: transform .08s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.tool:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--brand-ink); }
.tool:active { transform: translateY(0); }
.tool[disabled] { opacity: .45; cursor: default; transform: none; border-color: var(--line); color: var(--ink-soft); }
.tool.primary {
  background: var(--brand); color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent);
}
.tool.primary:hover { color: #fff; box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 46%, transparent); }

@media (max-width: 600px) {
  .color-hero { padding: 26px 22px; gap: 20px; }
  .color-stage { padding: 8px; }
  .tool { padding: 10px 16px; font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ sets (gallery tabs) ============ */
.set-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.set-tab {
  font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 999px;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.set-tab:hover { border-color: var(--c-create); }
.set-tab.sel { background: var(--c-create); border-color: var(--c-create); color: #fff; }
.set-tab:focus-visible { outline: 3px solid var(--c-create); outline-offset: 2px; }
.set-count {
  font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--c-create) 16%, transparent); color: inherit;
}
.set-tab.sel .set-count { background: rgba(255,255,255,.26); }
.set-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 0 0 16px; }
.set-blurb { margin: 0; color: var(--ink-soft); font-weight: 700; }
.tier-tabs { margin: 0; }
.tier-tabs .set-tab { font-size: .82rem; padding: 6px 12px; }
.page-thumb img {
  position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px);
  object-fit: contain; display: block;
}
.page-thumb.tall { height: 210px; }
.page-tag:empty { display: none; }
/* on the festive dark stage (landing.css), match its tier filters */
body.rk-land .set-tab { color: #D9CCF5; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }
body.rk-land .set-tab:hover { border-color: #FFC93C; }
body.rk-land .set-tab.sel { color: #241454; background: #FFC93C; border-color: #FFC93C; }
body.rk-land .set-count { background: rgba(255,255,255,.14); }
body.rk-land .set-tab.sel .set-count { background: rgba(36,20,84,.14); }
body.rk-land .set-blurb { color: #E7DBFF; }

.tier-chip.easy     { background: color-mix(in srgb, var(--c-create) 78%, #fff); }
.tier-chip.medium   { background: color-mix(in srgb, var(--c-create) 55%, #7b3f8f); }
.tier-chip.detailed { background: #4a3a8c; }
.hud-tier.medium    { background: color-mix(in srgb, var(--c-create) 55%, #7b3f8f); }
.hud-tier.detailed  { background: #4a3a8c; }

/* ============ picture pages (canvas bucket fill) ============ */
.color-stage.raster { position: relative; }
.page-canvas {
  display: block; margin: 0 auto; max-width: 100%; max-height: 78vh; width: auto; height: auto;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.color-stage.loading .page-canvas { opacity: .35; }
/* Rocko peeks over the top edge of every picture page — watching, not covering the art */
.stage-rocko {
  position: absolute; right: 14px; top: 0; width: 64px; height: auto;
  transform: translateY(-78%); pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(30,22,14,.18));
}
@media (max-width: 600px) { .stage-rocko { width: 50px; right: 8px; } }
.more-card { align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 180px; padding: 18px; }
.more-plus {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  font: 700 2rem/1 var(--font-display); color: #fff; background: var(--c-create);
}
/* many sets: on phones the set tabs become one swipeable row instead of a wall of chips */
@media (max-width: 600px) {
  #set-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -16px; margin-right: -16px; padding: 2px 16px 6px;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  #set-tabs::-webkit-scrollbar { display: none; }
  #set-tabs .set-tab { flex: 0 0 auto; scroll-snap-align: start; }
}

/* hero headline: "Over 2,800 pages to color!" (count computed in color.js) */
.color-count {
  display: inline-block; margin: 0 0 12px; transform: rotate(-2deg);
  font-family: var(--font-display); font-weight: 700; font-size: clamp(1.25rem, 3.6vw, 1.7rem);
  color: #241454; background: #FFC93C; padding: 6px 16px; border-radius: 14px;
  box-shadow: 0 6px 0 #E0A21A, 0 10px 22px rgba(10,4,30,.35);
  animation: countpop .6s cubic-bezier(.2,1.6,.4,1) both;
}
.color-count-num { color: var(--brand); }
@keyframes countpop { from { transform: rotate(-2deg) scale(.6); opacity: 0; } to { transform: rotate(-2deg) scale(1); opacity: 1; } }

/* ============ picture pages: Fill / Crayon / Chalk / Pastel / Eraser + size ============ */
.brushbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px;
  margin: 0 0 10px;
}
.brushbar .modes, .brushbar .sizes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.brushbar .mode {
  font: inherit; font-weight: 800; font-size: .92rem; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
}
.brushbar .mode.sel { background: var(--c-create); border-color: var(--c-create); color: #fff; }
.brushbar .size {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; cursor: pointer;
  border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line);
}
.brushbar .size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.brushbar .size.sel { border-color: var(--c-create); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-create) 35%, transparent); }
.brushbar.filling .sizes { opacity: .45; }            /* sizes don't apply to Fill (tapping one switches to Crayon) */
body.rk-land .brushbar .mode { color: #D9CCF5; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }
body.rk-land .brushbar .mode.sel { color: #241454; background: #FFC93C; border-color: #FFC93C; }
body.rk-land .brushbar .size { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); }
body.rk-land .brushbar .size i { background: #fff; }
body.rk-land .brushbar .size.sel { border-color: #FFC93C; box-shadow: 0 0 0 3px rgba(255,201,60,.35); }
/* drawing: the canvas takes the finger (no scroll / pinch while coloring) */
.color-stage.drawing .page-canvas { touch-action: none; cursor: crosshair; }
@media (max-width: 480px) { .brushbar .mode { font-size: .84rem; padding: 6px 10px; } .brushbar .size { width: 34px; height: 34px; } }
.brushbar .modes.fx { align-items: center; }
.brushbar .sizes { display: inline-flex; gap: 6px; margin-left: 6px; }
.brushbar.filling .sizes { display: none; }
.textures { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; width: 100%; }
.tex {
  width: 40px; height: 40px; padding: 0; cursor: pointer; border-radius: 12px;
  background-size: cover; background-position: center;
  border: 2px solid rgba(0,0,0,.14); box-shadow: 0 1px 2px rgba(30,22,14,.14);
}
.tex.sel { transform: scale(1.1); box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--c-create); }
body.rk-land .tex.sel { box-shadow: 0 0 0 3px #241454, 0 0 0 6px #FFC93C; }
@media (max-width: 480px) { .tex { width: 34px; height: 34px; } }
.textures[hidden] { display: none; }
/* phones: each toolbar row is one swipeable strip, so the page stays near the top */
@media (max-width: 600px) {
  .brushbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .brushbar .modes, .textures {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none;
    margin: 0; padding: 3px 2px 4px; max-width: 100%;
  }
  .brushbar .modes::-webkit-scrollbar, .textures::-webkit-scrollbar { display: none; }
  .brushbar .mode, .tex, .brushbar .size { flex: 0 0 auto; }
}

/* ============ favorites / hide ============ */
.card-wrap { position: relative; display: flex; transition: opacity .2s ease, transform .2s ease; }
.card-wrap > .page-card { flex: 1 1 auto; width: 100%; }
.card-wrap.gone { opacity: 0; transform: scale(.9); }
.card-acts { position: absolute; right: 10px; bottom: 11px; display: flex; gap: 6px; z-index: 2; }
.card-wrap .page-meta { padding-right: 88px; }
.card-act {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer;
  font-size: 1rem; line-height: 1; display: grid; place-items: center;
  background: rgba(255,255,255,.92); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .1s ease;
}
.card-act:hover { transform: scale(1.12); }
.card-act.hide { opacity: .75; }
.hud-mark {
  font: inherit; font-weight: 800; cursor: pointer; padding: 7px 13px; border-radius: 999px;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
}
.hud-mark.on { border-color: #FF3D8B; }
body.rk-land .hud-mark { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }
body.rk-land .hud-mark.on { border-color: #FF7FB6; background: rgba(255,127,182,.18); }
.brushbar .sizes { flex-wrap: nowrap; flex: 0 0 auto; }

/* ============ gallery groups: My stuff / Little kids / Big artists / Learn ============ */
.group-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.group-tabs .group-tab { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; padding: 10px 18px; }
body.rk-land .group-tabs .group-tab { color: #fff; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.28); }
body.rk-land .group-tabs .group-tab.sel { color: #241454; background: #FFC93C; border-color: #FFC93C; box-shadow: 0 5px 0 #E0A21A; }
/* set tabs under a group: a quieter second level */
body.rk-land #set-tabs .set-tab { font-size: .88rem; padding: 6px 12px; }
body.rk-land #set-tabs .set-tab.sel { color: #fff; background: #F04E37; border-color: #F04E37; }
@media (max-width: 600px) {
  .group-tabs { gap: 8px; }
  .group-tabs .group-tab { flex: 1 1 calc(50% - 8px); justify-content: center; font-size: .98rem; padding: 9px 10px; }
}
.group-tabs .group-tab { white-space: nowrap; }
@media (max-width: 600px) {
  .group-tabs .group-tab { font-size: .9rem; padding: 8px 6px; gap: 5px; }
  .group-tabs .group-tab .set-count { font-size: .64rem; padding: 1px 5px; }
}

/* ============ color by number ============ */
.palette.by-number { gap: 10px; }
.swatch.num {
  width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.35rem; color: #241454;
}
.swatch.num b { background: rgba(255,255,255,.82); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; line-height: 1; }
.swatch.num.done { opacity: .55; }
.swatch.num.done b { color: #1f8a3b; }
.cbn-left { opacity: .75; font-weight: 700; white-space: nowrap; }
.hud-mark#btn-cbn.on { background: #FFC93C; color: #241454; border-color: #FFC93C; }
.cbn-cheer {
  position: absolute; left: 50%; top: 42%; z-index: 5; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px; padding: 14px 22px 14px 14px; border-radius: 22px;
  background: #fff; color: #241454; font-family: var(--font-display); font-size: 1.6rem;
  box-shadow: 0 10px 0 #FFC93C, 0 18px 40px rgba(10,4,30,.35); pointer-events: none;
  animation: cheer 3.2s ease both;
}
.cbn-cheer img { width: 72px; height: 72px; }
@keyframes cheer {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20%, 85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); }
}
@media (max-width: 480px) { .swatch.num { width: 42px; height: 42px; font-size: 1.1rem; } .swatch.num b { width: 26px; height: 26px; } }
.brushbar[hidden], .hud-mark[hidden], .tool[hidden] { display: none; }

/* ============ Amount slider (spray, glitter, pastel, marker, smudge, blur) ============ */
.amount {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  font-weight: 800; font-size: .9rem; color: var(--ink);
}
.amount[hidden] { display: none; }
.amount input { width: 180px; accent-color: #FFC93C; height: 28px; }
body.rk-land .amount { color: #fff; }
@media (max-width: 600px) { .amount { width: 100%; } .amount input { flex: 1 1 auto; width: auto; } }

/* ============ brush cursor (mouse / pen) ============ */
.brush-cursor {
  position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; will-change: transform;
}
.brush-cursor[hidden] { display: none; }
.brush-cursor .ring {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%);
  border-radius: 50%; border: 2px solid; box-shadow: 0 0 0 1px rgba(255,255,255,.9), 0 1px 4px rgba(0,0,0,.25);
}
.brush-cursor .ring.eraser { border-style: dashed; }
.brush-cursor .ring.pastel { box-shadow: 0 0 8px 2px rgba(255,255,255,.8); }
.brush-cursor .ring.dot { border-width: 2px; box-shadow: 0 0 0 1.5px #241454, 0 2px 6px rgba(0,0,0,.3); }
.brush-cursor span { position: absolute; left: 0; top: 0; font-size: 18px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.color-stage.has-cursor .page-canvas { cursor: none; }

/* =========================================================================
   PLAY VIEW FITS THE SCREEN — no page scroll, no inner scroll of #view-color.
   nav.js adds body.rk-playing while a play view is open and locks the page
   (html/body overflow hidden); landing.css then makes #view-color an internal
   scroller. Here we turn #view-color into a flex COLUMN that fills the locked
   height: HUD / brush bar / palette / caption / tools stay one compact row
   each (horizontal-scroll strips), and #stage flexes to fill the leftover
   space and CLIPS — it is the zoom viewport (zoom.js). The picture is fit
   inside via contain, so nothing overflows. The gallery (#view-gallery) is a
   page list and is left completely untouched (it still scrolls normally).
   Any #stage-scoped selector out-specifies landing.css's section rule.
   ========================================================================= */
body.color.rk-playing > main { padding: 0 12px 8px; }

body.color.rk-playing #view-color {
  display: flex; flex-direction: column; gap: 8px;
  flex: 1 1 auto; height: 100%; min-height: 0; max-height: 100%;
  overflow: hidden;                 /* the view itself never scrolls */
  padding-top: 6px;
}

/* one-row horizontal strips: swipeable, never wrap to a second line.
   `safe center` centres when everything fits (desktop) but falls back to
   start when it overflows (phone) so the leading items stay reachable. */
body.color.rk-playing .hud,
body.color.rk-playing .brushbar,
body.color.rk-playing .palette,
body.color.rk-playing .tools {
  flex: 0 0 auto; flex-wrap: nowrap; margin: 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
body.color.rk-playing .hud::-webkit-scrollbar,
body.color.rk-playing .brushbar::-webkit-scrollbar,
body.color.rk-playing .palette::-webkit-scrollbar,
body.color.rk-playing .tools::-webkit-scrollbar { display: none; }

/* HUD — compact single row */
body.color.rk-playing .hud { justify-content: flex-start; gap: 8px; align-items: center; }
body.color.rk-playing .hud > * { flex: 0 0 auto; }
body.color.rk-playing .hud-spacer { flex: 1 1 auto; min-width: 0; }

/* brush bar — was a stack of rows on phones; now a single horizontal strip */
body.color.rk-playing .brushbar {
  flex-direction: row; align-items: center; justify-content: safe center; gap: 8px;
}
body.color.rk-playing .brushbar > * { flex: 0 0 auto; }
body.color.rk-playing .brushbar .modes,
body.color.rk-playing .brushbar .sizes,
body.color.rk-playing .brushbar .textures {
  flex-wrap: nowrap; overflow: visible; width: auto; max-width: none; margin: 0; padding: 0;
}
body.color.rk-playing .brushbar .amount { width: auto; }

/* palette — single strip */
body.color.rk-playing .palette { justify-content: safe center; gap: 8px; padding: 8px 12px; }
body.color.rk-playing .palette > * { flex: 0 0 auto; }

/* caption — one compact line; disappears on very short screens */
body.color.rk-playing .color-caption {
  flex: 0 0 auto; margin: 0; font-size: .9rem; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
@media (max-height: 560px) { body.color.rk-playing .color-caption { display: none; } }

/* tools — single row */
body.color.rk-playing .tools { justify-content: safe center; gap: 8px; }
body.color.rk-playing .tools > * { flex: 0 0 auto; }

/* stage wrapper (injected by zoom.js) takes #stage's place in the column;
   #stage fills it, clips, and centres the picture. touch-action:none so a
   two-finger pinch doesn't zoom the whole page — zoom.js handles it. */
body.color.rk-playing .stage-zoom {
  flex: 1 1 auto; min-height: 0; position: relative; display: flex;
}
body.color.rk-playing #stage {
  flex: 1 1 auto; min-height: 0; width: 100%; margin: 0; padding: 8px;
  position: relative; overflow: hidden;      /* the zoom viewport: fill + clip */
  /* flex-centre (NOT grid): a grid's implicit row auto-grows to the picture's
     intrinsic height, which defeats max-height:100%; the stage has a definite
     flex height, so here max-height:100% clamps the picture to fit. */
  display: flex; align-items: center; justify-content: center; touch-action: none;
}
/* fit the picture inside the stage (contain). The CANVAS keeps a TIGHT box
   (intrinsic size + max-constraints) so color.js's getBoundingClientRect
   coordinate maths stay exact; the SVG fills the box and its own
   preserveAspectRatio="xMidYMid meet" letterboxes the drawing (invisibly, on
   paper-on-paper) while tap hit-testing stays on the real shapes. */
body.color.rk-playing #stage .page-canvas {
  width: auto; height: auto; max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0; margin: 0; flex: 0 0 auto;
}
body.color.rk-playing #stage .page-svg {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  min-width: 0; min-height: 0; aspect-ratio: auto; margin: 0; flex: 0 0 auto;
}

/* ================= floating zoom controls (bottom-right of the stage) ===== */
.stage-zoom { position: relative; }
.zoom-ctrls {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
}
.zoom-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; line-height: 1; font-size: 1.45rem; font-weight: 700;
  color: var(--ink); background: rgba(255,255,255,.94);
  border: 1.5px solid var(--line); box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform .08s ease, border-color .12s ease, color .12s ease;
}
.zoom-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.zoom-btn:active { transform: scale(.92); }
body.rk-land .zoom-btn { color: #241454; background: rgba(255,255,255,.96); border-color: rgba(36,20,84,.15); }
