/* ═══════════════════════════════════════════════════════════
   ear_iq.css — Ear IQ / Musical IQ module styles
   Covers: section intro screen, play screen, demo cards,
   answer buttons, countdown, stems UI, archetype/percentile
   results, and MIQ phase bar.
   ═══════════════════════════════════════════════════════════ */


/* ─── 1. EIQ IMAGE WRAPPER ────────────────────────────────── */

/* image/emoji wrapper used on EIQ section intro screen */
.eiq-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

.eiq-icon-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Section intro icon — direct img (no wrapper div) */
#eiq-intro-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#eiq-intro .rp-phase-title {
    margin: 0;
    text-align: center;
}

#eiq-intro .rp-phase-body {
    text-align: center;
    text-wrap-style: pretty;
}

#eiq-intro .rp-phase-icon {
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 350px;
    margin: 0 auto !important;
}

#eiq-demo-screen-title {
    font-family: unset;
    font-size: 1rem;
    font-weight: 600;
    color: var(--pf-text);
    text-align: center;
    margin: 8px 0;
    line-height: 1.4;
    min-height: 1.4em;
    max-width: 450px;
    text-wrap-style: pretty;
}

/* ─── 2. EAR IQ MODULE — CONTAINER & SCREENS ─────────────── */

.step-ear-iq-module {
    align-self: stretch;
    padding: 8px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    max-width: min(900px, 100%);
}

.step-ear-iq-module #eiq-intro,
.step-ear-iq-module #eiq-demo-screen,
.step-ear-iq-module #eiq-play-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    gap: 16px;
    min-height: 60vh;
    padding: 120px 0 16px;
}

.step-ear-iq-module #eiq-intro {
    padding: 40px 0 16px;
}

.step-ear-iq-module #eiq-play-screen {
    height: 100dvh;
}

/* Override viewport-fixed .play-btn */
.step-ear-iq-module .play-btn:not(.play-btn--compact) {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: auto !important;
    margin: 4px auto 0;
}

.step-ear-iq-module .play-btn:not(.play-btn--compact)~.sound-wave {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: auto !important;
}


/* ── Stems replay button — reuses compact play-btn pill style ── */
.eiq-stems-replay-btn.play-btn--compact .eiq-stems-replay-icon {
    color: #fff;
    font-size: 14px;
    line-height: 1;
}

/* ─── 3. SKIP / SECONDARY BUTTONS ────────────────────────── */

.eiq-binary-choices .choice-label {
    font-size: 0.98rem;
}

/* Skip section — staging only (button not rendered in production HTML) */
.eiq-section-skip-btn {
    background: none;
    border: none;
    font-size: 0.82rem;
    color: var(--pf-text-dim);
    cursor: pointer;
    padding: 4px 12px;
    margin-top: 8px;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
    letter-spacing: 0.02em;
}

.eiq-section-skip-btn:hover {
    opacity: 1;
    color: var(--pf-text-muted);
}

.eiq-skip-btn {
    margin-top: 10px !important;
}

/* ─── 4. DEMO CARDS ───────────────────────────────────────── */

.eiq-demo-cards {
    display: flex;
    gap: 14px;
    justify-content: center;
    width: 100%;
    max-width: 380px;
    margin: 8px 0;
}

.eiq-demo-card {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 16px;
    background: var(--pf-bg-card);
    border: 2px solid var(--pf-border);
    border-radius: 16px;
    cursor: pointer;
    color: var(--pf-text);
    font-family: var(--pf-font);
    transition: border-color 0.12s, background 0.12s, transform 0.08s;
    -webkit-tap-highlight-color: transparent;
}

.eiq-demo-card:hover:not(:disabled) {
    border-color: var(--pf-primary);
    background: rgba(108, 92, 231, 0.10);
    transform: translateY(-2px);
}

.eiq-demo-card:active:not(:disabled) {
    transform: scale(0.95);
}

.eiq-demo-card.playing {
    border-color: var(--pf-accent);
    background: rgba(0, 206, 201, 0.08);
    box-shadow: 0 0 20px rgba(0, 206, 201, 0.2);
}

.eiq-demo-card:disabled {
    opacity: 0.6;
    cursor: default;
}

.eiq-demo-card-icon {
    font-size: 2rem;
    line-height: 1;
    display: block;
}

.eiq-demo-card-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pf-text);
    line-height: 1.3;
}

/* Hint text — visible by default, same height as the wave so swapping causes no shift */
.eiq-demo-card-hint {
    font-size: 0.78rem;
    color: var(--pf-text-dim);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    margin: 6px 0;
}

/* Wave — hidden before first tap, exact same height/margin as hint */
.eiq-demo-card-wave {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 24px;
    margin: 6px 0;
}

/* On play: hide hint, show wave */
.eiq-demo-card.playing .eiq-demo-card-hint {
    display: none;
}

.eiq-demo-card.playing .eiq-demo-card-wave {
    display: flex;
}

.eiq-demo-card-wave .wave-bar {
    width: 3px;
    height: 4px;
    background: var(--pf-accent);
    border-radius: 2px;
    animation: eiq-demo-wave 0.45s ease-in-out infinite alternate;
}

.eiq-demo-card-wave .wave-bar:nth-child(2) {
    animation-delay: 0.06s;
}

.eiq-demo-card-wave .wave-bar:nth-child(3) {
    animation-delay: 0.12s;
}

.eiq-demo-card-wave .wave-bar:nth-child(4) {
    animation-delay: 0.18s;
}

.eiq-demo-card-wave .wave-bar:nth-child(5) {
    animation-delay: 0.24s;
}

@keyframes eiq-demo-wave {
    from {
        transform: scaleY(1);
    }

    to {
        transform: scaleY(3.5);
    }
}


/* ─── 5. COUNTDOWN ────────────────────────────────────────── */

#eiq-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.12);
    border: 2px solid rgba(108, 92, 231, 0.3);
    animation: eiq-cd-pulse 1s ease-in-out infinite alternate;
}

@keyframes eiq-cd-pulse {
    from {
        box-shadow: 0 0 6px rgba(108, 92, 231, 0.2);
    }

    to {
        box-shadow: 0 0 20px rgba(126, 110, 248, 0.641);
    }
}

.eiq-countdown-num {
    font-family: var(--pf-font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--pf-primary-light);
    line-height: 1;
}


/* ─── 6. PROMPT ───────────────────────────────────────────── */

.step-ear-iq-module #eiq-prompt {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pf-text);
    text-align: center;
    letter-spacing: -0.01em;
    line-height: 1.4;
    min-height: 32px;
    vertical-align: middle;
    align-items: center;
    transition: opacity 0.2s;
    max-width: 450px;
    text-wrap-style: pretty;
}


/* ─── 7. ANSWER BUTTONS ───────────────────────────────────── */

/* Multi-choice & Binary — shared container */
.step-ear-iq-module .eiq-choices,
.step-ear-iq-module .eiq-binary-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    max-width: 440px;
    margin: 8px auto 0;
}

/* All EIQ answer buttons — single source of truth */
.step-ear-iq-module .eiq-answer-btn {
    flex: 1 1 0;
    min-width: 190px;
    min-height: 66px;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 18px 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    background: var(--pf-bg-card);
    border: 2px solid var(--pf-border);
    color: var(--pf-text);
    font-family: var(--pf-font);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, transform 0.08s;
    -webkit-tap-highlight-color: transparent;
}

.step-ear-iq-module .eiq-answer-btn:hover:not(:disabled) {
    border-color: var(--pf-primary);
    background: rgba(108, 92, 231, 0.12);
    transform: translateY(-1px);
}

.step-ear-iq-module .eiq-answer-btn:active:not(:disabled) {
    transform: scale(0.97);
}

/* Chosen state */
.step-ear-iq-module .eiq-answer-btn.chosen {
    border-color: var(--pf-primary) !important;
    background: rgba(108, 92, 231, 0.275) !important;
    box-shadow: 0 0 14px rgba(108, 92, 231, 0.5);
}

/* Sound wave — always reserve space, never collapses */
.step-ear-iq-module #eiq-wave {
    position: static;
    margin: 10px 0;
}

/* Icon colours */
.step-ear-iq-module .eiq-answer-btn[data-value="up"] .bi {
    color: var(--pf-success);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-answer-btn[data-value="down"] .bi {
    color: var(--pf-error);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-answer-btn[data-value="same"] .bi {
    color: var(--pf-success);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-answer-btn[data-value="different"] .bi {
    color: var(--pf-error);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-icon-colored.large {
    color: var(--pf-success);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-icon-colored.small {
    color: var(--pf-error);
    font-size: 1.1em;
}

.step-ear-iq-module .eiq-interval-icon {
    font-size: 1.5em;
    line-height: 1;
    vertical-align: middle;
    margin-right: 2px;
}

.step-ear-iq-module .eiq-style-same {
    color: var(--pf-success);
    font-weight: 700;
}

.step-ear-iq-module .eiq-style-diff {
    color: var(--pf-error);
    font-weight: 700;
}

.step-ear-iq-module .eiq-answer-btn--number {
    min-width: 90px !important;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.step-ear-iq-module .eiq-answer-btn--number:has(.eiq-count-notes) {
    justify-content: space-between;
}

.step-ear-iq-module .eiq-answer-btn--number .choice-label {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--pf-text);
}

.eiq-count-notes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
}

.eiq-count-note {
    font-size: 1.4rem;
    width: 18px;
    color: var(--pf-primary-light);
    line-height: 1;
    transition: color 0.12s;
}

.step-ear-iq-module .eiq-answer-btn--number.chosen .eiq-count-note {
    color: var(--pf-accent);
}

/* 2-column grid layout variant */
.eiq-choices--grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 380px;
    margin: 0 auto;
}

.eiq-choices--grid .eiq-answer-btn {
    flex: unset;
    max-width: unset;
    min-height: 70px;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
}


/* ─── 8. RESULTS — ARCHETYPE & PERCENTILE ─────────────────── */

.eiq-archetype-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--badge-color, #a78bfa);
    margin: 8px auto 0;
}

.eiq-archetype-icon {
    font-size: 1.2rem;
}

.eiq-archetype-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--badge-color, #a78bfa);
    letter-spacing: 0.02em;
}

.eiq-percentile-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.eiq-percentile-num {
    font-family: var(--pf-font-display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.eiq-percentile-label {
    font-size: 0.85rem;
    color: var(--pf-text-dim);
}


/* ─── 9. MIQ PHASE BAR ────────────────────────────────────── */

/* The MIQ bar now uses exactly the same ●—Label—● structure and CSS
   as the main funnel — no overrides needed. Styles live in steps.css. */


/* ─── 10. STEMS UI ────────────────────────────────────────── */

/* Replay original pill */
.eiq-stems-replay-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.eiq-stems-replay-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: transparent;
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius-full);
    color: var(--pf-text-muted);
    font-family: var(--pf-font);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s, opacity 0.15s;
}

.eiq-stems-replay-btn:hover:not(:disabled) {
    border-color: var(--pf-primary);
    background: rgba(108, 92, 231, 0.08);
    color: var(--pf-text);
}

.eiq-stems-replay-btn:disabled,
.eiq-stems-replay-btn--exhausted {
    opacity: 0.4;
    cursor: not-allowed;
}

.eiq-stems-replay-btn i {
    font-size: 1rem;
    line-height: 1;
}

.eiq-stems-replay-count {
    font-weight: 700;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* Cards layout */
.eiq-stems-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 440px;
    margin: 4px auto 0;
    width: 100%;
}

.eiq-stems-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Listen button — state machine
   Default       → play icon  (.eiq-stems-icon-default)
   .playing      → wave bars  (.eiq-stems-listen-wave)
   .played       → check icon (.eiq-stems-icon-played), success color
   .played.playing → playing wins (re-listening an already-heard clip) */

.eiq-stems-listen-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(108, 92, 231, 0.10);
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius-md);
    color: var(--pf-text);
    font-family: var(--pf-font);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.eiq-stems-listen-btn:hover:not(:disabled) {
    border-color: var(--pf-primary);
    background: rgba(108, 92, 231, 0.18);
}

.eiq-stems-listen-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.eiq-stems-listen-btn i {
    font-size: 1rem;
    line-height: 1;
}

.eiq-stems-listen-label {
    line-height: 1;
}

/* Playing → accent (teal) */
.eiq-stems-listen-btn.playing {
    border-color: var(--pf-accent);
    background: rgba(0, 206, 201, 0.16);
    color: var(--pf-accent);
}

/* Played → success (green) */
.eiq-stems-listen-btn.played {
    border-color: var(--pf-success);
    background: rgba(0, 184, 148, 0.12);
    color: var(--pf-success);
}

/* Played + re-listening → playing wins */
.eiq-stems-listen-btn.played.playing {
    border-color: var(--pf-accent);
    background: rgba(0, 206, 201, 0.16);
    color: var(--pf-accent);
}

/* Icon swap rules */
.eiq-stems-listen-btn .eiq-stems-icon-default,
.eiq-stems-listen-btn .eiq-stems-icon-played,
.eiq-stems-listen-btn .eiq-stems-listen-wave {
    display: inline-flex;
    align-items: center;
}

.eiq-stems-listen-btn .eiq-stems-icon-played,
.eiq-stems-listen-btn .eiq-stems-listen-wave {
    display: none;
}

.eiq-stems-listen-btn.played:not(.playing) .eiq-stems-icon-default {
    display: none;
}

.eiq-stems-listen-btn.played:not(.playing) .eiq-stems-icon-played {
    display: inline-flex;
}

.eiq-stems-listen-btn.playing .eiq-stems-icon-default,
.eiq-stems-listen-btn.playing .eiq-stems-icon-played {
    display: none;
}

.eiq-stems-listen-btn.playing .eiq-stems-listen-wave {
    display: inline-flex;
}

/* Wave bars inside the Listen button */
.eiq-stems-listen-wave {
    gap: 2px;
}

.eiq-stems-listen-wave .wave-bar {
    width: 3px;
    height: 14px;
    background: currentColor;
    border-radius: 2px;
    transform-origin: center;
    animation: eiq-stems-wave 0.9s ease-in-out infinite;
}

.eiq-stems-listen-wave .wave-bar:nth-child(2) {
    animation-delay: 0.15s;
}

.eiq-stems-listen-wave .wave-bar:nth-child(3) {
    animation-delay: 0.30s;
}

@keyframes eiq-stems-wave {

    0%,
    100% {
        transform: scaleY(0.35);
    }

    50% {
        transform: scaleY(1);
    }
}

/* Pick A/B — only override the disabled state */
.eiq-stems-pick-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ─── 11. RESPONSIVE ──────────────────────────────────────── */

@media (min-width: 640px) {
    .step-ear-iq-module #eiq-prompt {
        font-size: 1.3rem;
    }

    .step-ear-iq-module .eiq-binary-choices .eiq-answer-btn {
        font-size: 1.1rem;
    }

    .eiq-demo-card {
        padding: 24px 16px 20px;
    }

    .eiq-demo-card-icon {
        font-size: 2.4rem;
    }

    .step-ear-iq-module #eiq-demo-screen,
    .step-ear-iq-module #eiq-play-screen {
        padding: 150px 0 16px;
    }
}

@media (max-width: 767px) {

    .step-ear-iq-module .eiq-choices .eiq-answer-btn {
        min-width: auto;
    }

    .step-ear-iq-module .eiq-binary-choices {
        flex-direction: column;
    }

    .step-ear-iq-module .eiq-choices {
        flex-wrap: unset;
        flex-direction: column;
    }

    #eiq-intro .rp-phase-icon {
        max-width: 260px;
    }

    .eiq-binary-choices .choice-label {
        font-size: 0.9rem;
    }

    .step-ear-iq-module #eiq-intro {
        padding: 20px 0 16px;
    }
}

@media (max-width: 360px) {
    .eiq-stems-cards {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .eiq-stems-listen-wave .wave-bar {
        animation: none;
        transform: scaleY(0.7);
    }
}