/* Connect the Dots — game-specific styles */

.dots-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dots-status {
  margin: 0;
  width: min(100%, 560px);
  font-weight: 800;
  color: var(--ink-soft);
  text-align: center;
}

.dots-stage {
  width: min(100%, 560px);
  aspect-ratio: 1;
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  background: var(--floor);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.dots-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dots-fill {
  opacity: 0.85;
  stroke: var(--ink);
  stroke-width: 0.6;
  animation: dots-reveal 0.45s ease;
}

@keyframes dots-reveal {
  from { opacity: 0; }
  to { opacity: 0.85; }
}

.dots-guide {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
}

.dots-guides.ghost .dots-guide {
  opacity: 0.18;
  stroke-dasharray: 1.2 1.6;
}

.dots-guides.hidden-play .dots-guide {
  opacity: 0;
}

.dots-guides.complete .dots-guide {
  opacity: 0.9;
  stroke-width: 1.3;
}

.dots-line {
  stroke: var(--path);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.dots-line.draw-in {
  animation: dots-line-draw 0.22s ease-out forwards;
}

@keyframes dots-line-draw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

.dots-lines-complete .dots-line {
  stroke-width: 2;
  stroke: var(--coral-deep);
}

.dot-hit {
  fill: transparent;
  cursor: pointer;
}

.dot-hit.next {
  fill: rgba(255, 107, 74, 0.12);
}

.dot {
  fill: var(--ink);
  stroke: var(--floor);
  stroke-width: 0.5;
  transform-box: fill-box;
  transform-origin: center;
}

.dot.done {
  fill: var(--ink-soft);
  opacity: 0.45;
}

.dot.next {
  fill: var(--coral);
  animation: dot-pulse 1.1s ease-in-out infinite;
}

.dot.pop {
  animation: dot-pop 0.28s ease;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

@keyframes dot-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.dot-hit.pulse {
  fill: rgba(255, 107, 74, 0.2);
}

.dot-label {
  font-family: var(--font-display);
  font-size: 4px;
  font-weight: 800;
  fill: var(--ink);
  pointer-events: none;
  user-select: none;
}

.dot-label.next {
  fill: var(--coral-deep);
}

.dot-group.shake {
  animation: dot-shake 0.35s ease;
}

@keyframes dot-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.dots-complete-banner {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(107, 203, 119, 0.25);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(100%, 560px);
}

.dots-complete-banner[hidden] {
  display: none !important;
}

.dots-complete-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--teal-deep);
}

.dots-complete-best {
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--btn-ghost-border);
  background: var(--btn-ghost-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.category-btn.is-active,
.category-btn[aria-pressed="true"] {
  background: rgba(42, 157, 143, 0.18);
  border-color: var(--teal);
  color: var(--teal-deep);
}

.diff-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.diff-btn {
  min-height: 44px;
  padding: 8px 4px;
  border-radius: 10px;
  border: 2px solid var(--btn-ghost-border);
  background: var(--btn-ghost-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

.diff-btn.is-active,
.diff-btn[aria-pressed="true"] {
  background: rgba(255, 200, 87, 0.35);
  border-color: var(--sun);
  color: #7a5600;
}

[data-theme="dark"] .diff-btn.is-active {
  color: #ffd36a;
}

.dots-select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--btn-ghost-border);
  background: var(--btn-ghost-bg);
  color: var(--ink);
  font-weight: 700;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (pointer: coarse) {
  .diff-btn,
  .category-btn,
  .diff-preset {
    font-size: 0.95rem;
  }
}

@media print {
  .print-dots-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .print-dots-grid .dots-print-svg {
    width: 100%;
    height: auto;
    max-height: 42vh;
  }
}
