/* 🎨 The Coloring Room: the picture library, the coloring table (full screen) and the challenge */
.color-room { padding: 0 var(--m) var(--gap); }
.co-hero {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(32px, 5vw, 72px); align-items: center;
  padding: clamp(56px, 8vw, 120px) 0 clamp(48px, 6vw, 96px);
}
.co-hero .side-art { aspect-ratio: 1400 / 1046; }
.co-lib-h { margin-bottom: 32px; }

.co-lib { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.co-card { background: var(--surface); border-radius: 28px; overflow: hidden; display: flex; flex-direction: column; }
.co-card > img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.co-card > img.co-tall { object-fit: cover; object-position: center 8%; }   /* tall pages: show the title and her face */
.co-card-body { padding: clamp(24px, 2.4vw, 32px); display: flex; flex-direction: column; gap: 12px; flex: 1; }
.co-card h3 { font-size: var(--step-lead); line-height: 1.1; }
.co-tag { font-weight: 700; color: var(--accent); }
.co-tag-pro {
  align-self: flex-start; padding: 4px 14px; border-radius: 999px; letter-spacing: .12em;
  background: linear-gradient(135deg, #ffe08a, #d9a441); color: #3a2606;
}
.co-card-pro { box-shadow: inset 0 0 0 4px #d9a441; }
.co-card-btns { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.co-chal-btn { background: linear-gradient(135deg, #ffe08a, #d9a441); color: #3a2606; font-weight: 600; }
.co-link {
  min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink);
  font: inherit; text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
}

.co-how {
  margin-top: clamp(64px, 8vw, 120px); padding: clamp(32px, 5vw, 72px); border-radius: 28px;
  background: radial-gradient(circle at 75% 30%, #2a1a5a, #0b0820 75%);
}
.co-how ol { margin: 32px 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.co-how li { counter-increment: step; font-size: var(--step-body); }
.co-how li::before {
  content: counter(step); display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.5rem;
}
.co-how-small { margin-top: 32px; color: var(--soft); }

/* ---- the coloring table ---- */
html.co-open { overflow: hidden; }
.studio {
  position: fixed; inset: 0; z-index: 70; background: var(--bg); color: var(--ink);
  display: grid; grid-template-columns: minmax(0, 1fr) 352px; grid-template-rows: auto auto minmax(0, 1fr);
  grid-template-areas: "top panel" "note panel" "view panel";
}
.studio[hidden] { display: none; }
.co-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; }
.co-top h2 { font-size: var(--step-body); font-weight: 700; }
.co-x, .co-note-x {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink);
  font-size: 18px; cursor: pointer;
}
.co-note {
  grid-area: note; margin: 0 16px 10px; padding: 12px 12px 12px 18px; border-radius: 18px;
  background: linear-gradient(135deg, #ffe08a, #d9a441); color: #3a2606; display: flex; gap: 12px; align-items: center;
}
.co-note[hidden] { display: none; }
.co-note-text { font-weight: 600; line-height: 1.35; }
.co-note-x { background: #3a26061a; color: #3a2606; }
.co-view {
  grid-area: view; position: relative; overflow: hidden; touch-action: none; cursor: crosshair;
  background: #091827; border-radius: 0 22px 0 0;
}
.co-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.co-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.co-cv-color { background: #fff; }
.co-busy { position: absolute; inset: 0; display: none; place-items: center; padding: 24px; text-align: center; font-size: var(--step-lead); }
.co-view.is-busy .co-busy { display: grid; }
.co-zoom { position: absolute; left: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.co-zoom button {
  width: 48px; height: 48px; border: 2px solid #ffffff33; border-radius: 50%; background: var(--surface); color: var(--ink);
  font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.co-toast {
  position: absolute; left: 50%; top: 14px; max-width: calc(100% - 32px); padding: 10px 20px; border-radius: 999px;
  background: var(--paper); color: var(--paper-ink); font-weight: 600; text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, -16px); transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.co-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.co-panel {
  grid-area: panel; overflow-y: auto; padding: 16px 16px 104px; background: var(--surface);
  display: flex; flex-direction: column; gap: 18px;
}
.co-pal { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 6px; }
.co-sw { grid-column: span 2; }
.co-sw {
  aspect-ratio: 1; min-width: 0; border: 3px solid #ffffff2e; border-radius: 50%; background: var(--sw); cursor: pointer; padding: 0;
}
.co-sw[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--bg); }
.co-sw-num {
  grid-column: span 9; aspect-ratio: auto; min-height: 42px; border-radius: 999px; background: var(--bg);
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; color: var(--ink); font: inherit; text-align: left;
}
.co-sw-num b {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sw);
  color: #2a2530; text-shadow: 0 0 3px #fff, 0 0 3px #fff; box-shadow: inset 0 0 0 2px #ffffff55;
}
.co-sw-num span { font-size: var(--step-small); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-pal-more { grid-column: 1 / -1; margin-top: 6px; font-size: var(--step-small); color: var(--soft); }
.co-tools, .co-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.co-tools button, .co-acts button:not(.btn), .co-any {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 2px solid #ffffff38; border-radius: 999px;
  background: none; color: var(--ink); font: inherit; font-size: var(--step-small); font-weight: 600; cursor: pointer;
}
.co-tools button:hover, .co-acts button:not(.btn):hover, .co-any:hover { background: #ffffff14; }
.co-tools [aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.co-tools [hidden], .co-acts [hidden] { display: none; }
.co-any input { width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: none; cursor: pointer; }
.co-any input::-webkit-color-swatch-wrapper { padding: 0; }
.co-any input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.co-acts .btn { min-height: 48px; font-size: var(--step-small); padding: 0 1.2em; }
.studio :focus-visible { outline-offset: 2px; }

/* the radio keeps playing while you color */
html.co-open .radio { z-index: 75; }
@media (min-width: 761px) { html.co-open .radio { right: 16px; } }

/* ---- 🏆 the challenge ---- */
.chal { width: min(94vw, 34rem); max-height: 92svh; overflow-y: auto; }
.chal-q { font-weight: 600; margin: 16px 0 8px; }
.chal-gap { margin-top: 18px; }
.chal-opt { font-weight: 400; }
.chal-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chal-chips button {
  min-height: 44px; padding: 0 16px; border: 2px solid var(--paper-ink); border-radius: 999px;
  background: none; color: var(--paper-ink); font: inherit; cursor: pointer; text-align: left;
}
.chal-chips button[aria-pressed="true"] { background: var(--paper-ink); color: var(--paper); }
.chal .dare-msg { margin-top: 18px; }
.chal-go { width: 100%; margin-top: 18px; }

/* print only the picture */
.print-sheet { display: none; }
@media print {
  @page { margin: 8mm; }
  body > *:not(.print-sheet) { display: none !important; }
  html, body { background: #fff !important; }
  .print-sheet { display: block; }
  .print-sheet img { display: block; width: 100%; height: auto; }
}

@media (max-width: 1000px) {
  .co-lib { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .co-how ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .co-hero { grid-template-columns: 1fr; }
  .co-lib, .co-how ol { grid-template-columns: 1fr; }
  .studio {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "top" "note" "view" "panel";
  }
  .co-top { padding: 8px 12px; }
  .co-note { margin: 0 12px 8px; font-size: var(--step-small); }
  .co-view { border-radius: 0; }
  .co-panel { padding: 10px 0 12px; gap: 10px; max-height: 40svh; }
  .co-pal { display: flex; overflow-x: auto; padding: 4px 12px; gap: 8px; scrollbar-width: none; }
  .co-sw { flex: none; width: 42px; height: 42px; }
  .co-sw-num { width: auto; height: auto; }
  .co-sw-num span { display: none; }
  .co-pal-more { flex: none; align-self: center; margin: 0 4px; }
  .co-tools, .co-acts { flex-wrap: nowrap; overflow-x: auto; padding: 0 12px; scrollbar-width: none; }
  .co-tools > *, .co-acts > * { flex: none; }
  /* the radio rides at the top of the picture, out of the way of the colors */
  html.co-open .radio { top: 64px; bottom: auto; right: 12px; }
  html.co-open .radio-tab b { display: none; }
}
