/**
 * Copyright (c) 2024-2026 IZU IO LTD. All rights reserved.
 * This is proprietary software. Unauthorized copying or distribution is prohibited.
 */

/* ============================================================
   Speech Genie Web Demo — Styles
   ============================================================ */

:root {
    /* Brand palette (from Kadence second-palette) */
    --sg-accent: #3b9fd8;        /* sky blue — primary accent */
    --sg-blue: #1e3a5f;          /* deep navy — primary dark */
    --sg-blue-light: #336383;    /* steel blue — headers */
    --sg-blue-pale: #e5e7eb;     /* pale grey — borders */
    --sg-cream: #f9f6f2;         /* cream — site bg */
    --sg-cream-dark: #e5e7eb;    /* borders */
    --sg-gold: #D6B00F;          /* gold — highlights only */
    --sg-gold-light: #e9a22b;    /* amber */
    --sg-text: #6b7280;          /* body text grey */
    --sg-text-light: #9ca3af;    /* secondary text */
    --sg-green: #27ae60;
    --sg-red: #e74c3c;
    --sg-orange: #f28b6d;        /* salmon info */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* PWA: prevent pull-to-refresh, rubber-banding, text selection */
html { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #fff;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    background: #16213e;
    position: relative;
}

/* ---- Header ---- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--sg-blue);
    flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.btn-back {
    background: none;
    border: none;
    color: var(--sg-accent);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.btn-back.visible {
    opacity: 1;
    pointer-events: auto;
}
.logo {
    background: var(--sg-accent);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.logo:hover { opacity: 0.85; }
.header-title { font-size: 14px; font-weight: 600; opacity: 0.9; }
.header-center { font-size: 13px; opacity: 0.8; text-align: center; flex: 1; }
.header-right { font-size: 12px; opacity: 0.7; }

/* ---- Course progress bar (compact) ---- */
#course-progress-bar {
    position: relative;
    height: 22px;
    background: rgba(0,0,0,0.3);
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
}
#course-progress-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--sg-accent);
    opacity: 0.35;
    width: 0%;
    transition: width 0.5s ease;
}
#course-progress-label {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    letter-spacing: 0.3px;
}

/* ---- Picker tools (Designer mode, reset) ---- */
.picker-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 16px;
}
.designer-toggle {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}
.designer-toggle input { cursor: pointer; }
.picker-reset {
    font-size: 12px;
    color: var(--sg-red, #e74c3c);
    opacity: 0.7;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
}
.picker-reset:hover { opacity: 1; }

/* ---- Designer mode buttons ---- */
.designer-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px auto 0;
    padding: 10px 0;
    border-top: 1px dashed rgba(255,255,255,0.15);
}
.btn-designer-prev {
    padding: 8px 20px;
    background: rgba(255,255,255,0.1);
    border: 1px dashed rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}
.btn-designer-prev:hover {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}
.btn-designer-next {
    padding: 8px 20px;
    background: var(--sg-accent);
    border: none;
    color: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.btn-designer-next:hover { opacity: 0.85; }
.btn-designer-skip {
    padding: 8px 20px;
    background: rgba(255,255,255,0.1);
    border: 1px dashed rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.6);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
}
.btn-designer-skip:hover {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}
.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    color: rgba(255,255,255,0.5);
}

/* ---- Exercise progress bar ---- */
#progress-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0;
}
#progress-fill {
    height: 100%;
    background: var(--sg-accent);
    width: 0%;
    transition: width 0.4s ease;
}

/* ---- Screens ---- */
.screen {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
}
.screen.active { display: flex; flex-direction: column; }

/* ---- Loading ---- */
#screen-loading {
    align-items: center;
    justify-content: center;
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--sg-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Exercise Type Filter ---- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
    padding: 12px 0;
}
.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.filter-action-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 4px;
}
.filter-action-btn:hover {
    color: rgba(255,255,255,0.8);
}
.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.25);
    color: rgba(255,255,255,0.35);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: line-through;
}
.filter-chip.active {
    border-color: var(--chip-color, var(--sg-accent));
    background: var(--chip-color, var(--sg-accent));
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.filter-chip:hover {
    border-color: var(--chip-color, rgba(59,159,216,0.5));
    background: color-mix(in srgb, var(--chip-color, #3b9fd8) 30%, transparent);
}

/* ---- Course Selector ---- */
.courses-wrap {
    padding: 24px 20px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}
.courses-heading {
    font-size: 20px;
    color: var(--sg-gold);
    text-align: center;
    margin-bottom: 24px;
}
.course-card {
    position: relative;
    background: rgba(59, 159, 216, 0.08);
    border: 2px solid rgba(59, 159, 216, 0.25);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.course-card:hover {
    border-color: var(--sg-accent);
    background: rgba(59, 159, 216, 0.15);
    transform: translateY(-1px);
}
.course-card:active {
    transform: translateY(0);
}
.course-badge {
    display: inline-block;
    background: var(--sg-green);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.course-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.course-card-desc {
    font-size: 13px;
    color: var(--sg-text-light);
    line-height: 1.4;
}

.picker-change-course {
    display: block;
    margin: 0 auto 12px;
    font-size: 13px;
    padding: 6px 16px;
}

/* ---- Stage/Lesson Picker ---- */
.picker-wrap {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}
.picker-wrap h1 {
    font-size: 20px;
    color: var(--sg-gold);
    text-align: center;
    margin-bottom: 20px;
}
.picker-stage {
    margin-bottom: 16px;
}
.picker-stage-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    padding: 12px 16px;
    background: var(--sg-blue-light);
    border-left: 4px solid var(--sg-accent);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
}
.picker-stage-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.stage-progress {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
}
.picker-stage-title:hover {
    background: #3d7a9e;
}
.stage-progress-bar {
    height: 3px;
    background: rgba(255,255,255,0.1);
}
.stage-progress-fill {
    height: 100%;
    background: var(--sg-accent);
    transition: width 0.3s;
}
.picker-stage.collapsed .picker-stage-title {
    border-radius: 8px;
}
.picker-stage.collapsed .stage-progress-bar {
    display: none;
}
.picker-stage.collapsed .picker-lessons {
    display: none;
}
/* Greyed-out stages (no exercises matching filter) */
.picker-stage.stage-greyed {
    opacity: 0.35;
    pointer-events: none;
}
.picker-stage.stage-greyed .picker-stage-title {
    background: rgba(255,255,255,0.05);
}
/* Per-type filter count labels (inline in stage title) */
.stage-filter-labels {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
    padding-left: 8px;
}
.stage-filter-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255,255,255,0.2);
}
.picker-lessons {
    border: 1px solid rgba(255,255,255,0.08);
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.picker-lesson-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.picker-lesson-btn.completed {
    opacity: 0.7;
}
.lesson-check {
    color: var(--sg-accent);
    font-weight: 700;
    margin-right: 8px;
    font-size: 16px;
}
.picker-lesson-btn:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}
.picker-lesson-btn:hover {
    background: rgba(255,255,255,0.08);
}
.picker-lesson-name {
    flex: 1;
}
.picker-lesson-count {
    font-size: 12px;
    opacity: 0.5;
    margin-left: 8px;
}
.btn-secondary {
    display: inline-block;
    padding: 10px 24px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: rgba(255,255,255,0.7);
    transition: all 0.15s;
}
.btn-secondary:hover {
    border-color: var(--sg-gold);
    color: var(--sg-gold);
}

/* ---- Intro / Complete cards ---- */
.intro-card {
    text-align: center;
    margin: auto;
    padding: 40px 20px;
}
.intro-card h1 { font-size: 24px; margin-bottom: 12px; color: var(--sg-gold); }
.intro-card h2 { font-size: 18px; margin-bottom: 8px; opacity: 0.8; }
.intro-card p { font-size: 14px; opacity: 0.6; margin-bottom: 24px; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--sg-gold); color: #fff; }
.btn-primary:hover { background: var(--sg-gold-light); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ---- Exercise container ---- */
#exercise-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ---- Exercise header ---- */
.exercise-header {
    text-align: center;
    margin-bottom: 16px;
}
.exercise-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.badge-l2b { background: var(--sg-green); }
.badge-haai { background: var(--sg-orange); }
.badge-sr { background: #8e44ad; }
.badge-content { background: var(--sg-blue-light); }
.badge-gate { background: var(--sg-red); }
.badge-meter { background: var(--sg-blue); }
.badge-test { background: #2c3e50; }
.exercise-title { font-size: 16px; opacity: 0.8; }
.exercise-instruction { font-size: 13px; opacity: 0.5; margin-top: 4px; }

/* ---- Navigation ---- */
.exercise-nav {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    margin-top: auto;
    flex-shrink: 0;
}
.exercise-nav .btn { flex: 1; text-align: center; }

/* ============================================================
   L2B Training
   ============================================================ */
.l2b-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Target zone — drop zone below grid */
.l2b-target {
    width: 160px;
    height: 160px;
    border: 3px dashed rgba(255,255,255,0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 30px;
    transition: all 0.3s;
    position: relative;
}
.l2b-target.highlight {
    border-color: var(--sg-gold);
    background: rgba(184, 151, 106, 0.1);
}
.l2b-target.correct {
    border-color: var(--sg-green);
    background: rgba(39, 174, 96, 0.15);
}
.l2b-target-label {
    font-size: 12px;
    opacity: 0.4;
    position: absolute;
    bottom: -20px;
}

/* Grid of images — uses 4-col base for Big/Tile mixing */
.l2b-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-flow: dense;
    gap: 8px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}
.l2b-grid.l2b-grid-3x3 {
    grid-template-columns: repeat(3, 1fr);
}
.l2b-grid.l2b-grid-mixed {
    grid-template-columns: repeat(4, 1fr);
}

/* Big tiles span 2×2 in the grid */
.l2b-tile--big {
    grid-column: span 2;
    grid-row: span 2;
    border-color: rgba(184, 151, 106, 0.5);
}
.l2b-tile--big:hover {
    border-color: var(--sg-gold);
}
.l2b-tile {
    aspect-ratio: 1;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.2s;
    position: relative;
    border: 3px solid transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.l2b-tile:active { cursor: grabbing; }
.l2b-tile.dragging { opacity: 0.4; transform: scale(0.95); }
.l2b-tile:hover { transform: scale(1.05); }
.l2b-tile.correct { border-color: var(--sg-green); }
.l2b-tile.wrong { border-color: var(--sg-red); animation: shake 0.4s; }
.l2b-tile.dimmed { opacity: 0.3; pointer-events: none; }

/* Floating ghost tile during touch drag */
.l2b-tile-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.85;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    border: 3px solid var(--sg-gold);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.l2b-target.wrong-shake { animation: shake 0.4s; }
.l2b-tile img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}
.l2b-tile .tile-check {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}
.tile-check.ok { background: var(--sg-green); }
.tile-check.fail { background: var(--sg-red); }

/* L2B Intro — full-screen concept card (Big MMU introduction phase) */
.l2b-intro {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.l2b-intro-counter {
    font-size: 13px;
    opacity: 0.5;
    margin-bottom: 16px;
}
.l2b-intro-card {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    animation: fadeScaleIn 0.4s ease-out;
}
.l2b-intro-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}
.l2b-intro-text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    max-width: 340px;
}
.l2b-intro-next {
    margin-top: 20px;
    min-width: 140px;
}
@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Audio play button */
.audio-btn {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--sg-blue);
    border: 2px solid var(--sg-gold);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
    transition: all 0.2s;
}
.audio-btn:hover { background: var(--sg-blue-light); }
.audio-btn.playing { background: var(--sg-gold); animation: pulse 1s infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(184, 151, 106, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(184, 151, 106, 0); }
}

/* L2B instance counter */
.l2b-counter {
    font-size: 13px;
    opacity: 0.5;
    margin-bottom: 12px;
}

/* ============================================================
   HAAI (How Awesome Am I)
   ============================================================ */
.haai-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.haai-stimulus {
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
}
.haai-stimulus-text {
    font-size: 28px;
    font-weight: 700;
}
.haai-stimulus-image {
    width: 140px; height: 140px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}
.haai-stimulus-image img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 8px;
}

.haai-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}
.haai-option {
    background: #fff;
    border: 3px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}
.haai-option:hover { background: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.3); }
.haai-option.correct { border-color: var(--sg-green); background: rgba(39, 174, 96, 0.2); }
.haai-option.wrong { border-color: var(--sg-red); background: rgba(231, 76, 60, 0.2); }
.haai-option.haai-eliminated { opacity: 0.25; pointer-events: none; filter: grayscale(1); transition: opacity 0.4s, filter 0.4s; }
.haai-score-big { font-size: 3em; font-weight: 700; color: var(--sg-blue); margin: 0.3em 0; }
.haai-score-detail { font-size: 0.9em; color: var(--sg-text-light); margin-bottom: 1em; }
.haai-needs-review { display: flex; flex-wrap: wrap; gap: 0.75em; justify-content: center; }
.haai-review-item { display: flex; align-items: center; gap: 0.5em; background: rgba(231,76,60,0.08); border-radius: 8px; padding: 0.5em 0.75em; }
.haai-summary { text-align: center; }
.haai-option.previewing {
    border-color: var(--sg-gold);
    background: rgba(184, 151, 106, 0.2);
    transform: scale(1.03);
}
.haai-confirm {
    text-align: center;
    margin-top: 16px;
}
.haai-confirm-btn {
    padding: 10px 28px;
    font-size: 15px;
}
.haai-confirm-btn:disabled {
    opacity: 0.3;
}
.haai-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.haai-option-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--sg-text, #2C3E50);
}
.haai-option .audio-play-icon {
    font-size: 28px;
    color: var(--sg-text, #2C3E50);
    opacity: 0.7;
}
.haai-option-label {
    font-size: 11px;
    color: var(--sg-text, #2C3E50);
    opacity: 0.4;
    margin-top: 4px;
}
.haai-option.previewing .haai-option-label {
    opacity: 0.8;
    color: var(--sg-gold);
}
.haai-option.previewing .haai-option-label::after {
    content: ' ✓';
}
.haai-counter {
    font-size: 13px;
    opacity: 0.5;
    margin-bottom: 8px;
}
.haai-score {
    font-size: 15px;
    color: var(--sg-gold);
    margin-top: auto;
    padding: 16px 0 8px;
}

/* ============================================================
   Self Recording
   ============================================================ */
.sr-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.sr-image {
    width: 200px; height: 200px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 16px;
}
.sr-image img {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 8px;
}
.sr-text-display {
    text-align: center;
    margin-bottom: 16px;
}
.sr-text-target {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}
.sr-text-source {
    font-size: 16px;
    opacity: 0.5;
}
.sr-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    margin: 16px 0;
}
.sr-btn {
    width: 60px; height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #fff;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.sr-btn .sr-ring {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}
.sr-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 3;
}
.sr-ring-fill {
    fill: none;
    stroke: rgba(255,255,255,0.6);
    stroke-width: 3;
    stroke-dasharray: 169.65; /* 2*PI*27 */
    stroke-dashoffset: 169.65;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.05s linear;
}
.sr-ring-rec { stroke: #e74c3c; }
.sr-ring-pb { stroke: #2ecc71; }
.sr-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
/* Play original button */
.sr-play-btn { background: rgba(255,255,255,0.08); }
.sr-play-btn.active { background: rgba(255,255,255,0.15); }
/* Record button */
.sr-record-btn { background: #e74c3c; }
.sr-record-btn.recording {
    background: rgba(231, 76, 60, 0.4);
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(231, 76, 60, 0); }
}
/* Playback button */
.sr-playback-btn { background: rgba(255,255,255,0.05); }
.sr-playback-btn.has-recording { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.sr-playback-btn.active { background: rgba(46, 204, 113, 0.25); color: #2ecc71; }
.sr-btn:disabled { opacity: 0.25; cursor: not-allowed; }
.sr-status {
    font-size: 12px;
    opacity: 0.5;
    margin-top: 4px;
    text-align: center;
}
.sr-counter {
    font-size: 13px;
    opacity: 0.5;
    margin-bottom: 12px;
}

/* ============================================================
   Content items (video, audio, HTML)
   ============================================================ */
.content-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 12px 16px;
    overflow: hidden;
}
.content-wrap:has(.content-html) {
    justify-content: flex-start;
    overflow-y: auto;
}
.content-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}
.content-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}
.content-desc {
    font-size: 14px;
    opacity: 0.5;
    margin-bottom: 20px;
    max-width: 300px;
}

/* Content media */
.content-media {
    width: 100%;
    max-width: 480px;
    margin: 12px auto;
}
.content-video {
    width: 100%;
    border-radius: 8px;
    background: #000;
    max-height: 300px;
}
.content-image {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 8px;
}
.content-html {
    text-align: left;
    font-size: 15px;
    line-height: 1.8;
    color: rgba(255,255,255,0.9);
    width: 100%;
    max-width: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin: 8px 0 0;
}
.content-html p { margin: 0 0 12px; }
.content-html h2, .content-html h3 { color: var(--sg-gold); margin: 16px 0 8px; }
.content-lyrics {
    white-space: pre-wrap;
    font-style: italic;
}
.content-audio-player {
    margin: 16px 0;
}
.content-play-btn {
    width: 56px;
    height: 56px;
    font-size: 24px;
}

/* True/False */
.tf-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}
.tf-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 400px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.tf-card:hover { background: rgba(255,255,255,0.1); }
.tf-card-active {
    border-color: var(--sg-gold);
    background: rgba(184,151,106,0.1);
}
.tf-card-play {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.tf-card-body { flex: 1; }
.tf-card-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--sg-gold);
    margin-bottom: 2px;
}
.tf-card-text {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
    line-height: 1.4;
}
.tf-question {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    text-align: center;
    margin: 16px 0;
    max-width: 320px;
}
.tf-buttons {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}
.tf-btn {
    padding: 14px 36px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.tf-btn-true {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
.tf-btn-true:hover { background: rgba(255,255,255,0.15); }
.tf-btn-false {
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}
.tf-btn-false:hover { background: rgba(255,255,255,0.15); }
.tf-correct {
    background: var(--sg-green) !important;
    color: #fff !important;
    border-color: var(--sg-green) !important;
}
.tf-wrong {
    background: var(--sg-red) !important;
    color: #fff !important;
    border-color: var(--sg-red) !important;
    animation: shake 0.4s;
}
.tf-btn:disabled { opacity: 0.4; cursor: default; }
/* Feedback */
.tf-feedback {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    animation: fadeScaleIn 0.3s ease-out;
}
.tf-feedback-icon {
    font-size: 40px;
    margin-bottom: 8px;
}
.tf-feedback-ok { color: var(--sg-green); }
.tf-feedback-fail { color: var(--sg-red); }
.tf-feedback-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
}
.tf-feedback-hint {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-top: 8px;
    margin-bottom: 4px;
}
.tf-go-on {
    margin-top: 16px;
    min-width: 160px;
}
.badge-tf {
    background: #8e44ad;
}
.tf-hidden {
    display: none !important;
}

/* Multiple Choice */
.mc-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
}
.mc-question-image {
    width: 100%;
    max-width: 200px;
    margin-bottom: 16px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}
.mc-question-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}
.mc-question-text {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin-bottom: 16px;
    max-width: 400px;
}
.mc-audio {
    margin-bottom: 20px;
}
.mc-options {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mc-option {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mc-option:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.3);
}
.mc-option-play {
    font-size: 12px;
    opacity: 0.6;
}
.mc-option.mc-selected {
    background: rgba(184, 151, 106, 0.2);
    border-color: var(--sg-gold);
}
.mc-option.mc-disabled {
    pointer-events: none;
    opacity: 0.7;
}
.mc-report {
    width: 100%;
    max-width: 400px;
    margin: 20px 0;
}
.mc-report-header {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}
.mc-results-btn {
    width: 100%;
    max-width: 300px;
}

/* Gate */
.gate-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.gate-icon { font-size: 64px; margin-bottom: 16px; }
.gate-text { font-size: 16px; opacity: 0.6; margin-bottom: 20px; }

/* Meter */
.meter-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.meter-visual {
    width: 200px; height: 200px;
    border-radius: 50%;
    border: 8px solid var(--sg-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}
.meter-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--sg-gold);
}
.meter-label {
    font-size: 14px;
    opacity: 0.6;
}

/* ============================================================
   Score summary
   ============================================================ */
#score-summary {
    margin: 20px 0;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
.score-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 14px;
}
.score-row .label { opacity: 0.7; }
.score-row .value { font-weight: 600; color: var(--sg-gold); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-height: 700px) {
    .l2b-target { width: 120px; height: 120px; }
    .l2b-grid { gap: 6px; }
    .haai-stimulus { padding: 12px; }
}
