/* ─────────────────────────────────────────────────────────────────────────
   Launcher Card  —  New design
   Layout: [accent bar] › [icon + module label] › [title] › [stats] › [status] › [CTA]
   ───────────────────────────────────────────────────────────────────────── */

/* ── Wrapper ── */
.ielts-launcher-wrap {
    max-width: 420px;
    margin: 18px auto;
    padding: 0 12px;
    box-sizing: border-box;
}

.ielts-launcher-wrap.ielts-launcher-wrap-mock {
    max-width: 420px;
}

/* ── Card shell ── */
.ielts-launcher-card {
    --lc-accent: #2563eb;
    --lc-accent-muted: rgba(37, 99, 235, .12);
    --lc-accent-border: #bfdbfe;
    --lc-icon-from: #1d4ed8;
    --lc-icon-to: #2563eb;
    --lc-bg-tint: #eff6ff;

    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 22px 20px;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(160deg, #ffffff 0%, var(--lc-bg-tint) 100%);
    border: 1px solid var(--lc-accent-border);
    box-shadow: 0 4px 20px rgba(15, 23, 42, .07), 0 1px 4px rgba(15, 23, 42, .04);
}

/* Top accent line */
.ielts-launcher-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--lc-accent);
    border-radius: 20px 20px 0 0;
    pointer-events: none;
}

/* ── Module colour tokens ── */
.ielts-launcher-card-module-reading {
    --lc-accent: #2563eb;
    --lc-accent-muted: rgba(37, 99, 235, .1);
    --lc-accent-border: #bfdbfe;
    --lc-icon-from: #1d4ed8;
    --lc-icon-to: #3b82f6;
    --lc-bg-tint: #eff6ff;
}

.ielts-launcher-card-module-listening {
    --lc-accent: #0f766e;
    --lc-accent-muted: rgba(15, 118, 110, .1);
    --lc-accent-border: #99f6e4;
    --lc-icon-from: #115e59;
    --lc-icon-to: #0d9488;
    --lc-bg-tint: #f0fdfa;
}

.ielts-launcher-card-module-writing {
    --lc-accent: #c2410c;
    --lc-accent-muted: rgba(194, 65, 12, .1);
    --lc-accent-border: #fed7aa;
    --lc-icon-from: #9a3412;
    --lc-icon-to: #ea580c;
    --lc-bg-tint: #fff7ed;
}

.ielts-launcher-card-module-speaking {
    --lc-accent: #be185d;
    --lc-accent-muted: rgba(190, 24, 93, .1);
    --lc-accent-border: #fbcfe8;
    --lc-icon-from: #9d174d;
    --lc-icon-to: #db2777;
    --lc-bg-tint: #fdf2f8;
}

.ielts-launcher-card-mock {
    --lc-accent: #15803d;
    --lc-accent-muted: rgba(21, 128, 61, .1);
    --lc-accent-border: #dcfce7;
    --lc-icon-from: #15803d;
    --lc-icon-to: #22c55e;
    --lc-bg-tint: rgba(220, 252, 231, .67);
}

/* Style 1 mock — border shifts by state */
.ielts-launcher-style-1.ielts-launcher-card-mock.is-in_progress {
    border-color: #fde68a;
}

.ielts-launcher-style-1.ielts-launcher-card-mock.is-done {
    border-color: #bbf7d0;
}

/* ── Row 1: icon + module label ── */
.ielts-launcher-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.ielts-launcher-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--lc-icon-from) 0%, var(--lc-icon-to) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px var(--lc-accent-muted);
}

.ielts-launcher-icon svg {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
}

.ielts-launcher-module-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--lc-accent);
    line-height: 1.2;
}

/* ── Row 2: test title ── */
.ielts-launcher-title {
    margin: 0;
    font-size: clamp(1.1rem, 2.2vw, 1.28rem);
    font-weight: 800;
    line-height: 1.22;
    letter-spacing: -0.02em;
    color: #0f172a;
    position: relative;
    z-index: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Row 3: stats ── */
.ielts-launcher-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.ielts-launcher-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(15, 23, 42, .08);
    color: #374151;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.ielts-launcher-stat svg {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
}

.ielts-launcher-stat-time svg {
    color: var(--lc-accent);
}

.ielts-launcher-stat-stack svg {
    color: #b45309;
}

.ielts-launcher-stat-users svg {
    color: #059669;
}

/* Screen-reader only text */
.ielts-launcher-sr {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ── Row 4: divider + status ── */
.ielts-launcher-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.ielts-launcher-divider {
    flex: 1;
    height: 1px;
    background: rgba(15, 23, 42, .1);
    display: block;
}

.ielts-launcher-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}

.ielts-launcher-status-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}

.ielts-launcher-status.is-new {
    color: #94a3b8;
}

.ielts-launcher-status.is-progress {
    color: #2563eb;
}

.ielts-launcher-status.is-done {
    color: #16a34a;
}

.ielts-launcher-status.is-pending {
    color: #d97706;
}

/* ── Row 5: action buttons ── */
.ielts-launcher-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.ielts-launcher-form {
    margin: 0;
    display: contents;
}

.ielts-launcher-form-full {
    display: block;
    width: 100%;
}

.ielts-launcher-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    border: none;
}

.ielts-launcher-btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.ielts-launcher-btn:focus-visible {
    outline: 2px solid var(--lc-accent);
    outline-offset: 3px;
}

/* Full-width modifier */
.ielts-launcher-btn-full {
    width: 100%;
}

/* Primary — green CTA (Start Test / Continue / Retake) */
.ielts-launcher-btn-primary {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 56%, #15803d 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(22, 163, 74, .28), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.ielts-launcher-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(22, 163, 74, .32), inset 0 1px 0 rgba(255, 255, 255, .18);
    filter: saturate(1.05);
}

.ielts-launcher-btn-primary:active {
    transform: none;
    box-shadow: 0 4px 10px rgba(22, 163, 74, .22);
}

/* Secondary — outline (Restart) */
.ielts-launcher-btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, .8);
    color: #374151;
    border: 1.5px solid rgba(15, 23, 42, .14);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}

.ielts-launcher-btn-secondary:hover {
    background: #fff;
    border-color: rgba(15, 23, 42, .22);
    transform: translateY(-1px);
}

/* Results — outline with accent (go to dashboard) */
.ielts-launcher-btn-results {
    flex: 1;
    background: rgba(255, 255, 255, .8);
    color: var(--lc-accent);
    border: 1.5px solid var(--lc-accent-border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}

.ielts-launcher-btn-results:hover {
    background: var(--lc-accent-muted);
    transform: translateY(-1px);
}

/* Retake — solid accent (done state) */
.ielts-launcher-btn-retake {
    flex: 1;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 56%, #15803d 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 163, 74, .24), inset 0 1px 0 rgba(255, 255, 255, .15);
}

.ielts-launcher-btn-retake:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(22, 163, 74, .3);
    filter: saturate(1.05);
}

/* ── Context override: inside lesson source stack (2-col grid) ── */
.ielts-course-lesson-source-stack .ielts-launcher-wrap {
    max-width: 420px;
    margin: 0 auto;
    padding: 0;
    width: 100%;
}

/* ── Course lesson view override (single card, wider) ── */
.ielts-course-lesson-stage.is-launcher .ielts-launcher-wrap {
    max-width: 420px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-card:not(.ielts-launcher-style-2) {
    padding: 22px 22px 20px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 13px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-icon svg {
    width: 24px;
    height: 24px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-title {
    font-size: clamp(1.1rem, 2.2vw, 1.28rem);
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-btn {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: .92rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .ielts-launcher-wrap {
        margin: 12px auto;
        padding: 0 8px;
    }

    .ielts-launcher-card {
        padding: 18px 18px 16px;
        border-radius: 16px;
        gap: 14px;
    }

    .ielts-launcher-icon {
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        border-radius: 11px;
    }

    .ielts-launcher-icon svg {
        width: 22px;
        height: 22px;
    }

    .ielts-launcher-title {
        font-size: clamp(1rem, 4.8vw, 1.18rem);
    }

    .ielts-launcher-stats {
        gap: 6px;
    }

    .ielts-launcher-stat {
        padding: 5px 10px;
        font-size: 0.76rem;
    }

    .ielts-launcher-btn {
        padding: 12px 14px;
        font-size: 0.88rem;
    }
}

@media (max-width: 420px) {
    .ielts-launcher-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
        gap: 6px;
    }

    .ielts-launcher-stat {
        justify-content: center;
        min-width: 0;
    }

    .ielts-launcher-actions {
        flex-direction: column;
    }

    .ielts-launcher-btn-results,
    .ielts-launcher-btn-retake,
    .ielts-launcher-btn-secondary {
        flex: none;
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STYLE 2 — Top Accent Strip
   ═══════════════════════════════════════════════════════════════════════════ */

/* Derived gradient token (uses existing --lc-icon-from / --lc-icon-to) */
.ielts-launcher-card {
    --lc-grad: linear-gradient(140deg, var(--lc-icon-from) 0%, var(--lc-icon-to) 100%);
}

.ielts-launcher-style-2 {
    background: #fff;
    border: 1.5px solid #e8edf3;
    box-shadow: 0 4px 20px rgba(15, 23, 42, .08), 0 1px 4px rgba(15, 23, 42, .03);
    padding: 0;
    gap: 0;
}

.ielts-launcher-style-2::before {
    display: none;
}

/* Colored header strip */
.ielts-launcher-strip {
    background: var(--lc-grad);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.ielts-launcher-style-2 .ielts-launcher-header {
    gap: 11px;
}

.ielts-launcher-style-2 .ielts-launcher-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .2);
    box-shadow: none;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.ielts-launcher-style-2 .ielts-launcher-icon svg {
    width: 20px;
    height: 20px;
}

.ielts-launcher-style-2 .ielts-launcher-module-label {
    color: rgba(255, 255, 255, .95);
}

/* Header state chip */
.ielts-launcher-header-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .25);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.ielts-launcher-header-chip svg {
    width: 11px;
    height: 11px;
    flex: 0 0 auto;
}

/* White body below strip */
.ielts-launcher-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    position: relative;
    z-index: 1;
}

/* Text-mode stats (no pill borders) */
.ielts-launcher-stats-text {
    gap: 14px;
    flex-wrap: nowrap;
}

.ielts-launcher-stats-text .ielts-launcher-stat {
    background: transparent;
    border: none;
    padding: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
}

.ielts-launcher-stats-text .ielts-launcher-stat svg {
    color: #94a3b8;
}

/* Score card — shown in done state (Styles 2 & 3) */
.ielts-launcher-score-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    position: relative;
    z-index: 1;
}

.ielts-launcher-score-badge {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #dcfce7;
    border: 2px solid #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 900;
    color: #15803d;
    line-height: 1;
}

.ielts-launcher-score-text {
    flex: 1;
    min-width: 0;
}

.ielts-launcher-score-label {
    display: block;
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #15803d;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.ielts-launcher-score-sub {
    display: block;
    margin: 0;
    font-size: 0.78rem;
    color: #166534;
    font-weight: 600;
}

/* Course view overrides for Style 2 */
.ielts-course-lesson-stage.is-launcher .ielts-launcher-style-2 {
    padding: 0;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-style-2 .ielts-launcher-strip {
    padding: 18px 22px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-style-2 .ielts-launcher-body {
    padding: 22px;
    gap: 16px;
}

.ielts-course-lesson-stage.is-launcher .ielts-launcher-style-2 .ielts-launcher-icon {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STYLE 3 — Tinted State Card
   ═══════════════════════════════════════════════════════════════════════════ */

.ielts-launcher-style-3 {
    background: var(--lc-bg-tint);
    border-color: var(--lc-accent-border);
    box-shadow: 0 2px 16px rgba(15, 23, 42, .06);
}

.ielts-launcher-style-3::before {
    display: none;
}

/* State-based background tints */
.ielts-launcher-style-3.is-in_progress {
    background: rgba(254, 249, 195, .67);
    border-color: #fde68a;
}

.ielts-launcher-style-3.is-done {
    background: rgba(220, 252, 231, .67);
    border-color: #86efac;
}

.ielts-launcher-style-3.is-pending_review {
    background: rgba(254, 243, 199, .67);
    border-color: #fde68a;
}

/* Header: icon+label LEFT, state chip RIGHT */
.ielts-launcher-style-3 .ielts-launcher-header {
    justify-content: space-between;
}

.ielts-launcher-icon-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Floating state chip */
.ielts-launcher-state-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.ielts-launcher-state-chip svg {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
}

.ielts-launcher-state-chip.is-new {
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(255, 255, 255, .9);
    color: #94a3b8;
}

.ielts-launcher-state-chip.is-progress {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.ielts-launcher-state-chip.is-done {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.ielts-launcher-state-chip.is-pending {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* Style 3 score card: frosted glass look */
.ielts-launcher-style-3 .ielts-launcher-score-card {
    background: rgba(255, 255, 255, .8);
    border-color: rgba(255, 255, 255, .95);
}

.ielts-launcher-style-3 .ielts-launcher-score-badge {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    font-weight: 900;
    color: #15803d;
    border-radius: 0;
    line-height: 1;
}

/* Score breakdown card — mock Style 2 done state */
.ielts-launcher-score-breakdown {
    padding: 10px 14px;
    border-radius: 10px;
    background: #dcfce7;
    border: 1px solid #86efac;
    position: relative;
    z-index: 1;
}

.ielts-launcher-score-breakdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.ielts-launcher-score-breakdown-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #14532d;
}

.ielts-launcher-score-breakdown-band {
    font-size: 1.1rem;
    font-weight: 900;
    color: #15803d;
    line-height: 1;
}

.ielts-launcher-score-breakdown-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ielts-launcher-score-breakdown-meta span {
    font-size: 0.68rem;
    font-weight: 700;
    color: #14532d;
    letter-spacing: .02em;
}

/* Responsive for new styles */
@media (max-width: 640px) {
    .ielts-launcher-strip {
        padding: 12px 16px;
    }

    .ielts-launcher-body {
        padding: 14px 16px;
    }

    .ielts-launcher-stats-text {
        flex-wrap: wrap;
    }
}
