/* PlayCalm Coloring. Same calm look as the other games (.sd-head / .side / .buddy / .bubble / printable .sheet). */
.sd-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 0; }
.sd-head h1 { font-size: 28px; display: flex; align-items: center; gap: 10px; }
.cl-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: 20px; margin: 16px 0; align-items: start; }
.side { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.buddy { max-width: 200px; margin: 0 auto; width: 100%; }
.bubble { background: var(--raised); border: 2px solid var(--border); border-radius: 14px; padding: 10px 14px; font-weight: 600; min-height: 56px; }
.cl-board { padding: 10px; }
/* the picture and the colour bar fit on one screen together, so the bar never covers the drawing */
#cl-pic { max-width: min(620px, calc(100vh - 330px)); min-width: 260px; margin: 0 auto; }
@media (max-width: 640px) { #cl-pic { max-width: none; min-width: 0; } }
.cl-svg { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #fff; border-radius: 12px; touch-action: manipulation; }
.cl-svg .r { fill: #fff; stroke: #2B2B2B; stroke-width: 3; stroke-linejoin: round; transition: fill .18s ease-out; }
.cl-svg .l { fill: none; stroke: #2B2B2B; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.cl-svg.lead .r { stroke-width: 6; }
#cl-pic .r { cursor: pointer; outline: none; }
#cl-pic .r:focus-visible { stroke: var(--primary); stroke-width: 7; }
@media (prefers-reduced-motion: reduce) { .cl-svg .r { transition: none; } }

/* colour bar: stays at the bottom of the screen while you colour, close to the thumb */
.cl-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.cl-swatches { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; padding: 4px 2px; }
.cl-sw { flex: 0 0 auto; width: 48px; height: 48px; min-width: 48px; border-radius: 12px; border: 3px solid var(--border-strong); background: var(--c); cursor: pointer; transition: transform .12s ease-out; }
.cl-sw[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--primary); transform: translateY(-3px); }
.cl-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cl-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-row-t { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--text-2); width: 74px; line-height: 1.2; }
.cl-sug { padding: 0; }
.cl-wheel { display: flex; align-items: center; justify-content: center; background: var(--card); }
.cl-wheel-ico { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(#E63946, #FFD166, #4CAF50, #8ECAE6, #3A86FF, #9B5DE5, #F6A6C9, #E63946); box-shadow: inset 0 0 0 5px rgba(255,255,255,.55); }
.cl-tools { flex: 0 0 auto; display: flex; flex-direction: row; gap: 6px; }
.cl-tool { gap: 6px; font-weight: 700; }
.cl-tool[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); background: var(--accent-soft); }
.cl-wheel-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cl-wheel-c { width: 240px; height: 240px; max-width: 70vw; max-height: 70vw; border-radius: 50%; touch-action: none; cursor: crosshair; }
.cl-range { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 300px; font-weight: 700; }
.cl-range input { width: 100%; min-height: 32px; accent-color: var(--primary); }
.cl-wheel-prev .cl-dot { width: 64px; height: 40px; border-radius: 12px; }
.cl-wheel-body .confirm-actions { width: 100%; }
.cl-keys { color: var(--text-2); font-size: 14px; margin: 8px 0 0; }
@media (pointer: coarse) { .cl-keys { display: none; } }
.cl-now { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.cl-dot { display: inline-block; flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; background: var(--c); border: 2px solid var(--border-strong); }

/* gallery */
.cl-gallery { padding: 16px; margin: 8px 0 24px; }
.cl-gallery h2 { font-size: 22px; }
.cl-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.cl-tabs .btn[aria-pressed="true"], .print-tools .btn[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.cl-group { font-size: 18px; margin: 14px 0 8px; color: var(--text-2); }
.cl-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.cl-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--raised); cursor: pointer; font: inherit; font-weight: 700; color: var(--text); }
.cl-thumb svg { width: 100%; height: auto; }
.cl-thumb .r, .cl-thumb .l { stroke-width: 5; }
.cl-thumb[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
@media (hover: hover) and (pointer: fine) { .cl-thumb:hover { border-color: var(--border-strong); } }

/* printable A4 sheet */
.sheet-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 20px 0; }
.sheet-wrap > .cl-gallery { width: 100%; }
.sheet-fit { position: relative; width: 100%; max-width: 210mm; }
.sheet { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 210mm; height: 297mm; box-sizing: border-box; background: #fff; color: #000; padding: 14mm; box-shadow: var(--shadow); border: 1px solid #ccc; display: flex; flex-direction: column; gap: 7mm; }
.sheet .s-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; font-size: 14px; }
.sheet .s-brand { display: flex; align-items: center; gap: 6px; font-weight: 800; font-family: "Plus Jakarta Sans", sans-serif; direction: ltr; }
.sheet .s-brand img { width: 28px; height: 28px; }
.sheet .s-fields div { margin-bottom: 3mm; }
.sheet h2 { text-align: center; font: 800 24px var(--font-head); }
.cl-print { width: 175mm; margin: 0 auto; }
.cl-print .cl-svg { border-radius: 0; }
.cl-print .r { stroke: #000; }
.sheet.ink-color .cl-print svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .s-foot { margin-top: auto; display: flex; justify-content: space-between; font-size: 12px; color: #333; }
.print-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 900px) { .cl-layout { grid-template-columns: minmax(0, 1fr); } .cl-layout .side { order: 2; } }
/* phones: the picture and the whole colour set fit on one screen, so the bar wraps instead of hiding colours off-screen */
@media (max-width: 640px) {
  .cl-bar { position: static; flex-direction: column; align-items: stretch; }
  .cl-swatches { flex-wrap: wrap; overflow: visible; justify-content: center; }
  .cl-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .cl-row-t { width: auto; text-align: center; }
  .cl-tools { flex-direction: row; }
  .cl-tools { justify-content: center; }
  .cl-keys { display: none; }
}
@media (max-width: 480px) { .cl-board { padding: 4px; } .sd-head h1 { font-size: 24px; } }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .site-header, .site-footer, .print-tools, .no-print, .cl-gallery, .toast { display: none !important; }
  .sheet-wrap { margin: 0; gap: 0; }
  .sheet-fit { height: auto !important; max-width: none; position: static; }
  .sheet { position: static; transform: none !important; box-shadow: none; border: 0; width: 210mm; height: 297mm; }
}

/* drawn scenes (PNG line art, coloured on a canvas) */
.cl-canvas, .cl-img { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #fff; border-radius: 12px; }
.cl-canvas { cursor: pointer; touch-action: manipulation; outline: none; }
.cl-canvas:focus-visible { box-shadow: 0 0 0 4px var(--primary); }
.cl-board.loading .cl-canvas { background: #fff linear-gradient(90deg, #fff, #F1EDE2, #fff) 0 0 / 200% 100%; animation: cl-wait 1.2s linear infinite; }
@keyframes cl-wait { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .cl-board.loading .cl-canvas { animation: none; } }
.cl-thumb .cl-img { border-radius: 8px; }
.cl-print .cl-img { border-radius: 0; }
.sheet.ink-color .cl-print img { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* eraser: icon only (owner's decision), a big square button */
.cl-eraser { width: 64px; height: 64px; padding: 0; justify-content: center; }
.cl-eraser svg { width: 40px; height: 40px; }
/* zoom: the scene at twice the size inside the same box; scroll (or drag with two fingers) to move around */
.cl-board.zoom #cl-pic { overflow: auto; aspect-ratio: 1; overscroll-behavior: contain; border-radius: 12px; }
.cl-board.zoom .cl-canvas { width: 200%; max-width: none; }
.cl-zoom { width: 64px; height: 64px; padding: 0; justify-content: center; }
.cl-zoom[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); background: var(--accent-soft); }
/* colour lens: a round window above the finger showing the right colours, twice the size */
.cl-lens { position: fixed; z-index: 60; width: 140px; height: 140px; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none;
  transition: opacity .12s ease-out, transform .12s ease-out; }
.cl-lens.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.cl-lens canvas { width: 140px; height: 140px; border-radius: 50%; border: 4px solid #2B2B2B; box-shadow: 0 8px 24px rgba(0,0,0,.28); background: #fff; display: block; }
.cl-lens-tag { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px); display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--card); color: var(--text); border: 2px solid var(--border-strong); border-radius: 999px; padding: 4px 12px 4px 6px; font-weight: 800; font-size: 15px; }
.cl-lens-tag i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #2B2B2B; display: inline-block; }
@media (prefers-reduced-motion: reduce) { .cl-lens { transition: none; } }
.cl-lensbtn { width: 64px; height: 64px; padding: 0; justify-content: center; touch-action: none; }
.cl-lensbtn[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); background: var(--accent-soft); }
.cl-board.lens-on .cl-canvas { cursor: zoom-in; touch-action: none; }

/* "?" — show the first-visit tour again */
.cl-help span { font: 800 26px/1 var(--font-head); }
/* first-visit tour (Driver.js popover) in the PlayCalm look: our fonts and colours, day and night, 48px buttons, right-to-left */
.driver-popover.pc-tour { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 18px; max-width: min(340px, calc(100vw - 32px)); font-family: var(--font-ar); }
.driver-popover.pc-tour .driver-popover-arrow { border-color: var(--card); }
.driver-popover.pc-tour .driver-popover-title { font: 800 20px/1.3 var(--font-head); color: var(--text); }
.driver-popover.pc-tour .driver-popover-description { font-size: 17px; line-height: 1.6; color: var(--text); }
.driver-popover.pc-tour .driver-popover-progress-text { color: var(--secondary); font-size: 15px; }
.driver-popover.pc-tour .driver-popover-footer { gap: 8px; margin-top: 14px; }
.driver-popover.pc-tour .driver-popover-navigation-btns { gap: 8px; }
.driver-popover.pc-tour .driver-popover-footer button { min-height: 48px; min-width: 48px; padding: 8px 16px; border-radius: var(--radius); font: 700 16px/1 var(--font-ar);
  text-shadow: none; background: var(--raised); color: var(--text); border: 1px solid var(--border-strong); }
.driver-popover.pc-tour .driver-popover-footer button.driver-popover-next-btn { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.driver-popover.pc-tour .driver-popover-close-btn { width: 48px; height: 48px; font-size: 26px; color: var(--secondary); }
[dir="rtl"] .driver-popover.pc-tour { direction: rtl; text-align: right; }
[dir="rtl"] .driver-popover.pc-tour .driver-popover-close-btn { right: auto; left: 0; }
@media print { .driver-popover, .driver-overlay { display: none !important; } }
