/* =========================================================
   Play activities — page-scoped styles (Task 24)
   Reuses design tokens; loaded only from Play views.
========================================================= */

.play-hub {
    padding: var(--space-6) 0 var(--space-4);
}

.play-hub--premium {
    padding: clamp(28px, 5vw, 56px) 0 clamp(16px, 3vw, 32px);
    background:
        radial-gradient(ellipse 55% 50% at 10% 10%, var(--tint-lavender), transparent 60%),
        radial-gradient(ellipse 50% 45% at 90% 15%, var(--tint-sky), transparent 55%),
        linear-gradient(180deg, #fbf8f3 0%, var(--bg) 100%);
}

.play-hub__hero-grid {
    text-align: left;
}

.play-hub__hero-copy h1 {
    margin: 0 0 12px;
    font-size: clamp(1.85rem, 3.4vw, 2.65rem);
}

.play-hub__hero-art {
    position: relative;
    width: min(100%, 520px);
    justify-self: center;
}

.play-hub__pip {
    display: block;
    margin: 0 auto var(--space-4);
    max-width: 140px;
    height: auto;
}

.play-hub__pip--overlay {
    position: absolute;
    right: 6%;
    bottom: -6%;
    margin: 0;
    max-width: clamp(100px, 30%, 150px);
    filter: drop-shadow(0 12px 18px rgba(26, 35, 50, 0.16));
    animation: pip-float 4.5s ease-in-out infinite;
    pointer-events: none;
}

.play-hub__privacy {
    max-width: 36rem;
    margin: var(--space-4) 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.hub-premium--play .play-hub__world-card,
.hub-premium--play .play-hub__card {
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.hub-premium--play .play-hub__world-card:hover,
.hub-premium--play .play-hub__world-card:focus-visible,
.hub-premium--play .play-hub__card:hover,
.hub-premium--play .play-hub__card:focus-visible {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    outline: none;
}

.hub-premium--play .play-hub__card-icon {
    transition: transform 280ms ease;
}

.hub-premium--play .play-hub__card:hover .play-hub__card-icon,
.hub-premium--play .play-hub__card:focus-visible .play-hub__card-icon {
    transform: scale(1.08) translateY(-2px);
}

@media (max-width: 900px) {
    .play-hub__hero-grid {
        text-align: center;
    }

    .play-hub__privacy {
        margin-left: auto;
        margin-right: auto;
    }

    .play-hub__hero-art {
        order: -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .play-hub__pip--overlay {
        animation: none !important;
    }

    .hub-premium--play .play-hub__world-card:hover,
    .hub-premium--play .play-hub__world-card:focus-visible,
    .hub-premium--play .play-hub__card:hover,
    .hub-premium--play .play-hub__card:focus-visible,
    .hub-premium--play .play-hub__card:hover .play-hub__card-icon,
    .hub-premium--play .play-hub__card:focus-visible .play-hub__card-icon {
        transform: none;
    }
}

.play-hub__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-5);
}

.play-hub__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    min-height: 11rem;
}

.play-hub__card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.play-hub__card:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.play-hub__card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.play-hub__card p {
    margin: 0;
    color: var(--text-muted);
}

.play-hub__card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-md);
    background: var(--tint-coral);
    color: var(--ink-coral);
    font-weight: 800;
    font-size: 1.35rem;
}

.play-hub__card-badge--shape {
    background: var(--tint-sky);
    position: relative;
}

.play-hub__card-badge--shape::after {
    content: "";
    width: 1.25rem;
    height: 1.25rem;
    background: var(--pastel-sky);
    border-radius: 4px;
    transform: rotate(45deg);
}

.play-hub__card-icon {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.play-hub__card-age {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--tint-mint);
    color: var(--ink-mint);
    font-size: 0.8rem;
    font-weight: 700;
}

.play-hub__group-title {
    margin-top: var(--space-7);
}

.play-activity {
    padding: var(--space-5) 0 var(--space-7);
}

.play-activity__inner {
    max-width: 40rem;
    margin: 0 auto;
    text-align: center;
}

.play-activity__pip {
    display: block;
    margin: 0 auto var(--space-3);
    max-width: 96px;
    height: auto;
}

.play-activity__age {
    display: inline-block;
    margin: 0 0 var(--space-2);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--tint-mint);
    color: var(--ink-mint);
    font-size: 0.85rem;
    font-weight: 700;
}

.play-activity__title {
    margin: 0 0 var(--space-2);
}

.play-activity__parent {
    margin: 0 auto var(--space-5);
    max-width: 32rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.play-activity__instruction {
    margin: 0 0 var(--space-4);
    font-size: 1.15rem;
    font-weight: 700;
}

.play-prompt {
    min-height: 8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    padding: var(--space-5);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.play-prompt.is-celebrate {
    background: var(--tint-mint);
    border-color: var(--pastel-mint);
}

.play-prompt__letter {
    font-size: clamp(4rem, 18vw, 6.5rem);
    font-weight: 800;
    line-height: 1;
    color: var(--primary);
    letter-spacing: 0.02em;
}

.play-prompt__word {
    font-size: clamp(2rem, 10vw, 3.25rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--primary);
    text-transform: capitalize;
}

.play-prompt__picture {
    display: block;
    /* Task 35B: ~200px floor on mobile; grows to ~240px on tablet/desktop */
    width: clamp(12.5rem, 40vw, 15rem);
    max-width: 100%;
    height: auto;
}

.play-prompt__hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 600;
}

.play-prompt__sound {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.play-choice--word {
    font-size: 1.25rem;
    text-transform: capitalize;
    min-height: 4rem;
}

.play-choice--picture,
.play-choice--compare,
.play-choice--group {
    flex-direction: column;
    font-size: 1rem;
    min-height: 6rem;
    padding: var(--space-3);
}

.play-choice__picture {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.play-choice__picture--big {
    width: 112px;
    height: 112px;
}

.play-choice__picture--small {
    width: 56px;
    height: 56px;
}

.play-choices--compare {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.play-choices--groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.play-count-grid--compact {
    max-width: 9rem;
    gap: var(--space-2);
}

.play-count-grid--compact .play-count-shape {
    width: 1.35rem;
    height: 1.35rem;
}

.play-pattern {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    align-items: stretch;
}

.play-pattern__cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-width: 4.5rem;
    min-height: 5.5rem;
    padding: var(--space-3);
    background: var(--surface-muted, var(--primary-soft));
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-weight: 700;
    text-transform: capitalize;
}

.play-pattern__cell--ask {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.play-shape--pattern {
    width: 2.25rem;
    height: 2.25rem;
}

.play-swatch--pattern {
    width: 2.25rem;
    height: 2.25rem;
}

.play-status {
    min-height: 1.75rem;
    margin-bottom: var(--space-4);
    font-weight: 700;
    font-size: 1.1rem;
}

.play-status.is-correct {
    color: var(--ink-mint);
}

.play-status.is-incorrect {
    color: var(--ink-coral);
}

.play-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin: 0 0 var(--space-5);
    padding: 0;
    border: 0;
    min-inline-size: 0;
}

.play-choices legend {
    padding: 0;
}

.play-choice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 3rem;
    min-width: 3rem;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.play-choice:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.play-choice:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.play-choice.is-correct {
    background: var(--tint-mint);
    border-color: var(--pastel-mint);
    color: var(--ink-mint);
}

.play-choice.is-incorrect {
    background: var(--tint-coral);
    border-color: var(--pastel-coral);
    color: var(--ink-coral);
}

.play-choice--swatch,
.play-choice--shape {
    flex-direction: column;
    font-size: 1rem;
    min-height: 5.5rem;
}

.play-choice__label {
    text-transform: capitalize;
}

.play-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    align-items: center;
}

.play-try-another:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Counting shapes */
.play-count-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    align-items: center;
    max-width: 22rem;
}

.play-count-shape {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
}

.play-count-shape--circle {
    border-radius: 50%;
    background: var(--pastel-sky);
}

.play-count-shape--star {
    background: var(--pastel-sunshine);
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
}

/* Color swatches */
.play-swatch {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--swatch-color, var(--pastel-coral));
    border: 2px solid rgba(26, 35, 50, 0.12);
    box-shadow: inset 0 -4px 0 rgba(26, 35, 50, 0.06);
}

.play-swatch--large {
    width: 6rem;
    height: 6rem;
}

/* Shape outlines */
.play-shape {
    display: block;
    width: 2.75rem;
    height: 2.75rem;
    background: var(--pastel-lavender);
}

.play-shape--large {
    width: 6rem;
    height: 6rem;
}

.play-shape--circle {
    border-radius: 50%;
    background: transparent;
    border: 4px solid var(--pastel-sky);
}

.play-shape--square {
    border-radius: 6px;
    background: transparent;
    border: 4px solid var(--pastel-mint);
}

.play-shape--triangle {
    width: 0;
    height: 0;
    background: transparent;
    border-left: 1.4rem solid transparent;
    border-right: 1.4rem solid transparent;
    border-bottom: 2.4rem solid var(--pastel-peach);
}

.play-shape--triangle.play-shape--large {
    border-left-width: 3rem;
    border-right-width: 3rem;
    border-bottom-width: 5.2rem;
}

.play-shape--star {
    background: var(--pastel-sunshine);
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
    );
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Voice toolbar (optional TTS) */
.play-voice {
    margin: 0 auto var(--space-4);
    max-width: 36rem;
    text-align: center;
}

.play-voice__note {
    margin: 0 0 var(--space-2);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.play-voice__controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
}

.play-voice__btn {
    min-height: 3rem;
    min-width: 3rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.95rem;
    font-weight: 700;
}

.play-voice__btn[aria-pressed="true"] {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.play-hint {
    margin: 0 0 var(--space-4);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--tint-sky);
    color: var(--ink-sky, var(--text));
    font-size: 0.95rem;
    font-weight: 600;
}

/* Memory FlipMatch */
.play-choices--memory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.play-choice--memory {
    flex-direction: column;
    min-height: 6.5rem;
    aspect-ratio: 1;
}

.play-choice--memory.is-matched {
    opacity: 0.85;
    pointer-events: none;
}

.play-memory__back {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.play-memory__face {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.play-memory__face img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

/* SortAssign */
.play-choices--sort {
    display: block;
}

.play-sort {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.play-sort__items,
.play-sort__buckets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
}

.play-choice--sort-item.is-selected {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.play-choice--sort-item.is-sorted {
    display: none;
}

.play-bucket {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    min-width: 8rem;
    flex: 1 1 8rem;
    max-width: 12rem;
}

.play-choice--bucket {
    flex-direction: column;
    min-height: 5rem;
}

.play-bucket__icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.play-bucket__placed {
    min-height: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
}

.play-bucket__chip {
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-pill);
    background: var(--tint-mint);
    color: var(--ink-mint);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: capitalize;
}

/* Spot / hunt / shape */
.play-spot-board {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    justify-content: center;
    align-items: center;
}

.play-shape-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.play-shape-slot__frame {
    width: 6.5rem;
    height: 6.5rem;
    border: 3px dashed var(--border-strong);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
}

.play-shape-slot__frame .play-shape {
    opacity: 0.35;
}

@media (min-width: 560px) {
    .play-choices {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .play-choices--compare {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .play-choices--groups {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .play-choices--memory {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .play-hub__card,
    .play-choice,
    .play-prompt {
        transition: none;
    }

    .play-hub__card:hover {
        transform: none;
    }
}

/* Task 33B — body/senses activity responsive polish */
.play-activity__inner {
    width: 100%;
    padding-inline: 1rem;
    box-sizing: border-box;
}

/* Task 35B: prompt picture sizing consolidated on .play-prompt__picture above */

.play-voice__controls,
.play-sound__controls,
.play-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.play-voice__btn,
.play-actions .btn,
.play-actions .btn-secondary,
.play-actions .btn-ghost,
.play-choice {
    min-height: 3rem;
    min-width: 3rem;
}

@media (max-width: 820px) {
    .play-activity__inner {
        max-width: 36rem;
    }

    .play-hub__world-grid {
        grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    }
}

@media (max-width: 480px) {
    .play-prompt {
        padding: 0.85rem;
    }

    .play-choices {
        grid-template-columns: 1fr 1fr;
        gap: 0.65rem;
    }

    .play-choice {

        font-size: 1.35rem;
        min-height: 3.25rem;
    }

    .play-count-shape {
        width: 2.1rem;
        height: 2.1rem;
    }
}

/* --- Task 31B: sound toolbar + Learning Worlds hub --- */
.play-sound {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 35, 50, 0.08);
}

.play-sound__note,
.play-sound__status {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted, #5b6472);
}

.play-sound__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.play-sound-prompt {
  margin-top: 0.75rem;
}

.play-sound-prompt__btn {
  min-height: 3rem;
  min-width: 10rem;
}

.play-sound__attribution {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted, #5b6472);
}

.play-sound__attribution summary {
  cursor: pointer;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
}

.play-sound__attribution-text {
  margin-top: 0.4rem;
}

.play-sound__attribution-text ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}

.play-sound__attribution-text li {
  margin-bottom: 0.25rem;
}

.play-hub__world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}

.play-hub__world-card {
  display: block;
  padding: 1.1rem 1rem;
  border-radius: 1.1rem;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(160deg, #fff8ef, #eef7ff);
  border: 1px solid rgba(26, 35, 50, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-hub__world-card:hover,
.play-hub__world-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(26, 35, 50, 0.08);
  outline: none;
}

.play-hub__world-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 0.45rem;
  border-radius: 0.75rem;
  background: rgba(91, 141, 239, 0.15);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.play-hub__world-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.play-hub__world-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted, #5b6472);
}

.play-hub__filters {
  margin: 1rem 0 1.5rem;
}

.play-hub__filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.play-hub__filter-label {
  font-weight: 600;
  margin-right: 0.35rem;
}

.play-hub__chip {
  border: 1px solid rgba(26, 35, 50, 0.15);
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  min-height: 2.5rem;
  cursor: pointer;
  font: inherit;
}

.play-hub__chip.is-active,
.play-hub__chip[aria-pressed="true"] {
  background: #1a2332;
  color: #fff;
  border-color: #1a2332;
}

.play-hub__filter-note {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted, #5b6472);
}

.play-hub__empty-stage {
  margin: 0.85rem 0 0;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 248, 239, 0.95);
  border: 1px solid rgba(26, 35, 50, 0.1);
  font-size: 0.95rem;
  color: var(--text-muted, #5b6472);
  text-align: left;
  max-width: 40rem;
}

.play-hub__card--featured {
  border: 2px solid rgba(91, 141, 239, 0.35);
}

.play-hub__card[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .play-hub__world-card {
    transition: none;
  }
  .play-hub__world-card:hover,
  .play-hub__world-card:focus-visible {
    transform: none;
  }
}
