/* "Show more" control under each library section (the list is windowed). */
.pronunciation-loadmore {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 24px 0 6px;
}

.pronunciation-loadmore .button-secondary {
    min-height: 46px;
    padding: 0 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.pronunciation-loadmore [data-loadmore-count] {
    font-size: 0.92rem;
}

/* Library grid: responsive, equal-height cards. Owned explicitly here so the
   column count is deterministic rather than inherited from .modal-list. */
.pronunciation-items-list {
    grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Professional card: a crisp white surface with a soft shadow and a gentle
   hover lift. It's a flex column so the action row can be pinned to the bottom
   (margin-top:auto below) — that keeps every "Listen" button aligned across a
   row no matter how much phonetic/meta text a word carries. */
.ps-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border: 1px solid rgba(124, 121, 184, 0.16);
    border-radius: 18px;
    padding: 18px 18px 16px;
    box-shadow: 0 1px 2px rgba(34, 42, 70, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.ps-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 121, 184, 0.34);
    box-shadow: 0 12px 26px rgba(34, 42, 70, 0.10);
}

/* Calmer card layout: a prominent word, a muted sub-line (phonetic + language
   flag), one muted meta line, then the action row — instead of a stack of pills
   and two heavy buttons. */
.ps-card-word {
    margin: 0 0 4px;
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text);
    overflow-wrap: anywhere;
}

.ps-card-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ps-card-phon {
    color: var(--muted);
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.ps-card-lang {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.ps-card-flag {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(34, 42, 70, 0.08);
}

.ps-card-flag[hidden] {
    display: none;
}

.ps-card-meta {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 14px;
}

.ps-card-meta:empty {
    display: none;
}

.pronunciation-practice-card {
    /* auto top-margin pins the action row to the card's bottom edge, so the
       Listen buttons line up across a row regardless of meta length. */
    margin-top: auto;
    display: grid;
    gap: 12px;
}

.pronunciation-practice-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* The <audio> is now headless (driven by the custom Listen button); keep it
   out of the flex flow so it doesn't reserve empty space. */
.pronunciation-practice-audio {
    display: none;
}

.pronunciation-listen-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(124, 121, 184, 0.20);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pronunciation-listen-button:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(98, 95, 160, 0.26);
}

.pronunciation-listen-button:focus-visible {
    outline: 3px solid rgba(124, 121, 184, 0.45);
    outline-offset: 2px;
}

.pronunciation-listen-icon { display: inline-flex; line-height: 1; }

.pronunciation-listen-button.is-playing {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Calm, de-emphasized placeholder for items that have no audio yet. */
.pronunciation-noaudio {
    margin-top: auto; /* pin to the card bottom, aligning with Listen buttons */
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(120, 120, 140, 0.07);
    border: 1px dashed rgba(120, 120, 140, 0.30);
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.pronunciation-practice-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 4px;
    background: none;
    color: var(--muted);
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.18s ease;
}

.pronunciation-practice-button::before {
    content: "";
    width: 14px;
    height: 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 14a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 14a3 3 0 0 0 3-3V6a3 3 0 1 0-6 0v5a3 3 0 0 0 3 3zm5-3a5 5 0 0 1-10 0H5a7 7 0 0 0 6 6.92V21h2v-3.08A7 7 0 0 0 19 11h-2z'/></svg>") center / contain no-repeat;
    flex: 0 0 14px;
}

.pronunciation-practice-button:hover {
    color: var(--primary-dark);
}

.pronunciation-practice-button:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
    border-radius: 8px;
}

.pronunciation-practice-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.pronunciation-practice-button.is-listening {
    color: #d64545;
    animation: pronunciation-practice-blink 1.1s ease-in-out infinite;
}

.pronunciation-practice-button.is-listening::before {
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='6' y='6' width='12' height='12' rx='2'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='6' y='6' width='12' height='12' rx='2'/></svg>") center / contain no-repeat;
}

@keyframes pronunciation-practice-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.pronunciation-practice-result {
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(180deg, #fafbff 0%, #f5f7fd 100%);
    border: 1px solid var(--border);
    display: grid;
    gap: 8px;
}

/* The result box stays hidden until the learner actually records — display:grid
   above otherwise overrides the [hidden] attribute, so the prompt showed on
   every card. */
.pronunciation-practice-result[hidden] {
    display: none;
}

.pronunciation-practice-status,
.pronunciation-practice-heard {
    color: var(--muted);
    line-height: 1.55;
}

.pronunciation-practice-score {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
}

.pronunciation-practice-feedback {
    color: var(--primary-dark);
    font-weight: 700;
    line-height: 1.5;
}


@media (max-width: 700px) {
    /* Listen (primary) + the quiet Practice link sit on one row; the card is
       full-width on mobile so they fit without stretching. */
    .pronunciation-practice-row {
        align-items: center;
        gap: 10px;
    }
}
