body {
  max-width: 960px;
  margin: auto;
  padding: 18px;
}
button,
select {
  background: #fafaf4;
}
.instructions h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 5px;
}
.instructions p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  color: var(--green);
  font-size: 12px;
  margin-top: 10px;
}
.practice-link {
  color: #974427;
  font-size: 13px;
  border: 0;
  padding: 8px 4px;
  background: none;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.puzzle-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 12px;
  font-size: 13px;
}
.puzzle-toolbar select {
  flex: 1;
  max-width: 200px;
}
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.selection-bar strong {
  font-weight: 500;
}
.selection-bar button {
  font-size: 12px;
  min-height: 44px;
  padding: 6px 14px;
}
#piece-picker {
  display: flex;
  flex-wrap: nowrap;
  overflow: auto;
  gap: 3px;
  padding: 3px;
  margin: 3px -3px 8px;
}
#piece-picker button {
  flex: 0 0 44px;
  background: var(--piece-color);
  border: 2px solid transparent;
  color: white;
  width: 44px;
  min-height: 44px;
  padding: 0;
  font-weight: 700;
}
#piece-picker button[aria-pressed='true'] {
  outline: 2px solid #273b30;
  outline-offset: 2px;
  border-color: #fafaf4;
}
.transform-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.transform-toolbar button {
  flex: 1;
  font-size: 13px;
  min-width: 0;
  padding: 7px 8px;
}
#game {
  display: block;
  width: 100%;
  height: auto;
  background: #e9ece1;
  border: 1px solid #d8dece;
  border-radius: 10px;
  user-select: none;
  touch-action: none;
}
#game .target {
  fill: #d2d9c8;
  pointer-events: none;
}
#game .target path {
  fill: #d2d9c8;
  stroke: #738367;
  stroke-width: 0.25;
  stroke-dasharray: 0.8 0.6;
}
.tray-background {
  fill: #f5f3e9;
  pointer-events: none;
}
.board-caption {
  fill: #53634d;
  font: 1.8px sans-serif;
  text-anchor: middle;
  pointer-events: none;
  letter-spacing: 0.05px;
}
.tan {
  stroke: #fffdf5;
  stroke-width: 0.35;
  stroke-linejoin: round;
  cursor: grab;
  touch-action: none;
}
.tan.selected {
  stroke: #283b30;
  stroke-width: 0.65;
  paint-order: stroke fill;
}
.tan:focus-visible {
  outline: none;
  stroke: #111;
  stroke-width: 1;
}
.dragging,
.dragging .tan {
  cursor: grabbing;
}
.dragging {
  touch-action: none;
}
.piece-numbers {
  pointer-events: none;
  fill: white;
  font: 700 2.8px sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
}
.hint,
.practice-target {
  fill: none;
  stroke: #a03a19;
  stroke-width: 0.6;
  stroke-dasharray: 1 0.6;
  pointer-events: none;
}
.practice-target {
  animation: pulse 1.4s ease-in-out infinite;
}
#game-status {
  min-height: 42px;
  margin: 10px 0 0;
  color: var(--green);
  font-size: 13px;
}
#result {
  padding: 16px;
  background: #e0e8d8;
  border: 1px solid #b4c4a5;
  border-radius: 10px;
  margin: 12px 0;
}
#result strong {
  display: block;
  font-size: 15px;
  margin-bottom: 10px;
}
#result button {
  background: var(--green);
  color: white;
}
.support-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.support-toolbar button {
  font-size: 13px;
}
.fine-controls {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}
.fine-controls summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px 0;
}
.fine-controls p {
  margin: 0 0 8px;
}
@keyframes pulse {
  50% {
    stroke-width: 1;
    stroke-opacity: 0.45;
  }
}
@media (max-width: 580px) {
  body {
    padding: 10px;
  }
  .instructions h2 {
    font-size: 17px;
  }
  .puzzle-toolbar {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .puzzle-toolbar label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .puzzle-toolbar select {
    min-width: 0;
    max-width: none;
    padding-inline: 8px;
  }
  .puzzle-toolbar button {
    padding-inline: 8px;
    font-size: 12px;
  }
  .steps {
    gap: 8px;
    font-size: 11px;
  }
  .board-caption {
    font-size: 2px;
  }
  .transform-toolbar button {
    padding-inline: 3px;
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .practice-target {
    animation: none;
  }
}
