/* K&K Quest shared scratch pad (2026-10-21).
   One look for every maths game with a pad: Prep for Exam, Multiplication Quiz and
   Order of Operations. Markup:
     <aside class="kk-pad">
       <div class="kk-pad-head">
         <div><b class="kk-pad-title">✏️ Scratch pad</b><small class="kk-pad-sub">Write your working here</small></div>
         <div class="kk-pad-actions"><button>Undo</button><button>Clear</button></div>
       </div>
       <canvas class="kk-pad-canvas"></canvas>
     </aside>
   Each game sizes the canvas height from JS to fill the screen height that is left,
   and draws with ink #1d2b4f, 4 CSS px wide. */
.kk-pad {
  display: flex; flex-direction: column; min-width: 0; padding: 12px;
  border: 2px solid #d6dde5; border-radius: 20px; background: #fff;
  box-shadow: 0 10px 26px rgba(31, 45, 58, .08);
  color: #1f2d3a; text-align: left;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;
}
.kk-pad .kk-pad-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.kk-pad .kk-pad-title { display: block; margin: 0; color: #1f2d3a; font-family: inherit; font-size: 18px; font-weight: 900; line-height: 1.2; }
.kk-pad .kk-pad-sub { display: block; margin: 2px 0 0; color: #6b7684; font-family: inherit; font-size: 13px; font-weight: 700; }
.kk-pad .kk-pad-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.kk-pad .kk-pad-actions button {
  min-height: 40px; padding: 0 14px; border: 2px solid #cfd7e0; border-radius: 12px;
  background: #f6f8fa; color: #1f2d3a; font-family: inherit; font-size: 15px; font-weight: 900;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.kk-pad .kk-pad-actions button:active { background: #e8edf2; transform: translateY(1px); }
.kk-pad .kk-pad-canvas {
  display: block; width: 100%; height: 420px; min-height: 0; flex: 0 0 auto;
  border: 2px solid #c9d3dd; border-radius: 14px;
  background-color: #fffffb;
  background-image: linear-gradient(#dfe7ee 1px, transparent 1px), linear-gradient(90deg, #dfe7ee 1px, transparent 1px);
  background-size: 24px 24px; background-position: -1px -1px;
  touch-action: none; cursor: crosshair;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
@media (max-width: 600px) {
  .kk-pad { padding: 8px; border-radius: 16px; }
  .kk-pad .kk-pad-head { margin-bottom: 6px; }
  .kk-pad .kk-pad-title { font-size: 16px; }
  .kk-pad .kk-pad-sub { display: none; }
  .kk-pad .kk-pad-actions button { min-height: 36px; padding: 0 12px; font-size: 14px; }
}

/* Clock faces laid over the pad (KKPadClocks): drawn under-and-through, never catch touches. */
.kk-pad-clocks { position: absolute; display: flex; align-items: center; justify-content: space-evenly; pointer-events: none; }
.kk-pad-clocks svg { display: block; flex: 0 0 auto; }
.kk-pad .kk-pad-actions button.kk-pad-clock-btn { border-color: #9fc6c1; background: #eef8f6; color: #0d5e58; }
.kk-pad .kk-pad-actions button.kk-pad-clock-btn:disabled { opacity: .45; }
/* With a third (clock) button the head may not fit beside the title: wrap instead of spilling out. */
.kk-pad .kk-pad-head { flex-wrap: wrap; row-gap: 6px; }
.kk-pad .kk-pad-title { white-space: nowrap; }
