/* Pipes — own styles, theme variables only. Root class: .pp */

.pp {
  width: 100%;
  max-width: 640px;
}

.pp-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.pp-stat {
  min-width: 76px;
  padding: 8px 12px 6px;
  text-align: center;
  border-radius: 10px;
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
}

.pp-stat b {
  display: block;
  font: 500 1.3rem/1.15 var(--gm-display, "Fraunces", Georgia, serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pp-lab {
  display: block;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gm-muted, rgba(242, 238, 230, 0.66));
}

.pp-lockbtn {
  min-height: 44px;
  align-self: center;
  touch-action: manipulation;
}

.pp-lockbtn[aria-pressed="true"] {
  background: var(--gm-accent, #c0392b);
  border-color: var(--gm-accent, #c0392b);
  color: #fff;
}

.pp-board {
  --n: 7;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  max-width: calc(var(--n) * 72px + 8px);
  padding: 4px;
  box-sizing: border-box;
  background: var(--gm-surface, #1b2740);
  border: 1px solid var(--gm-line, rgba(255, 255, 255, 0.09));
  border-radius: var(--gm-radius, 12px);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.pp-tile {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: block;
  aspect-ratio: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14%;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  background: var(--gm-bg-2, #131c2b);
  color: var(--gm-muted, rgba(242, 238, 230, 0.66));
  transition: background 0.18s ease, color 0.18s ease;
}

.pp-tile:hover { background: var(--gm-surface-2, #22304a); }

.pp-tile:focus-visible {
  outline: 3px solid var(--gm-accent-bright, #e0584a);
  outline-offset: -3px;
  z-index: 2;
}

.pp-tile.is-on {
  background: var(--gm-accent-soft, rgba(192, 57, 43, 0.3));
  color: var(--gm-accent, #c0392b);
}

.pp-tile.is-on:hover { background: var(--gm-accent-soft, rgba(192, 57, 43, 0.3)); }

.pp-tile svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: rotate(var(--a, 0deg));
  transition: transform 0.18s ease;
}

.pp-tile path {
  fill: none;
  stroke: currentColor;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pp-node {
  fill: currentColor;
}

.pp-tile.is-on .pp-node { fill: var(--gm-accent-bright, #e0584a); }

.pp-src {
  fill: var(--gm-accent-bright, #e0584a);
  stroke: var(--gm-surface, #1b2740);
  stroke-width: 3;
}

.pp-tile.is-source { background: var(--gm-accent-soft, rgba(192, 57, 43, 0.3)); }

.pp-tile.is-locked {
  box-shadow: inset 0 0 0 2px var(--gm-line-2, rgba(255, 255, 255, 0.16));
}

.pp-tile.is-locked::after {
  content: "";
  position: absolute;
  right: 9%;
  top: 9%;
  width: 14%;
  height: 14%;
  border-radius: 50%;
  background: var(--gm-text, #f2eee6);
  opacity: 0.55;
}

.pp.is-solved .pp-tile { cursor: default; }
.pp.is-solved .pp-tile:hover { background: var(--gm-accent-soft, rgba(192, 57, 43, 0.3)); }

.pp-tile.is-shake svg { animation: pp-shake 0.3s ease; }

@keyframes pp-shake {
  0%, 100% { transform: rotate(var(--a, 0deg)) translateX(0); }
  30% { transform: rotate(var(--a, 0deg)) translateX(-5%); }
  70% { transform: rotate(var(--a, 0deg)) translateX(5%); }
}

#gm-pipes .gm-status { margin-top: 12px; }

#pp-size { border-radius: 16px; }

.gm-actions .gm-btn,
.gm-seg button {
  min-height: 44px;
  touch-action: manipulation;
}

@media (max-width: 480px) {
  .pp-bar { gap: 6px; }
  .pp-stat { min-width: 62px; padding: 8px 6px 6px; }
  .pp-stat b { font-size: 1.15rem; }
  .pp-lockbtn { padding: 10px 12px; }
  .pp-board { padding: 3px; gap: 2px; }
  .pp-board[data-n="9"] { padding: 2px; gap: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  .pp-tile, .pp-tile svg { transition: none; }
  .pp-tile.is-shake svg { animation: none; }
}
