/* «مملكة التلوين» (games/coloring/), ported from the standalone kids game. Everything is
   scoped to .kg-coloring, the stage the game mounts into; the stage is also the containing
   block for the fixed brush, dialogs and effects. */

.kg-coloring {
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden;
  transform: translateZ(0);
  contain: layout style;
  border: 1px solid #d2d6db;
  border-radius: 16px;
  /* Set by the script from the viewport and the palette's height; this is the first paint. */
  --canvas-area: clamp(180px, min(calc(100svh / var(--site-zoom, 1) - 120px), calc(100vw / var(--site-zoom, 1) - 40px)), 668px);
  /* The site's tokens under the game's own names. */
  --card: #ffffff;
  --card-soft: var(--green-50);
  --ink: #161616;
  --ink-muted: #6c737f;
  --line: #d2d6db;
  --primary: var(--green-600);
  --primary-hover: var(--green-700);
  --primary-tint: var(--green-100);
  --accent-gold: var(--green-600);
  --shadow: none;
  --shadow-sm: none;
  font-family: inherit;
  background: #f3f4f6;
  color: var(--ink);
  padding: 15px;
  user-select: none;
  direction: rtl;
}

.kg-coloring * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.kg-coloring .game-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kg-coloring .kg-icon {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
}

.kg-coloring .game-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 2;
}

.kg-coloring .title-tag {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* The site's petal mark. */
.kg-coloring .title-tag::before {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url('../img/ui/petal-mark.svg') center / contain no-repeat;
}

.kg-coloring .title-text {
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.kg-coloring .title-text::after {
  content: 'مَلَكُوتُ الزُّهُور';
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
}

/* The status line: one line, full width of what the title leaves. */
.kg-coloring .name-banner {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}

.kg-coloring .name-banner .name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-coloring .name-banner .lock-icon {
  display: inline-flex;
  flex: none;
  color: var(--green-700);
}

.kg-coloring .name-banner.locked-empty {
  color: var(--ink-muted);
}

.kg-coloring .name-banner.locked-empty .lock-icon {
  color: var(--ink-muted);
}

.kg-coloring .name-banner.revealed {
  border-color: var(--green-600);
  background: var(--green-600);
  color: #ffffff;
  font-weight: 700;
}

.kg-coloring .name-banner.revealed .lock-icon {
  color: #ffffff;
}

.kg-coloring .progress {
  flex: none;
  width: 70px;
  height: 6px;
  background: var(--primary-tint);
  border-radius: 4px;
  overflow: hidden;
}

.kg-coloring .progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.kg-coloring .name-banner.revealed .progress {
  display: none;
}

.kg-coloring .picker {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 15px 0 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  z-index: 2;
}

/* The tiles scroll on their own, with room for the completed badge and remove button. */
.kg-coloring .picker-track {
  display: flex;
  flex: 1;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 18px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding-inline: 18px;
  scrollbar-width: thin;
  scrollbar-color: #9da4ae transparent;
}

.kg-coloring .picker-label {
  flex-shrink: 0;
  align-self: center;
  padding: 3px 11px;
  border: 1px solid var(--green-200);
  border-radius: 9999px;
  background: var(--green-50);
  color: var(--green-700);
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
}

.kg-coloring .picker-track::-webkit-scrollbar {
  height: 6px;
}

.kg-coloring .picker-track::-webkit-scrollbar-track {
  background: transparent;
}

.kg-coloring .picker-track::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.kg-coloring .picker-item {
  position: relative;
  flex: 0 0 108px;
  height: 96px;
}

.kg-coloring .picker button.flower-btn {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink);
}

.kg-coloring .picker button.flower-btn:hover {
  border-color: var(--ink-muted);
  background: #f3f4f6;
}

/* The chosen drawing: a thick dark outline, not colour alone. */
.kg-coloring .picker button.flower-btn.active {
  border-color: var(--green-900);
  background: var(--green-100);
  box-shadow: inset 0 0 0 2px var(--green-900);
  font-weight: 700;
}

.kg-coloring .picker .flower-btn img {
  flex: 1;
  min-height: 0;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.kg-coloring .picker .flower-btn span {
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-coloring .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #b42318;
  color: white;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.kg-coloring .remove-btn:hover {
  background: #912018;
}

.kg-coloring .brush-cursor {
  position: fixed;
  pointer-events: none;
  width: 110px;
  height: 110px;
  left: 0;
  top: 0;
  transform-origin: 86.5% 92.5%;
  z-index: 1500;
  opacity: 0;
  color: #ff8c42;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.32));
  transition: left 0.09s linear, top 0.09s linear;
  will-change: left, top;
  isolation: isolate;
}

.kg-coloring .brush-cursor .brush-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.kg-coloring .brush-cursor .handle-tint {
  position: absolute;
  inset: 0;
  background-color: #b8814a;
  -webkit-mask-image: url('../games/coloring/brush-handle-mask.png');
  mask-image: url('../games/coloring/brush-handle-mask.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mix-blend-mode: multiply;
}

.kg-coloring .brush-cursor .bristle-tint {
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask-image: url('../games/coloring/brush-bristle-mask.png');
  mask-image: url('../games/coloring/brush-bristle-mask.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  mix-blend-mode: multiply;
}

.kg-coloring .brush-cursor.active {
  opacity: 1;
  animation: kg-coloring-brush-paint 0.26s ease-in-out infinite alternate;
}

@keyframes kg-coloring-brush-paint {
  0% {
    transform: rotate(-14deg) scale(1);
  }
  100% {
    transform: rotate(4deg) scale(1.06);
  }
}

.kg-coloring .brush-cursor.fading {
  transition: opacity 0.25s ease-out;
  opacity: 0;
  animation: none;
}

/* Completed drawings carry a check. */
.kg-coloring .success-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--green-600)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
    center / 14px 14px no-repeat;
  z-index: 3;
  pointer-events: none;
  animation: kg-coloring-badge-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes kg-coloring-badge-pop {
  0% {
    transform: scale(0) rotate(-180deg);
  }
  60% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.kg-coloring .upload-btn {
  flex: 0 0 100px;
  height: 88px;
  border-radius: 8px;
  border: 1px dashed var(--green-600);
  background: var(--card-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  transition: background-color 0.15s ease;
  font-family: inherit;
  font-weight: 500;
  color: var(--green-700);
  font-size: 12px;
}

.kg-coloring .upload-btn:hover {
  border-style: solid;
  background: var(--primary-tint);
}

.kg-coloring .upload-btn .plus {
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}

.kg-coloring .canvas-wrap {
  flex: none;
  height: var(--canvas-area);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
}

.kg-coloring .canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: crosshair;
  border-radius: 8px;
}

.kg-coloring .canvas-wrap.empty canvas {
  display: none;
}

.kg-coloring .empty-msg {
  display: none;
  color: var(--ink-muted);
  text-align: center;
  font-size: 16px;
  line-height: 24px;
}

.kg-coloring .empty-msg .big {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--green-600);
}

.kg-coloring .empty-msg .big .kg-icon {
  width: 72px;
  height: 72px;
  stroke-width: 1.5;
}

.kg-coloring .empty-hint {
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
}

.kg-coloring .canvas-wrap.empty .empty-msg {
  display: block;
}

.kg-coloring .canvas-wrap.loading::after {
  content: 'جاري التحميل...';
  position: absolute;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 16px;
}

.kg-coloring .palette {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 2;
}

.kg-coloring .palette[hidden] {
  display: none;
}

.kg-coloring .palette-label {
  display: inline-flex;
  align-self: center;
  margin-left: 4px;
  padding: 7px;
  border: 1px solid var(--green-200);
  border-radius: 9999px;
  background: var(--green-50);
  color: var(--green-700);
}

.kg-coloring .swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* The paints keep their own colours. */
.kg-coloring .pen {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  cursor: pointer;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kg-coloring .pen:hover {
  transform: scale(1.08);
}

/* The chosen paint: larger, ringed, with a pointer above it. */
.kg-coloring .pen.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px var(--green-900);
  z-index: 5;
}

.kg-coloring .pen.active::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--green-900);
}

.kg-coloring .pen.eraser {
  background: #ffffff;
  border: 3px solid var(--ink-muted);
  background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.08) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

.kg-coloring .pen.add-color {
  background: var(--card);
  border: 1px dashed var(--ink-muted);
  color: var(--ink-muted);
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.kg-coloring .pen.add-color .plus-mark {
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  margin-top: -2px;
  pointer-events: none;
}

.kg-coloring .pen.add-color .add-color-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}

.kg-coloring .pen.add-color:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

.kg-coloring .actions {
  display: flex;
  gap: 8px;
  margin-right: auto;
  align-self: center;
}

/* The flat site button (.btn in site.css) under the game's own class names. */
.kg-coloring .action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: var(--green-600);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.kg-coloring .action-btn:hover {
  background: var(--green-700);
}

.kg-coloring .action-btn:active {
  background: var(--green-900);
}

.kg-coloring .action-btn.ghost {
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.kg-coloring .action-btn.ghost:hover {
  background: #f3f4f6;
}

.kg-coloring .action-btn.ghost:active {
  background: #e5e7eb;
}

/* Celebration pieces are petal shapes in the paints' colours. */
.kg-coloring .sparkle {
  position: absolute;
  pointer-events: none;
  width: 12px;
  height: 12px;
  border-radius: 50% 0 50% 0;
  z-index: 100;
  animation: kg-coloring-confetti-burst 1s ease-out forwards;
}

@keyframes kg-coloring-confetti-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.4) rotate(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.6)
      rotate(var(--dr));
    opacity: 0;
  }
}

.kg-coloring .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: kg-coloring-backdrop-in 0.3s ease-out;
}

.kg-coloring .modal-backdrop.show {
  display: flex;
}

@keyframes kg-coloring-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.kg-coloring .modal-card {
  background: var(--card);
  border-radius: 16px;
  padding: 32px 40px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.3);
  text-align: center;
  max-width: 90vw;
  position: relative;
  animation: kg-coloring-modal-pop 0.3s ease-out;
  overflow: hidden;
}

@keyframes kg-coloring-modal-pop {
  0% {
    transform: scale(0.94);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.kg-coloring .reveal-card {
  padding: 0 !important;
  max-width: 420px;
  width: 90vw;
  overflow: hidden;
}

.kg-coloring .modal-hero {
  position: relative;
  width: 100%;
  height: 240px;
  background: var(--green-50);
  overflow: hidden;
}

.kg-coloring .modal-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: kg-coloring-photo-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
}

@keyframes kg-coloring-photo-pop {
  0% {
    transform: scale(1.12);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.kg-coloring .modal-photo[hidden] {
  display: none;
}

.kg-coloring .modal-body {
  padding: 18px 32px 28px;
  text-align: center;
  position: relative;
}

.kg-coloring .modal-card .name-display {
  font-weight: 700;
  font-size: clamp(26px, 4.5vw, 32px);
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.4;
}

.kg-coloring .modal-card .label {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 22px;
}

.kg-coloring .modal-card .modal-btn {
  min-width: 140px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: var(--green-600);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.kg-coloring .modal-card .modal-btn:hover {
  background: var(--green-700);
}

.kg-coloring .modal-card .modal-btn:active {
  background: var(--green-900);
}

.kg-coloring .reveal-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 600;
}

.kg-coloring .reveal-burst {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50% 0 50% 0;
  animation: kg-coloring-big-burst 2s ease-out forwards;
}

@keyframes kg-coloring-big-burst {
  0% {
    transform: translate(-50%, -50%) scale(0.2) rotate(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--bx)), calc(-50% + var(--by))) scale(1.4)
      rotate(var(--br));
    opacity: 0;
  }
}

.kg-coloring .confetti-fall {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  animation: kg-coloring-fall linear forwards;
}

@keyframes kg-coloring-fall {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0.7;
  }
}

/* ---------- Additions for the static site ---------- */

/* In-game dialog replacing the browser's prompt() and alert(). */
.kg-coloring .ask-card {
  width: min(420px, 90vw);
  padding: 28px 28px 24px;
}

.kg-coloring .big-emoji {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--green-600);
}

.kg-coloring .big-emoji .kg-icon {
  width: 44px;
  height: 44px;
  stroke-width: 1.5;
}

.kg-coloring .ask-title {
  font-size: clamp(19px, 3.5vw, 22px);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.kg-coloring .ask-card .label {
  margin-bottom: 16px;
}

/* Same field look as the site's forms. */
.kg-coloring .ask-input {
  display: block;
  width: 100%;
  height: 40px;
  margin-bottom: 18px;
  padding: 0 16px;
  border: 0;
  border-radius: 4px;
  background: #f3f4f6;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  user-select: text;
}

.kg-coloring .ask-input:focus-visible {
  outline: 2px solid #161616;
  outline-offset: 0;
}

.kg-coloring .ask-input[hidden] {
  display: none;
}

.kg-coloring .ask-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.kg-coloring .modal-card .modal-btn--quiet {
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.kg-coloring .modal-card .modal-btn--quiet:hover {
  background: #f3f4f6;
}

.kg-coloring .modal-btn[hidden] {
  display: none;
}

.kg-coloring button:focus-visible,
.kg-coloring .pen.add-color:focus-within,
.kg-coloring .canvas-wrap canvas:focus-visible {
  outline: 2px solid #161616;
  outline-offset: 2px;
}

.kg-coloring .add-color-input:focus-visible {
  outline: none;
}

.kg-coloring .canvas-wrap canvas {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.kg-coloring .game-noscript {
  margin: 1rem;
  padding: 1.25rem;
}

@media (max-width: 700px) {
  .kg-coloring {
    padding: 11px;
  }

  .kg-coloring .game-root {
    gap: 8px;
  }

  /* Title over a full-width, single-line status. */
  .kg-coloring .game-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .kg-coloring .name-banner {
    flex: none;
    justify-content: flex-start;
    font-size: 14px;
    line-height: 20px;
  }

  .kg-coloring .progress {
    width: 48px;
    margin-inline-start: auto;
  }

  /* The label sits over the drawings, which wrap: none is cut off. */
  .kg-coloring .picker {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 11px 11px 0;
  }

  .kg-coloring .picker-track {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding: 10px 0 11px;
    overflow: visible;
  }

  .kg-coloring .picker-item,
  .kg-coloring .upload-btn {
    flex: 1 1 72px;
    max-width: 108px;
    height: 76px;
  }

  .kg-coloring .picker .flower-btn {
    padding: 4px;
  }

  .kg-coloring .picker .flower-btn span {
    font-size: 10px;
  }

  .kg-coloring .upload-btn {
    font-size: 11px;
  }

  .kg-coloring .upload-btn .plus {
    font-size: 22px;
  }

  .kg-coloring .canvas-wrap {
    padding: 10px;
  }

  .kg-coloring .pen {
    width: 36px;
    height: 36px;
  }

  /* The paints stay small enough for two rows; their touch area reaches into the gaps. */
  .kg-coloring .pen:not(.add-color)::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
  }

  .kg-coloring .palette {
    padding: 9px 11px 11px;
    gap: 8px;
  }

  .kg-coloring .action-btn {
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    line-height: 20px;
  }

  .kg-coloring .action-btn.ghost {
    padding: 0 11px;
  }

  .kg-coloring .empty-msg .big .kg-icon {
    width: 56px;
    height: 56px;
  }

  .kg-coloring .empty-hint {
    font-size: 18px;
  }

  .kg-coloring .modal-hero {
    height: 200px;
  }

  .kg-coloring .modal-body {
    padding: 16px 24px 22px;
  }
}

@media (max-height: 600px) {
  .kg-coloring .picker-item,
  .kg-coloring .upload-btn {
    height: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kg-coloring *,
  .kg-coloring *::before,
  .kg-coloring *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* A custom drawing has no photo: the dialog shows no empty picture area. */
.kg-coloring .modal-hero:has(.modal-photo[hidden]) {
  display: none;
}

.kg-coloring .modal-hero:has(.modal-photo[hidden]) + .modal-body {
  padding-top: 28px;
}
