/* Kare Resim Şifresi (kidsPixelCode). Every rule is scoped under .kp-pixel-code. The stage paints its own light
   paper and dark ink, so it reads the same in the light and the dark site theme. */
.kp-pixel-code {
  --pc-ink: #2d2a4a;
  --pc-paper: #fdfbff;
  --pc-lilac: #ece6fb;
  --pc-rim: #8a7bc4;
  --pc-deep: #4b3c8f;
  --pc-focus: #1f5f9e;
  --pc-line: #b9b3d6;
  --pc-mint: #d9f5ea;
  --pc-mint-deep: #2f7d5b;
  --pc-wrong: #9b2c3f;
  /* The site paints paragraphs with --k-ink-2 (pale, for dark pages); this paper needs the dark ink instead. */
  --k-ink-2: var(--pc-ink);
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  border-radius: 20px;
  background: var(--pc-paper);
  color: var(--pc-ink);
  color-scheme: light;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.kp-pixel-code * { box-sizing: border-box; }
.kp-pixel-code p { color: var(--pc-ink); margin: 0 0 8px; }
.kp-pixel-code ol, .kp-pixel-code ul { margin: 0; padding: 0; list-style: none; }
.kp-pixel-code button { font: inherit; cursor: pointer; }
.kp-pixel-code button:focus-visible { outline: 3px solid var(--pc-focus); outline-offset: 2px; }
.kp-pixel-code .screen-only { display: block; }
.kp-pixel-code .print-only { display: none; }
.kp-pixel-code .kp-subheading { margin: 14px 0 8px; font-size: 1rem; color: var(--pc-ink); }

.kp-pixel-code .kp-intro { margin: 0 0 8px; }
.kp-pixel-code .kp-intro > summary { cursor: pointer; font-weight: 700; color: var(--pc-ink); min-height: 48px; display: flex; align-items: center; }
.kp-pixel-code .kp-instruction { margin: 0 0 6px; font-size: 1.05rem; }
.kp-pixel-code .kp-howto { margin: 0 0 10px; }

.kp-pixel-code .kp-levels,
.kp-pixel-code .kp-modes,
.kp-pixel-code .kp-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.kp-pixel-code .kp-mode-label { margin: 0 0 4px; font-weight: 700; font-size: 0.95rem; }
.kp-pixel-code .kp-levels button,
.kp-pixel-code .kp-modes button,
.kp-pixel-code .kp-controls button {
  min-height: 48px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--pc-rim);
  background: #ffffff; color: var(--pc-ink); font-weight: 700;
}
.kp-pixel-code .kp-levels button[aria-pressed="true"],
.kp-pixel-code .kp-modes button[aria-pressed="true"] { background: var(--pc-lilac); border-color: var(--pc-deep); }
.kp-pixel-code .kp-controls button:disabled { opacity: .5; cursor: default; }

.kp-pixel-code .kp-work { display: grid; justify-items: center; margin: 0 0 12px; }
.kp-pixel-code .kp-board-wrap { max-width: 100%; overflow-x: auto; padding: 6px 4px; }
.kp-pixel-code .kp-board { display: grid; width: max-content; margin: 0 auto; gap: 0; }
.kp-pixel-code .kp-n5 { grid-template-columns: auto repeat(5, minmax(40px, 56px)); }
.kp-pixel-code .kp-n8 { grid-template-columns: auto repeat(8, minmax(30px, 46px)); }
.kp-pixel-code .kp-n10 { grid-template-columns: auto repeat(10, minmax(26px, 40px)); }
.kp-pixel-code .kp-corner { min-height: 0; }

.kp-pixel-code .kp-clue { display: flex; font-size: 0.85rem; font-weight: 700; color: var(--pc-deep); line-height: 1.2; }
.kp-pixel-code .kp-col-clue { flex-direction: column; justify-content: flex-end; align-items: center; padding: 2px 0 4px; }
.kp-pixel-code .kp-row-clue { flex-direction: row; justify-content: flex-end; align-items: center; padding: 0 6px 0 2px; gap: 4px; white-space: nowrap; }
.kp-pixel-code .kp-clue.is-done li { text-decoration: line-through; opacity: .55; }

.kp-pixel-code .kp-cell {
  aspect-ratio: 1; min-width: 26px; min-height: 26px; padding: 0; margin: 0;
  border: 1px solid var(--pc-line); background: #ffffff; color: var(--pc-deep);
  font-size: 1.1rem; font-weight: 800; line-height: 1;
}
.kp-pixel-code .kp-cell[data-state="filled"] { background: var(--pc-ink); border-color: var(--pc-ink); }
.kp-pixel-code .kp-cell[data-state="marked"] { background: var(--pc-paper); color: var(--pc-rim); }
.kp-pixel-code .kp-cell.is-wrong { outline: 2px dashed var(--pc-wrong); outline-offset: -4px; }
.kp-pixel-code .kp-cell:focus-visible { position: relative; z-index: 1; }

.kp-pixel-code .kp-status { min-height: 3em; font-weight: 700; color: var(--pc-deep); }
.kp-pixel-code .kp-status:focus-visible { outline: 3px solid var(--pc-focus); outline-offset: 3px; }
.kp-pixel-code .kp-status[data-solved="true"] { color: var(--pc-mint-deep); font-size: 1.15rem; }

.kp-pixel-code .kp-trains { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--pc-lilac); }
.kp-pixel-code .kp-trains p { margin: 0 0 6px; }
.kp-pixel-code .kp-trains .kp-why { font-weight: 600; }

@media (max-width: 359px) {
  .kp-pixel-code { padding: 12px; }
  .kp-pixel-code .kp-n10 { grid-template-columns: auto repeat(10, minmax(24px, 36px)); }
}

@media print {
  .kp-pixel-code { background: #ffffff; color: #000000; box-shadow: none; padding: 0; }
  .kp-pixel-code .screen-only { display: none; }
  .kp-pixel-code .print-only { display: block; color: #000000; }
  .kp-pixel-code .kp-print-grid { border-collapse: collapse; margin: 12px 0; }
  .kp-pixel-code .kp-print-clue { font-size: 0.95rem; padding: 2px 6px; text-align: right; color: #000000; }
  .kp-pixel-code .kp-print-cell { width: 28px; height: 28px; border: 1px solid #000000; }
}

@media (prefers-reduced-motion: reduce) {
  .kp-pixel-code * { transition: none !important; animation: none !important; }
}
