/* Pronunciation-evaluation feedback (score ring, word bands, phoneme panel) */

.pron-ring {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
    flex-shrink: 0;
}
.pron-ring svg { width: 100%; height: 100%; }
.pron-ring circle {
    fill: none;
    stroke-width: 10;
    cx: 60;
}
.pron-ring .pron-ring-bg { stroke: #e9ecef; }
.pron-ring .pron-ring-fg {
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
    transition: stroke-dashoffset .6s ease;
}
.pron-ring .pron-num {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
}
.pron-subscores { line-height: 1.45; color: #495057; }

.pron-high { color: #198754; }
.pron-mid  { color: #fd7e14; }
.pron-low  { color: #dc3545; }
.pron-ring.pron-high .pron-ring-fg { stroke: #198754; }
.pron-ring.pron-mid  .pron-ring-fg { stroke: #fd7e14; }
.pron-ring.pron-low  .pron-ring-fg { stroke: #dc3545; }

.pron-words {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem .9rem;
    font-size: 1.2rem;
}
.pron-word-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: .4rem;
}
.pron-word {
    padding: 0 .15rem;
    border-bottom: 3px solid currentColor;
    border-radius: 2px;
    font-size: 1.2rem;
    line-height: 1.7;
}

.pron-phonemes {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: .3rem;
    margin-top: .3rem;
}
.pron-ph {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 1.7rem;
    gap: .1rem;
}
.pron-ph-sym { font-weight: 600; font-size: .95rem; }
.pron-ph-score { font-size: .72rem; color: #6c757d; }
.pron-ph-bar {
    display: block;
    height: 5px;
    border-radius: 3px;
    background: currentColor;
    opacity: .75;
}

.pron-hint { margin-top: .2rem; }
#audioModal #stt-result { min-height: 2rem; }

/* Info-only phones (Nahuatl word-final saltillo): shown gray, excluded
   from the score — must never read as an error. */
.pron-ph.pron-info { opacity: .6; }
.pron-ph.pron-info .pron-ph-sym,
.pron-ph.pron-info .pron-ph-score { color: #6c757d; }
.pron-ph.pron-info .pron-ph-bar { background: #adb5bd; }

/* ------------------------------------------------------------------
 * Practice card (proposal 2): one modal, three phases — Escucha,
 * Graba, Compara. The .pron-* score styles above stay shared with the
 * legacy js/stt.js UI (cached pages on production until go-live).
 * ------------------------------------------------------------------ */

/* Step indicator in the modal header */
#audioModal .cualli-steps { display: flex; gap: .9rem; align-items: center; font-size: .85rem; color: #6c757d; }
#audioModal .cualli-step { display: inline-flex; align-items: center; gap: .35rem; }
#audioModal .cualli-step b {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.35rem; height: 1.35rem;
    border-radius: 50%;
    background: #e9ecef; color: #6c757d;
    font-size: .75rem; font-weight: 700;
}
#audioModal .cualli-step.cualli-current { color: #dc3545; font-weight: 600; }
#audioModal .cualli-step.cualli-current b { background: #dc3545; color: #fff; }
#audioModal .cualli-help-btn { font-weight: 700; text-decoration: none; color: #0d6efd; }
#audioModal .cualli-help-btn.cualli-coach { animation: cualli-coach-blink 1.2s ease-in-out 3; }
@keyframes cualli-coach-blink { 50% { transform: scale(1.35); } }
#audioModal .cualli-help-card {
    background: rgba(13, 202, 240, .1);
    border-radius: .5rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    font-size: .9rem;
}

/* Phase visibility: only the active section renders */
#audioModal #cualli-phase-listen,
#audioModal #cualli-phase-record,
#audioModal #cualli-phase-result { display: none; }
#audioModal #cualli-body[data-cualli-phase="listen"]  #cualli-phase-listen  { display: block; }
#audioModal #cualli-body[data-cualli-phase="record"]  #cualli-phase-record  { display: block; }
#audioModal #cualli-body[data-cualli-phase="result"]  #cualli-phase-result  { display: block; }

/* The cloned reference-audio link stays functional but invisible:
   the Escuchar buttons are its visible affordances. */
#audioModal #text-to-read .audio { display: none; }
#audioModal .cualli-word { font-size: 2rem; line-height: 1.3; }
.cualli-state { min-height: 1.4em; font-size: .95rem; color: #495057; margin-top: .35rem; }

/* Phase 2 · Graba: pulsing mic inside an SVG countdown ring */
.cualli-recstage { position: relative; width: 7.5rem; height: 7.5rem; }
.cualli-countdown { position: absolute; inset: 0; width: 100%; height: 100%; }
.cualli-countdown circle { fill: none; stroke-width: 5; }
.cualli-countdown-bg { stroke: #e9ecef; }
.cualli-countdown-fg {
    stroke: #dc3545; stroke-linecap: round;
    stroke-dasharray: 339.292; stroke-dashoffset: 0;
    transform: rotate(-90deg); transform-origin: 60px 60px;
    transition: stroke-dashoffset .2s linear;
}
.cualli-record {
    position: absolute; inset: 0; margin: auto;
    width: 5.5rem; height: 5.5rem;
    border: 0; border-radius: 50%;
    background-color: #dc3545; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2.1rem; line-height: 1;
    cursor: pointer;
    transition: transform .15s ease;
}
.cualli-record:hover:not(:disabled) { transform: scale(1.05); }
.cualli-record:active:not(:disabled) { transform: scale(.97); }
.cualli-record:focus-visible { outline: 3px solid rgba(220, 53, 69, .35); outline-offset: 2px; }
.cualli-record .cualli-ic { display: none; align-items: center; justify-content: center; }
.cualli-record.is-idle .cualli-ic-mic,
.cualli-record.is-blocked .cualli-ic-mic,
.cualli-record.is-unsupported .cualli-ic-mic { display: inline-flex; }
.cualli-record.is-recording .cualli-ic-stop { display: inline-flex; }
.cualli-record.is-analyzing .cualli-ic-wait { display: inline-block; width: 2.2rem; height: 2.2rem; border-width: .25em; color: #fff; }
.cualli-record.is-recording { animation: cualli-pulse 1.6s ease-out infinite; }
@keyframes cualli-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 53, 69, .55); }
    70%  { box-shadow: 0 0 0 1.1rem rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.cualli-bars { height: 2rem; gap: .3rem; margin-top: .6rem; }
.cualli-bars span {
    width: 6px; height: 6%;
    border-radius: 3px;
    background: #198754;
    transition: height .1s linear;
}
.cualli-timer {
    margin-top: .35rem;
    text-align: center;
    font-size: .95rem; font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #dc3545;
}

/* Phase 3 · Compara */
#cualli-phase-result .btn-group .btn,
#cualli-phase-result #cualli-again { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
#cualli-original.playing,
#cualli-original.playing:hover { background-color: #0d6efd; border-color: #0d6efd; color: #fff; }
#cualli-mine.playing,
#cualli-mine.playing:hover { background-color: #0d6efd; border-color: #0d6efd; color: #fff; }

/* Play buttons double as stop buttons while their audio plays */
.cualli-audio-btn .cualli-ic-playwrap,
.cualli-audio-btn .cualli-ic-stopwrap { display: inline-flex; align-items: center; }
.cualli-audio-btn .cualli-ic-stopwrap { display: none; }
.cualli-audio-btn.playing .cualli-ic-playwrap { display: none; }
.cualli-audio-btn.playing .cualli-ic-stopwrap { display: inline-flex; }
#cualli-listen.playing,
#cualli-listen.playing:hover { background-color: #495057; border-color: #495057; color: #fff; }

/* Subscore chips */
.pron-chips { margin-top: .25rem; }
.pron-chip { font-weight: 600; font-size: .8rem; padding: .4em .7em; }
.pron-chip.pron-high { background-color: #d1e7dd; color: #0f5132; }
.pron-chip.pron-mid  { background-color: #ffe5d0; color: #ad4e00; }
.pron-chip.pron-low  { background-color: #f8d7da; color: #842029; }

/* Words are now buttons that expand their phoneme detail */
.pron-word {
    border: 0; background: none; padding: 0 .15rem;
    border-bottom: 3px solid currentColor;
    border-radius: 2px;
    font-size: 1.2rem; line-height: 1.7;
    cursor: pointer;
}
.pron-phonemes { display: none; }
.pron-phonemes.show { display: flex; }
.pron-hint { text-align: center; }

/* Mic-hint warning variant: beats the base .cualli-state gray whatever
   the stylesheet order against Bootstrap's .text-warning. */
.cualli-state.text-warning { color: #ffc107; }

/* The practice card clones the tlajtoli audio links into #text-to-read
   only so recorder.js can read their data-audio URLs; their icons and
   拉美/西班牙-style labels must not render next to the word. */
#text-to-read .audio { display: none; }
