/* ============================================================
   SPEAKING PRACTICE — Styles
============================================================ */

/* ── Image Compare ── */
.ic-images-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 14px 0 18px;
}
.ic-img-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ic-img {
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    border-radius: var(--r-md);
    border: 2px solid var(--border);
    background: var(--surface-3, var(--surface));
    display: block;
}
.ic-img-label {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.ic-prompt {
    font-size: .97rem;
    line-height: 1.55;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.ic-hints-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ic-hints-lbl {
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.ic-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ic-hint-chip {
    font-size: .78rem;
    font-style: italic;
    color: var(--accent);
    background: rgba(var(--accent-rgb, 59,130,246), .1);
    border: 1px solid rgba(var(--accent-rgb, 59,130,246), .25);
    border-radius: 20px;
    padding: 2px 10px;
}
.ic-connectors-found {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    min-height: 32px;
}
.ic-connector-badge {
    font-size: .82rem;
    font-weight: 600;
    color: #10b981;
    background: rgba(16,185,129,.12);
    border: 1px solid rgba(16,185,129,.3);
    border-radius: 20px;
    padding: 3px 12px;
}
@media (max-width: 500px) {
    .ic-images-grid { grid-template-columns: 1fr; }
}

/* ── Header — uses tenses-hdr from tenses.css ── */

/* ── Sentence / prompt card ── */
.sp-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.sp-card-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.sp-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-level-badge {
    font-size: .72rem; font-weight: 700; letter-spacing: .04em;
    background: var(--accent); color: #fff;
    border-radius: 6px; padding: 2px 8px;
}
.sp-cat-badge {
    font-size: .75rem; color: var(--text-secondary);
    background: var(--surface-3, var(--surface));
    border: 1px solid var(--border);
    border-radius: 6px; padding: 2px 8px;
}
.sp-sentence {
    font-size: 1.2rem; font-weight: 500; line-height: 1.6;
    color: var(--text-primary); margin-bottom: 0;
}
.sp-topic {
    font-size: 1.05rem; font-weight: 500; line-height: 1.55;
    color: var(--text-primary);
}
.btn-new-sentence {
    background: var(--surface-3, var(--surface)); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 7px 14px;
    font-family: var(--font-body); font-size: .84rem; font-weight: 600;
    color: var(--text-secondary); cursor: pointer; transition: all .15s;
    white-space: nowrap;
}
.btn-new-sentence:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Record button ── */
.sp-record-area {
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; padding: 28px 0 20px;
}
.record-btn {
    width: 80px; height: 80px; border-radius: 50%;
    border: none; cursor: pointer;
    background: var(--accent);
    color: #fff; font-size: 2rem;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, background .2s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(79,70,229,.35);
    position: relative;
    flex-shrink: 0;
}
.record-btn:hover:not(:disabled) {
    transform: scale(1.07);
    box-shadow: 0 6px 24px rgba(79,70,229,.45);
}
.record-btn.recording {
    background: #ef4444;
    box-shadow: 0 4px 16px rgba(239,68,68,.45);
    animation: pulse-record 1.4s infinite;
}
.record-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 4px 16px rgba(239,68,68,.45), 0 0 0 0 rgba(239,68,68,.25); }
    50%       { box-shadow: 0 4px 16px rgba(239,68,68,.45), 0 0 0 14px rgba(239,68,68,.0); }
}

.record-label {
    font-size: .88rem; font-weight: 600; color: var(--text-secondary);
    text-align: center;
}
.record-timer {
    font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
    color: #ef4444; min-width: 48px; text-align: center;
    opacity: 0; transition: opacity .2s;
}
.record-timer.visible { opacity: 1; }

/* ── Waveform animation ── */
.waveform {
    display: flex; align-items: center; gap: 3px; height: 36px;
    opacity: 0; transition: opacity .3s;
}
.waveform.active { opacity: 1; }
.wave-bar {
    width: 4px; border-radius: 99px;
    background: #ef4444; min-height: 6px;
    animation: wave-bounce 0.8s ease-in-out infinite;
}
.wave-bar:nth-child(1) { animation-delay: 0s;    height: 16px; }
.wave-bar:nth-child(2) { animation-delay: .1s;   height: 28px; }
.wave-bar:nth-child(3) { animation-delay: .2s;   height: 20px; }
.wave-bar:nth-child(4) { animation-delay: .3s;   height: 32px; }
.wave-bar:nth-child(5) { animation-delay: .15s;  height: 24px; }
.wave-bar:nth-child(6) { animation-delay: .25s;  height: 18px; }
.wave-bar:nth-child(7) { animation-delay: .05s;  height: 28px; }

@keyframes wave-bounce {
    0%, 100% { transform: scaleY(1); }
    50%       { transform: scaleY(.4); }
}

/* ── Score panel ── */
.sp-score-panel {
    display: flex; align-items: center; gap: 24px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 20px 24px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.sp-score-ring {
    display: flex; align-items: baseline; gap: 2px;
    font-family: var(--font-display);
    font-size: 3rem; font-weight: 700;
    transition: color .4s;
    flex-shrink: 0;
}
.sp-score-denom { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.sp-score-label {
    font-size: 1rem; font-weight: 700; color: var(--text-primary);
    margin-bottom: 8px;
}
.sp-score-details {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.sp-badge {
    font-size: .75rem; font-weight: 600; padding: 3px 9px;
    border-radius: 20px; display: inline-flex; align-items: center; gap: 4px;
}
.sp-badge-accuracy { background: rgba(79,70,229,.12);  color: #4f46e5; }
.sp-badge-words    { background: rgba(16,185,129,.12); color: #10b981; }
.sp-badge-errors   { background: rgba(239,68,68,.12);  color: #ef4444; }

/* ── Word diff (Read Aloud result) ── */
.sp-diff-box {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 20px 22px;
    font-size: 1.05rem; line-height: 2; margin-bottom: 16px;
}
.w-correct { color: var(--text-primary); }
.w-wrong   {
    color: #ef4444; text-decoration: line-through;
    background: rgba(239,68,68,.1); border-radius: 3px;
    padding: 0 2px;
}
.w-missing {
    color: #f59e0b; font-style: italic;
    background: rgba(245,158,11,.08); border-radius: 3px;
    padding: 0 2px;
}
.w-extra {
    color: #6366f1;
    background: rgba(99,102,241,.1); border-radius: 3px;
    padding: 0 2px;
}

/* ── Dictation input ── */
.sp-dictation-wrap {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    margin-bottom: 20px;
}
#sp-dictation-input {
    width: 100%; min-height: 100px;
    background: transparent; border: none; outline: none; resize: vertical;
    font-family: var(--font-body); font-size: 1rem; line-height: 1.7;
    color: var(--text-primary); padding: 18px 20px;
    box-sizing: border-box;
}
#sp-dictation-input::placeholder { color: var(--text-muted); }
.sp-dictation-footer {
    display: flex; justify-content: flex-end; padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ── Free speaking transcription ── */
.sp-transcript-box {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 20px 22px;
    min-height: 100px; font-size: .97rem; line-height: 1.8;
    color: var(--text-primary); margin-bottom: 16px;
    white-space: pre-wrap;
}
.sp-transcript-placeholder {
    color: var(--text-muted); font-style: italic;
}

/* ── Grammar errors from LanguageTool (Free Speaking) ── */
.sp-grammar-error {
    border-bottom: 2px solid #ef4444;
    background: rgba(239,68,68,.08);
    border-radius: 3px; cursor: pointer; padding: 0 1px;
}
.sp-grammar-error:hover { background: rgba(239,68,68,.15); }

/* ── Timer bar (Free Speaking) ── */
.sp-timer-track {
    height: 5px; border-radius: 99px;
    background: var(--border); overflow: hidden;
    margin-bottom: 12px;
}
.sp-timer-bar {
    height: 100%; border-radius: 99px;
    background: var(--accent); transition: width .5s linear, background .3s;
    width: 0%;
}
.sp-timer-bar.warning { background: #f59e0b; }
.sp-timer-bar.full    { background: #ef4444; }

/* ── TTS play button (Dictation) ── */
.sp-play-btn {
    display: flex; align-items: center; gap: 8px;
    background: var(--accent); color: #fff;
    border: none; border-radius: var(--r-md);
    padding: 10px 20px; cursor: pointer;
    font-family: var(--font-body); font-size: .9rem; font-weight: 600;
    transition: opacity .15s, transform .15s;
    margin-bottom: 16px;
}
.sp-play-btn:hover { opacity: .88; transform: scale(1.02); }
.sp-play-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Level filter — uses .level-tabs / .level-tab from tenses.css ── */

/* ── Try again / action row ── */
.sp-action-row {
    display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px;
}

/* ── History tab ── */
.sp-history-card {
    display: flex; gap: 16px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 14px 16px;
    margin-bottom: 10px; cursor: pointer;
    transition: border-color .15s;
}
.sp-history-card:hover { border-color: var(--accent); }
.sp-history-left { flex-shrink: 0; }
.sp-history-score {
    font-family: var(--font-display); font-size: 2rem; font-weight: 700;
    line-height: 1; min-width: 56px; text-align: center;
}
.sp-history-body { flex: 1; min-width: 0; }
.sp-history-title {
    font-weight: 600; font-size: .9rem; margin-bottom: 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-history-meta {
    display: flex; gap: 8px; flex-wrap: wrap;
    font-size: .78rem; color: var(--text-muted); margin-bottom: 4px;
}
.sp-history-preview {
    font-size: .82rem; color: var(--text-muted); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Browser support banner ── */
.sp-no-support {
    text-align: center; padding: 40px 20px;
    background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.3);
    border-radius: var(--r-lg); color: var(--text-secondary);
}
.sp-no-support strong { color: #f59e0b; display: block; margin-bottom: 8px; font-size: 1rem; }

/* ── Empty state ── */
.sp-empty {
    text-align: center; padding: 60px 20px;
    color: var(--text-secondary);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .sp-score-ring { font-size: 2.2rem; }
    .record-btn { width: 68px; height: 68px; font-size: 1.6rem; }
    .sp-sentence { font-size: 1rem; }
}
