/* Su Kanalları (kidsPipes). Every rule is scoped under .kp-pipes. The board is a light panel with dark ink, so it reads on both site themes. */
.kp-pipes {
  --pp-ink: #1d3340;
  /* The site paints paragraphs with --k-ink-2 (pale, for dark pages); this paper needs the dark ink instead. */
  --k-ink-2: var(--pp-ink);
  --pp-paper: #fbfdfe;
  --pp-sky: #e3f1f8;
  --pp-rim: #7aa9c2;
  --pp-deep: #1c5f86;
  --pp-focus: #0b4f7c;
  --pp-hint: #fff1d6;
  display: block;
  max-width: 980px;
  margin: 0 auto;
  background: var(--pp-paper);
  color: var(--pp-ink);
  color-scheme: light;
  line-height: 1.5;
}
.kp-pipes .screen-only { display: block; }
.kp-pipes .print-only { display: none; }
.kp-pipes .kp-instruction { margin: 0 0 14px; font-size: 1.05rem; }
.kp-pipes .kp-subheading { margin: 14px 0 8px; font-size: 1rem; }
.kp-pipes .kp-levels,
.kp-pipes .kp-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.kp-pipes button {
  min-width: 48px;
  min-height: 48px;
  padding: 10px 16px;
  border: 2px solid var(--pp-ink);
  border-radius: 14px;
  background: var(--pp-paper);
  color: var(--pp-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.kp-pipes button[aria-pressed="true"] { background: var(--pp-sky); box-shadow: inset 0 0 0 2px var(--pp-deep); }
.kp-pipes button:disabled { opacity: .45; cursor: not-allowed; }
.kp-pipes button:focus-visible { outline: 4px solid var(--pp-focus); outline-offset: 3px; }
.kp-pipes .kp-work { display: grid; gap: 8px; }
.kp-pipes .kp-frame {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 34px;
  box-sizing: border-box;
  border: 2px solid var(--pp-rim);
  border-radius: 20px;
  background: #f4f8fa;
}
.kp-pipes .kp-grid {
  display: grid;
  width: 100%;
  border: 2px solid var(--pp-ink);
  background: #fffdf7;
}
.kp-pipes .kp-grid[data-size="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kp-pipes .kp-grid[data-size="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kp-pipes .kp-grid[data-size="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kp-pipes .kp-cell {
  position: relative;
  display: block;
  aspect-ratio: 1;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  padding: 0;
  border: 1px solid #c4d3dc;
  border-radius: 0;
  background: #fffdf7;
  touch-action: manipulation;
}
.kp-pipes .kp-cell[data-wet="true"] { background: #f1f9ff; }
.kp-pipes .kp-cell:hover { background: #fff6e0; }
.kp-pipes .kp-cell[data-wet="true"]:hover { background: #e4f2fb; }
.kp-pipes .kp-cell:focus-visible { outline: 4px solid var(--pp-focus); outline-offset: -6px; }
.kp-pipes .kp-cell[data-hint="true"] { outline: 4px dashed #b35c00; outline-offset: -8px; }
.kp-pipes .kp-channel { display: block; width: 100%; height: 100%; }
.kp-pipes .kp-channel.kp-turn { animation: kp-pipes-turn .2s ease-out; }
@keyframes kp-pipes-turn {
  from { transform: rotate(-90deg); }
  to { transform: rotate(0deg); }
}
.kp-pipes .kp-tab {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--pp-ink);
  border-radius: 999px;
  background: #fff;
  color: var(--pp-ink);
  font-size: .85rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.kp-pipes .kp-tab[data-role="garden"] { border-style: double; border-width: 4px; }
.kp-pipes .kp-tab[data-side="north"] { top: -30px; left: 50%; transform: translateX(-50%); }
.kp-pipes .kp-tab[data-side="south"] { bottom: -30px; left: 50%; transform: translateX(-50%); }
.kp-pipes .kp-tab[data-side="west"] { left: -30px; top: 50%; transform: translateY(-50%); }
.kp-pipes .kp-tab[data-side="east"] { right: -30px; top: 50%; transform: translateY(-50%); }
.kp-pipes .kp-legend { margin: 0; font-size: .95rem; font-weight: 700; }
.kp-pipes .kp-keys { margin: 0; font-size: .9rem; }
.kp-pipes .kp-status { min-height: 2.2em; margin: 6px 0; font-weight: 700; }
.kp-pipes .kp-status[data-solved="true"] { color: var(--pp-deep); }
.kp-pipes .kp-hint:empty { display: none; }
.kp-pipes .kp-hint { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: var(--pp-hint); }
.kp-pipes .kp-trains { margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--pp-sky); }
.kp-pipes .kp-trains p { margin: 4px 0; }
.kp-pipes .kp-trains h2,
.kp-pipes .kp-trains p { color: var(--pp-ink); }
.kp-pipes .kp-why { font-style: italic; }
@media (min-width: 700px) {
  .kp-pipes .kp-frame { padding: 40px; }
  .kp-pipes .kp-tab[data-side="north"] { top: -34px; }
  .kp-pipes .kp-tab[data-side="south"] { bottom: -34px; }
  .kp-pipes .kp-tab[data-side="west"] { left: -34px; }
  .kp-pipes .kp-tab[data-side="east"] { right: -34px; }
}
@media print {
  .kp-pipes { background: #fff; }
  .kp-pipes .screen-only { display: none; }
  .kp-pipes .print-only { display: block; color: #000; }
  .kp-pipes .print-only button { display: none; }
  .kp-pipes .kp-frame { border: 1px solid #000; background: #fff; }
  .kp-pipes .kp-grid,
  .kp-pipes .kp-cell { border-color: #000; background: #fff; }
  .kp-pipes .kp-channel { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .kp-pipes .kp-tab { border-color: #000; }
}
@media (prefers-reduced-motion: reduce) {
  .kp-pipes * { transition: none !important; animation: none !important; }
}
