.coloring-page { background: #fff8f4; color: #292035; }
.coloring-intro { text-align: center; max-width: 800px; margin: 2.5rem auto; }
.coloring-intro h1 { font: 850 clamp(2.5rem,6vw,4.5rem)/1.1 system-ui,sans-serif; margin: .5rem 0 1rem; }
.coloring-intro h1 span { color: #c51871; }
.coloring-intro p { margin: .7rem 0; }
.coloring-editor { background: white; border: 2px solid #edd7eb; border-radius: 1.5rem; padding: 1.25rem; box-shadow: 0 8px 24px #672a7110; }
.editor-heading,.gallery-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.editor-heading h2 { margin: .5rem 0; font: 800 1.8rem/1.2 system-ui,sans-serif; }
.coloring-workspace { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 1.5rem; margin-top: 1rem; }
.coloring-tools fieldset { border: 0; margin: 0 0 1rem; padding: 0; }
.coloring-tools legend { font-weight: 750; margin-bottom: .6rem; }
.color-palette { display: grid; grid-template-columns: repeat(4,1fr); gap: .5rem; }
.color-palette button { width: 44px; height: 44px; min-width: 0; padding: 0; border: 3px solid #ffffff; border-radius: 50%; box-shadow: 0 0 0 1px #998ca6; }
.color-palette button[aria-pressed="true"] { outline: 3px solid #30203e; outline-offset: 2px; }
.coloring-tools button,.coloring-tools input { cursor: pointer; }
.custom-color { display: flex; align-items: center; gap: .8rem; margin: 1rem 0; font-weight: 650; }
.custom-color input { min-height: 44px; width: 60px; padding: 3px; }
.tool-picker button,.history-tools button,.clear-picture { min-height: 44px; border: 1px solid #cfb5db; border-radius: .7rem; background: #faf3fd; padding: .65rem; color: #3b2250; font: 700 1rem/1.2 system-ui,sans-serif; }
.tool-picker button { width: 100%; text-align: left; margin-bottom: .4rem; }
.tool-picker button[aria-pressed="true"] { background: #63338e; border-color: #63338e; color: white; }
.brush-size { display: block; font-weight: 700; }
.brush-size input { display: block; width: 100%; min-height: 44px; accent-color: #c51871; }
.history-tools { display: flex; gap: .5rem; margin: .75rem 0; }
.history-tools button { flex: 1; }
.history-tools button:disabled { opacity: .45; cursor: default; }
.clear-picture { width: 100%; background: #fff2ee; color: #973b32; }
.art-actions { display: grid; gap: .65rem; margin-top: 1rem; }
.coloring-note { color: #65596f; font-size: .9rem; line-height: 1.5; }
.coloring-paper { min-width: 0; text-align: center; }
#coloring-status { min-height: 1.5em; margin-top: 0; }
#coloring-canvas { display: block; width: 100%; max-width: 650px; height: auto; margin-inline: auto; border: 1px solid #cfc8d5; border-radius: .5rem; background: white; touch-action: none; cursor: crosshair; }
#coloring-canvas:focus-visible { outline: 3px solid #a638ca; outline-offset: 3px; }
.coloring-gallery { margin-block: 3rem; }
.coloring-pictures { display: grid; grid-template-columns: repeat(auto-fill,minmax(170px,1fr)); gap: 1rem; margin-block: 1rem; }
.coloring-picture { padding: 1rem; border: 1px solid #ead3e3; border-radius: 1rem; background: white; display: flex; flex-direction: column; align-items: stretch; gap: .6rem; }
.coloring-picture img { width: 100%; height: 180px; object-fit: contain; }
.coloring-picture h3 { font: 750 1rem/1.3 system-ui,sans-serif; margin: 0; }
.coloring-picture p { margin: 0; font-size: .9rem; color: #68536e; }
.coloring-picture .button { margin-top: auto; text-align: center; }
@media(max-width:700px) {
  .coloring-workspace { display: flex; flex-direction: column; gap: .75rem; }
  .coloring-tools { display: contents; }
  .coloring-tools fieldset { margin-bottom: 0; }
  .color-palette { grid-template-columns: repeat(6,1fr); gap: .4rem; }
  .color-palette button { width: 44px; height: 44px; min-height: 44px; }
  .coloring-tools > fieldset:first-child { order: 0; }
  .tool-picker { display: flex; flex-wrap: wrap; gap: .3rem; order: 1; }
  .tool-picker legend { width: 100%; }
  .tool-picker button { width: auto; flex: 1; text-align: center; font-size: .9rem; }
  .custom-color { margin-block: .5rem; }
  .coloring-paper { order: 2; }
  .brush-size { order: 3; }
  .history-tools { order: 4; margin: 0; }
  .clear-picture { order: 5; }
  .art-actions { order: 6; margin-top: 0; grid-template-columns: 1fr 1fr; }
  .coloring-tools .coloring-note { order: 7; margin: 0; }
  .coloring-editor { padding: .8rem; }
  .coloring-intro { margin-block: 1.5rem; }
  .coloring-pictures { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; }
  .coloring-picture { padding: .7rem; }
  .coloring-picture img { height: 150px; }
}
@media(max-width:360px) { .color-palette { grid-template-columns: repeat(5,1fr); } }
@media print {
  body.coloring-page > *:not(#coloring-print-image) { display: none !important; }
  #coloring-print-image { display: block !important; max-width: 100%; max-height: 245mm; width: auto; margin: 0 auto; }
  body.coloring-page { background: white; margin: 0; }
}
