/* Riddle Up — shared puzzle game screen.
   Shared by every puzzle mode (Classic "What Am I?", Rebus, Logic,
   Detective & Lateral Thinking - see PuzzleController@play); the mode
   only changes which riddle pool is played, not this screen. Mobile-
   first, centered single-column game container. Uses the `--surface-*`
   dark-theme-safe tokens defined in ../site.css (loaded sitewide).
   Loaded only on puzzle play pages via \Assets::add. */

.pz-game {
    max-width: 46rem;
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}

/* ---- Header ---- */
.pz-game-header {
    margin-bottom: 1.5rem;
}

.pz-game-back {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    font-size: .875rem;
    color: var(--body-color);
    text-decoration: none;
}

.pz-game-back:hover {
    color: var(--indigo);
}

.pz-game-streak {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-weight: 700;
    font-size: .875rem;
    color: rgb(var(--warning-rgb));
    background: rgba(var(--warning-rgb), .12);
    padding: .3rem .75rem;
    border-radius: 50rem;
}

/* ---- Metadata ---- */
.pz-meta {
    margin-bottom: 1.25rem;
}

.pz-meta-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    font-size: .8125rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--indigo);
}

.pz-meta-number {
    display: block;
    margin-top: .35rem;
    font-size: .8125rem;
    opacity: .55;
}

.pz-badge {
    display: inline-block;
    margin-top: .75rem;
    padding: .3rem .9rem;
    border-radius: 50rem;
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .04em;
}

.pz-badge--easy {
    background: rgba(var(--success-rgb), .14);
    color: rgb(var(--success-rgb));
}

.pz-badge--medium {
    background: rgba(var(--warning-rgb), .16);
    color: rgb(var(--warning-rgb));
}

.pz-badge--hard {
    background: rgb(var(--danger-rgb));
    color: var(--white);
}

.pz-badge--expert {
    background: linear-gradient(135deg, rgb(var(--danger-rgb)), var(--indigo));
    color: var(--white);
}

/* ---- Riddle card ---- */
.pz-riddle-card {
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: var(--surface-hover-shadow);
    padding: 2rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.pz-riddle-text {
    margin: 0;
    font-size: clamp(1.125rem, 1rem + 1vw, 1.5rem);
    font-weight: 600;
    line-height: 1.6;
    white-space: pre-line;
}

/* Entrance fade lives on the outer container, not .pz-riddle-card - the
   shake animation below restarts itself via a forced reflow on
   .pz-riddle-card, which would also restart any animation declared
   directly on that same element (including this one, since its rule
   stays permanently matched via animation-fill-mode: both). */
@media (prefers-reduced-motion: no-preference) {
    .pz-game {
        animation: pz-card-in .35s ease both;
    }
}

@keyframes pz-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Answer form ---- */
.pz-answer-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: .75rem;
}

.pz-answer-input {
    width: 100%;
    padding: .9rem 1.1rem;
    font-size: 1rem;
    border-radius: .9rem;
    border: 1px solid var(--border-color);
    background: var(--surface-bg);
    color: var(--body-color);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.pz-answer-input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 .2rem rgba(var(--indigo-rgb), .2);
}

.pz-answer-input:disabled {
    opacity: .6;
}

.pz-submit-btn {
    width: 100%;
    padding: .85rem 1rem;
    font-weight: 600;
    min-height: 2.75rem;
}

.pz-attempts-hint {
    text-align: center;
    font-size: .8125rem;
    opacity: .6;
    min-height: 1.2em;
    margin-bottom: .5rem;
}

/* ---- Hint / reveal ---- */
.pz-secondary-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.pz-text-btn {
    background: none;
    border: none;
    padding: .4rem .25rem;
    min-height: 2.75rem;
    font-weight: 600;
    font-size: .875rem;
    color: var(--indigo);
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.pz-text-btn:hover {
    text-decoration: underline;
}

.pz-text-btn--muted {
    color: var(--body-color);
    opacity: .6;
}

.pz-hint-panel {
    background: rgba(var(--warning-rgb), .1);
    border: 1px dashed rgba(var(--warning-rgb), .4);
    border-radius: .9rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: .925rem;
}

.pz-reveal-confirm {
    background: var(--surface-muted-bg);
    border: 1px solid var(--border-color);
    border-radius: .9rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    text-align: center;
}

.pz-reveal-confirm p {
    margin-bottom: .75rem;
    font-size: .875rem;
}

.pz-reveal-confirm .d-flex {
    justify-content: center;
}

/* ---- Result panel ---- */
.pz-result {
    text-align: center;
    background: var(--surface-bg);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 2rem 1.5rem;
    margin-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
    .pz-result {
        animation: pz-card-in .3s ease both;
    }
    .pz-result--correct .pz-result-icon {
        animation: pz-pop .4s ease;
    }
    .pz-riddle-card.pz-shake {
        animation: pz-shake .4s ease;
    }
}

@keyframes pz-pop {
    0% { transform: scale(.6); opacity: 0; }
    60% { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); }
}

@keyframes pz-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

.pz-result-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: .5rem;
}

.pz-result--correct .pz-result-icon,
.pz-result--correct .pz-result-title {
    color: rgb(var(--success-rgb));
}

.pz-result--incorrect .pz-result-icon,
.pz-result--incorrect .pz-result-title {
    color: rgb(var(--danger-rgb));
}

.pz-result--revealed .pz-result-icon,
.pz-result--revealed .pz-result-title {
    color: rgb(var(--warning-rgb));
}

.pz-result-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.pz-result-answer {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.pz-result-score {
    display: inline-block;
    font-weight: 700;
    font-size: .95rem;
    color: var(--indigo);
    background: rgba(var(--indigo-rgb), .12);
    padding: .3rem .9rem;
    border-radius: 50rem;
    margin-bottom: .5rem;
}

.pz-explanation {
    text-align: left;
    background: var(--surface-muted-bg);
    border-radius: .9rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

.pz-explanation-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-weight: 700;
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--indigo);
    margin-bottom: .4rem;
}

.pz-explanation p {
    margin: 0;
    font-size: .925rem;
    line-height: 1.6;
    opacity: .9;
}

.pz-result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .6rem;
    margin-top: .5rem;
}

.pz-next-btn {
    order: -1;
    flex: 1 1 100%;
    font-weight: 700;
    min-height: 2.9rem;
}

@media (min-width: 480px) {
    .pz-next-btn {
        flex: 1 1 auto;
        order: 0;
    }
}

@media (min-width: 576px) {
    .pz-game {
        padding-top: 1.75rem;
    }

    .pz-riddle-card {
        padding: 2.5rem 2.25rem;
    }

    .pz-answer-form {
        flex-direction: row;
    }

    .pz-answer-input {
        flex: 1;
    }

    .pz-submit-btn {
        width: auto;
        padding-left: 1.75rem;
        padding-right: 1.75rem;
    }
}
