/* =====================================================
   COLORING BOOK PAGE
   ===================================================== */

.color-hero {
  background: linear-gradient(180deg, #e8f5ec 0%, var(--parchment) 100%);
  padding: 1.5rem 1.2rem 0.75rem;
  text-align: center;
}
.color-hero .section-title { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.color-hero .section-subtitle { font-size: 0.95rem; }
.crumbs { text-align: left; max-width: 900px; margin: 0 auto 0.25rem; font-weight: 800; font-size: 0.9rem; }
.crumbs a { color: var(--green); }
.crumbs a:hover { text-decoration: underline; }

.color-app { max-width: 900px; margin: 0 auto; }

/* ── Picture picker ─────────────────────────────── */
.page-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.75rem 1rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.page-btn {
  flex: 0 0 auto;
  width: 74px;
  background: var(--white);
  border: 3px solid var(--parchment3);
  border-radius: 14px;
  padding: 4px;
  cursor: pointer;
  position: relative;
  scroll-snap-align: center;
  font-family: var(--font-body);
  transition: border-color 0.2s, transform 0.2s;
}
.page-btn img { width: 100%; height: 72px; object-fit: contain; }
.page-btn span { display: block; font-size: 0.65rem; font-weight: 800; color: var(--ink-mid); line-height: 1.1; padding: 2px 0 1px; }
.page-btn.active { border-color: var(--red); transform: translateY(-2px); }
.page-btn.done::after {
  content: "🎨";
  position: absolute;
  top: -6px; right: -6px;
  font-size: 0.9rem;
  background: var(--gold-light);
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ── Canvas stage ───────────────────────────────── */
.stage {
  overflow: auto;
  margin: 0 0.75rem;
  background: var(--white);
  border: 3px solid var(--parchment3);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  max-height: 70vh;
  -webkit-overflow-scrolling: touch;
}
.canvas-wrap {
  position: relative;
  margin: 0 auto;
  line-height: 0;
  background: #fff;
}
.canvas-wrap canvas { display: block; width: 100%; height: auto; }
#lines { position: absolute; inset: 0; pointer-events: none; }
#paint { touch-action: none; cursor: crosshair; }
#paint.mode-fill { touch-action: pan-x pan-y pinch-zoom; cursor: pointer; }
.loading {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.9);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  color: var(--green);
  font-size: 1.3rem;
}
.loading[hidden] { display: none; }

.status {
  min-height: 1.4rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-light);
  padding: 0.35rem 1rem 0;
}

/* ── Dock: tools + colors, stays in reach ───────── */
.dock {
  position: sticky;
  bottom: 0;
  z-index: 50;
  background: var(--parchment2);
  border-top: 3px solid var(--parchment3);
  padding: 0.5rem 0.6rem calc(0.6rem + env(safe-area-inset-bottom));
  margin-top: 0.5rem;
  box-shadow: 0 -4px 14px rgba(122,74,30,0.15);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.toolbar .spacer { flex: 1 1 0; }
.tool, .act {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--white);
  border: 2.5px solid var(--parchment3);
  border-radius: 12px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.55rem;
  justify-content: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.15s, border-color 0.15s;
}
.tool.active { background: var(--green); border-color: var(--green); color: var(--gold-light); }
.act:active, .tool:active { transform: translateY(1px); }
.act:disabled { opacity: 0.4; cursor: default; }
.act-save { background: var(--red); border-color: var(--red); color: #fff; }
.act-save:hover { background: var(--red-light); }
.act.confirm { background: var(--gold-light); border-color: var(--gold); }

.sizes { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.45rem; }
.sizes[hidden] { display: none; }
.sizes-label { font-size: 0.8rem; font-weight: 800; color: var(--ink-mid); margin-right: 0.2rem; }
.size {
  width: 44px; height: 40px;
  border-radius: 12px;
  border: 2.5px solid var(--parchment3);
  background: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.size.active { border-color: var(--red); }

/* ── Palette ────────────────────────────────────── */
.palette {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 4px 2px 6px;
  -webkit-overflow-scrolling: touch;
}
.swatch {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.95);
  box-shadow: 0 0 0 2px rgba(122,74,30,0.35), 0 2px 4px rgba(0,0,0,0.2);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.swatch.active { box-shadow: 0 0 0 3.5px var(--red), 0 2px 6px rgba(0,0,0,0.3); transform: scale(1.12); }
.swatch.custom {
  background: conic-gradient(#f44, #fd4, #4d4, #4df, #66f, #f4d, #f44);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* Phones: icon-only buttons keep the dock to two short rows */
.tool .lbl, .act .lbl { display: none; }
.act.confirm .lbl { display: inline; }
.toolbar { margin-bottom: 0.35rem; }

@media (min-width: 560px) {
  .tool .lbl, .act .lbl { display: inline; }
}
@media (min-width: 700px) {
  .tool, .act { font-size: 0.95rem; padding: 0 1rem; }
  .swatch { width: 44px; height: 44px; }
  .page-btn { width: 88px; }
  .page-btn img { height: 86px; }
}

/* ── Share with Santa ───────────────────────────── */
.share-row { text-align: center; padding: 0.4rem 1rem 0.2rem; }

.santa-dialog {
  border: 3px solid var(--parchment3);
  border-radius: var(--radius-card);
  background: var(--parchment);
  color: var(--ink);
  padding: 1.25rem 1.25rem 1.1rem;
  width: min(92vw, 440px);
  box-shadow: var(--shadow-lift);
  margin: auto;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
}
.santa-dialog::backdrop { background: rgba(42, 26, 10, 0.55); }
.santa-dialog h2 { font-family: var(--font-display); color: var(--green); font-size: 1.5rem; text-align: center; margin-bottom: 0.6rem; }
.santa-preview { max-height: 30vh; width: auto; max-width: 100%; margin: 0 auto 0.7rem; border: 3px solid var(--parchment3); border-radius: 12px; background: #fff; }
.santa-text { font-size: 0.95rem; line-height: 1.55; color: var(--ink-mid); text-align: center; margin-bottom: 0.7rem; }
.grownup { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 800; font-size: 0.95rem; background: var(--parchment2); border-radius: 12px; padding: 0.65rem 0.8rem; cursor: pointer; }
.grownup input { width: 22px; height: 22px; margin-top: 1px; flex: 0 0 auto; accent-color: var(--green); }
.santa-small { font-size: 0.78rem; color: var(--ink-light); text-align: center; margin: 0.5rem 0 0; }
.santa-msg { min-height: 1.3rem; text-align: center; font-weight: 800; font-size: 0.95rem; margin: 0.45rem 0; color: var(--ink-mid); }
.santa-msg.ok { color: var(--green); }
.santa-msg.err { color: var(--red); }
.santa-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.santa-actions .btn { font-size: 1rem; padding: 0.6rem 1.4rem; }
.santa-actions .btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.santa-dialog.sent .grownup, .santa-dialog.sent .santa-small, .santa-dialog.sent #santaSend { display: none; }
