/* Finger-trace + puzzle games — aligned with Vymaľovanky / site cards */

.trace-shell {
  display: grid;
  gap: 1.35rem;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 247, 251, 0.9), rgba(255, 255, 255, 0.95));
  border: 2px solid rgba(244, 114, 182, 0.28);
  border-radius: 26px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 14px 28px rgba(190, 24, 93, 0.08);
}

.trace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.trace-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: min(100%, 52rem);
}

.trace-pick {
  appearance: none;
  border: 1.5px solid rgba(244, 114, 182, 0.32);
  background: #fff;
  color: #9d174d;
  font-family: Nunito, Inter, system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 42px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.trace-pick:hover {
  background: #fff7fb;
  border-color: #f472b6;
}

.trace-pick.is-active,
.trace-pick[aria-pressed="true"] {
  background: linear-gradient(90deg, #f472b6, #fb8ac2);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px rgba(244, 114, 182, 0.28);
}

.trace-pick:focus-visible {
  outline: 2px solid #f472b6;
  outline-offset: 2px;
}

.trace-play {
  display: grid;
  gap: 1rem;
  align-items: start;
}

@media (min-width: 900px) {
  .trace-play {
    grid-template-columns: minmax(0, 1fr) 11.5rem;
  }
}

.trace-stage-wrap {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
}

.trace-hint-demo {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  padding: 0.85rem;
  border-radius: 20px;
  background: #fff;
  border: 1.5px solid rgba(244, 114, 182, 0.28);
  box-shadow: 0 10px 22px rgba(190, 24, 93, 0.08);
}

.trace-hint-demo[hidden] {
  display: none !important;
}

.trace-hint-label {
  margin: 0;
  font-family: Nunito, Inter, system-ui, sans-serif;
  font-weight: 800;
  font-size: 0.92rem;
  color: #9d174d;
}

.trace-hint-svg {
  width: 100%;
  max-width: 9.5rem;
  aspect-ratio: 360 / 420;
  border-radius: 14px;
  border: 1px dashed rgba(244, 114, 182, 0.35);
  background: #fffdf8;
}

.trace-hint-draw {
  animation: traceStrokeReveal 3.2s ease-in-out infinite;
}

.trace-hint-caption {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
  line-height: 1.35;
  text-wrap: pretty;
}

@keyframes traceStrokeReveal {
  0% { stroke-dashoffset: 100; }
  70%, 100% { stroke-dashoffset: 0; }
}

.trace-stage {
  width: min(100%, 440px);
  aspect-ratio: 360 / 420;
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 12%, rgba(253, 224, 71, 0.28), transparent 42%),
    radial-gradient(circle at 88% 78%, rgba(244, 114, 182, 0.2), transparent 46%),
    #fffdf8;
  box-shadow: 0 16px 36px rgba(190, 24, 93, 0.12);
  border: 2px solid rgba(244, 114, 182, 0.22);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.trace-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.trace-walls path,
.trace-walls rect {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trace-progress {
  width: min(100%, 440px);
  height: 12px;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.16);
  overflow: hidden;
  border: 1px solid rgba(244, 114, 182, 0.18);
}

.trace-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f472b6, #fbbf24 55%, #38bdf8);
  border-radius: inherit;
  transition: width 160ms ease;
}

.trace-status {
  margin: 0;
  text-align: center;
  color: #4b5563;
  font-family: Nunito, Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
}

.trace-actions .btn {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 800;
}

.trace-celebrate {
  animation: tracePop 700ms cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes tracePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.025); }
  100% { transform: scale(1); }
}

@media (max-width: 640px) {
  .trace-shell {
    padding: 1rem;
    border-radius: 22px;
  }

  .trace-pick {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trace-celebrate { animation: none; }
  .trace-progress > span { transition: none; }
  .trace-pick { transition: none; }
  .trace-hint-draw { animation: none; stroke-dashoffset: 0; }
  .trace-hint-pulse { display: none; }
}
