/* Builder wrapper resets */
.wpcode-shortcode-wrapper,
.wpcode-block,
.wp-block-shortcode {
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide empty paragraphs injected around shortcodes */
.ls-pte-writing-wrap + p:empty,
.lsqz-pte-container + p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ════════════════════════════════════════════════════════════════════════
   v2.1.37 — Theme Integration:
   - Container inherits font-family from active WordPress theme
   - Font sizes use em (relative to parent) so they scale with theme base
   - max-width adjusted; width: 100% so theme containers control layout
   ════════════════════════════════════════════════════════════════════════ */
.lsqz-pte-container {
    max-width: 100%;
    width: 100%;
    margin: var(--quiz-head-gap, 24px) auto var(--quiz-bottom-gap, 32px);
    font-family: inherit; /* v2.1.37 — inherit theme font (Open Sans, Roboto, etc) */
    color: #1e293b;
    box-sizing: border-box;
}

.lsqz-pte-container .card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.lsqz-pte-header h2 {
    font-size: 1.5em;
    margin: 0 0 8px;
    color: #0f172a;
}

.lsqz-pte-instruction {
    font-size: 0.875em;
    color: #64748b;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 12px 16px;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
}

.lsqz-pte-prompt {
    font-size: 1em;
    line-height: 1.7;
    /* v3.4.2 — REMOVED white-space: pre-wrap (was causing HTML indentation to render as visible whitespace ~50px around toggle button).
       Same fix as IELTS Writing v3.2.4.2.
       The pre-wrap property remains on .lsqz-prompt-text child where it actually belongs (for prompt text line-break formatting). */
    padding-top: 12px !important; /* compact when toggle header present */
}

/* v2.1.30 — Prompt toggle (collapsible passage)
 * v2.1.52 — Compact pill style (parity with IELTS Writing v2.1.51)
 * v2.1.53 — Reduced bottom margin (12px) for tighter mobile layout
 * v2.1.54 — Full-width clickable area, icon right-aligned (standard UX) */
.lsqz-prompt-toggle {
    display: none; /* hidden by default; only shown on mobile via @media */
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 6px 8px;
    margin: 0 -8px 12px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s ease, transform .15s ease;
}

.lsqz-prompt-toggle:hover {
    background: #f8f7fe;
}

.lsqz-prompt-toggle:hover .lsqz-prompt-toggle-icon {
    background: #c7d2fe;
    transform: scale(1.05);
}

.lsqz-prompt-toggle:active {
    transform: scale(0.99);
    background: #eef2ff;
}

.lsqz-prompt-toggle:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.lsqz-prompt-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #4f46e5;
    background: #eef2ff;
    padding: 6px 14px;
    border-radius: 999px;
    line-height: 1.4;
    white-space: nowrap;
}

.lsqz-prompt-toggle-icon {
    font-size: 18px;
    font-weight: 700;
    color: #6366f1;
    width: 24px;
    height: 24px;
    line-height: 1;
    text-align: center;
    transition: transform .25s ease, background .15s ease;
    border-radius: 50%;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* v3.1.0 — caret-based toggle (replaces minus character) */
.lsqz-prompt-toggle[aria-expanded="true"]  .lsqz-caret-up   { display: inline; }
.lsqz-prompt-toggle[aria-expanded="true"]  .lsqz-caret-down { display: none;   }
.lsqz-prompt-toggle[aria-expanded="false"] .lsqz-caret-up   { display: none;   }
.lsqz-prompt-toggle[aria-expanded="false"] .lsqz-caret-down { display: inline; }

.lsqz-prompt-toggle-icon .lsqz-caret-up,
.lsqz-prompt-toggle-icon .lsqz-caret-down {
    font-size: 13px;
    color: #6366f1;
    line-height: 1;
    transition: transform 0.2s ease;
}

.lsqz-prompt-text {
    transition: max-height .3s ease-out, opacity .2s;
    overflow: hidden;
    white-space: pre-wrap; /* v3.4.2 — moved here from parent .lsqz-pte-prompt to fix whitespace bug */
}

.lsqz-prompt-text.lsqz-hidden {
    max-height: 0 !important;
    opacity: 0;
    margin-bottom: -12px;
}

/* v2.1.53 — Tame paragraph spacing inside prompt text */
.lsqz-prompt-text p {
    margin: 0 0 12px;
    line-height: 1.7;
}

.lsqz-prompt-text p:first-child {
    margin-top: 0;
}

.lsqz-prompt-text p:last-child {
    margin-bottom: 0;
}

.lsqz-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.lsqz-field label {
    display: block;
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 6px;
    color: #475569;
}

.lsqz-input, .lsqz-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: max(16px, 1em); /* v2.1.37 — safeguard against themes with small base */
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.6;
}

.lsqz-textarea {
    resize: vertical;
    min-height: 180px;
    /* v2.1.30 — Disable mobile autocorrect/spellcheck to preserve AI scoring validity */
    -webkit-tap-highlight-color: transparent;
}

.lsqz-input:focus, .lsqz-textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lsqz-answer-area {
    margin-top: 24px;
}

.lsqz-counter {
    text-align: right;
    font-size: 0.75em;
    margin-top: 6px;
    font-weight: bold;
    color: #64748b;
}

.lsqz-btn {
    background: #0f172a;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    width: 100%;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.lsqz-btn:hover {
    background: #1e293b;
}

.lsqz-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.lsqz-btn.outline {
    background: transparent;
    color: #0f172a;
    border: 2px solid #0f172a;
    margin-top: 10px;
}

.lsqz-btn.cta {
    background: #16a34a;
}

.lsqz-status {
    margin-top: 16px;
}

.lsqz-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875em;
}

.lsqz-alert.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.lsqz-loading {
    background: #eff6ff;
    color: #1e40af;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

/* ════════════════════════════════════════════════════════════════════════
   v2.1.36 — AI Evaluation Result UI (Elegant & Mobile-First)
   ════════════════════════════════════════════════════════════════════════ */

/* Hero section — circle + verdict tag + title */
.lsqz-result-hero {
    position: relative;
    border-radius: 14px;
    padding: 28px 24px;
    margin-bottom: 24px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}

.lsqz-result-hero.excellent   { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: #86efac; }
.lsqz-result-hero.strong      { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border-color: #93c5fd; }
.lsqz-result-hero.developing  { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: #fcd34d; }
.lsqz-result-hero.needs-work  { background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%); border-color: #fca5a5; }

.lsqz-result-hero-content {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
    z-index: 1;
}

.lsqz-result-circle-wrap {
    flex-shrink: 0;
}

.lsqz-overall-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: currentColor; /* v2.1.39 — colored bg from tier */
    color: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 3px solid currentColor;
}

.lsqz-result-hero.excellent  .lsqz-overall-circle { color: #16a34a; }
.lsqz-result-hero.strong     .lsqz-overall-circle { color: #2563eb; }
.lsqz-result-hero.developing .lsqz-overall-circle { color: #d97706; }
.lsqz-result-hero.needs-work .lsqz-overall-circle { color: #dc2626; }

.lsqz-overall-circle .val {
    font-size: 2.15em;
    font-weight: 800;
    line-height: 1;
    color: #ffffff; /* v2.1.39 — white number for high contrast on colored bg */
}

.lsqz-overall-circle .lbl {
    font-size: 0.7em;
    text-transform: uppercase;
    color: #ffffff; /* v2.1.39 — white label too */
    opacity: 0.9;
    font-weight: 600;
    margin-top: 2px;
    letter-spacing: 0.05em;
}

.lsqz-result-meta {
    flex: 1;
    min-width: 0;
}

.lsqz-result-verdict-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.9);
    color: #0f172a;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.lsqz-result-title {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0f172a;
    line-height: 1.2;
}

.lsqz-result-subtitle {
    font-size: 0.8em;
    color: #475569;
    margin: 0;
    line-height: 1.4;
}

/* Section heading */
.lsqz-section-heading {
    font-size: 0.9em;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f1f5f9;
}

.lsqz-scores-section {
    margin-bottom: 24px;
}

/* Score items — vertical card style */
.lsqz-scores-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lsqz-score-item {
    background: #fafbfc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 14px 16px;
    transition: box-shadow .15s;
    /* v2.1.39 — removed colored border-left for cleaner look */
}

.lsqz-score-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* v2.1.39 — Subtle top accent dot instead of colored border */
.lsqz-score-item.tier-high { background: linear-gradient(180deg, #f0fdf4 0%, #fafbfc 8%); }
.lsqz-score-item.tier-mid  { background: linear-gradient(180deg, #fffbeb 0%, #fafbfc 8%); }
.lsqz-score-item.tier-low  { background: linear-gradient(180deg, #fef2f2 0%, #fafbfc 8%); }

.lsqz-score-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.lsqz-score-label {
    font-size: 0.875em;
    font-weight: 600;
    color: #1e293b;
    width: auto;
}

.lsqz-score-num {
    font-size: 0.875em;
    color: #475569;
    text-align: right;
    width: auto;
}

.lsqz-score-num strong {
    font-size: 1.125em;
    color: #0f172a;
    font-weight: 800;
}

.lsqz-score-max {
    font-size: 0.8em;
    color: #94a3b8;
    font-weight: 500;
    margin-left: 2px;
}

.lsqz-score-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.lsqz-score-bar span {
    display: block;
    height: 100%;
    transition: width .6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lsqz-score-item.tier-high .lsqz-score-bar span { background: linear-gradient(90deg, #16a34a, #22c55e); }
.lsqz-score-item.tier-mid  .lsqz-score-bar span { background: linear-gradient(90deg, #d97706, #f59e0b); }
.lsqz-score-item.tier-low  .lsqz-score-bar span { background: linear-gradient(90deg, #dc2626, #ef4444); }

.lsqz-score-desc {
    font-size: 0.75em;
    color: #64748b;
    font-style: italic;
    line-height: 1.5;
}

/* Feedback box & recommendations */
.lsqz-feedback-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 16px;
    margin-top: 0;
}

.lsqz-feedback-box p {
    font-size: 0.875em;
    line-height: 1.7;
    color: #0c4a6e;
    margin: 0;
}

.lsqz-feedback-box .lsqz-section-heading {
    color: #075985;
    border-bottom: none;
    padding-bottom: 4px;
    margin-bottom: 12px;
    font-size: 0.95em;
}

/* v2.1.39 — Recommendation: distinct amber/orange treatment + numbered list styling */
.lsqz-recommendation {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 16px;
    margin-top: 0;
    position: relative;
}

.lsqz-recommendation .lsqz-section-heading {
    color: #92400e;
    border-bottom: none;
    padding-bottom: 4px;
    margin-bottom: 12px;
    font-size: 0.95em;
}

.lsqz-recommendation p {
    font-size: 0.875em;
    line-height: 1.8;
    color: #78350f;
    margin: 0;
    /* v2.1.39 — Better numbered list rendering (parses "1. ... 2. ..." patterns) */
    white-space: pre-wrap;
}

/* v2.1.39 — Numbered recommendation items get visual treatment */
.lsqz-recommendation-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: rec-counter;
}

.lsqz-recommendation-list li {
    counter-increment: rec-counter;
    position: relative;
    padding-left: 38px;
    margin-bottom: 12px;
    font-size: 0.875em;
    line-height: 1.65;
    color: #78350f;
}

.lsqz-recommendation-list li:last-child {
    margin-bottom: 0;
}

.lsqz-recommendation-list li::before {
    content: counter(rec-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 26px;
    height: 26px;
    background: #d97706;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7em;
    box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

/* Action buttons */
.lsqz-result-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
    text-align: center;
}

.lsqz-btn-review {
    display: inline-block;
    background: #0f172a !important;
    color: #fff !important;
    padding: 12px 28px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transition: background .15s, transform .1s;
    border: none !important;
    font-size: 0.9em !important;
}

.lsqz-btn-review:hover {
    background: #1e293b !important;
    transform: translateY(-1px);
}

.lsqz-remaining {
    margin: 14px 0 0;
    font-size: 0.8em;
    color: #64748b;
}

.lsqz-remaining strong {
    color: #0f172a;
    font-size: 0.9em;
}

/* v2.1.36 — Hide sticky header/timer when result shown (mobile fix) */
.lsqz-hide-on-result {
    display: none !important;
}

/* Mobile-first responsiveness for result */
@media (max-width: 600px) {
    .lsqz-result-hero {
        padding: 22px 18px;
    }
    .lsqz-result-hero-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    .lsqz-overall-circle {
        width: 80px;
        height: 80px;
    }
    .lsqz-overall-circle .val {
        font-size: 1.9em;
    }
    .lsqz-result-title {
        font-size: 1.2em;
    }
    .lsqz-result-subtitle {
        font-size: 0.75em;
    }
    .lsqz-result-verdict-tag {
        font-size: 0.7em;
    }
    .lsqz-score-item {
        padding: 12px 14px;
    }
    .lsqz-score-num strong {
        font-size: 1em;
    }
    .lsqz-btn-review {
        display: block;
        width: 100%;
        padding: 14px !important;
    }
}

@media (max-width: 400px) {
    .lsqz-result-hero { padding: 18px 14px; }
    .lsqz-overall-circle { width: 72px; height: 72px; }
    .lsqz-overall-circle .val { font-size: 1.65em; }
    .lsqz-result-title { font-size: 1.05em; }
}

/* OVERRIDE legacy result CSS to ensure cleanup */
.lsqz-result-header { display: none; }

.lsqz-feedback-box h4, .lsqz-recommendation h4 {
    margin: 0 0 8px;
    font-size: 0.9em;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lsqz-paywall {
    text-align: center;
    background: #fffbeb;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #fde68a;
}

.lsqz-paywall p {
    margin: 0 0 16px;
    font-weight: 600;
    color: #92400e;
}

.lsqz-remaining {
    text-align: center;
    font-size: 0.75em;
    color: #94a3b8;
    margin-top: 12px;
}

/* ════════════════════════════════════════════════════════════════════════
   v2.1.35 — Expandable Card UX (REPLACES blur overlay pattern)
   - Initial state: only the Start gate is visible (.lsqz-start-gate)
   - Hidden until Start: .lsqz-expandable-content (display:none)
   - After Start: start gate removed via JS, content slides in
   - One-way only: cannot be minimized again
   ════════════════════════════════════════════════════════════════════════ */
.lsqz-expandable-wrapper {
    position: relative;
}

.lsqz-state-collapsed .lsqz-expandable-content {
    display: none;
}

.lsqz-state-expanded .lsqz-expandable-content {
    display: block;
    animation: lsqz-content-fade-in .5s ease-out;
}

@keyframes lsqz-content-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Start gate: prominent CTA card before exam begins */
.lsqz-start-gate {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #86efac;
    border-radius: 14px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.08);
}

.lsqz-start-prompt {
    max-width: 460px;
    margin: 0 auto;
}

.lsqz-start-icon {
    font-size: 3em;
    line-height: 1;
    margin-bottom: 14px;
}

.lsqz-start-title {
    font-size: 1.4em;
    font-weight: 700;
    color: #14532d;
    margin: 0 0 10px;
}

.lsqz-start-desc {
    font-size: 0.9em;
    color: #166534;
    line-height: 1.6;
    margin: 0 0 22px;
}

.lsqz-start-desc strong {
    color: #14532d;
}

.lsqz-start-btn {
    background: #16a34a !important;
    color: #fff !important;
    border: none !important;
    padding: 14px 38px !important;
    font-size: 1em !important;
    font-weight: 600 !important;
    border-radius: 10px !important;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
    transition: background .15s, transform .1s, box-shadow .15s;
}

.lsqz-start-btn:hover {
    background: #15803d !important;
    box-shadow: 0 6px 18px rgba(22, 163, 74, 0.35);
}

.lsqz-start-btn:active {
    transform: scale(0.98);
}

/* Password gate (when password protection enabled) */
.lsqz-password-gate {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px;
    text-align: center;
    max-width: 380px;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.lsqz-password-gate p {
    margin: 0 0 16px;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9em;
}

.lsqz-password-row {
    display: flex;
    gap: 8px;
}

.lsqz-password-row .lsqz-input {
    flex: 1;
}

.lsqz-password-row .lsqz-btn {
    width: auto;
    padding: 10px 20px;
}

#lsqz-pte-password-error {
    margin-top: 10px;
    font-size: 0.8em;
    color: #dc2626;
    font-weight: 500;
}

/* Mobile adjustments for start gate */
@media (max-width: 480px) {
    .lsqz-start-gate {
        padding: 28px 18px;
    }
    .lsqz-start-icon {
        font-size: 2.5em;
    }
    .lsqz-start-title {
        font-size: 1.2em;
    }
    .lsqz-start-desc {
        font-size: 0.875em;
    }
    .lsqz-start-btn {
        width: 100%;
        padding: 14px !important;
    }
}

/* ── Header layout ───────────────────────────────────────────────────────── */
/* v3.4.2 — Flat header style now only applies when .lsqz-hero class is NOT present.
   When hero is active (PTE Writing v3.4.2+), .lsqz-hero-inner handles the flex layout instead. */
.lsqz-pte-header:not(.lsqz-hero) {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.lsqz-pte-header-left {
    flex: 1;
}

.lsqz-pte-type-badge {
    display: inline-block;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 6px;
}

.lsqz-pte-header h2 {
    font-size: 1.25em;
    margin: 0;
}

.lsqz-pte-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    font-weight: 700;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 14px;
    flex-shrink: 0;
    transition: background .2s, color .2s, transform .2s;
    /* v2.1.30 — Tabular numbers prevent timer "jumping" as digits change */
    font-variant-numeric: tabular-nums;
}

/* v2.1.30 — Timer warning state (< 60s remaining): more prominent red treatment */
.lsqz-pte-timer.lsqz-timer-warning {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

/* v2.1.30 — Timer critical state (< 30s): pulse animation for urgency */
.lsqz-pte-timer.lsqz-timer-critical {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    animation: lsqz-timer-pulse 1s ease-in-out infinite;
}

@keyframes lsqz-timer-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50%      { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

/* v2.1.30 — Toast notification for copy/paste feedback */
.lsqz-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.875em;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lsqz-toast.lsqz-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════════════════════
   v2.1.32 — Identity Panel (shown after Submit clicked, matches PTE Speaking)
   ════════════════════════════════════════════════════════════════════════ */

.lsqz-identity-panel {
    margin-top: 20px;
    padding: 20px;
    background: #f0fdf4;
    border: 2px solid #86efac;
    border-radius: 12px;
    animation: lsqz-identity-slide-in .4s ease-out;
}

@keyframes lsqz-identity-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.lsqz-identity-intro {
    color: #15803d;
    font-weight: 600;
    margin: 0 0 14px;
    font-size: 0.9em;
    text-align: center;
}

.lsqz-confirm-submit-btn {
    width: 100%;
    background: #16a34a !important;
    border: none;
    color: #fff !important;
    padding: 14px 20px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, transform .1s;
}

.lsqz-confirm-submit-btn:hover {
    background: #15803d !important;
}

.lsqz-confirm-submit-btn:active {
    transform: scale(0.98);
}

.lsqz-confirm-submit-btn:disabled {
    background: #94a3b8 !important;
    cursor: not-allowed;
}

/* v2.1.32 — Locked textarea: visual indicator that answer is final */
.lsqz-textarea.lsqz-locked {
    background: #f8fafc !important;
    color: #475569 !important;
    border-color: #cbd5e1 !important;
    cursor: not-allowed;
    user-select: text; /* keep selectable for Copy */
}

.lsqz-textarea.lsqz-locked::after {
    content: '🔒 Locked';
}

/* v2.1.32 — Locked timer: greyed out, no animation */
.lsqz-pte-timer.lsqz-timer-locked {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
    animation: none !important;
    transform: none !important;
}

.lsqz-pte-timer.lsqz-timer-locked::before {
    content: '🔒 ';
}

/* v2.1.32 — Mobile identity panel optimization */
@media (max-width: 480px) {
    .lsqz-identity-panel {
        padding: 16px;
        margin-top: 16px;
    }
    .lsqz-identity-intro {
        font-size: 0.875em;
    }
    .lsqz-confirm-submit-btn {
        padding: 14px;
        font-size: 0.9em;
    }
}


.lsqz-toast.lsqz-toast-error {
    background: #dc2626;
}

.lsqz-toast.lsqz-toast-success {
    background: #16a34a;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.lsqz-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.lsqz-tool-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    color: #475569;
    transition: background .15s, transform .1s;
    /* v2.1.30 — Mobile touch target: minimum 44px height for accessibility */
    min-height: 40px;
    min-width: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.lsqz-tool-btn:hover {
    background: #e2e8f0;
}

.lsqz-tool-btn:active {
    transform: scale(0.96);
    background: #cbd5e1;
}

.lsqz-tool-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Counter bar ─────────────────────────────────────────────────────────── */
.lsqz-counter-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: #64748b;
    margin-top: 8px;
}

.lsqz-counter-num {
    font-weight: 700;
}

.lsqz-counter-range {
    color: #94a3b8;
}

/* ── Actions row ─────────────────────────────────────────────────────────── */
.lsqz-actions {
    margin-top: 20px;
}

.lsqz-result-actions {
    margin-top: 20px;
    text-align: center;
}

/* ── Prep phase banner ───────────────────────────────────────────────────── */
.lsqz-prep-phase {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: #fefce8;
    border: 1.5px solid #fde047;
    border-radius: 12px;
}

.lsqz-prep-banner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lsqz-prep-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #713f12;
}

.lsqz-prep-countdown {
    font-size: 1.75em;
    font-weight: 800;
    color: #92400e;
    min-width: 2ch;
    text-align: center;
    line-height: 1;
}

.lsqz-prep-unit {
    font-size: 0.75em;
    color: #92400e;
    opacity: 0.7;
}

.lsqz-prep-hint {
    font-size: 0.75em;
    color: #78350f;
    margin-top: 6px;
}

/* ════════════════════════════════════════════════════════════════════════
   v2.1.30 — Mobile UX Comprehensive Overhaul
   ════════════════════════════════════════════════════════════════════════ */

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .lsqz-pte-container .card { padding: 18px; }
    /* v2.1.36 — legacy result overrides removed; new design has its own breakpoints */
}

/* Mobile (≤480px) */
@media (max-width: 480px) {
    .lsqz-pte-container .card { padding: 14px 12px; border-radius: 10px; }
    .lsqz-pte-container { margin: 12px auto 24px; padding: 0 8px; }

    /* v2.1.30 — STICKY TIMER: Always visible at top during writing
       v3.4.2 — Scoped with :not(.lsqz-hero) so hero header keeps gradient on mobile. */
    .lsqz-pte-header:not(.lsqz-hero) {
        flex-direction: row;
        gap: 10px;
        align-items: center;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 100;
        padding: 10px 12px;
        margin: -14px -12px 16px;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
    .lsqz-pte-header h2 {
        font-size: 1em;
        line-height: 1.3;
    }
    .lsqz-pte-header-left {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .lsqz-pte-header h2 {
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }
    .lsqz-pte-type-badge {
        font-size: 0.625em;
        padding: 2px 8px;
    }
    .lsqz-pte-timer {
        font-size: 1em;
        padding: 8px 12px;
        flex-shrink: 0;
    }

    /* v2.1.30 — TOOLBAR: Bigger touch targets (44px min) for mobile */
    .lsqz-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }
    .lsqz-tool-btn {
        font-size: 0.8em;
        padding: 10px 14px;
        min-height: 44px; /* WCAG/Apple minimum touch target */
        flex: 1;
        min-width: 90px;
    }

    /* v2.1.30 — TEXTAREA: Optimized for mobile portrait */
    .lsqz-textarea {
        font-size: max(16px, 1em) !important; /* v2.1.37 — Critical: prevents iOS zoom */
        min-height: 200px;
        line-height: 1.6;
        padding: 12px;
    }
    /* Essay textarea slightly larger but not too tall on mobile */
    .lsqz-type-essay .lsqz-textarea {
        min-height: 280px;
    }
    .lsqz-type-swt .lsqz-textarea {
        min-height: 140px;
    }

    /* Form */
    .lsqz-form-grid { grid-template-columns: 1fr; }
    .lsqz-input { font-size: 1em; padding: 12px; }

    /* Password gate */
    .lsqz-password-row { flex-direction: column; }
    .lsqz-password-row .lsqz-btn { width: 100%; }

    /* v2.1.36 — Score bars + overall circle styles moved to new result design above */

    /* Result actions */
    .lsqz-result-actions { text-align: center; }

    /* Instruction block */
    .lsqz-pte-instruction { padding: 10px 12px; font-size: 0.8em; }

    /* v2.1.30 — Word counter: bigger and more visible */
    .lsqz-counter-bar {
        font-size: 0.875em;
        margin-top: 10px;
        padding: 8px 0;
        position: sticky;
        bottom: 0;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        padding-top: 12px;
    }
    .lsqz-counter-num {
        font-size: 1em;
    }

    /* v2.1.30 — Mobile-only: show prompt toggle button
       v2.1.52 — Use inline-flex to keep compact pill style */
    .lsqz-prompt-toggle {
        display: inline-flex;
    }

    /* v2.1.52 — Separator line between toggle and prompt text on mobile
       v2.1.53 — Tighter padding (12px) */
    .lsqz-prompt-toggle ~ .lsqz-prompt-text:not(.lsqz-hidden) {
        padding-top: 12px;
        border-top: 1px solid #f1f5f9;
    }

    /* v2.1.30 — Submit button: prominent and easy to tap */
    .lsqz-actions {
        margin-top: 16px;
    }
    .lsqz-actions .lsqz-btn {
        width: 100%;
        padding: 14px;
        font-size: 1em;
        min-height: 50px;
    }

    /* v2.1.30 — Prep timer banner mobile-friendly */
    .lsqz-prep-banner {
        flex-direction: column;
        text-align: center;
        gap: 4px !important;
        padding: 12px !important;
    }
    .lsqz-prep-countdown {
        font-size: 1.75em !important;
    }
}

/* v2.1.30 — Very small screens (≤360px) */
@media (max-width: 360px) {
    .lsqz-pte-header h2 { font-size: 0.875em; }
    .lsqz-tool-btn { font-size: 0.75em; padding: 8px 10px; min-width: 70px; }
    .lsqz-pte-timer { font-size: 0.875em; padding: 7px 10px; }
}

/* v2.1.30 — Landscape mobile (low height)
   v3.4.2 — Scoped for consistency (hero isn't sticky anyway, but be explicit). */
@media (max-width: 768px) and (max-height: 500px) {
    .lsqz-pte-header:not(.lsqz-hero) { position: relative; } /* don't sticky in landscape */
    .lsqz-textarea { min-height: 120px !important; }
}
