/* ============================================
   LIVE QUIZ — Design System v4.1
   Theme: Light Premium with Optional Dark Mode
   Layout: Vertical 3-step flow
   ============================================ */

@import "fonts.css";

/* ---------- CSS Custom Properties ---------- */
:root {
    /* Core palette */
    --primary: #1155D6;
    --primary-light: #4d80e8;
    --primary-dark: #0d44b5;
    --primary-glow: rgba(17, 85, 214, 0.22);
    --accent: #0ea5a0;
    --accent-light: #38bdf8;

    /* Backgrounds */
    --bg-page: #f0f2f8;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbff;
    --bg-subtle: #f7f8fc;
    --bg-input: #f4f5fa;

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #334155;
    --text-muted: #475569;
    /* Darkened for 4.5:1 contrast against #f0f2f8 */
    --text-on-primary: #ffffff;

    /* Borders & shadows */
    --border: #dce3f0;
    --border-focus: var(--primary);
    --shadow-sm: 0 2px 8px rgba(17, 85, 214, 0.06);
    --shadow-md: 0 4px 20px rgba(17, 85, 214, 0.08);
    --shadow-lg: 0 8px 40px rgba(17, 85, 214, 0.12);
    --shadow-glow: 0 0 30px rgba(17, 85, 214, 0.18);

    /* Status */
    --success: #00b894;
    --success-bg: #e6f9f3;
    --error: #d63031;
    --error-bg: #fde8e8;
    --warning: #f39c12;
    --warning-bg: #fef9e7;

    /* Radius & spacing */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
    --bg-page: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.85);
    --bg-card-hover: rgba(51, 65, 85, 0.9);
    --bg-subtle: rgba(51, 65, 85, 0.5);
    --bg-input: rgba(15, 23, 42, 0.6);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    /* Lightened for contrast against dark backgrounds */

    --border: rgba(17, 85, 214, 0.18);
    --border-focus: var(--primary-light);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(17, 85, 214, 0.35);

    --success-bg: rgba(0, 184, 148, 0.15);
    --error-bg: rgba(214, 48, 49, 0.15);
    --warning-bg: rgba(243, 156, 18, 0.15);
}

[data-theme="dark"] .step-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(17, 85, 214, 0.15);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header ---------- */
.app-header {
    width: 100%;
    padding: 14px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 8px;
}

/* Header Stepper */
.header-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: 30px;
}

.stepper-step {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.stepper-num {
    color: var(--primary);
    font-weight: 800;
    font-size: 1.1rem;
}

.stepper-dot {
    color: var(--border);
    font-size: 1.4rem;
    line-height: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.header-logo-wrapper {
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-logo-wrapper img {
    width: 145%;
    /* Zoom pour masquer le fond gris */
    height: 145%;
    object-fit: cover;
}

.header-brand span {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.header-link:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(17, 85, 214, 0.06);
    transform: translateY(-1px);
}

.header-link i {
    font-size: 0.85rem;
}

/* Accès élève — Accent button (non-blue) */
.header-link-eleve {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3);
    font-weight: 700;
}

.header-link-eleve:hover {
    background: linear-gradient(135deg, #047857, #059669);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(5, 150, 105, 0.45);
    transform: translateY(-2px);
}

/* Theme toggle */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    padding: 0;
    margin: 0;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(17, 85, 214, 0.06);
    transform: translateY(-1px);
}

/* ---------- Main Container ---------- */
.main-container {
    width: 90%;
    max-width: 1400px;
    padding: 30px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
    margin: 0 auto;
}

/* ---------- Step Cards ---------- */
.step-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 28px 32px;
    position: relative;
    transition: box-shadow var(--transition-base), transform var(--transition-base);
    opacity: 0;
    width: 100%;
    overflow: visible;
}

/* Ensure the questions step sits above step 2/3 so dropdown menus are not clipped */
#step-questions {
    z-index: 2;
}


.step-card:not(.reveal) {
    animation: fadeSlideIn 0.5s ease forwards;
}

.step-card:nth-child(1):not(.reveal) {
    animation-delay: 0.05s;
}

.step-card:nth-child(2):not(.reveal) {
    animation-delay: 0.15s;
}

.step-card:nth-child(3):not(.reveal) {
    animation-delay: 0.25s;
}

/* Scroll Reveal classes */
.step-card.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.step-card.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.step-card:hover {
    box-shadow: var(--shadow-lg);
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Step header with number badge */
.step-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.step-number {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.step-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.step-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

/* ---------- Step 1: 2-Column Question Layout ---------- */

/* Column label banners */
.q-col-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: -4px;
}

.q-col-label-manual {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

[data-theme="dark"] .q-col-label-manual {
    background: rgba(100, 116, 139, 0.15);
    color: #94a3b8;
}

.step1-tab-inner {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.step1-tab-inner>.q-block:first-child {
    flex: 2;
    /* Takes 2/3 of space */
    height: auto;
}

.step1-tab-inner>.q-block:last-child {
    flex: 1;
    /* Takes 1/3 of space */
    height: auto;
}

/* Retain separator inside merged block if needed */
.q-block-sep {
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

/* Bank select row */
.bank-select-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bank-select-row>label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.bank-select-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bank-select {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.88rem;
    background: var(--bg-card);
    /* Changed from bg-input */
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23334155' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C2.185 5.355 2.403 5 2.768 5h10.464c.365 0 .583.355.317.658l-4.796 5.482a.5.5 0 0 1-.74 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 10px) center;
    padding-right: 30px;
}

.bank-select:hover {
    border-color: var(--primary);
    background-color: var(--bg-subtle);
}

.bank-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Q-Block Cards */
.q-block {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 18px 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.q-block:hover {
    border-color: rgba(17, 85, 214, 0.3);
    box-shadow: var(--shadow-sm);
}

.q-block-clickable {
    cursor: pointer;
    align-items: center;
}

.q-block-clickable:hover {
    background: rgba(17, 85, 214, 0.04);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.q-block-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.q-block-body {
    flex: 1;
    min-width: 0;
}

.q-block-body h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.q-block-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.q-block-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    justify-content: center;
}

.q-block-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.q-block-clickable:hover .q-block-arrow {
    color: var(--primary);
    transform: translateX(3px);
}

/* Bank buttons grid */
.bank-buttons-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bank-btn {
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.bank-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(17, 85, 214, 0.04);
}

/* Small button variant */
.btn-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
}

/* Scroll-Snap Reveal Animations */
.step-card.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.step-card.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Keep step-card base animation for non-reveal cards */
.step-card:not(.reveal) {
    animation: fadeSlideIn 0.5s ease forwards;
    opacity: 0;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-family: 'Inter', sans-serif;
    width: auto;
    margin: 0;
}

.btn-action-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-action-secondary {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-action-secondary:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(17, 85, 214, 0.06);
    transform: translateY(-1px);
}

/* Custom Dropdown for Banks */
.bank-dropdown-container {
    position: relative;
    display: inline-block;
}

.bank-dropdown-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 280px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all var(--transition-base);
}

.bank-dropdown-list.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.bank-dropdown-item {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.bank-dropdown-item:last-child {
    border-bottom: none;
}

.bank-dropdown-item:hover {
    background: var(--bg-subtle);
}

.bank-dropdown-item-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.bank-dropdown-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.bank-dropdown-badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-college {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-lycee {
    background: #fef3c7;
    color: #92400e;
}

.badge-superieur {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-autre {
    background: #f3f4f6;
    color: #374151;
}

[data-theme="dark"] .badge-college {
    background: rgba(3, 105, 161, 0.2);
}

[data-theme="dark"] .badge-lycee {
    background: rgba(146, 64, 14, 0.2);
}

[data-theme="dark"] .badge-superieur {
    background: rgba(91, 33, 182, 0.2);
}

[data-theme="dark"] .badge-autre {
    background: rgba(55, 65, 81, 0.2);
}

/* Questions Table */
.questions-section {
    margin-top: 4px;
}

.questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.questions-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.questions-header .q-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 20px;
    margin-left: 8px;
}

/* Scroll wrapper pour la banque de questions */
.q-table-scroll {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.q-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.q-table thead {
    background: var(--bg-subtle);
}

.q-table th {
    text-align: left;
    padding: 12px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.q-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.q-table tbody tr:last-child td {
    border-bottom: none;
}

.q-table tbody tr:hover {
    background: var(--bg-subtle);
}

.q-table input,
.q-table textarea {
    width: 100%;
    padding: 7px 10px;
    margin: 0;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.84rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: 'Inter', sans-serif;
    box-sizing: border-box;
}

.q-table textarea {
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    min-height: 38px;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

.q-table input:focus,
.q-table textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-card);
}

.q-table .input-correct {
    border-color: var(--success);
    background: var(--success-bg);
}

.q-table .input-correct:focus {
    box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.15);
}

.q-table .input-wrong {
    border-color: #ff7675;
}

.q-table .input-duration {
    border-color: var(--warning);
    background: var(--warning-bg);
    width: 100%;
    max-width: 65px;
    text-align: center;
}

/* Drag handle colonne */
.q-table .drag-handle {
    color: var(--text-muted);
    cursor: grab;
    text-align: center;
    font-size: 0.85rem;
    padding: 8px 4px;
    user-select: none;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.q-table tr:hover .drag-handle {
    opacity: 1;
}

/* Bouton édition */
.btn-edit-q {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 3px;
    width: auto;
    margin: 0;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.btn-edit-q:hover {
    background: var(--bg-subtle);
    transform: scale(1.15);
}

/* Couleurs des en-têtes selon le type de colonne */
.q-table th.th-correct {
    color: var(--success);
}

.q-table th.th-wrong {
    color: #e17055;
}


.btn-delete-q {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 3px;
    width: auto;
    margin: 0;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.btn-delete-q:hover {
    color: var(--error);
    background: var(--error-bg);
    transform: scale(1.15);
}

.empty-table-msg {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 30px;
}

/* ---------- Step 2: Mode Switches (iOS-style pill) ---------- */
.custom-switch-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.custom-switch-layout {
    display: flex;
    align-items: center;
    gap: 16px;
    background: transparent;
}

.custom-switch-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-switch-label:hover {
    color: var(--text-primary);
}

.custom-switch-label.active {
    color: var(--primary);
}

.custom-switch-label i {
    font-size: 1.05rem;
}

.custom-switch-pill {
    position: relative;
    width: 64px;
    height: 34px;
    display: inline-block;
    cursor: pointer;
}

.custom-switch-pill input {
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.custom-switch-slider::before {
    content: "";
    position: absolute;
    height: 25px;
    width: 25px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.custom-switch-pill input:checked+.custom-switch-slider {
    background-color: rgba(17, 85, 214, 0.1);
    border-color: var(--primary);
}

.custom-switch-pill input:checked+.custom-switch-slider::before {
    transform: translateX(30px);
    background-color: var(--primary);
}

[data-theme="dark"] .custom-switch-slider {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .custom-switch-pill input:checked+.custom-switch-slider {
    background-color: rgba(17, 85, 214, 0.2);
    border-color: var(--primary);
}

[data-theme="dark"] .custom-switch-slider::before {
    background-color: var(--text-secondary);
}

[data-theme="dark"] .custom-switch-pill input:checked+.custom-switch-slider::before {
    background-color: var(--primary-light);
}

/* Tab content visibility */
.mode-tab-content {
    display: none;
    animation: fadeTabIn 0.3s ease;
}

.mode-tab-content.active {
    display: block;
}

@keyframes fadeTabIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Source Picker (Step 1) ---------- */
.source-picker {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.source-card {
    flex: 1;
    max-width: 420px;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.source-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: scale(1.02);
}

.source-card-icon {
    font-size: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.source-card-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.source-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Source detail panels */
.source-panel {
    animation: fadeTabIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.source-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 6px 0;
    transition: color var(--transition-fast);
}

.source-back-link:hover {
    color: var(--primary-dark, #0a47a0);
}

@media (max-width: 600px) {
    .source-picker {
        flex-direction: column;
        align-items: center;
    }
}

/* ---------- Options Accordion ---------- */
.options-accordion {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    margin-top: 16px;
    overflow: visible;
    /* les tooltips des option-cards doivent pouvoir dépasser */
}

.options-accordion summary {
    padding: 18px 24px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
}

.options-accordion summary::-webkit-details-marker {
    display: none;
}

.options-accordion summary::before {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform var(--transition-base);
}

.options-accordion[open] summary::before {
    transform: rotate(180deg);
}

.options-accordion summary:hover {
    color: var(--primary);
    background: rgba(0, 113, 227, 0.04);
}

.options-accordion .options-grid {
    padding: 50px 12px 18px;
    /* padding-top réservé à l'espace des tooltips */
}

/* Dark mode adjustments for new components */
[data-theme="dark"] .source-card {
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .options-accordion {
    border-color: rgba(255, 255, 255, 0.08);
}

/* Scan intro banner */
.scan-intro {
    text-align: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(14, 165, 160, 0.08), rgba(17, 85, 214, 0.06));
    border: 1px solid rgba(14, 165, 160, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.scan-intro h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.scan-intro p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Option input number (for scan config) */
.option-input-number {
    width: 70px;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.option-input-number:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-card);
}

/* Scan actions */
.scan-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Scan Card Configuration Panel */
.scan-card-config {
    margin-top: 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.scan-card-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.scan-card-config-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.scan-card-config-header h4 i {
    color: var(--primary);
}

.scan-card-config-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.scan-active-count {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    padding: 4px 12px;
    background: var(--primary-glow);
    border-radius: 20px;
}

.scan-card-grid-config {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.scan-card-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.scan-card-chip:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.scan-card-chip.inactive {
    opacity: 0.4;
    background: var(--bg-subtle);
}

.scan-card-chip.inactive .scan-card-name-input {
    pointer-events: none;
}

.scan-card-chip-num {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.scan-card-chip.inactive .scan-card-chip-num {
    background: var(--border);
    color: var(--text-muted);
}

.scan-card-chip-toggle {
    display: none;
}

.scan-card-name-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.scan-card-name-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.scan-card-name-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.75rem;
}

@media (max-width: 600px) {
    .scan-card-grid-config {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .scan-card-config-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Tournament placeholder */
.tournament-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.tournament-placeholder h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tournament-placeholder p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Scan Lobby */
.scan-session-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 10px 0 20px;
    flex-wrap: wrap;
}

.scan-session-code {
    font-size: 1rem;
    color: var(--text-secondary);
}

.scan-session-code strong {
    color: var(--primary);
    letter-spacing: 2px;
    font-size: 1.15rem;
}

.scan-session-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.status-waiting {
    background: var(--warning);
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.status-active {
    background: var(--success);
    animation: statusPulse 1.2s ease-in-out infinite;
}

.status-dot.status-ended {
    background: var(--text-muted);
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.scan-lobby-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 24px;
}

.scan-lobby-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scan-lobby-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.scan-lobby-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Scan Steps Grid */
.scan-steps-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.scan-step-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-base);
}

.scan-step-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.scan-step-number {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.scan-step-body {
    flex: 1;
}

.scan-step-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.scan-step-body p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.scan-step-qr-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.qr-container {
    display: flex;
    justify-content: center;
}

@media (max-width: 600px) {
    .scan-steps-grid {
        gap: 12px;
    }

    .scan-step-card {
        padding: 16px;
    }

    .scan-step-qr-row {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* ---------- Step 2: Options ---------- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    overflow: visible;
    /* permet aux tooltips de dépasser la grille */
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    height: 120px;
    /* Force tous les boutons à la même taille */
    text-align: center;
    box-sizing: border-box;
    overflow: visible;
    /* tooltips must not be clipped */
}

.option-card:hover {
    border-color: var(--primary);
    background: rgba(17, 85, 214, 0.04);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.option-card.active {
    border-color: var(--primary);
    background: rgba(17, 85, 214, 0.06);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ---------- Tooltips sur les option-cards ---------- */
.option-card[data-tooltip] {
    position: relative;
}

.option-card[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 260px;
    padding: 9px 12px;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #1a1a2e);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.45;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    white-space: pre-line;
    text-align: left;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Petite flèche pointant vers le bas */
.option-card[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border: 6px solid transparent;
    border-top-color: var(--border, #e2e8f0);
    pointer-events: none;
    z-index: 101;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.option-card[data-tooltip]:hover::before,
.option-card[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.option-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.option-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.option-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    display: block;
    width: 100%;
    word-wrap: break-word;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    margin-top: auto;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #d0d5e0;
    border-radius: 22px;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(18px);
}

/* ---------- Step 3: Launch ---------- */
.launch-section {
    text-align: center;
    padding: 10px 0;
}

.launch-section p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 24px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.btn-launch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 48px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 6px 25px var(--primary-glow);
    width: auto;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

.btn-launch::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.btn-launch:hover::before {
    left: 100%;
}

.btn-launch:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(17, 85, 214, 0.35);
}

.btn-launch:active {
    transform: translateY(-1px);
}

.btn-launch i {
    font-size: 1.3rem;
}

/* ---------- Other Screens (game, lobby, etc.) ---------- */
/* Keep .card system for non-home screens */
.card {
    background: var(--bg-card);
    width: 100%;
    max-width: 900px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    padding: 30px;
    text-align: center;
    display: none;
    margin: 30px auto;
}

.card.active {
    display: block;
}

/* Hide home screen via card system but show via custom layout */
#screen-home {
    max-width: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: transparent;
    margin: 0;
}

#screen-home.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

h1 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-weight: 800;
    font-size: 1.6rem;
}

.subtitle {
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 20px;
    display: block;
}

/* General input styles */
input,
textarea {
    font-family: 'Inter', sans-serif;
}

/* General button styles */
button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
}

button:hover {
    transform: translateY(-2px);
}

.btn-host {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    width: 100%;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-host:hover {
    box-shadow: 0 6px 25px var(--primary-glow);
}

.btn-close {
    background: var(--error);
    width: auto;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    float: right;
    border: none;
    color: white;
    border-radius: var(--radius-sm);
}

.btn-export {
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    margin-bottom: 10px;
}

/* Player Grid */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.player-badge {
    background: var(--bg-subtle);
    padding: 10px 35px 10px 15px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 2px solid transparent;
    position: relative;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.player-badge.ready {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success);
}

.avatar-badge {
    width: 28px;
    height: 28px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-badge svg {
    width: 100%;
    height: 100%;
    display: block;
}

.avatar-badge-sm {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-badge-sm svg {
    width: 100%;
    height: 100%;
    display: block;
}

.avatar-podium {
    width: 32px;
    height: 32px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-podium svg {
    width: 100%;
    height: 100%;
    display: block;
}

.badge-delete {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.badge-delete:hover {
    color: var(--error);
}

/* Timer */
.timer-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary-light));
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Image container */
.q-image-container {
    margin: 15px 0;
    display: none;
}

.q-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.tab-btn {
    background: var(--bg-subtle);
    color: var(--text-muted);
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.92rem;
    transition: all var(--transition-fast);
    border: 1px solid var(--border);
}

.tab-btn:hover {
    background: rgba(17, 85, 214, 0.06);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Ranking */
.ranking-list {
    position: relative;
    min-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg-card);
    transition: height 0.5s ease;
}

.ranking-item {
    position: absolute;
    width: 100%;
    height: 54px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease, border-color 0.4s ease;
    box-sizing: border-box;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item:hover {
    background: var(--bg-subtle);
}

.rank-1 {
    background: #fff8e1 !important;
    color: #d35400;
    box-shadow: inset 4px 0 0 #f39c12;
}

/* Results */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: left;
}

.result-item {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    position: relative;
    font-weight: 700;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.result-item.correct {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    opacity: 1;
    border: none;
}

.result-item.incorrect {
    background: linear-gradient(135deg, #d63031, #e17055);
    color: white;
    opacity: 0.75;
}

.result-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 12px;
    border-radius: 6px;
    min-width: 24px;
    text-align: center;
    font-size: 0.9rem;
}

.logo-in-game {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 54px;
    height: 54px;
    z-index: 100;
    overflow: hidden;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.logo-in-game img {
    width: 145%;
    /* Zoom pour masquer le fond gris */
    height: 145%;
    object-fit: cover;
    opacity: 1;
}

/* Floating room code */
.floating-room-code {
    position: fixed;
    bottom: 12px;
    left: 12px;
    background: var(--text-primary);
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    letter-spacing: 1.5px;
    display: none;
    font-family: 'Inter', monospace;
}

/* MathJax */
.mjx-chtml {
    font-size: 1.2em !important;
}

.hidden {
    display: none !important;
}

/* File drop */
.file-drop {
    border: 3px dashed var(--border);
    padding: 30px;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 15px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.file-drop:hover,
.file-drop.dragover {
    background: var(--bg-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

/* Launch Section */
.launch-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0;
    gap: 16px;
}

.launch-section p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0;
}

/* ---------- Footer ---------- */
.app-footer {
    width: 100%;
    padding: 24px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.7;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    margin-top: auto;
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.app-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.footer-sep {
    color: var(--border);
}

.footer-credit {
    opacity: 0.8;
}

.footer-credit a {
    color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .questions-columns {
        grid-template-columns: 1fr;
    }

    .header-stepper {
        order: 3;
        width: 100%;
        justify-content: center;
        padding-top: 4px;
    }
}

@media (max-width: 768px) {
    .main-container {
        width: 95%;
        padding: 20px 14px 30px;
        gap: 20px;
    }

    .step-card {
        padding: 22px 18px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .btn-action {
        justify-content: center;
    }

    .header-actions .header-link span {
        display: none;
    }

    .header-stepper {
        display: none;
    }

    .app-header {
        padding: 12px 16px;
    }

    .q-table {
        font-size: 0.78rem;
    }

    .q-table th,
    .q-table td {
        padding: 6px 4px;
    }

    .btn-launch {
        width: 100%;
        padding: 16px 24px;
    }

}

@media (max-width: 480px) {
    .step-header {
        gap: 10px;
    }

    .logo-in-game {
        width: 36px;
        height: 36px;
        top: 12px;
        left: 12px;
        border-radius: 8px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .step-title {
        font-size: 1.05rem;
    }

    .header-brand img {
        width: 34px;
        height: 34px;
    }

    .header-brand span {
        font-size: 1.15rem;
    }

    .q-block {
        padding: 14px;
    }

    .q-block-icon {
        width: 34px;
        height: 34px;
        font-size: 1.2rem;
    }
}

/* ---------- Join Link Display (Lobby) ---------- */
.join-link-display {
    text-align: center;
    margin: 10px auto 0;
    padding: 12px 20px;
    max-width: 500px;
}

/* ---------- Edit Button ---------- */
.btn-edit-q {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    width: auto;
    margin: 0 2px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.btn-edit-q:hover {
    color: var(--primary);
    background: rgba(17, 85, 214, 0.08);
    transform: scale(1.15);
}

/* ---------- Edit Modal ---------- */
.edit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.edit-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 600px;
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

#preview-all-modal .edit-modal {
    max-width: 850px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Animated Podium ---------- */
.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 15px;
    height: 300px;
    margin: 40px auto;
    padding: 0 20px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
}

.podium-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    text-align: center;
    word-break: break-all;
}

.podium-score {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.podium-bar {
    width: 100%;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15px;
    font-size: 3rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9);
    animation: growUp 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform-origin: bottom;
    transform: scaleY(0);
}

.place-1 .podium-bar {
    height: 200px;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    box-shadow: 0 -5px 20px rgba(241, 196, 15, 0.5);
    animation-delay: 1.6s;
}

.place-2 .podium-bar {
    height: 140px;
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    animation-delay: 0.8s;
}

.place-3 .podium-bar {
    height: 100px;
    background: linear-gradient(135deg, #e67e22, #d35400);
    animation-delay: 0s;
}

.place-1 {
    order: 2;
    z-index: 3;
}

.place-2 {
    order: 1;
    z-index: 2;
}

.place-3 {
    order: 3;
    z-index: 1;
}

@keyframes growUp {
    0% {
        transform: scaleY(0);
    }

    100% {
        transform: scaleY(1);
    }
}

.edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
}

.edit-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.edit-modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all var(--transition-fast);
    margin: 0;
}

.edit-modal-close:hover {
    background: var(--error-bg);
    color: var(--error);
}



.edit-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.edit-field label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.edit-field input,
.edit-field textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: all var(--transition-fast);
    resize: vertical;
    width: 100%;
    margin: 0;
}

.edit-field input:focus,
.edit-field textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-card);
}

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Nouvelles classes UX pour les modales */
.edit-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.edit-section:last-child {
    margin-bottom: 0;
}

.edit-grid-2x2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.edit-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.answer-correct textarea {
    border-color: var(--success) !important;
    background-color: rgba(46, 204, 113, 0.05) !important;
}

.answer-correct label {
    color: var(--success) !important;
}

.answer-wrong textarea {
    background-color: var(--bg-card);
}

.small-field {
    max-width: 140px;
}

.edit-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
}

.btn-modal-cancel {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    width: auto;
    margin: 0;
}

.btn-modal-cancel:hover {
    border-color: var(--error);
    color: var(--error);
}

.btn-modal-save {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px var(--primary-glow);
    font-family: 'Inter', sans-serif;
    width: auto;
    margin: 0;
}

.btn-modal-save:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
}

@media (max-width: 480px) {

    .edit-row,
    .edit-grid-2x2,
    .edit-row-2 {
        grid-template-columns: 1fr;
    }

    .edit-modal {
        max-width: 100%;
    }
}

/* ---------- Toast Notification ---------- */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-primary);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 20000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    font-family: 'Inter', sans-serif;
    max-width: 90vw;
    text-align: center;
}

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

/* ---------- Draggable Table Rows ---------- */
.q-table tbody tr[draggable="true"] {
    transition: border-top 0.1s;
}

.drag-handle {
    cursor: grab;
    color: #b2bec3;
    text-align: center;
    font-size: 1.1rem;
    padding: 0 8px;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
}

.drag-handle:hover {
    color: var(--primary);
    background: rgba(17, 85, 214, 0.1);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Media Queries for step 1 tabs */
@media (max-width: 768px) {
    .step1-tab-inner {
        flex-direction: column;
    }
}

/* ---------- Floating Music Button ---------- */
.floating-music-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid var(--border);
    transition: all 0.3s ease;
    z-index: 1000;
}

.floating-music-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.2);
    color: var(--primary);
    border-color: var(--primary);
}

.floating-music-btn.music-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 20px var(--primary-glow);
    animation: musicPulse 2s ease-in-out infinite;
}

.floating-music-btn.music-active:hover {
    color: white;
    transform: scale(1.1);
    animation: none;
}

@keyframes musicPulse {

    0%,
    100% {
        box-shadow: 0 4px 20px var(--primary-glow);
    }

    50% {
        box-shadow: 0 4px 30px rgba(17, 85, 214, 0.4);
    }
}

/* =============================================
   GAME CONTROLS BAR
   ============================================= */
.game-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: fit-content;
    margin: 0 auto 20px auto;
    box-shadow: var(--shadow-sm);
}

.game-controls-group {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    position: relative;
}

.game-controls-group:not(:last-child) {
    border-right: 1px solid var(--border);
    padding-right: 14px;
}

.game-controls-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    position: absolute;
    top: -4px;
    left: 8px;
    background: var(--surface);
    padding: 0 4px;
    line-height: 1;
}

.btn-game-control {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-game-control:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-game-control:active {
    transform: translateY(0);
}

.btn-game-control i {
    font-size: 0.75rem;
}

/* Skip button — amber */
.btn-game-skip {
    border-color: #f0932b;
    color: #f0932b;
}

.btn-game-skip:hover {
    background: #f0932b;
    color: white;
    border-color: #f0932b;
    box-shadow: 0 2px 8px rgba(240, 147, 43, 0.3);
}

/* Stop button — red */
.btn-game-stop {
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-game-stop:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

/* Toggle button — purple */
.btn-game-toggle {
    border-color: #6c5ce7;
    color: #6c5ce7;
}

.btn-game-toggle:hover {
    background: #6c5ce7;
    color: white;
    border-color: #6c5ce7;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

/* Responsive: stack groups on small screens */
@media (max-width: 700px) {
    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .game-controls-group {
        justify-content: center;
        border-right: none !important;
        padding-right: 8px !important;
        border-bottom: 1px solid var(--border);
        padding-bottom: 10px;
    }

    .game-controls-group:last-child {
        border-bottom: none;
        padding-bottom: 4px;
    }
}

/* --- Answer Image Support --- */
.btn-img-toggle {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
    line-height: 1;
    vertical-align: middle;
}

.btn-img-toggle:hover {
    background: var(--primary);
    color: white;
}

.ans-img-input {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    transition: all var(--transition-fast);
}

.ans-img-input:focus {
    border-color: var(--primary);
    border-style: solid;
    background: white;
    outline: none;
}

/* --- Final Banner Animation --- */
@keyframes slideUpBanner {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.final-banner-anim {
    animation: slideUpBanner 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* =============================================
   PREVIEW ALL QUESTIONS MODAL
   ============================================= */
#preview-all-modal .edit-modal {
    max-width: 900px;
    width: 95%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

#preview-all-modal .edit-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 24px;
    gap: 16px;
}

.preview-cards-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: all 0.25s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.preview-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-left-color: var(--primary-light);
    transform: translateX(2px);
}

.preview-card.highlight-new {
    border-left-color: var(--success);
    animation: pulseNewCard 1.5s ease-in-out;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.04), transparent);
}

@keyframes pulseNewCard {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(46, 204, 113, 0);
    }

    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
}

.preview-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.preview-card-number {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-card-badge-new {
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.preview-card-actions {
    display: flex;
    gap: 6px;
}

.preview-card-actions button {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    color: var(--text-secondary);
}

.preview-card-actions button:hover {
    transform: scale(1.1);
}

.preview-card-actions .btn-preview-edit:hover {
    background: rgba(17, 85, 214, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.preview-card-actions .btn-preview-delete:hover {
    background: var(--error-bg);
    border-color: var(--error);
    color: var(--error);
}

.preview-card-question {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 14px;
}

.preview-card-image {
    text-align: center;
    margin-bottom: 12px;
}

.preview-card-image img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    border: 1px solid var(--border);
}

.preview-card-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.preview-card-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.preview-card-option.correct {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.08);
    color: var(--success);
    font-weight: 700;
}

.preview-card-option.correct .preview-option-letter {
    background: var(--success);
    color: white;
}

.preview-card-option.wrong {
    opacity: 0.75;
}

.preview-option-letter {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    background: var(--bg-subtle);
    color: var(--text-muted);
    flex-shrink: 0;
}

.preview-option-text {
    flex: 1;
    word-break: break-word;
}

.preview-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.preview-empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.preview-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.preview-empty-state p {
    font-size: 1rem;
    font-weight: 500;
}

/* Preview modal header count */
.preview-modal-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: auto;
    padding-right: 12px;
}

/* Slideshow navigation */
.preview-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.preview-nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.preview-pagination {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-subtle);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    min-width: 140px;
    text-align: center;
}

.preview-slide {
    display: none;
    width: 100%;
}

.preview-slide.active {
    display: block;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Redesigning the preview card to look like the projector */
.preview-slide .preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border) !important;
    padding: 40px;
    box-shadow: none !important;
    cursor: default;
    transition: none;
    text-align: center;
    transform: none !important;
    /* Prevent shaking from global hover */
}

.preview-slide .preview-card:hover {
    transform: none !important;
    box-shadow: none !important;
}

.preview-slide .preview-card-question {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 30px;
    color: var(--text-primary);
    line-height: 1.2;
}

.preview-slide .preview-card-image {
    margin: 0 auto 30px;
    max-width: 600px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.preview-slide .preview-card-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.preview-slide .preview-card-option {
    padding: 24px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    border: 3px solid transparent;
}

.preview-slide .preview-option-letter {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
}

/* Option colors (Projector style) */
.preview-slide .preview-card-option.wrong {
    background: var(--bg-subtle);
    color: var(--text-primary);
    border-color: var(--border);
    opacity: 1;
}

.preview-slide .preview-card-option.correct {
    background: #30D158;
    color: white;
    border-color: #30D158;
    box-shadow: 0 10px 20px rgba(48, 209, 88, 0.2);
}

.preview-slide .preview-card-option:nth-child(1) .preview-option-letter {
    background: #3b82f6;
    color: white;
}

.preview-slide .preview-card-option:nth-child(2) .preview-option-letter {
    background: #f97316;
    color: white;
}

.preview-slide .preview-card-option:nth-child(3) .preview-option-letter {
    background: #a855f7;
    color: white;
}

.preview-slide .preview-card-option:nth-child(4) .preview-option-letter {
    background: #14b8a6;
    color: white;
}

.preview-slide .preview-card-option.correct .preview-option-letter {
    background: rgba(255, 255, 255, 0.2) !important;
}

@media (max-width: 600px) {
    .preview-card-options {
        grid-template-columns: 1fr;
    }

    #preview-all-modal .edit-modal {
        max-width: 100%;
    }

    .preview-card {
        padding: 14px 16px;
    }
}

/* =============================================
   STANDALONE BANK SECTION
   ============================================= */
.bank-section-standalone {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 28px 30px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(17, 85, 214, 0.06);
    position: relative;
    overflow: hidden;
    animation: fadeSlideIn 0.5s ease forwards;
    opacity: 0;
}

.bank-section-standalone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light), transparent);
    opacity: 0.6;
}

[data-theme="dark"] .bank-section-standalone {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.08);
    border-left-color: var(--primary);
}

.bank-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.bank-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bank-section-title-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.bank-section-title h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.bank-section-title .q-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 20px;
    margin-left: 4px;
    box-shadow: 0 2px 6px var(--primary-glow);
}

.bank-section-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.bank-section-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.bank-section-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.3;
    display: block;
}

.bank-section-empty p {
    font-size: 0.9rem;
    margin: 0;
}

/* Bouton Visualiser — couleur distinctive */
.btn-action-visualize {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.btn-action-visualize:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
    color: white;
    border: none;
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
}

[data-theme="dark"] .btn-action-visualize {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}