/* Each carriage holds one repeat. Matching windows share a column. */
.board.pattern .pattern-track {
  --window: clamp(32px, 8.7vw, 46px);
  grid-auto-flow: row;
  grid-auto-columns: auto;
  justify-content: center;
  justify-items: start;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(160deg, #e4f3f2, #fbf0ce);
  border: 1px solid #d4d8bd;
  border-radius: 20px;
}
.board.pattern .pattern-track::after { display: none; }
.train-section {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--window);
  gap: 4px;
  padding: 4px 7px;
  margin-bottom: 4px;
  border: 1px solid #9a6556;
  border-bottom: 4px solid #854e48;
  border-radius: 10px;
  background: #eda879;
}
.train-section::before, .train-section::after {
  content: ""; position: absolute; bottom: -9px; width: 10px; height: 7px;
  border-radius: 0 0 6px 6px; background: #494151;
}
.train-section::before { left: 12%; }
.train-section::after { right: 12%; }
.train-section .wagon { border-color: #c98364; border-radius: 5px; }
.train-section .wagon::before, .train-section .wagon::after { display: none; }
.train-section .wagon.guide { outline: 3px solid #6955a5; outline-offset: -3px; background: #fff5c0; }
.train-section .wagon.filled { background: #e0f3cc; border: 2px solid #4c7945; }
.pattern .answer { max-height: 112px; }
.pattern .answer .shape { max-width: 66px; }
.puzzle-help {
  justify-self: center; min-height: 44px; padding: 5px 15px; border-radius: 24px;
  background: #fffdf6; color: #483b59; border: 1px solid #ada1b6; font-weight: 700;
}
.help-symbol { display: inline-grid; place-items: center; min-width: 1.45em; aspect-ratio: 1; border-radius: 50%; background: #eee7fa; }
.dot-prompt {
  display: grid; gap: 6px; justify-items: center; padding: 12px;
  background: #e1f0e7; border: 1px solid #bfdbcb; border-radius: 18px;
}
.dot-equation { display: flex; align-items: center; justify-content: center; gap: 6px; color: #32645c; font-weight: 800; font-size: 1.35rem; }
.dot-equation .dot-tray { width: 48px; padding: 4px; gap: 3px; background: #fffdf7; border: 1px solid #93b7a2; border-radius: 6px; }
.quantity-bars { display: flex; gap: 4px; height: 30px; align-items: flex-end; }
.quantity-bars i { display: block; width: 12px; border-radius: 3px 3px 0 0; background: #98bdab; height: 36%; }
.quantity-bars i:nth-child(2) { height: 66%; }
.quantity-bars i:last-child { height: 100%; background: #29685d; }
.dot-question { font-size: clamp(.95rem, 3.8vw, 1.15rem); }
.dots .answer { padding: clamp(6px, 1.8vw, 16px); aspect-ratio: 1; max-height: 150px; background: #fffdf7; }
.dots .answer.matched { border-color: #416e5c; background: #e0f1dd; }
.dots .dot-tray i { display: grid; place-items: center; }
.pip-digit { display: none; }
.counting .answer .pip-digit { display: inline; color: white; font: 750 clamp(10px, 3.2vw, 16px)/1 system-ui, sans-serif; }
.maze-map { touch-action: none; user-select: none; -webkit-user-select: none; }
.maze-map .maze-cell.visited::before { width: 21%; border: 1px solid #95654b; background: #e9b98a; }
.maze-map .maze-hint { background: #f0d58e; box-shadow: inset 0 0 0 3px #9b7328; }
.maze-map.blocked .player { box-shadow: inset 0 0 0 2px #c88657; border-radius: 6px; }
.maze-controls { display: grid; justify-items: center; gap: 8px; }
.maze-controls .maze-pad { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; }
.maze-pad [data-key="ArrowUp"] { grid-column: 2; grid-row: 1; }
.maze-pad [data-key="ArrowLeft"] { grid-column: 1; grid-row: 2; }
.maze-pad [data-key="ArrowDown"] { grid-column: 2; grid-row: 2; }
.maze-pad [data-key="ArrowRight"] { grid-column: 3; grid-row: 2; }
.maze-pad .recommended { background: #ffe7a0; border-color: #836322; }
@media (prefers-reduced-motion: no-preference) {
  .pattern-track.arrived .train-section:last-child { animation: carriage-settle .42s ease-out; }
  .maze-map.finished .goal { animation: goal-glow .5s ease-out; }
}
@keyframes carriage-settle { 50% { transform: translateX(5px); } }
@keyframes goal-glow { 50% { background: #ffe07a; } }
@media (orientation: landscape) and (max-height: 550px) {
  .board.pattern .pattern-track { --window: 26px; gap: 6px; padding-block: 8px; }
}
@media (max-width: 480px) and (max-height: 650px) {
  .board.maze .maze-map { width: min(100%, max(210px, calc(100dvh - 313px))); }
  .maze-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .maze-controls .maze-pad { display: flex; }
  .maze-controls .direction { width: 44px; height: 44px; }
  .maze-controls .puzzle-help { padding-inline: 9px; }
  .maze-controls .help-symbol { display: none; }
}
