/* ===== Variables et Reset ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --accent: #6366f1;
    --accent-dark: #4f46e5;
    --accent-light: #a5b4fc;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --success: #10b981;
    --success-light: #d1fae5;
    --error: #ef4444;
    --error-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05), 0 0 0 1px rgba(99, 102, 241, 0.03);
    --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.08), 0 4px 10px -3px rgb(0 0 0 / 0.04), 0 0 0 1px rgba(99, 102, 241, 0.04);
    --radius: 12px;
    --radius-sm: 8px;
}

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

/* ===== Base ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    background:
        radial-gradient(900px 360px at 20% -10%, rgba(99, 102, 241, 0.10) 0%, transparent 60%),
        radial-gradient(700px 280px at 100% 0%, rgba(129, 140, 248, 0.08) 0%, transparent 58%),
        #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    color: var(--gray-800);
    line-height: 1.65;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body > .account-bar,
body > h1,
body > .site-tagline,
body > .tabs-nav,
body > .tab,
body > .footer {
    width: 100%;
    flex-shrink: 0;
}

.legal-page {
    width: min(880px, calc(100% - 2rem));
    margin: 40px auto;
    padding: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.legal-page h1 {
    margin-top: 0;
    margin-bottom: 12px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: clamp(1.8rem, 4.8vw, 2.3rem);
    font-weight: 700;
    text-align: left;
    letter-spacing: normal;
    line-height: 1.3;
}

.legal-page h2 {
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.legal-page h2 i {
    color: inherit;
    margin-right: 0.45rem;
}

.legal-page p {
    line-height: 1.7;
    margin: 0 0 14px;
}

.legal-page ul {
    margin: 0 0 14px;
    padding-left: 1.75rem;
}

.legal-page li {
    margin-bottom: 8px;
}

.help-admonition {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--primary-light);
    border-radius: var(--radius-sm);
    background: #eef2ff;
}

.help-admonition summary {
    cursor: pointer;
    color: var(--primary-dark);
    font-weight: 600;
}

.help-admonition summary i {
    margin-right: 0.35rem;
}

.help-admonition pre {
    margin-top: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: #ffffff;
    border: 1px solid var(--gray-200);
    overflow-x: auto;
}

.legal-page a {
    color: var(--primary-dark);
}

.contact-page h1 i {
    color: var(--primary-dark);
    margin-right: 0.35rem;
}

.contact-form {
    margin-top: 18px;
    display: grid;
    gap: 10px;
}

.contact-help {
    margin: 0 0 8px;
    color: var(--gray-700);
    line-height: 1.6;
}

.contact-form label {
    font-weight: 600;
    color: var(--gray-700);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--gray-800);
    font: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-contact-submit {
    margin-top: 8px;
    width: fit-content;
    padding: 12px 18px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
}

.btn-contact-submit i {
    margin-right: 0.4rem;
}

.btn-contact-submit:hover {
    filter: brightness(1.05);
}

.btn-contact-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.contact-status {
    margin-top: 2px;
    min-height: 1.5em;
    font-weight: 500;
}

.contact-status.is-success {
    color: var(--success);
}

.contact-status.is-error {
    color: var(--error);
}

.contact-form.is-complete > :not(#contactStatus) {
    display: none;
}

.contact-form.is-complete #contactStatus {
    margin: 0;
    min-height: 0;
    padding: 22px 20px;
    border-radius: 16px;
    text-align: center;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    font-weight: 800;
    line-height: 1.25;
}

.contact-form.is-complete #contactStatus.is-success {
    color: #065f46;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
}

.legal-header {
    width: min(900px, 100%);
    margin: 8px auto 0;
}

.legal-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-900);
}

.legal-brand img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.legal-brand span {
    font-family: 'Pacifico', 'Brush Script MT', cursive;
    font-size: 2rem;
    line-height: 1;
}

.account-bar {
    max-width: 980px;
    width: 100%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(99, 102, 241, 0.10);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.05);
}

.account-bar:empty {
    display: none;
}

.account-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.account-right {
    display: flex;
    align-items: center;
}

.account-link {
    color: var(--gray-900);
    text-decoration: none;
    font-weight: 600;
}

.account-link:hover {
    text-decoration: underline;
}

.account-name-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.account-icon-link {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.14);
    border-radius: 999px;
    background: #ffffff;
    color: var(--gray-900);
    text-decoration: none;
    box-shadow: none;
    position: relative;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.account-icon-link:hover,
.account-icon-link:focus-visible {
    text-decoration: none;
    border-color: rgba(99, 102, 241, 0.28);
    background: #eef2ff;
    box-shadow: none;
    transform: translateY(-1px);
}

.account-icon-link i {
    font-size: 1.05rem;
}

.account-icon-link.is-current {
    border-color: rgba(79, 70, 229, 0.12);
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: none;
}

.account-icon-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    font-size: 0.55rem;
    font-weight: 600;
    color: #4f46e5;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    padding: 2px 5px;
    z-index: 10;
}

.account-icon-link[data-tooltip]:hover::after,
.account-icon-link[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Container principal ===== */
h1 {
    text-align: center;
    font-family: 'Pacifico', 'Brush Script MT', cursive;
    font-size: clamp(4rem, 8vw, 5.6rem);
    font-weight: 400;
    margin-top: 18px;
    margin-bottom: 18px;
    text-shadow: none;
    letter-spacing: 0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 40%, #818cf8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-top: 18px;
    margin-bottom: 18px;
}

.brand-title-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    opacity: 0;
    animation: pageEnter 0.5s ease-out forwards;
}

.brand-title h1 {
    margin: 0;
    opacity: 0;
    animation: pageEnter 0.5s ease-out 0.1s forwards;
}

.site-tagline {
    margin: 0 auto 48px;
    max-width: 760px;
    text-align: center;
    color: var(--gray-600);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: -0.005em;
    opacity: 0;
    animation: pageEnter 0.5s ease-out 0.2s forwards;
}

/* ===== Navigation par onglets ===== */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tabs-nav:empty {
    display: none;
    margin-bottom: 0;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    background: #eef2ff;
    color: #3730a3;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid #c7d2fe;
}

.tab-btn:hover {
    background: #c7d2fe;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    border-color: transparent;
}

/* ===== Onglets/Conteneurs ===== */
.tab {
    display: none;
    max-width: 900px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 0;
    border-top: 2px solid rgba(99, 102, 241, 0.55);
    animation: fadeIn 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tab::after {
    display: none;
}

.tab:hover {
    box-shadow: var(--shadow-lg), 0 0 24px rgba(99, 102, 241, 0.08);
    border-top-color: rgba(99, 102, 241, 0.55);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.tab.active {
    display: block;
    margin-bottom: 30px;
}

.tab.tab-enter {
    animation: tabSlideIn 0.24s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pageEnter {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes tabSlideIn {
    from {
        opacity: 0.4;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* ===== Liseré indigo supérieur pour les cartes ===== */
body.page-login .card,
body.page-profile .card,
body.page-admin .card,
body.page-setup-admin .card {
    position: relative;
    overflow: hidden;
}

body.page-login .card::after,
body.page-profile .card::after,
body.page-admin .card::after,
body.page-setup-admin .card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #6366f1, #818cf8, #6366f1);
    border-radius: 2px 2px 0 0;
    opacity: 0.55;
}

/* ===== Shimmer sur boutons principaux ===== */
@keyframes btnShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ===== Motif décoratif arrière-plan ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.5;
    background-image: radial-gradient(circle, #c7d2fe 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

/* ===== Titres ===== */
h2 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gray-100);
    letter-spacing: -0.02em;
}

h2 > i, h3 > i {
    margin-right: 6px;
}

h3 {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 15px;
    letter-spacing: -0.015em;
}

h4 {
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Formulaires ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group-checkbox {
    margin-top: -2px;
}

.option-checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.option-checkbox-card:hover,
.option-checkbox-card:focus-within {
    border-color: #c7d2fe;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.option-checkbox-card input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.option-checkbox-copy {
    display: grid;
    gap: 4px;
}

.option-checkbox-copy strong {
    color: var(--gray-800);
    font-size: 0.98rem;
    line-height: 1.35;
}

.option-checkbox-copy small {
    color: #4b5563;
    font-size: 0.82rem;
    line-height: 1.5;
}

#batchQuestions {
    display: grid;
    gap: 16px;
    margin-bottom: 20px;
}

.saved-quizzes-panel {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    padding: 12px;
    margin-bottom: 14px;
}

.saved-quizzes-panel h3 {
    margin: 0 0 8px;
    font-size: 0.98rem;
}

.saved-quizzes-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) repeat(4, auto);
    gap: 10px;
    align-items: center;
}

.saved-quizzes-row .secondary-btn {
    min-width: 0;
    padding: 10px 14px;
    font-size: 0.93rem;
}

#purgeTrashQuizBtn:hover,
#purgeTrashQuizBtn:focus-visible {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.saved-quiz-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

#savedQuizCards.saved-quiz-cards {
    display: block;
}

.saved-quiz-cards.saved-quiz-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.saved-quiz-sections {
    display: grid;
    gap: 14px;
}

.saved-quiz-section {
    display: grid;
    gap: 10px;
}

.saved-quiz-section + .saved-quiz-section {
    margin-top: 10px;
}

.saved-quiz-section-title {
    margin: 0;
    padding: 0;
    border: none;
    font-size: 0.98rem;
    color: var(--primary-dark);
}

.saved-quiz-empty {
    margin: 0;
    padding: 8px 10px;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.saved-quiz-card {
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.saved-quiz-card.is-active {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.saved-quiz-card-draft {
    border-style: dashed;
}

.saved-quiz-card-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
}

.saved-quiz-card-head-main {
    min-width: 0;
}

.saved-quiz-card-head h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--gray-800);
    line-height: 1.3;
}

.saved-quiz-card-code {
    margin: 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--gray-500);
}

.saved-quiz-card-meta {
    margin: 8px 0 10px;
    color: var(--gray-600);
    font-size: 0.86rem;
}

.saved-quiz-card-count {
    display: block;
}

.saved-quiz-card-updated {
    display: block;
    margin-top: 2px;
    margin-bottom: 3px;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--gray-500);
}

.saved-quiz-card-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: auto;
}

.saved-quiz-card-actions .secondary-btn {
    flex: 0 0 auto;
}

.saved-quiz-card-actions .saved-quiz-action-btn.icon-only-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
}

.saved-quiz-card-actions .saved-quiz-action-btn.icon-only-btn i[class*="fa-"] {
    font-size: 0.86rem;
}

.saved-quiz-card-actions .saved-quiz-action-btn.icon-only-btn:hover,
.saved-quiz-card-actions .saved-quiz-action-btn.icon-only-btn:focus-visible {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.saved-quiz-favorite-btn.icon-only-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: var(--gray-400);
}

.saved-quiz-favorite-btn.icon-only-btn i[class*="fa-"] {
    font-size: 0.76rem;
}

.saved-quiz-favorite-btn:hover {
    border-color: #fbbf24;
    color: #d97706;
    background: #fffbeb;
    transform: translateY(-1px);
}

.saved-quiz-favorite-btn.is-favorite {
    color: #f59e0b;
    border-color: #fcd34d;
    background: #fffbeb;
}

.saved-quiz-favorite-btn.is-favorite i {
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.28);
}

.saved-quiz-favorite-btn:focus-visible {
    outline: 3px solid rgba(245, 158, 11, 0.25);
    outline-offset: 2px;
}


@media (max-width: 980px) {
    .saved-quizzes-row {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .saved-quiz-cards.saved-quiz-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .saved-quiz-cards.saved-quiz-cards-grid {
        grid-template-columns: 1fr;
    }
}

.batch-question-block {
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    padding: 22px;
    background: linear-gradient(180deg, #eef2ff 0%, #e8eafc 100%);
}

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

.batch-question-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.batch-question-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-question-title {
    margin: 0;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #111827;
}

.drag-question-handle {
    cursor: grab;
}

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

.batch-question-block.is-dragging {
    opacity: 0.58;
    border-color: #a5b4fc;
}

#batchQuestions.drag-active .batch-question-block {
    transition: transform 0.12s ease;
}

.batch-question-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.batch-builder-actions {
    margin-top: 8px;
    border-top: none;
    padding-top: 0;
}

.answer-with-correct {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.batch-multiple-builder {
    display: grid;
    gap: 14px;
}

.batch-multiple-items {
    display: grid;
    gap: 12px;
}

.multiple-option-row {
    margin-bottom: 0;
}

.multiple-option-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.remove-multiple-option-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.answer-input-wrap {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.math-enabled-input-wrap {
    position: relative;
    width: 100%;
}

.math-enabled-input-wrap input[type="text"],
.math-enabled-input-wrap textarea {
    padding-right: 42px;
}

.inline-math-insert-btn,
.question-math-insert-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 30px;
    min-width: 30px;
    height: 30px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    background: rgba(255, 255, 255, 0.82);
    color: #64748b;
    box-shadow: none;
    z-index: 2;
}

.question-math-insert-btn {
    top: 12px;
    transform: none;
}

.inline-math-insert-btn:hover,
.inline-math-insert-btn:focus-visible,
.question-math-insert-btn:hover,
.question-math-insert-btn:focus-visible {
    background: #ffffff;
    border-color: rgba(99, 102, 241, 0.3);
    color: #4338ca;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.inline-math-insert-btn:hover,
.inline-math-insert-btn:focus-visible {
    transform: translateY(-50%);
}

.question-math-insert-btn:hover,
.question-math-insert-btn:focus-visible {
    transform: none;
}

.math-tool-icon {
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1;
}

.answer-input-index {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.correct-choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    cursor: pointer;
}

.correct-choice input[type="radio"],
.correct-choice input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.correct-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 2px solid var(--gray-300);
    background: #ffffff;
    box-shadow: inset 0 0 0 2px #ffffff;
    transition: all 0.2s ease;
    position: relative;
}

.correct-choice input[type="checkbox"] + .correct-icon {
    border-radius: 6px;
}

.correct-icon::before {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.65);
    transition: all 0.18s ease;
}

.correct-choice:hover .correct-icon {
    border-color: #22c55e;
}

.correct-choice input[type="radio"]:checked + .correct-icon,
.correct-choice input[type="checkbox"]:checked + .correct-icon {
    border-color: #16a34a;
    background: linear-gradient(135deg, #34d399 0%, #16a34a 100%);
}

.correct-choice input[type="radio"]:checked + .correct-icon::before,
.correct-choice input[type="checkbox"]:checked + .correct-icon::before {
    opacity: 1;
    transform: scale(1);
}

.correct-choice input[type="radio"]:focus-visible + .correct-icon,
.correct-choice input[type="checkbox"]:focus-visible + .correct-icon {
    outline: 3px solid rgba(37, 99, 235, 0.2);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.95rem;
}

input[type="text"],
input[type="url"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

input[type="text"]:focus,
input[type="url"]:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

input[type="text"]::placeholder,
input[type="url"]::placeholder {
    color: var(--gray-400);
}

textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--gray-50);
    resize: vertical;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

textarea::placeholder {
    color: var(--gray-400);
}

#trashQuizSelect {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    background: #fff;
    color: var(--gray-800);
}

#trashQuizSelect:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.batch-question-input {
    min-height: 60px;
    overflow-wrap: anywhere;
}

.batch-question-editor-wrap {
    position: relative;
}

.compact-question-input-row {
    margin-bottom: 24px;
}

.batch-question-input[contenteditable="true"] {
    width: 100%;
    min-height: 54px;
    padding: 8px 52px 8px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 1rem;
    line-height: 1.3;
    transition: all 0.2s ease;
    caret-color: var(--primary);
}

.batch-question-input[contenteditable="true"]:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.batch-question-input.is-empty::before {
    content: attr(data-placeholder);
    color: var(--gray-400);
    pointer-events: none;
}

.batch-question-input[contenteditable="true"].is-empty {
    display: flex;
    align-items: center;
}

.batch-question-input[contenteditable="true"] > :first-child,
.formatted-question > :first-child {
    margin-top: 0;
}

.batch-question-input[contenteditable="true"] > :last-child,
.formatted-question > :last-child {
    margin-bottom: 0;
}

.batch-question-input[contenteditable="true"] p,
.formatted-question p {
    margin: 0 0 0.45em;
}

.batch-question-input[contenteditable="true"] ul,
.batch-question-input[contenteditable="true"] ol,
.formatted-question ul,
.formatted-question ol {
    margin: 0.55em 0;
    padding-left: 1.35em;
}

.batch-question-input[contenteditable="true"] li + li,
.formatted-question li + li {
    margin-top: 0.18em;
}

.formatted-question {
    line-height: 1.55;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.formatted-question .katex-display,
.result-item .katex-display,
.final-report-answer .katex-display,
.created-answers .katex-display,
.option-item .katex-display,
.answer-option label .katex-display {
    margin: 0.5em 0;
}

.question-open-response-row {
    margin-top: 12px;
}

.question-participant-responses-row {
    margin-top: 10px;
}

.question-settings-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
    margin-top: 8px;
    margin-bottom: 30px;
}

.question-settings-grid > .form-group {
    margin-bottom: 0;
}

.question-settings-grid > .form-group {
    display: grid;
    gap: 10px;
    align-content: start;
}

.question-setting-heading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    color: var(--gray-800);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.question-setting-heading i[class*="fa-"] {
    color: var(--gray-700);
    font-size: 1.05rem;
}

.inline-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-weight: 500;
}

.inline-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.math-modal {
    position: fixed;
    inset: 0;
    z-index: 3200;
    pointer-events: none;
    --keyboard-zindex: 10000;
}

.math-modal.hidden {
    display: none;
}

.math-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    pointer-events: auto;
}

.math-modal-panel {
    position: relative;
    width: min(720px, calc(100vw - 28px));
    margin: max(24px, 4vh) auto 0;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.26);
    overflow: visible;
    pointer-events: auto;
    z-index: 1;
}

.math-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--gray-200);
}

.math-modal-header h3 {
    margin: 0;
}

.math-modal-body {
    display: grid;
    gap: 14px;
    padding: 20px 18px 16px;
}

.math-modal-help {
    margin: 0;
    color: var(--gray-600);
}

.math-insert-field,
.open-answer-math-field {
    display: block;
    width: 100%;
    min-height: 58px;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: var(--gray-50);
    font-size: 1.05rem;
}

.math-insert-field:focus-within,
.open-answer-math-field:focus-within {
    border-color: var(--primary);
    background: #ffffff;
}

.math-preview-block {
    display: grid;
    gap: 8px;
}

.math-preview-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.math-preview-surface {
    min-height: 56px;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: #f8fafc;
}

.math-preview-placeholder {
    margin: 0;
    color: var(--gray-500);
}

.import-markdown-panel {
    width: min(760px, calc(100vw - 28px));
}

.import-markdown-actions-row {
    display: flex;
    justify-content: flex-start;
}

.import-markdown-textarea {
    width: 100%;
    min-height: 240px;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    background: var(--gray-50);
    color: var(--gray-800);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}

.import-markdown-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: #ffffff;
}

.math-modal-panel > .action-buttons {
    margin-top: 0;
    padding: 16px 18px 20px;
}

math-field {
    --primary-color: #4f46e5;
    --caret-color: #4f46e5;
    --selection-background-color: rgba(99, 102, 241, 0.2);
}

math-field::part(virtual-keyboard-toggle),
math-field::part(menu-toggle),
[part="virtual-keyboard-toggle"],
[part="menu-toggle"],
.ML__virtual-keyboard-toggle {
    display: none !important;
}

.ML__keyboard,
.ML__keyboard * {
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

.ML__keyboard {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: 0 -16px 36px rgba(15, 23, 42, 0.18);
}

.ML__keyboard .MLK__plate,
.ML__keyboard .MLK__layer,
.ML__keyboard .MLK__toolbar,
.ML__keyboard .MLK__backdrop {
    pointer-events: auto !important;
}

.question-format-toolbar {
    position: fixed;
    z-index: 2500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.question-format-toolbar.hidden {
    display: none;
}

.question-format-toolbar-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #1f2937;
    box-shadow: none;
}

.question-format-toolbar-btn:hover,
.question-format-toolbar-btn:focus-visible {
    background: #eef2ff;
    color: #312e81;
    border-color: #c7d2fe;
    transform: none;
}

.question-format-toolbar-btn.is-active {
    background: #e0e7ff;
    color: #312e81;
    border-color: #a5b4fc;
}

.question-format-toolbar-divider {
    width: 1px;
    height: 24px;
    background: rgba(148, 163, 184, 0.5);
    margin: 0 2px;
}

.question-type-row {
    position: relative;
}

select.batch-question-type {
    appearance: none;
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1.2;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding-right: 44px;
}

select.batch-question-type:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.question-type-row::after {
    content: '⌄';
    position: absolute;
    right: 14px;
    top: 66px;
    transform: translateY(-50%);
    font-size: 1rem;
    line-height: 1;
    color: var(--gray-500);
    pointer-events: none;
}

.question-timer-row {
    position: relative;
}

select.batch-time-limit-select {
    appearance: none;
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    line-height: 1.2;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding-right: 44px;
}

select.batch-time-limit-select:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.question-timer-row::after {
    content: '⌄';
    position: absolute;
    right: 14px;
    top: 66px;
    transform: translateY(-50%);
    font-size: 1rem;
    line-height: 1;
    color: var(--gray-500);
    pointer-events: none;
}

.question-video-fields {
    margin-top: 14px;
}

.video-range-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.video-range-field {
    display: grid;
    gap: 6px;
    justify-items: start;
}

.video-range-field input {
    width: min(190px, 100%);
}

.video-range-help {
    margin: 8px 0 0;
    color: var(--gray-600);
    font-size: 0.85rem;
}

@media (max-width: 680px) {
    .video-range-row {
        grid-template-columns: 1fr;
    }
}

.open-question-help {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin-top: 4px;
}

.question-image-fields {
    margin-top: 18px;
    margin-bottom: 22px;
}

.question-image-fields.has-image > label,
.question-image-fields.has-image > .batch-question-image-input {
    display: none;
}

.question-image-toggle-row {
    margin-top: 0;
}

.question-image-toggle-row .toggle-question-image-fields-btn {
    width: 100%;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: none;
}

.question-image-toggle-row .toggle-question-image-fields-btn span {
    font-weight: 500;
}

.question-settings-grid .question-participant-responses-row {
    margin-top: 0;
}

.question-settings-grid .question-participant-responses-row .inline-checkbox-label {
    width: 100%;
    height: 52px;
    padding: 0 18px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    font-weight: 500;
    line-height: 1.35;
    align-items: center;
    justify-content: flex-start;
}

.question-settings-grid .question-participant-responses-row .inline-checkbox-label:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

@media (max-width: 1180px) {
    .question-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .question-settings-grid {
        grid-template-columns: 1fr;
    }
}

.batch-question-image-preview {
    margin: 10px auto 0;
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    border-radius: var(--radius-sm);
    text-align: center;
}

.batch-question-image-preview-img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 360px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: transparent;
    object-fit: contain;
    margin: 0 auto;
    transform-origin: center center;
    transition: transform 0.14s ease;
}

.batch-question-image-preview.is-landscape-full .batch-question-image-preview-img {
    width: 100%;
    height: auto;
    max-height: 460px;
}

.batch-question-image-preview.is-portrait-large .batch-question-image-preview-img {
    width: min(100%, 560px);
    height: auto;
    max-height: 760px;
}

.question-image-zoom-controls {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(4px);
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
}

.question-image-zoom-controls .question-image-zoom-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: #f8fafc;
    box-shadow: none;
}

.question-image-zoom-controls .question-image-zoom-btn:hover {
    background: transparent;
    color: #ffffff;
}

.question-image-zoom-controls .question-image-zoom-btn:disabled {
    background: transparent;
    color: rgba(248, 250, 252, 0.45);
}

.question-image-zoom-value {
    min-width: 48px;
    text-align: center;
    font-size: 0.84rem;
    font-weight: 600;
    color: #e2e8f0;
}

.clear-question-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.82);
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-2px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.batch-question-image-preview:hover .clear-question-image-btn,
.batch-question-image-preview:focus-within .clear-question-image-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.batch-question-image-preview:hover .question-image-zoom-controls,
.batch-question-image-preview:focus-within .question-image-zoom-controls {
    opacity: 1;
    pointer-events: auto;
}

@media (hover: none) {
    .clear-question-image-btn {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .question-image-zoom-controls {
        opacity: 1;
        pointer-events: auto;
    }
}

.question-cloze-fields {
    margin-top: 18px;
}

.batch-cloze-text {
    min-height: 180px;
}

.question-ranking-fields {
    margin-top: 18px;
}

.question-labelimage-fields {
    margin-top: 12px;
}

.question-labelimage-image-fields {
    margin-bottom: 10px;
}

.question-labelimage-image-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.question-labelimage-image-fields.has-image .batch-question-image-input {
    width: 132px;
    font-size: 0;
}

.question-labelimage-image-fields.has-image .batch-question-image-input::file-selector-button {
    font-size: 1rem;
}

.question-labelimage-image-fields.has-image .batch-question-image-input::-webkit-file-upload-button {
    font-size: 1rem;
}

.question-labelimage-image-row .clear-labelimage-btn {
    width: 34px;
    height: 34px;
}

.batch-ranking-builder {
    display: grid;
    gap: 14px;
}

.batch-ranking-items {
    display: grid;
    gap: 12px;
}

.ranking-editor-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
}

.ranking-editor-row.is-dragging {
    opacity: 0.55;
}

.ranking-editor-handle {
    cursor: grab;
}

.ranking-editor-handle:active {
    cursor: grabbing;
}

.batch-ranking-item-input {
    width: 100%;
}

.cloze-example-label {
    margin: 10px 0 6px;
    font-weight: 700;
    color: var(--gray-700);
}

.cloze-example-text {
    margin: 0;
    padding: 10px 12px;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    color: var(--gray-700);
}

.labelimage-editor {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.labelimage-canvas-wrap {
    display: grid;
    gap: 8px;
}

.legend-editor-canvas {
    position: relative;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    overflow: hidden;
    min-height: 220px;
    cursor: crosshair;
}

.legend-editor-canvas.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.legend-editor-image {
    display: block;
    width: 100%;
    max-height: 700px;
    object-fit: contain;
    margin: 0 auto;
}

.legend-editor-canvas.is-empty .legend-editor-image {
    display: none;
}

.legend-editor-empty {
    margin: 0;
    padding: 18px;
    color: var(--gray-600);
    text-align: center;
}

.legend-editor-canvas:not(.is-empty) .legend-editor-empty {
    display: none;
}

.legend-editor-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.legend-editor-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    min-width: 0;
    padding: 0;
    border: 2px solid #1d4ed8;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1;
    pointer-events: auto;
    cursor: pointer;
}

.legend-editor-marker.is-placeholder {
    border-style: dashed;
    border-color: #4338ca;
    background: rgba(99, 102, 241, 0.18);
    color: #1e1b4b;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    animation: legendPlaceholderPulse 1.25s ease-in-out infinite;
}

.legend-editor-marker.is-placeholder::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1.5px dashed rgba(67, 56, 202, 0.55);
    border-radius: 999px;
    pointer-events: none;
}

.legend-editor-marker.is-current {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.26);
}

@keyframes legendPlaceholderPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.07); }
}

.legend-editor-help {
    margin: 0;
    color: var(--gray-600);
    font-size: 0.92rem;
}

.legend-editor-instruction {
    margin: 0;
    color: var(--gray-600);
    font-size: 0.85rem;
}

.labelimage-sidebar {
    display: grid;
    align-content: start;
    gap: 10px;
}

.batch-legend-label-items {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.legend-label-row {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
}

.legend-label-row.is-active {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
}

.legend-label-index {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #6366f1;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.84rem;
}

.labelimage-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 12px;
}

.labelimage-player-canvas-wrap {
    display: grid;
    gap: 8px;
}

.labelimage-player-canvas {
    position: relative;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--gray-50);
    cursor: crosshair;
}

.labelimage-player-image {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    margin: 0 auto;
}

.labelimage-player-overlay {
    position: absolute;
    inset: 0;
}

.labelimage-player-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 36px;
    border: 2px dashed #6366f1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.labelimage-player-marker::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(67, 56, 202, 0.72);
    transform: translate(-50%, -50%);
}

.labelimage-player-marker.is-placeholder {
    border-color: rgba(67, 56, 202, 0.7);
    background: rgba(255, 255, 255, 0.42);
}

.labelimage-player-marker.is-assigned {
    border-style: solid;
    border-color: #4338ca;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.98), 0 4px 12px rgba(49, 46, 129, 0.24);
    min-width: 130px;
    width: auto;
    max-width: 220px;
    padding: 0 10px;
}

.labelimage-player-marker.is-assigned::before {
    display: none;
}

.labelimage-player-marker-text {
    display: block;
    width: 100%;
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e1b4b;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.labelimage-player-marker.is-placeholder::after {
    content: '';
    position: absolute;
    inset: -8px;
    border: 2px dashed rgba(67, 56, 202, 0.6);
    border-radius: 999px;
    pointer-events: none;
}

.labelimage-player-marker.is-current {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.26);
}

.labelimage-player-marker.is-drop-target {
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.28), 0 0 0 6px rgba(67, 56, 202, 0.12);
}

.labelimage-player-canvas.is-dragging .labelimage-player-marker {
    transition: box-shadow 120ms ease, transform 120ms ease;
}

.labelimage-player-drag-chip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    max-width: 240px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 2px solid #4338ca;
    background: #ffffff;
    color: #1e1b4b;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 8px 20px rgba(30, 27, 75, 0.28);
}

.labelimage-player-help {
    margin: 0;
    color: var(--gray-600);
}

.labelimage-player-labels {
    display: grid;
    align-content: start;
    gap: 8px;
}

.labelimage-label-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    border-radius: 10px;
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.labelimage-label-btn.is-active {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
}

.labelimage-label-btn.is-placed {
    border-color: rgba(99, 102, 241, 0.44);
    background: rgba(99, 102, 241, 0.08);
}

.labelimage-label-num {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #6366f1;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

@media (max-width: 980px) {
    .labelimage-player {
        grid-template-columns: 1fr;
    }

    .batch-legend-label-items {
        grid-template-columns: 1fr;
    }
}

.cloze-preview-item {
    white-space: pre-wrap;
}

.cloze-inline-wrap {
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    white-space: pre-wrap;
    line-height: 1.8;
}

.cloze-blank-input-wrap {
    display: inline-flex;
    width: 168px;
    max-width: 220px;
    min-width: 108px;
    margin: 0 6px;
    vertical-align: middle;
}

.cloze-blank-input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 6px 8px;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    font: inherit;
    vertical-align: baseline;
}

.cloze-blank-input:focus {
    outline: none;
    border-color: var(--primary);
}

.cloze-blank-input::placeholder {
    color: #8b8b8b;
}

.cloze-blank-input:focus::placeholder {
    color: transparent;
}

.open-responses-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.open-response-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    padding: 10px 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.open-response-item.correct-response-item {
    border-color: #86efac;
    background: #f0fdf4;
}

.results-total-line {
    margin-top: 16px;
    margin-bottom: 14px;
}

.results-total-line + .open-response-item,
.results-total-line + .open-responses-list {
    margin-top: 18px;
}

.results-empty-line {
    margin-top: 12px;
    margin-bottom: 20px;
    color: var(--gray-600);
}

.results-labelmap-legend {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.results-labelmap-legend-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: #f8fafc;
}

.results-labelmap-legend-index {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

.results-labelmap-legend-text {
    min-width: 0;
    font-weight: 600;
    color: var(--gray-800);
    overflow-wrap: anywhere;
}

.results-labelmap-legend-count {
    font-weight: 700;
    color: var(--gray-700);
    white-space: nowrap;
}

.results-video-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    margin-top: 10px;
}

.results-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-fallback-link {
    margin: 8px 0 0;
    font-size: 0.95rem;
    color: var(--gray-600);
}

.video-fallback-link a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
}

.video-fallback-link a:visited {
    color: #4f46e5;
}

.video-fallback-link a:hover {
    color: #3730a3;
    text-decoration: underline;
}

.rating-summary {
    font-size: 1.05rem;
    margin: 8px 0 14px;
}

.rating-summary-compact {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 12px;
}

.rating-summary-main,
.rating-summary-sub {
    margin: 0;
}

.rating-summary-main {
    font-weight: 700;
    font-size: 1.05rem;
}

.rating-summary-sub {
    color: var(--gray-600);
    font-size: 0.92rem;
}

.wordcloud-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    align-items: baseline;
    justify-content: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    margin-top: 10px;
    min-height: 170px;
    text-align: center;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.wordcloud-container.large {
    min-height: 260px;
    padding: 18px;
    gap: 14px 16px;
}

.wordcloud-term {
    display: inline-block;
    line-height: 1.22;
    padding: 3px 6px;
    white-space: normal;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    transition: filter 0.15s ease;
}

.wordcloud-term:hover {
    filter: brightness(1.08);
}

/* ===== Boutons ===== */
button {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button i[class*="fa-"] {
    font-size: 0.92em;
}

.icon-only-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
}

.icon-only-btn i[class*="fa-"] {
    font-size: 0.95rem;
}

button[type="submit"],
.action-buttons button:first-child {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

button[type="submit"]::before,
.action-buttons button:first-child::before,
.live-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transition: none;
    pointer-events: none;
}

button[type="submit"]:hover::before,
.action-buttons button:first-child:hover::before,
.live-btn:hover::before {
    animation: btnShimmer 0.6s ease forwards;
}

button[type="submit"]:hover,
.action-buttons button:first-child:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.secondary-btn {
    background: var(--gray-100);
    color: var(--gray-700);
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: var(--gray-200);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.primary-action-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.primary-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.site-notice {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 5200;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
    font-weight: 600;
    line-height: 1.45;
}

.site-notice.is-success {
    background: linear-gradient(135deg, #16a34a 0%, #059669 100%);
    color: white;
}

.site-notice.is-error {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.open-math-editor-btn.icon-only-btn.inline-math-insert-btn,
.open-math-editor-btn.icon-only-btn.question-math-insert-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    padding: 0;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.open-math-editor-btn.secondary-btn.inline-math-insert-btn:hover,
.open-math-editor-btn.secondary-btn.inline-math-insert-btn:focus-visible {
    transform: translateY(-50%) !important;
}

.open-math-editor-btn.secondary-btn.question-math-insert-btn:hover,
.open-math-editor-btn.secondary-btn.question-math-insert-btn:focus-visible {
    transform: none !important;
}

/* ===== Zone de succès après création ===== */
.code-success {
    background: linear-gradient(135deg, #16a34a 0%, #059669 100%);
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 25px;
}

.loading-dots {
    display: inline-flex;
    margin-left: 4px;
}

.loading-dots span {
    display: inline-block;
    min-width: 7px;
    animation: dotPulse 1.1s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

/* ===== Affichage du code ===== */
.code-display {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    border: 1px solid var(--gray-200);
    color: white;
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    margin: 25px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.code-display::before {
    content: "Code d'accès";
    font-size: 0.85rem;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.code-display-value {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    font-family: 'Monaco', 'Consolas', monospace;
    line-height: 1.1;
}

.code-copy-btn {
    margin-top: 14px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.code-copy-btn i {
    pointer-events: none;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.code-copy-btn:disabled {
    opacity: 0.78;
    cursor: progress;
}

.code-copy-btn.is-copied {
    border-color: #34d399;
    background: rgba(16, 185, 129, 0.24);
}

/* ===== Résumé de la question ===== */
.question-summary {
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 20px 0;
}

.created-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    padding: 12px 16px;
    background: white;
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 15px;
}

.question-summary .created-question + h4 {
    margin-top: 24px;
}

.question-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.question-summary-head h4 {
    margin: 0;
}

.live-compact-nav {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.question-summary .question-image-display + h4 {
    margin-top: 24px;
}

.question-timer {
    margin: 8px 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

.question-timer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.question-timer-label {
    font-size: 0.88rem;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.25px;
}

.question-timer-head strong {
    font-size: 0.98rem;
    color: var(--gray-800);
}

.question-timer-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--gray-100);
    overflow: hidden;
}

.question-timer-bar {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
    transition: width 0.18s linear, background 0.18s ease;
}

.question-timer.is-warning .question-timer-bar {
    background: linear-gradient(90deg, #f59e0b 0%, #f97316 100%);
}

.question-timer.is-expired .question-timer-bar {
    width: 0 !important;
    background: #f43f5e;
}

.question-timer.is-expired .question-timer-head strong {
    color: #f43f5e;
}

.created-answers {
    list-style: none;
    padding: 0;
}

.created-answers li {
    padding: 10px 16px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
    position: relative;
    padding-left: 40px;
}

.created-answers li::before {
    content: counter(answer);
    counter-increment: answer;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.created-answers {
    counter-reset: answer;
}

.created-answers li.correct-answer-item {
    border-color: #86efac;
    background: #f0fdf4;
}

.created-media-preview {
    margin-top: 10px;
}

.created-video-wrap {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
}

.created-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.created-media-error {
    margin: 0;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    color: var(--gray-700);
}

.correct-answer {
    margin-top: 12px;
    color: #166534;
    font-weight: 600;
}

/* ===== URL et QR Code ===== */
.url-display {
    background: #f8fafc;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.url-display p {
    color: var(--gray-600);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.url-display a {
    color: var(--primary);
    font-weight: 600;
    word-break: break-all;
    text-decoration: none;
    font-size: 0.95rem;
}

.url-display a:hover {
    text-decoration: underline;
}

.response-link-block {
    margin-bottom: 8px;
}

.response-link-block p {
    margin-bottom: 8px;
}

.response-link-block.primary-link-block {
    margin-bottom: 20px;
}

.qr-section {
    text-align: center;
    margin: 25px 0;
    padding: 25px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

#qrCodeImage {
    max-width: 200px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    background: transparent;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* ===== Boutons d'action ===== */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--gray-200);
}

#homePanel.home-panel-empty .home-actions {
    border-top: none;
    padding-top: 0;
    margin-top: 16px;
}

.action-buttons button {
    flex: 1;
    min-width: 180px;
}

#createSuccess .live-action-buttons {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

#createSuccess .live-action-buttons button {
    width: 100%;
    min-width: 0;
    padding: 7px 6px;
    font-size: 0.7rem;
    gap: 0;
    letter-spacing: -0.01em;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    border-radius: 10px;
}

#createSuccess .live-action-buttons button i[class*="fa-"] {
    display: none;
}

/* ===== Options de réponse ===== */
.answer-options-container {
    margin: 20px 0;
}

.answer-option {
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
}

.answer-option:hover {
    border-color: var(--primary-light);
    background: var(--gray-50);
}

.answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.answer-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.answer-option label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

.rating-choice-label {
    letter-spacing: 1px;
    font-size: 1.35rem;
    color: #9ca3af;
}

.answer-option input[type="radio"]:checked + .rating-choice-label {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    font-weight: 700;
}

.ranking-answer-option {
    display: block;
    cursor: default;
}

.ranking-instruction {
    margin: 0 0 12px;
}

.ranking-sort-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.ranking-sort-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    background: #f8fafc;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.ranking-sort-item.is-dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.ranking-sort-handle {
    color: var(--gray-500);
    font-size: 0.9rem;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: grab;
    line-height: 1;
    touch-action: none;
}

.ranking-sort-text {
    flex: 1;
}

.ranking-sort-input {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 8px 10px;
    background: #ffffff;
    color: var(--gray-800);
    font: inherit;
    pointer-events: none;
}

.rating-stars-inline {
    display: inline-block;
    letter-spacing: 1px;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 55%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
}

/* ===== Conteneur de question (réponse) ===== */
.question-container {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 25px;
}

.answer-question-meta {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

#questionText {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.question-image-display {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.question-image-display img {
    width: auto;
    max-width: 100%;
    max-height: 420px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.15);
    object-fit: contain;
}

.question-image-display.is-landscape-full {
    display: block;
}

.question-image-display.is-landscape-full img {
    width: 100%;
    height: auto;
    max-height: 460px;
}

.question-image-display.is-portrait-large img {
    width: min(100%, 560px);
    height: auto;
    max-height: 760px;
}

.question-summary .question-image-display img,
#resultsQuestionImageWrap img {
    border: 1px solid var(--gray-200);
    background: transparent;
}

#resultsQuestionImageWrap {
    margin-bottom: 18px;
}

#resultsQuestionImageWrap.results-labelmap-wrap {
    position: relative;
}

.results-labelmap-overlay {
    position: absolute;
    inset: auto;
    pointer-events: none;
}

.results-labelmap-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.results-labelmap-tag {
    min-width: 72px;
    max-width: clamp(96px, 18vw, 164px);
    min-height: 22px;
    padding: 3px 7px;
    border-radius: 9px;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
    border: 1px solid #15803d;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
    position: relative;
    z-index: 1;
}

.results-labelmap-count-badge {
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    padding: 0 3px;
    background: #14532d;
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.55);
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    z-index: 2;
}

@media (max-width: 900px) {
    .results-labelmap-tag {
        min-width: 62px;
        max-width: 116px;
        font-size: 0.56rem;
        padding: 3px 6px;
    }
}

@media (max-width: 640px) {
    .results-labelmap-tag {
        min-width: 52px;
        max-width: 104px;
        min-height: 20px;
        font-size: 0.5rem;
        padding: 2px 5px;
        border-radius: 8px;
    }

    .results-labelmap-count-badge {
        min-width: 12px;
        height: 12px;
        font-size: 0.46rem;
        left: 50%;
        bottom: -7px;
    }
}

#questionContent {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 25px;
    border: 1px solid var(--gray-200);
    margin-top: 20px;
}

/* ===== Résultats ===== */
.result-item {
    background: var(--surface);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 15px;
}

.result-item p {
    margin-bottom: 12px;
    font-weight: 500;
}

.result-item p strong {
    color: var(--gray-800);
}

.result-answer-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.result-answer-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.result-answer-percent {
    flex: 0 0 auto;
    font-weight: 700;
    color: var(--gray-700);
}

.correct-icon-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: 0.95rem;
}

.result-item.correct-result {
    border-color: #86efac;
    background: #f0fdf4;
}

.rating-row {
    display: grid;
    grid-template-columns: auto 44px;
    grid-template-areas:
        "stars count"
        "bar bar";
    gap: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.rating-row-label {
    grid-area: stars;
    margin: 0;
    line-height: 1.2;
}

.rating-row-count {
    grid-area: count;
    margin: 0;
    text-align: right;
    font-weight: 700;
    color: var(--gray-700);
}

.rating-row .progress-bar {
    grid-area: bar;
    height: 8px;
}

.rating-dashboard {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: 18px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    padding: 14px;
    --rating-accent: #f59e0b;
}

.rating-dashboard-avg {
    display: grid;
    align-content: center;
    gap: 4px;
}

.rating-avg-value {
    margin: 0;
    font-size: 3rem;
    line-height: 1;
    font-weight: 700;
    color: var(--gray-800);
}

.rating-avg-label,
.rating-avg-votes {
    margin: 0;
    color: var(--gray-600);
}

.rating-avg-stars {
    margin: 6px 0 2px;
    font-size: 1.7rem;
    line-height: 1;
    letter-spacing: 3px;
}

.rating-avg-star {
    color: #cbd5e1;
}

.rating-avg-star.is-on {
    color: var(--rating-accent);
}

.rating-dashboard-dist {
    display: grid;
    gap: 10px;
}

.rating-level-row {
    display: grid;
    grid-template-columns: 90px 1fr 28px;
    gap: 10px;
    align-items: center;
}

.rating-level-label,
.rating-level-count {
    margin: 0;
}

.rating-level-label {
    color: var(--gray-700);
}

.rating-level-count {
    font-weight: 700;
    text-align: right;
    color: var(--gray-700);
}

.rating-level-bar {
    height: 12px;
    border-radius: 999px;
    background: var(--gray-200);
    overflow: hidden;
}

.rating-level-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
}

.correct-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.78rem;
    font-weight: 700;
}

.progress-bar {
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    height: 12px;
}

.progress-fill {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 10px;
    height: 100%;
    transition: width 0.5s ease;
}

/* ===== Layout pour la création ===== */
.share-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: center;
    margin: 25px 0;
}

.share-row .qr-section {
    margin: 0;
}

.share-row .code-display {
    margin: 0;
}

@media (max-width: 768px) {
    .share-row {
        grid-template-columns: 1fr;
    }
}

#resultsQuestionText {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.results-question-meta {
    margin: 0 0 10px;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.results-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 24px;
    padding-top: 8px;
    width: 100%;
}

.results-actions button {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    line-height: 1.2;
    font-size: 0.85rem;
    white-space: nowrap;
    text-align: center;
    overflow: hidden;
}

.results-help-text {
    margin: -8px 0 16px;
    color: var(--gray-600);
    font-size: 0.92rem;
}

.live-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.live-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.25);
}

.live-btn:disabled {
    background: var(--gray-300);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.results-actions .secondary-btn {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
}

.results-actions .secondary-btn:hover {
    background: #c7d2fe;
    border-color: #a5b4fc;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: #312e81;
}

.results-actions .secondary-btn:disabled {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-500);
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.final-report {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.final-report h3 {
    margin: 0 0 14px;
}

.final-report-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
}

.final-report-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 14px;
    min-width: 0;
}

#resultsContent.report-mode #resultsQuestionMeta,
#resultsContent.report-mode #resultsQuestionText,
#resultsContent.report-mode #resultsQuestionImageWrap,
#resultsContent.report-mode .results-help-text,
#resultsContent.report-mode #resultsStats,
#resultsContent.report-mode #refreshResultsBtn,
#resultsContent.report-mode #revealCorrectBtn {
    display: none !important;
}

.final-report-card h4 {
    margin: 0 0 8px;
}

.final-report-question {
    margin: 0 0 10px;
    font-weight: 600;
    color: var(--gray-800);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.final-report-answers {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.final-report-answer {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.92rem;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.final-report-answer a,
.final-report-answer a:visited {
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.final-report-answer a:hover {
    color: var(--primary);
}

.final-report-answer.is-correct {
    border-color: #86efac;
    background: #f0fdf4;
}

.final-report-total {
    margin-top: 10px;
    font-weight: 700;
}

@media (max-width: 720px) {
    .final-report-grid {
        grid-template-columns: 1fr;
    }

    .rating-dashboard {
        grid-template-columns: 1fr;
    }

    #createSuccess .live-action-buttons {
        grid-template-columns: 1fr;
    }

    #createSuccess .live-action-buttons button {
        width: 100%;
    }

    .question-summary-head {
        align-items: flex-start;
    }
}

/* ===== Messages ===== */
.error-message {
    background: var(--error-light);
    color: var(--error);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    body {
        padding: 15px;
    }

    .legal-page {
        width: min(100%, calc(100% - 1rem));
        margin: 16px auto;
        padding: 18px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .brand-title h1 {
        font-size: clamp(2.6rem, 12vw, 3.6rem);
        line-height: 1.05;
    }

    body.page-profile .page-title,
    body.page-admin .page-title {
        font-size: clamp(2.6rem, 12vw, 3.6rem);
        line-height: 1.05;
    }

    .tab {
        padding: 20px;
    }

    .tabs-nav {
        gap: 6px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .question-summary-head {
        flex-direction: column;
        align-items: stretch;
    }

    .live-compact-nav {
        justify-content: flex-end;
    }

    .code-display {
        padding: 20px;
    }

    .code-display-value {
        font-size: 1.8rem;
        letter-spacing: 4px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }

    button {
        padding: 12px 20px;
    }
}

/* ===== Animations ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes dotPulse {
    0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-1px); }
}

.code-display:hover {
    animation: pulse 1s ease infinite;
}

/* ===== Scrollbar personnalisée ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== Footer ===== */
.footer {
    max-width: 900px;
    width: 100%;
    margin: auto auto 12px;
    margin-top: 36px;
    padding-top: 0;
    border-top: none;
    text-align: center;
    color: var(--gray-500);
    position: relative;
}

.footer::before {
    content: '';
    display: block;
    width: 60%;
    max-width: 320px;
    height: 2px;
    margin: 0 auto 28px;
    background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
    border-radius: 2px;
}

.footer-content {
    display: grid;
    gap: 18px;
    justify-items: center;
}

.made-with {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.made-with a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.made-with a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.made-with .fa-heart {
    color: var(--primary);
    margin: 0 3px;
    animation: footerHeartBeat 3.2s infinite ease-in-out;
    transform-origin: center;
}

.license p {
    margin: 0;
    font-size: 0.88rem;
}

.license a {
    text-decoration: none;
    border: 0;
}

.year {
    margin: 2px 0 0;
    font-size: 0.88rem;
    color: var(--gray-400);
}

.footer-legal {
    margin: 0;
    font-size: 0.88rem;
}

.footer-legal a {
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.footer-support {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: inherit;
}

.footer-support-brand {
    font-family: 'Pacifico', 'Brush Script MT', cursive;
}

.footer-support-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-support-link:hover,
.footer-support-link:focus-visible {
    color: var(--primary-dark);
    text-decoration: underline;
}

.footer-support-link i {
    margin-left: 0.2rem;
    font-size: 0.95em;
}

@keyframes footerHeartBeat {
    0%, 100% { transform: scale(1); }
    20% { transform: scale(1.06); }
    40% { transform: scale(1); }
    60% { transform: scale(1.03); }
}

.session-corner {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 228px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 14px 12px;
    z-index: 40;
    text-align: center;
    backdrop-filter: blur(6px);
}

.session-corner-title {
    margin: 0 0 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4f46e5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#sessionCornerQr {
    width: 148px;
    height: 148px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
    background: transparent;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.session-corner-code-label {
    margin: 8px 0 2px;
    font-size: 0.75rem;
    color: #6366f1;
    text-transform: uppercase;
}

.session-corner-code {
    margin: 0;
    font-family: 'Monaco', 'Consolas', monospace;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: 1px;
}

.connected-audience-badge {
    position: fixed;
    left: 16px;
    bottom: 16px;
    width: 64px;
    height: 64px;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    z-index: 45;
    backdrop-filter: blur(6px);
    color: #0f172a;
}

.connected-audience-badge .fa-users {
    font-size: 0.72rem;
    color: #6366f1;
}

#connectedAudienceCount {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1;
}

.connected-audience-badge.is-stale {
    opacity: 0.7;
}

.theme-toggle {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 80;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 1px solid var(--gray-300);
    background: #ffffff;
    color: var(--gray-700);
    border-radius: 999px;
    padding: 0;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle:hover {
    background: #eef2ff;
    border-color: var(--primary-light);
    box-shadow: none;
    transform: rotate(15deg);
}

.theme-toggle:active {
    transform: rotate(30deg) scale(0.92);
}

.theme-toggle-inline {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    box-shadow: none;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    flex: 0 0 44px;
}

.account-bar .theme-toggle-inline {
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin-top: 0;
    padding: 0;
    border-radius: 999px;
    flex: 0 0 44px;
}

.reveal-item {
    opacity: 0;
    transform: translateY(6px);
    animation: revealUp 0.36s ease forwards;
}

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

@media (max-width: 640px) {
    .session-corner {
        width: 132px;
        padding: 8px 8px 9px;
        right: 8px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        border-radius: 12px;
    }

    .session-corner-title {
        margin: 0 0 4px;
        font-size: 0.72rem;
        letter-spacing: 0.35px;
        gap: 4px;
    }

    #sessionCornerQr {
        display: none;
    }

    .session-corner.is-expanded-mobile {
        width: 152px;
        padding: 10px 8px;
    }

    .session-corner.is-expanded-mobile #sessionCornerQr {
        display: block;
        width: 96px;
        height: 96px;
        margin: 4px auto 6px;
    }

    .session-corner-code-label {
        margin: 0;
        font-size: 0.66rem;
        cursor: pointer;
    }

    .session-corner-code {
        margin-top: 2px;
        font-size: 1.12rem;
        letter-spacing: 0.6px;
        cursor: pointer;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
    }

    .session-corner-code:active {
        opacity: 0.8;
    }

    .connected-audience-badge {
        left: 8px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
        width: 56px;
        height: 56px;
    }

    .connected-audience-badge .fa-users {
        font-size: 0.66rem;
    }

    #connectedAudienceCount {
        font-size: 0.96rem;
    }
}

:root.theme-dark {
    --surface: #111827;
    --surface-alt: #0f172a;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #94a3b8;
    --gray-500: #cbd5e1;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;
}

:root.theme-dark body {
    background:
        radial-gradient(900px 360px at 20% -10%, rgba(99, 102, 241, 0.14) 0%, transparent 60%),
        radial-gradient(700px 280px at 100% 0%, rgba(79, 70, 229, 0.10) 0%, transparent 58%),
        #020617;
    color: var(--gray-800);
}

:root.theme-dark h1 {
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

:root.theme-dark body::before {
    opacity: 0.14;
    background-image: radial-gradient(circle, #818cf8 1px, transparent 1px);
}

:root.theme-dark body.page-login .card::after,
:root.theme-dark body.page-profile .card::after,
:root.theme-dark body.page-admin .card::after,
:root.theme-dark body.page-setup-admin .card::after {
    background: linear-gradient(90deg, #6366f1, #a5b4fc, #6366f1);
}

:root.theme-dark h2 {
    color: #a5b4fc;
}

:root.theme-dark h3 {
    color: #818cf8;
}

:root.theme-dark .legal-page {
    background: #111827;
    border-color: #334155;
    color: var(--gray-800);
}

:root.theme-dark .legal-page h2 {
    color: var(--gray-900);
}

:root.theme-dark .legal-page a {
    color: #a5b4fc;
}

:root.theme-dark .contact-form label {
    color: var(--gray-800);
}

:root.theme-dark .contact-help {
    color: var(--gray-900);
}

:root.theme-dark .contact-form input,
:root.theme-dark .contact-form textarea {
    background: #0f172a;
    border-color: #334155;
    color: var(--gray-900);
}

:root.theme-dark .contact-form input:focus,
:root.theme-dark .contact-form textarea:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

:root.theme-dark .help-admonition {
    background: #1e1b4b;
    border-color: #4338ca;
}

:root.theme-dark .help-admonition summary {
    color: #a5b4fc;
}

:root.theme-dark .help-admonition pre {
    background: #0b1220;
    border-color: #334155;
    color: var(--gray-800);
}

:root.theme-dark .account-bar {
    background: #111827;
    border-color: rgba(99, 102, 241, 0.15);
    color: var(--gray-800);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

:root.theme-dark .account-icon-link {
    border-color: #334155;
    background: #1e293b;
    color: #e2e8f0;
}

:root.theme-dark .account-icon-link:hover,
:root.theme-dark .account-icon-link:focus-visible {
    border-color: #475569;
    background: #334155;
    box-shadow: none;
}

:root.theme-dark .account-icon-link.is-current {
    border-color: rgba(129, 140, 248, 0.45);
    background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
    color: #ffffff;
}

:root.theme-dark .account-icon-link[data-tooltip]::after {
    color: #a5b4fc;
    background: #1e1b4b;
    border-color: #4338ca;
}

:root.theme-dark .tab,
:root.theme-dark .saved-quizzes-panel,
:root.theme-dark .batch-question-block,
:root.theme-dark .batch-question-block .question-multiple-fields,
:root.theme-dark .question-summary,
:root.theme-dark .created-question,
:root.theme-dark .created-answers li,
:root.theme-dark .qr-section,
:root.theme-dark .open-response-item,
:root.theme-dark .wordcloud-container,
:root.theme-dark .url-display,
:root.theme-dark .rating-summary-compact {
    background: #111827;
    border-color: #334155;
    color: var(--gray-800);
}

:root.theme-dark .tab {
    border-top-color: rgba(129, 140, 248, 0.72);
}

:root.theme-dark .tab {
    border-top-color: rgba(129, 140, 248, 0.72);
}

:root.theme-dark .created-video-wrap {
    border-color: #334155;
}

:root.theme-dark .option-checkbox-card {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(17, 24, 39, 0.94) 100%);
    border-color: #334155;
    box-shadow: none;
}

:root.theme-dark .option-checkbox-card:hover,
:root.theme-dark .option-checkbox-card:focus-within {
    border-color: rgba(129, 140, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

:root.theme-dark .option-checkbox-copy strong {
    color: #e5e7eb;
}

:root.theme-dark .option-checkbox-copy small {
    color: #cbd5e1;
}

:root.theme-dark .batch-question-input[contenteditable="true"] {
    background: #0f172a;
    border-color: #334155;
    color: #e5e7eb;
}

:root.theme-dark .batch-question-input[contenteditable="true"]:focus {
    background: #111827;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

:root.theme-dark .question-format-toolbar {
    background: rgba(15, 23, 42, 0.94);
    border-color: rgba(99, 102, 241, 0.26);
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.45);
}

:root.theme-dark .question-format-toolbar-btn {
    color: #e5e7eb;
}

:root.theme-dark .question-format-toolbar-btn:hover,
:root.theme-dark .question-format-toolbar-btn:focus-visible {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(129, 140, 248, 0.35);
    color: #c7d2fe;
}

:root.theme-dark .question-format-toolbar-btn.is-active {
    background: rgba(99, 102, 241, 0.28);
    border-color: rgba(129, 140, 248, 0.5);
    color: #c7d2fe;
}

:root.theme-dark .question-format-toolbar-divider {
    background: rgba(71, 85, 105, 0.9);
}

:root.theme-dark .inline-math-insert-btn,
:root.theme-dark .question-math-insert-btn {
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(100, 116, 139, 0.45);
    color: #cbd5e1;
}

:root.theme-dark .inline-math-insert-btn:hover,
:root.theme-dark .inline-math-insert-btn:focus-visible,
:root.theme-dark .question-math-insert-btn:hover,
:root.theme-dark .question-math-insert-btn:focus-visible {
    background: rgba(30, 41, 59, 0.98);
    border-color: rgba(129, 140, 248, 0.45);
    color: #e0e7ff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.32);
}

:root.theme-dark .math-modal-panel {
    background: #0f172a;
    border-color: rgba(99, 102, 241, 0.2);
}

:root.theme-dark .math-modal-header {
    border-bottom-color: #334155;
}

:root.theme-dark .math-modal-help,
:root.theme-dark .math-preview-label,
:root.theme-dark .math-preview-placeholder {
    color: #94a3b8;
}

:root.theme-dark .math-insert-field,
:root.theme-dark .open-answer-math-field,
:root.theme-dark .math-preview-surface,
:root.theme-dark .import-markdown-textarea {
    background: #111827;
    border-color: #334155;
    color: #e5e7eb;
}

:root.theme-dark .ML__keyboard {
    box-shadow: 0 -18px 42px rgba(2, 6, 23, 0.5);
}

:root.theme-dark .question-timer {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .question-timer-label {
    color: #94a3b8;
}

:root.theme-dark .question-timer-head strong {
    color: #e2e8f0;
}

:root.theme-dark .question-timer-track {
    background: #1e293b;
}

:root.theme-dark .legend-editor-canvas,
:root.theme-dark .labelimage-player-canvas,
:root.theme-dark .legend-label-row,
:root.theme-dark .labelimage-label-btn {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark #resultsQuestionImageWrap img {
    background: #0f172a;
}

:root.theme-dark .results-labelmap-overlay {
    background: transparent;
}

:root.theme-dark .legend-editor-help,
:root.theme-dark .legend-editor-instruction,
:root.theme-dark .labelimage-player-help {
    color: #cbd5e1;
}

:root.theme-dark .legend-editor-marker.is-placeholder {
    border-color: #818cf8;
    background: rgba(99, 102, 241, 0.32);
    color: #e0e7ff;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.9);
}

:root.theme-dark .legend-editor-marker.is-placeholder::after {
    border-color: rgba(129, 140, 248, 0.7);
}

:root.theme-dark .legend-editor-marker.is-current {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.3);
}

:root.theme-dark .labelimage-player-marker.is-placeholder {
    border-color: rgba(165, 180, 252, 0.85);
    background: rgba(15, 23, 42, 0.55);
}

:root.theme-dark .labelimage-player-marker::before {
    background: rgba(199, 210, 254, 0.8);
}

:root.theme-dark .labelimage-player-marker.is-assigned {
    border-color: #a5b4fc;
    background: #1e293b;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.96), 0 5px 14px rgba(129, 140, 248, 0.26);
}

:root.theme-dark .labelimage-player-marker-text {
    color: #eef2ff;
}

:root.theme-dark .labelimage-player-marker.is-assigned::before {
    display: none;
}

:root.theme-dark .labelimage-player-marker.is-placeholder::after {
    border-color: rgba(165, 180, 252, 0.72);
}

:root.theme-dark .labelimage-player-marker.is-current {
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.3);
}

:root.theme-dark .labelimage-player-marker.is-drop-target {
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.3), 0 0 0 6px rgba(165, 180, 252, 0.14);
}

:root.theme-dark .labelimage-player-drag-chip {
    border-color: #a5b4fc;
    background: #1e293b;
    color: #eef2ff;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.48);
}

:root.theme-dark .question-labelimage-image-fields.has-image .batch-question-image-input {
    background: #0b1220;
    border-color: #334155;
}

:root.theme-dark .question-labelimage-image-fields.has-image .batch-question-image-input::file-selector-button,
:root.theme-dark .question-labelimage-image-fields.has-image .batch-question-image-input::-webkit-file-upload-button {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 8px;
}

:root.theme-dark .created-media-error {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .rating-row {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .results-video-wrap {
    border-color: #334155;
}

:root.theme-dark .video-fallback-link {
    color: #cbd5e1;
}

:root.theme-dark .video-fallback-link a,
:root.theme-dark .video-fallback-link a:visited {
    color: #a5b4fc;
}

:root.theme-dark .video-fallback-link a:hover {
    color: #c7d2fe;
}

:root.theme-dark .results-labelmap-count-badge {
    background: #14532d;
    border-color: #16a34a;
}

:root.theme-dark .results-labelmap-tag {
    border-color: #22c55e;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

:root.theme-dark .results-labelmap-legend-item {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .results-labelmap-legend-text,
:root.theme-dark .results-labelmap-legend-count {
    color: #e2e8f0;
}

:root.theme-dark .rating-row-count {
    color: #e2e8f0;
}

:root.theme-dark .tab-btn {
    background: #0f172a;
    border-color: #334155;
    color: #a5b4fc;
}

:root.theme-dark .tab-btn:hover {
    background: #1e293b;
}

:root.theme-dark .secondary-btn {
    background: #1e293b;
    color: #e2e8f0;
}

:root.theme-dark .secondary-btn:hover {
    background: #334155;
}

:root.theme-dark .primary-action-btn {
    color: white;
}

:root.theme-dark .site-notice.is-error {
    background: #3f1d12;
    border-color: #9a3412;
    color: #fed7aa;
}

:root.theme-dark .open-math-editor-btn.secondary-btn.inline-math-insert-btn:hover,
:root.theme-dark .open-math-editor-btn.secondary-btn.inline-math-insert-btn:focus-visible {
    transform: translateY(-50%) !important;
}

:root.theme-dark .open-math-editor-btn.secondary-btn.question-math-insert-btn:hover,
:root.theme-dark .open-math-editor-btn.secondary-btn.question-math-insert-btn:focus-visible {
    transform: none !important;
}

:root.theme-dark .saved-quiz-card {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark #homePanel > h2,
:root.theme-dark #trashQuizzesPanel h3,
:root.theme-dark .saved-quiz-section-title {
    color: #ffffff;
}

:root.theme-dark .saved-quiz-card.is-active {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

:root.theme-dark .saved-quiz-card-draft {
    border-color: #6366f1;
}

:root.theme-dark .saved-quiz-card-meta,
:root.theme-dark .saved-quiz-card-code {
    color: #cbd5e1;
}

:root.theme-dark .saved-quiz-card-updated {
    color: #94a3b8;
}

:root.theme-dark .saved-quiz-empty {
    border-color: #334155;
    background: #0b1220;
    color: #94a3b8;
}

:root.theme-dark .saved-quiz-favorite-btn {
    border-color: #334155;
    background: #1e293b;
    color: #94a3b8;
}

:root.theme-dark .saved-quiz-favorite-btn:hover {
    border-color: #d97706;
    background: rgba(217, 119, 6, 0.12);
    color: #f59e0b;
}

:root.theme-dark .saved-quiz-favorite-btn.is-favorite {
    border-color: #b45309;
    background: rgba(217, 119, 6, 0.14);
    color: #f59e0b;
}

:root.theme-dark input[type="text"],
:root.theme-dark input[type="url"],
:root.theme-dark textarea,
:root.theme-dark select.batch-question-type,
:root.theme-dark select.batch-time-limit-select,
:root.theme-dark #trashQuizSelect {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .question-settings-grid .question-participant-responses-row .inline-checkbox-label {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .question-image-toggle-row .toggle-question-image-fields-btn {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .question-settings-grid .question-participant-responses-row .inline-checkbox-label:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

:root.theme-dark .question-image-toggle-row .toggle-question-image-fields-btn:hover,
:root.theme-dark .question-image-toggle-row .toggle-question-image-fields-btn:focus-visible {
    background: #0f172a;
    border-color: #475569;
    box-shadow: none;
}

:root.theme-dark input[type="text"]::placeholder,
:root.theme-dark input[type="url"]::placeholder,
:root.theme-dark textarea::placeholder {
    color: #94a3b8;
}

:root.theme-dark .answer-input-index {
    background: #1e293b;
    color: #e2e8f0;
}

:root.theme-dark .correct-icon {
    background: #0b1220;
    border-color: #475569;
    box-shadow: inset 0 0 0 2px #0b1220;
}

:root.theme-dark .correct-choice:hover .correct-icon {
    border-color: #34d399;
}

:root.theme-dark .correct-choice input[type="radio"]:focus-visible + .correct-icon,
:root.theme-dark .correct-choice input[type="checkbox"]:focus-visible + .correct-icon {
    outline: 3px solid rgba(99, 102, 241, 0.28);
}

:root.theme-dark .answer-option {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .answer-option:hover {
    border-color: #818cf8;
    background: #111827;
}

:root.theme-dark .answer-option input[type="radio"],
:root.theme-dark .answer-option input[type="checkbox"] {
    accent-color: #818cf8;
}

:root.theme-dark .rating-choice-label {
    color: #64748b;
}

:root.theme-dark .ranking-sort-item {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .ranking-sort-handle {
    color: #94a3b8;
}

:root.theme-dark .ranking-sort-input {
    background: #0b1220;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .ranking-editor-row {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .question-type-row::after,
:root.theme-dark .question-timer-row::after {
    color: #cbd5e1;
}

:root.theme-dark .footer {
    color: #ffffff;
}

:root.theme-dark .footer::before {
    background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.4), transparent);
}

:root.theme-dark .made-with .fa-heart {
    color: #a5b4fc;
}

:root.theme-dark .year {
    color: #ffffff;
}

:root.theme-dark .made-with a {
    color: #a5b4fc;
}

:root.theme-dark .account-link {
    color: #f8fafc;
}

:root.theme-dark .session-corner {
    background: rgba(15, 23, 42, 0.95);
    border-color: #334155;
}

:root.theme-dark .connected-audience-badge {
    background: rgba(15, 23, 42, 0.95);
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .connected-audience-badge .fa-users {
    color: #a5b4fc;
}

:root.theme-dark #sessionCornerQr {
    border-color: #334155;
}

:root.theme-dark .theme-toggle {
    background: #111827;
    color: #e2e8f0;
    border-color: #334155;
    box-shadow: none;
}

:root.theme-dark .theme-toggle:hover {
    background: #1e293b;
    border-color: #a5b4fc;
    box-shadow: none;
}

:root.theme-dark .batch-question-title {
    color: #d1d5db;
}

:root.theme-dark .code-display {
    background: linear-gradient(135deg, #0f172a 0%, #111827 100%);
    border-color: #334155;
    color: #f8fafc;
}

:root.theme-dark .code-display::before {
    color: #94a3b8;
}

:root.theme-dark .result-item {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .result-item.correct-result {
    background: #052e1f;
    border-color: #15803d;
}

:root.theme-dark .result-item.correct-result .result-answer-percent,
:root.theme-dark .result-item.correct-result .result-answer-main strong {
    color: #dcfce7;
}

:root.theme-dark .open-response-item.correct-response-item {
    background: #052e1f;
    border-color: #15803d;
    color: #dcfce7;
}

:root.theme-dark .rating-dashboard {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .rating-avg-value {
    color: #f1f5f9;
}

:root.theme-dark .rating-avg-label,
:root.theme-dark .rating-avg-votes,
:root.theme-dark .rating-level-label,
:root.theme-dark .rating-level-count {
    color: #cbd5e1;
}

:root.theme-dark .rating-avg-star {
    color: #475569;
}

:root.theme-dark .rating-avg-star.is-on {
    color: var(--rating-accent);
}

:root.theme-dark .rating-level-bar {
    background: #334155;
}

:root.theme-dark .final-report {
    border-top-color: #334155;
}

:root.theme-dark .final-report-card {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .final-report-question,
:root.theme-dark .final-report-total {
    color: #e2e8f0;
}

:root.theme-dark .final-report-answer {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .final-report-answer a,
:root.theme-dark .final-report-answer a:visited {
    color: #a5b4fc;
}

:root.theme-dark .final-report-answer a:hover {
    color: #c7d2fe;
}

:root.theme-dark .final-report-answer.is-correct {
    background: #052e1f;
    border-color: #15803d;
}

:root.theme-dark .answer-question-meta {
    color: rgba(226, 232, 240, 0.92);
}

:root.theme-dark .correct-tag {
    background: #14532d;
    color: #dcfce7;
}

:root.theme-dark .cloze-example-text {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

:root.theme-dark .cloze-inline-wrap {
    background: #0f172a;
    border-color: #334155;
}

:root.theme-dark .cloze-blank-input {
    background: #020617;
    border-color: #334155;
    color: #e2e8f0;
}

/* Auth/Admin pages */
@keyframes footerHeartBeat {
    0%, 100% { transform: scale(1); }
    20% { transform: scale(1.06); }
    40% { transform: scale(1); }
    60% { transform: scale(1.03); }
}

body.page-login,
body.page-profile,
body.page-admin,
body.page-setup-admin {
    font-family: Inter, system-ui, sans-serif;
    background: #f8fafc;
    margin: 0;
    padding: 24px;
    color: #1f2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.page-login .theme-toggle:not(.theme-toggle-inline),
body.page-profile .theme-toggle:not(.theme-toggle-inline),
body.page-admin .theme-toggle:not(.theme-toggle-inline),
body.page-setup-admin .theme-toggle:not(.theme-toggle-inline) {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 80;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 0;
    font-size: 1.05rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.page-login .footer,
body.page-profile .footer,
body.page-admin .footer,
body.page-setup-admin .footer {
    margin: auto auto 8px;
    margin-top: 36px;
    padding-top: 0;
    border-top: none;
    text-align: center;
    color: #6b7280;
    width: 100%;
    position: relative;
}

body.page-login .footer::before,
body.page-profile .footer::before,
body.page-admin .footer::before,
body.page-setup-admin .footer::before {
    content: '';
    display: block;
    width: 60%;
    max-width: 320px;
    height: 2px;
    margin: 0 auto 28px;
    background: linear-gradient(90deg, transparent, #a5b4fc, transparent);
    border-radius: 2px;
}

body.page-login .footer-content,
body.page-profile .footer-content,
body.page-admin .footer-content,
body.page-setup-admin .footer-content {
    display: grid;
    gap: 18px;
    justify-items: center;
}

body.page-login .made-with,
body.page-profile .made-with,
body.page-admin .made-with,
body.page-setup-admin .made-with {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

body.page-login .made-with a,
body.page-profile .made-with a,
body.page-admin .made-with a,
body.page-setup-admin .made-with a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

body.page-login .made-with a:hover,
body.page-profile .made-with a:hover,
body.page-admin .made-with a:hover,
body.page-setup-admin .made-with a:hover {
    color: #6366f1;
    text-decoration: underline;
}

body.page-login .made-with .fa-heart,
body.page-profile .made-with .fa-heart,
body.page-admin .made-with .fa-heart,
body.page-setup-admin .made-with .fa-heart {
    display: inline-block;
    color: #6366f1;
    margin: 0 3px;
    animation: footerHeartBeat 3.2s infinite ease-in-out;
    transform-origin: center;
}

body.page-login .license p,
body.page-profile .license p,
body.page-admin .license p,
body.page-setup-admin .license p {
    margin: 0;
    font-size: 0.88rem;
}

body.page-login .footer-legal a,
body.page-profile .footer-legal a,
body.page-admin .footer-legal a,
body.page-setup-admin .footer-legal a {
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

body.page-login .footer-legal a:hover,
body.page-profile .footer-legal a:hover,
body.page-admin .footer-legal a:hover,
body.page-setup-admin .footer-legal a:hover {
    color: #6366f1;
    text-decoration: underline;
}

body.page-login .license a,
body.page-profile .license a,
body.page-admin .license a,
body.page-setup-admin .license a {
    color: inherit;
    text-decoration: none;
    border: 0;
}

body.page-login .year,
body.page-profile .year,
body.page-admin .year,
body.page-setup-admin .year {
    margin: 2px 0 0;
    font-size: 0.88rem;
    color: #9ca3af;
}

body.page-login .wrap {
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    animation: pageEnter 0.4s ease-out;
}

body.page-login .hero { margin-bottom: clamp(40px, 6vh, 68px); text-align: center; }
body.page-login .login-main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(68px, 9vh, 118px); }
body.page-login .title { margin: 0; font-family: "Pacifico", "Brush Script MT", cursive; font-size: clamp(4rem, 8vw, 5.6rem); letter-spacing: 0.02em; font-weight: 400; line-height: 1.1; background: linear-gradient(135deg, #6366f1 0%, #4f46e5 40%, #818cf8 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
body.page-login .subtitle { margin: 20px auto 0; max-width: 680px; font-size: clamp(1.05rem, 2.1vw, 1.18rem); font-weight: 500; color: #4b5563; line-height: 1.6; letter-spacing: -0.005em; }
body.page-login .card { margin: 0; background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 0; border-top: 2px solid rgba(99, 102, 241, 0.55); border-radius: 14px; padding: 24px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06); transition: box-shadow 0.3s ease, border-top-color 0.3s ease; }
body.page-login .card::after { display: none; }
body.page-login .card:hover { box-shadow: 0 14px 40px rgba(99, 102, 241, 0.10), 0 0 24px rgba(99, 102, 241, 0.06); border-top-color: rgba(79, 70, 229, 0.72); }
body.page-login .split { display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; gap: 24px; }
body.page-login .divider { width: 1px; min-height: 280px; background: #e5e7eb; justify-self: center; }
body.page-login .logo-pane { display: grid; place-items: center; padding: 12px; }
body.page-login .logo-pane img { width: min(320px, 100%); height: auto; object-fit: contain; }
body.page-login .form-pane h2 { margin: 0 0 14px; font-size: 1.4rem; }
body.page-login label { display: block; font-weight: 600; margin: 12px 0 6px; }
body.page-login input { width: 100%; box-sizing: border-box; border: 2px solid #e5e7eb; border-radius: 8px; padding: 12px; font-size: 1rem; }
body.page-login input:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18); }
body.page-login button { width: 100%; margin-top: 14px; border: 1px solid #c7d2fe; border-radius: 8px; padding: 12px; font-weight: 700; color: #3730a3; background: #eef2ff; cursor: pointer; transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease; }
body.page-login button:hover { background: #c7d2fe; border-color: #a5b4fc; color: #312e81; }
body.page-login .error { margin-top: 10px; padding: 10px; background: #fee2e2; color: #b91c1c; border-radius: 8px; }
body.page-login .info { margin-top: 10px; padding: 10px; background: #e0f2fe; color: #0c4a6e; border-radius: 8px; }
body.page-login .hint { margin-top: 14px; font-size: 0.9rem; color: #4b5563; }
body.page-login .hint a { display: inline-flex; align-items: center; gap: 6px; color: #4f46e5; text-decoration: none; font-weight: 600; }
body.page-login .hint a:visited { color: #4f46e5; }
body.page-login .hint a:hover { color: #3730a3; text-decoration: underline; }
body.page-login .hint a:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; border-radius: 4px; }
body.page-login .beta-notice { margin: 0 auto clamp(52px, 7vh, 96px); max-width: 560px; padding: 14px 18px; font-size: 0.95rem; line-height: 1.55; text-align: center; color: #4338ca; background: rgba(224, 231, 255, 0.7); border: 1px solid rgba(129, 140, 248, 0.35); border-radius: 10px; }
body.page-login .beta-notice p { margin: 0; }
body.page-login .beta-notice p + p { margin-top: 4px; }
body.page-login .beta-notice-title { font-weight: 700; }
body.page-login .beta-notice i { margin-right: 8px; color: #4f46e5; }
body.page-login .beta-notice a { color: #3730a3; font-weight: 700; text-decoration: none; }
body.page-login .beta-notice a:hover { text-decoration: underline; }
body.page-login .beta-notice a:focus-visible { outline: 2px solid #a5b4fc; outline-offset: 2px; border-radius: 4px; }

body.page-profile .wrap {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    animation: pageEnter 0.4s ease-out;
}

body.page-profile .top { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 16px; }
body.page-profile .top-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.page-profile .page-top-brand { display: grid; gap: 8px; justify-items: center; width: 100%; }
body.page-profile .page-brand-line { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
body.page-profile .page-brand-logo { width: 128px; height: 128px; object-fit: contain; opacity: 0; animation: pageEnter 0.5s ease-out forwards; }
body.page-profile .page-title { margin: 0; font-family: "Pacifico", "Brush Script MT", cursive; font-size: clamp(4rem, 8vw, 5.6rem); font-weight: 400; line-height: 1.1; letter-spacing: 0.02em; background: linear-gradient(135deg, #6366f1 0%, #4f46e5 40%, #818cf8 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; opacity: 0; animation: pageEnter 0.5s ease-out 0.1s forwards; }
body.page-profile .page-site-tagline { margin: 0 auto 48px; max-width: 760px; text-align: center; color: var(--gray-600); font-size: 1.1rem; font-weight: 500; line-height: 1.6; letter-spacing: -0.005em; opacity: 0; animation: pageEnter 0.5s ease-out 0.2s forwards; }
body.page-profile .card { background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 0; border-top: 2px solid rgba(99, 102, 241, 0.55); border-radius: 12px; padding: 18px; margin-bottom: 22px; transition: box-shadow 0.3s ease, border-top-color 0.3s ease; }
body.page-profile .card::after { display: none; }
body.page-profile .card:hover { box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08), 0 0 20px rgba(99, 102, 241, 0.05); border-top-color: rgba(79, 70, 229, 0.72); }
body.page-profile h1, body.page-profile h2 { margin: 0 0 12px; }
body.page-profile .card h2 { display: inline-flex; align-items: center; gap: 8px; }
body.page-profile .card h2 { border-bottom-width: 1px; }
body.page-profile label { display: block; font-weight: 600; margin: 10px 0 6px; }
body.page-profile input { width: 100%; box-sizing: border-box; border: 2px solid #e5e7eb; border-radius: 8px; padding: 11px; font-size: 1rem; }
body.page-profile input:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18); }
body.page-profile .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body.page-profile button,
body.page-profile .link { border: 1px solid #d1d5db; border-radius: 8px; padding: 11px 14px; font-weight: 700; background: #f8fafc; color: #334155; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease; }
body.page-profile .top-links .link { min-height: 44px; display: inline-flex; align-items: center; }
body.page-profile .top-links .link { border-radius: 999px; }
body.page-profile .top-links .link:not(.icon-link) { height: 44px; padding: 0 14px; box-sizing: border-box; }
body.page-profile .icon-link { min-width: 48px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
body.page-profile .icon-link i { font-size: 1.15rem; }
body.page-profile .top-links .icon-link[data-tooltip] { position: relative; }
body.page-profile .top-links .icon-link[data-tooltip]::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%) translateY(3px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; white-space: nowrap; font-size: 0.55rem; font-weight: 600; color: #4f46e5; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 3px; padding: 1px 5px; z-index: 10; }
body.page-profile .top-links .icon-link[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
body.page-profile button:hover,
body.page-profile .link:hover { background: #eef2f7; border-color: #cbd5e1; color: #1e293b; }
body.page-profile button[type="submit"] { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
body.page-profile button[type="submit"]:hover { background: #c7d2fe; border-color: #a5b4fc; color: #312e81; }
body.page-profile .form-actions { margin-top: 16px; }
body.page-profile .msg-ok { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; }
body.page-profile .msg-err { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 8px; }
body.page-profile .meta { color: #4b5563; font-size: 0.93rem; margin-top: -6px; margin-bottom: 8px; }
body.page-profile .export-text {
    margin: 0 0 14px;
    color: #111827;
}
body.page-profile .export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
body.page-profile .danger-zone {
    border: 0;
    border-top: 2px solid #ef4444;
    border-radius: 12px;
    background: #fffafa;
    padding: 10px 14px;
}
body.page-profile .danger-zone::after {
    display: none;
}
body.page-profile .danger-zone:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.08);
    border-top-color: #ef4444;
}
body.page-profile .danger-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #b91c1c;
    border-bottom-width: 1px;
    border-bottom-color: rgba(239, 68, 68, 0.22);
    margin-bottom: 4px;
    font-size: 0.95rem;
}
body.page-profile .danger-text {
    margin: 0 0 6px;
    color: #7f1d1d;
    font-size: 0.85rem;
}
body.page-profile .danger-zone label {
    color: #991b1b;
    font-size: 0.88rem;
    margin: 6px 0 4px;
}
body.page-profile .danger-zone input {
    border-color: #fca5a5;
    background: #fff;
    color: #7f1d1d;
    padding: 8px 10px;
}
body.page-profile .danger-zone input:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}
body.page-profile .danger-zone .danger-btn {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.88rem;
}
body.page-profile .danger-zone .danger-btn:hover { background: #dc2626 !important; border-color: #dc2626 !important; color: #fff !important; }

body.page-admin .wrap {
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    animation: pageEnter 0.4s ease-out;
}

body.page-admin .top { display: flex; justify-content: center; align-items: center; margin-bottom: 16px; }
body.page-admin .top-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.page-admin .page-top-brand { display: grid; gap: 8px; justify-items: center; width: 100%; }
body.page-admin .page-brand-line { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
body.page-admin .page-brand-logo { width: 128px; height: 128px; object-fit: contain; opacity: 0; animation: pageEnter 0.5s ease-out forwards; }
body.page-admin .page-title { margin: 0; font-family: "Pacifico", "Brush Script MT", cursive; font-size: clamp(4rem, 8vw, 5.6rem); font-weight: 400; line-height: 1.1; letter-spacing: 0.02em; background: linear-gradient(135deg, #6366f1 0%, #4f46e5 40%, #818cf8 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; opacity: 0; animation: pageEnter 0.5s ease-out 0.1s forwards; }
body.page-admin .page-site-tagline { margin: 0 auto 48px; max-width: 760px; text-align: center; color: var(--gray-600); font-size: 1.1rem; font-weight: 500; line-height: 1.6; letter-spacing: -0.005em; opacity: 0; animation: pageEnter 0.5s ease-out 0.2s forwards; }
body.page-admin .card { background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 0; border-top: 2px solid rgba(99, 102, 241, 0.55); border-radius: 12px; padding: 18px; margin-bottom: 14px; transition: box-shadow 0.3s ease, border-top-color 0.3s ease; }
body.page-admin .card::after { display: none; }
body.page-admin .card:hover { box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08), 0 0 20px rgba(99, 102, 241, 0.05); border-top-color: rgba(79, 70, 229, 0.72); }
body.page-admin h1, body.page-admin h2 { margin: 0 0 12px; }
body.page-admin .card h2 { display: inline-flex; align-items: center; gap: 8px; }
body.page-admin .card h2 { border-bottom-width: 1px; }
body.page-admin .row { display: grid; grid-template-columns: 1fr 1fr 1fr 180px; gap: 10px; }
body.page-admin label { display: block; font-weight: 600; margin: 10px 0 6px; }
body.page-admin input,
body.page-admin select { width: 100%; box-sizing: border-box; border: 2px solid #e5e7eb; border-radius: 8px; padding: 11px; font-size: 1rem; }
body.page-admin input:focus,
body.page-admin select:focus { outline: none; border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18); }
body.page-admin button,
body.page-admin .link { border: 1px solid #d1d5db; border-radius: 8px; padding: 11px 14px; font-weight: 700; background: #f8fafc; color: #334155; cursor: pointer; text-decoration: none; display: inline-block; transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease; }
body.page-admin .top-links .link { min-height: 44px; display: inline-flex; align-items: center; }
body.page-admin .top-links .link { border-radius: 999px; }
body.page-admin .top-links .link:not(.icon-link) { height: 44px; padding: 0 14px; box-sizing: border-box; }
body.page-admin .icon-link { min-width: 48px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
body.page-admin .icon-link i { font-size: 1.15rem; }
body.page-admin .top-links .icon-link[data-tooltip] { position: relative; }
body.page-admin .top-links .icon-link[data-tooltip]::after { content: attr(data-tooltip); position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%) translateY(3px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; white-space: nowrap; font-size: 0.55rem; font-weight: 600; color: #4f46e5; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 3px; padding: 1px 5px; z-index: 10; }
body.page-admin .top-links .icon-link[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
body.page-admin button:hover,
body.page-admin .link:hover { background: #eef2f7; border-color: #cbd5e1; color: #1e293b; }
body.page-admin button[type="submit"] { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
body.page-admin button[type="submit"]:hover { background: #c7d2fe; border-color: #a5b4fc; color: #312e81; }
body.page-admin #runHealthcheckBtn { display: inline-flex; align-items: center; gap: 14px; }
body.page-admin #runHealthcheckBtn i { margin-right: 0; }
body.page-admin .healthcheck-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
body.page-admin #purgeOrphansBtn { display: inline-flex; align-items: center; gap: 14px; background: #ef4444; border-color: #ef4444; color: #ffffff; }
body.page-admin #purgeOrphansBtn:hover { background: #dc2626; border-color: #dc2626; color: #ffffff; }
body.page-admin #purgeOrphansBtn:disabled { opacity: 0.75; cursor: not-allowed; }
body.page-admin .form-actions { margin-top: 16px; }
body.page-admin .msg-ok { background: #dcfce7; color: #166534; padding: 10px; border-radius: 8px; }
body.page-admin .msg-err { background: #fee2e2; color: #b91c1c; padding: 10px; border-radius: 8px; }
body.page-admin .accounts-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.page-admin table { width: 100%; border-collapse: collapse; }
body.page-admin th,
body.page-admin td { border-bottom: 1px solid #e5e7eb; padding: 8px; text-align: left; font-size: 0.95rem; }
body.page-admin .accounts-pagination-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
body.page-admin .accounts-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 0; }
body.page-admin .accounts-page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid #d1d5db; background: #f8fafc; color: #334155; text-decoration: none; font-weight: 700; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
body.page-admin .accounts-page-link:hover,
body.page-admin .accounts-page-link:focus-visible { background: #eef2ff; border-color: #a5b4fc; color: #4338ca; transform: translateY(-1px); }
body.page-admin .accounts-page-link.is-current { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); border-color: #4f46e5; color: #ffffff; box-shadow: 0 8px 18px -12px rgba(79, 70, 229, 0.55); }
body.page-admin .accounts-page-size-form { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
body.page-admin .accounts-page-size-form label { margin: 0; font-weight: 600; color: #475569; }
body.page-admin .accounts-page-size-form select { min-width: 86px; }
body.page-admin .healthcheck-panel { margin-top: 14px; padding-top: 14px; border-top: 1px dashed #d1d5db; display: grid; gap: 12px; }
body.page-admin .healthcheck-summary-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
body.page-admin .healthcheck-badge { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; border-radius: 999px; padding: 6px 12px; border: 1px solid #d1d5db; background: #f8fafc; color: #334155; }
body.page-admin .healthcheck-badge.is-ok { background: #dcfce7; border-color: #86efac; color: #166534; }
body.page-admin .healthcheck-badge.is-error { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
body.page-admin .healthcheck-badge.is-pending { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
body.page-admin .healthcheck-timestamp { color: #64748b; font-size: 0.93rem; }
body.page-admin .healthcheck-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
body.page-admin .healthcheck-item { border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px; background: #f8fafc; }
body.page-admin .healthcheck-item.is-ok { border-color: #86efac; background: #f0fdf4; }
body.page-admin .healthcheck-item.is-error { border-color: #fca5a5; background: #fef2f2; }
body.page-admin .healthcheck-item.is-warn { border-color: #fcd34d; background: #fffbeb; }
body.page-admin .healthcheck-item-label { margin: 0 0 6px; font-size: 0.82rem; font-weight: 600; color: #64748b; }
body.page-admin .healthcheck-item-value { margin: 0; font-size: 1.1rem; font-weight: 800; color: #0f172a; }
body.page-admin .healthcheck-item-value.is-ok { color: #166534; }
body.page-admin .healthcheck-item-value.is-error { color: #b91c1c; }
body.page-admin .healthcheck-item-value.is-warn { color: #b45309; }
body.page-admin .healthcheck-item-value.is-neutral { color: #0f172a; }
body.page-admin .healthcheck-empty { margin: 0; color: #64748b; font-size: 0.95rem; }
body.page-admin .healthcheck-raw { border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
body.page-admin .healthcheck-raw summary { cursor: pointer; padding: 10px 12px; font-weight: 700; color: #334155; }
body.page-admin .healthcheck-raw pre { margin: 0; padding: 12px; border-top: 1px solid #e2e8f0; max-height: 320px; overflow: auto; background: #ffffff; color: #0f172a; font-size: 0.86rem; }

body.page-setup-admin .wrap {
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

body.page-setup-admin .card { max-width: 460px; margin: 40px auto; width: 100%; background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(99, 102, 241, 0.10); border-radius: 12px; padding: 22px; }
body.page-setup-admin .brand-heading { display: inline-flex; align-items: center; gap: 10px; }
body.page-setup-admin .brand-heading img { width: 80px; height: 80px; object-fit: contain; }
body.page-setup-admin h1 { margin: 0 0 10px; font-size: 1.35rem; }
body.page-setup-admin p { margin: 0 0 12px; color: #4b5563; }
body.page-setup-admin label { display: block; font-weight: 600; margin: 12px 0 6px; }
body.page-setup-admin input { width: 100%; box-sizing: border-box; border: 2px solid #e5e7eb; border-radius: 8px; padding: 12px; font-size: 1rem; }
body.page-setup-admin button { width: 100%; margin-top: 14px; border: 0; border-radius: 8px; padding: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #4f46e5); cursor: pointer; }
body.page-setup-admin .error { margin-top: 10px; padding: 10px; background: #fee2e2; color: #b91c1c; border-radius: 8px; }

@media (prefers-color-scheme: dark) {
    :root:not(.theme-light) body.page-login,
    :root:not(.theme-light) body.page-profile,
    :root:not(.theme-light) body.page-admin,
    :root:not(.theme-light) body.page-setup-admin {
        background: #020617;
        color: #e2e8f0;
    }

    :root:not(.theme-light) body.page-login .footer,
    :root:not(.theme-light) body.page-profile .footer,
    :root:not(.theme-light) body.page-admin .footer,
    :root:not(.theme-light) body.page-setup-admin .footer {
        color: #ffffff;
    }

    :root:not(.theme-light) body.page-login .footer::before,
    :root:not(.theme-light) body.page-profile .footer::before,
    :root:not(.theme-light) body.page-admin .footer::before,
    :root:not(.theme-light) body.page-setup-admin .footer::before {
        background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.4), transparent);
    }

    :root:not(.theme-light) body.page-login .made-with a,
    :root:not(.theme-light) body.page-profile .made-with a,
    :root:not(.theme-light) body.page-admin .made-with a,
    :root:not(.theme-light) body.page-setup-admin .made-with a {
        color: #a5b4fc;
    }

    :root:not(.theme-light) body.page-login .made-with .fa-heart,
    :root:not(.theme-light) body.page-profile .made-with .fa-heart,
    :root:not(.theme-light) body.page-admin .made-with .fa-heart,
    :root:not(.theme-light) body.page-setup-admin .made-with .fa-heart {
        color: #a5b4fc;
    }

    :root:not(.theme-light) body.page-login .year,
    :root:not(.theme-light) body.page-profile .year,
    :root:not(.theme-light) body.page-admin .year,
    :root:not(.theme-light) body.page-setup-admin .year {
        color: #ffffff;
    }

    :root:not(.theme-light) body.page-login .title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    :root:not(.theme-light) body.page-login .subtitle,
    :root:not(.theme-light) body.page-login .hint { color: #cbd5e1; }
    :root:not(.theme-light) body.page-login .hint a { color: #a5b4fc; }
    :root:not(.theme-light) body.page-login .hint a:visited { color: #a5b4fc; }
    :root:not(.theme-light) body.page-login .hint a:hover { color: #c7d2fe; }
    :root:not(.theme-light) body.page-login .beta-notice { color: #c7d2fe; background: rgba(49, 46, 129, 0.35); border-color: rgba(129, 140, 248, 0.4); }
    :root:not(.theme-light) body.page-login .beta-notice i { color: #c7d2fe; }
    :root:not(.theme-light) body.page-login .beta-notice a { color: #e0e7ff; }
    :root:not(.theme-light) body.page-login .beta-notice a:hover { color: #c7d2fe; }
    :root:not(.theme-light) body.page-login .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); box-shadow: none; }
    :root:not(.theme-light) body.page-login .divider { background: #334155; }
    :root:not(.theme-light) body.page-login .form-pane h2 { color: #a5b4fc; }
    :root:not(.theme-light) body.page-login label { color: #e2e8f0; }
    :root:not(.theme-light) body.page-login input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-login input::placeholder { color: #94a3b8; }
    :root:not(.theme-light) body.page-login button { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.3); color: #a5b4fc; }
    :root:not(.theme-light) body.page-login button:hover { background: rgba(99, 102, 241, 0.25); border-color: rgba(99, 102, 241, 0.5); color: #c7d2fe; }
    :root:not(.theme-light) body.page-login .info { background: #082f49; color: #bae6fd; }

    :root:not(.theme-light) body.page-profile .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); }
    :root:not(.theme-light) body.page-profile h1,
    :root:not(.theme-light) body.page-profile h2,
    :root:not(.theme-light) body.page-profile label { color: #e2e8f0; }
    :root:not(.theme-light) body.page-profile .page-title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    :root:not(.theme-light) body.page-profile .meta { color: #cbd5e1; }
    :root:not(.theme-light) body.page-profile .export-text { color: #ffffff; }
    :root:not(.theme-light) body.page-profile .danger-zone { background: #2b0b12; border-top-color: #ef4444; }
    :root:not(.theme-light) body.page-profile .danger-zone:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12); border-top-color: #ef4444; }
    :root:not(.theme-light) body.page-profile .danger-title { color: #fecaca; border-bottom-color: rgba(254, 202, 202, 0.22); }
    :root:not(.theme-light) body.page-profile .danger-text { color: #fecaca; }
    :root:not(.theme-light) body.page-profile .danger-zone label { color: #fecaca; }
    :root:not(.theme-light) body.page-profile .danger-zone input { background: #1f1114; border-color: #b91c1c; color: #fee2e2; }
    :root:not(.theme-light) body.page-profile .danger-zone input:focus { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28); }
    :root:not(.theme-light) body.page-profile .danger-zone .danger-btn { background: #dc2626 !important; border-color: #dc2626 !important; color: #fff !important; }
    :root:not(.theme-light) body.page-profile .danger-zone .danger-btn:hover { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
    :root:not(.theme-light) body.page-profile input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-profile button,
    :root:not(.theme-light) body.page-profile .link { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-profile button:hover,
    :root:not(.theme-light) body.page-profile .link:hover { background: #334155; border-color: #475569; color: #f8fafc; }

    :root:not(.theme-light) body.page-admin .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); }
    :root:not(.theme-light) body.page-admin h1,
    :root:not(.theme-light) body.page-admin h2,
    :root:not(.theme-light) body.page-admin label,
    :root:not(.theme-light) body.page-admin th,
    :root:not(.theme-light) body.page-admin td { color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin .page-title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
    :root:not(.theme-light) body.page-admin input,
    :root:not(.theme-light) body.page-admin select { background: #0b1220; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin button,
    :root:not(.theme-light) body.page-admin .link { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin button:hover,
    :root:not(.theme-light) body.page-admin .link:hover { background: #334155; border-color: #475569; color: #f8fafc; }
    :root:not(.theme-light) body.page-admin #purgeOrphansBtn { background: #ef4444; border-color: #ef4444; color: #fff; }
    :root:not(.theme-light) body.page-admin #purgeOrphansBtn:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
    :root:not(.theme-light) body.page-admin th,
    :root:not(.theme-light) body.page-admin td { border-bottom-color: #334155; }
    :root:not(.theme-light) body.page-admin .healthcheck-panel { border-top-color: #334155; }
    :root:not(.theme-light) body.page-admin .healthcheck-badge { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin .healthcheck-badge.is-ok { background: #064e3b; border-color: #065f46; color: #a7f3d0; }
    :root:not(.theme-light) body.page-admin .healthcheck-badge.is-error { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
    :root:not(.theme-light) body.page-admin .healthcheck-badge.is-pending { background: #1e1b4b; border-color: #4338ca; color: #c7d2fe; }
    :root:not(.theme-light) body.page-admin .healthcheck-timestamp,
    :root:not(.theme-light) body.page-admin .healthcheck-item-label,
    :root:not(.theme-light) body.page-admin .healthcheck-empty { color: #94a3b8; }
    :root:not(.theme-light) body.page-admin .healthcheck-item { background: #0b1220; border-color: #334155; }
    :root:not(.theme-light) body.page-admin .healthcheck-item.is-ok { border-color: #065f46; background: #022c22; }
    :root:not(.theme-light) body.page-admin .healthcheck-item.is-error { border-color: #991b1b; background: #3f0d12; }
    :root:not(.theme-light) body.page-admin .healthcheck-item.is-warn { border-color: #b45309; background: #3a1f0a; }
    :root:not(.theme-light) body.page-admin .healthcheck-item-value.is-neutral { color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin .healthcheck-item-value.is-ok { color: #86efac; }
    :root:not(.theme-light) body.page-admin .healthcheck-item-value.is-error { color: #fca5a5; }
    :root:not(.theme-light) body.page-admin .healthcheck-item-value.is-warn { color: #fbbf24; }
    :root:not(.theme-light) body.page-admin .healthcheck-raw { background: #0b1220; border-color: #334155; }
    :root:not(.theme-light) body.page-admin .healthcheck-raw summary { color: #e2e8f0; }
    :root:not(.theme-light) body.page-admin .healthcheck-raw pre { background: #020617; border-top-color: #334155; color: #e2e8f0; }
    :root:not(.theme-light) body.page-setup-admin .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-color: rgba(99, 102, 241, 0.15); }
    :root:not(.theme-light) body.page-setup-admin h1,
    :root:not(.theme-light) body.page-setup-admin p,
    :root:not(.theme-light) body.page-setup-admin label { color: #e2e8f0; }
    :root:not(.theme-light) body.page-setup-admin input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
}

:root.theme-dark body.page-login,
:root.theme-dark body.page-profile,
:root.theme-dark body.page-admin,
:root.theme-dark body.page-setup-admin {
    background: #020617;
    color: #e2e8f0;
}

:root.theme-dark body.page-login .footer,
:root.theme-dark body.page-profile .footer,
:root.theme-dark body.page-admin .footer,
:root.theme-dark body.page-setup-admin .footer {
    color: #ffffff;
}

:root.theme-dark body.page-login .footer::before,
:root.theme-dark body.page-profile .footer::before,
:root.theme-dark body.page-admin .footer::before,
:root.theme-dark body.page-setup-admin .footer::before {
    background: linear-gradient(90deg, transparent, rgba(165, 180, 252, 0.4), transparent);
}

:root.theme-dark body.page-login .made-with a,
:root.theme-dark body.page-profile .made-with a,
:root.theme-dark body.page-admin .made-with a,
:root.theme-dark body.page-setup-admin .made-with a {
    color: #a5b4fc;
}

:root.theme-dark body.page-login .made-with .fa-heart,
:root.theme-dark body.page-profile .made-with .fa-heart,
:root.theme-dark body.page-admin .made-with .fa-heart,
:root.theme-dark body.page-setup-admin .made-with .fa-heart {
    color: #a5b4fc;
}

:root.theme-dark body.page-login .year,
:root.theme-dark body.page-profile .year,
:root.theme-dark body.page-admin .year,
:root.theme-dark body.page-setup-admin .year {
    color: #ffffff;
}

:root.theme-dark body.page-login .title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
:root.theme-dark body.page-login .subtitle,
:root.theme-dark body.page-login .hint { color: #cbd5e1; }
:root.theme-dark body.page-login .hint a { color: #a5b4fc; }
:root.theme-dark body.page-login .hint a:visited { color: #a5b4fc; }
:root.theme-dark body.page-login .hint a:hover { color: #c7d2fe; }
:root.theme-dark body.page-login .beta-notice { color: #c7d2fe; background: rgba(49, 46, 129, 0.35); border-color: rgba(129, 140, 248, 0.4); }
:root.theme-dark body.page-login .beta-notice i { color: #c7d2fe; }
:root.theme-dark body.page-login .beta-notice a { color: #e0e7ff; }
:root.theme-dark body.page-login .beta-notice a:hover { color: #c7d2fe; }
:root.theme-dark body.page-login .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); box-shadow: none; }
:root.theme-dark body.page-login .divider { background: #334155; }
:root.theme-dark body.page-login .form-pane h2 { color: #a5b4fc; }
:root.theme-dark body.page-login label { color: #e2e8f0; }
:root.theme-dark body.page-login input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-login input::placeholder { color: #94a3b8; }
:root.theme-dark body.page-login button { background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.3); color: #a5b4fc; }
:root.theme-dark body.page-login button:hover { background: rgba(99, 102, 241, 0.25); border-color: rgba(99, 102, 241, 0.5); color: #c7d2fe; }
:root.theme-dark body.page-login .info { background: #082f49; color: #bae6fd; }

:root.theme-dark body.page-profile .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); }
:root.theme-dark body.page-profile h1,
:root.theme-dark body.page-profile h2,
:root.theme-dark body.page-profile label { color: #e2e8f0; }
:root.theme-dark body.page-profile .page-title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
:root.theme-dark body.page-profile .meta { color: #cbd5e1; }
:root.theme-dark body.page-profile .export-text { color: #ffffff; }
:root.theme-dark body.page-profile .danger-zone { background: #2b0b12; border-top-color: #ef4444; }
:root.theme-dark body.page-profile .danger-zone:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.12); border-top-color: #ef4444; }
:root.theme-dark body.page-profile .danger-title { color: #fecaca; border-bottom-color: rgba(254, 202, 202, 0.22); }
:root.theme-dark body.page-profile .danger-text { color: #fecaca; }
:root.theme-dark body.page-profile .danger-zone label { color: #fecaca; }
:root.theme-dark body.page-profile .danger-zone input { background: #1f1114; border-color: #b91c1c; color: #fee2e2; }
:root.theme-dark body.page-profile .danger-zone input:focus { border-color: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28); }
:root.theme-dark body.page-profile .danger-zone .danger-btn { background: #dc2626 !important; border-color: #dc2626 !important; color: #fff !important; }
:root.theme-dark body.page-profile .danger-zone .danger-btn:hover { background: #b91c1c !important; border-color: #b91c1c !important; color: #fff !important; }
:root.theme-dark body.page-profile input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-profile button,
:root.theme-dark body.page-profile .link { background: #1e293b; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-profile button:hover,
:root.theme-dark body.page-profile .link:hover { background: #334155; border-color: #475569; color: #f8fafc; }
:root.theme-dark body.page-profile .top-links .icon-link[data-tooltip]::after { color: #a5b4fc; background: #1e1b4b; border-color: #4338ca; }

:root.theme-dark body.page-admin .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top-color: rgba(129, 140, 248, 0.72); }
:root.theme-dark body.page-admin h1,
:root.theme-dark body.page-admin h2,
:root.theme-dark body.page-admin label,
:root.theme-dark body.page-admin th,
:root.theme-dark body.page-admin td { color: #e2e8f0; }
:root.theme-dark body.page-admin .page-title { background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 40%, #c7d2fe 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
:root.theme-dark body.page-admin input,
:root.theme-dark body.page-admin select { background: #0b1220; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-admin button,
:root.theme-dark body.page-admin .link { background: #1e293b; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-admin button:hover,
:root.theme-dark body.page-admin .link:hover { background: #334155; border-color: #475569; color: #f8fafc; }
:root.theme-dark body.page-admin .top-links .icon-link[data-tooltip]::after { color: #a5b4fc; background: #1e1b4b; border-color: #4338ca; }
:root.theme-dark body.page-admin #purgeOrphansBtn { background: #ef4444; border-color: #ef4444; color: #fff; }
:root.theme-dark body.page-admin #purgeOrphansBtn:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
:root.theme-dark body.page-admin th,
:root.theme-dark body.page-admin td { border-bottom-color: #334155; }
:root.theme-dark body.page-admin .healthcheck-panel { border-top-color: #334155; }
:root.theme-dark body.page-admin .healthcheck-badge { background: #1e293b; border-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-admin .healthcheck-badge.is-ok { background: #064e3b; border-color: #065f46; color: #a7f3d0; }
:root.theme-dark body.page-admin .healthcheck-badge.is-error { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
:root.theme-dark body.page-admin .healthcheck-badge.is-pending { background: #1e1b4b; border-color: #4338ca; color: #c7d2fe; }
:root.theme-dark body.page-admin .healthcheck-timestamp,
:root.theme-dark body.page-admin .healthcheck-item-label,
:root.theme-dark body.page-admin .healthcheck-empty { color: #94a3b8; }
:root.theme-dark body.page-admin .healthcheck-item { background: #0b1220; border-color: #334155; }
:root.theme-dark body.page-admin .healthcheck-item.is-ok { border-color: #065f46; background: #022c22; }
:root.theme-dark body.page-admin .healthcheck-item.is-error { border-color: #991b1b; background: #3f0d12; }
:root.theme-dark body.page-admin .healthcheck-item.is-warn { border-color: #b45309; background: #3a1f0a; }
:root.theme-dark body.page-admin .healthcheck-item-value.is-neutral { color: #e2e8f0; }
:root.theme-dark body.page-admin .healthcheck-item-value.is-ok { color: #86efac; }
:root.theme-dark body.page-admin .healthcheck-item-value.is-error { color: #fca5a5; }
:root.theme-dark body.page-admin .healthcheck-item-value.is-warn { color: #fbbf24; }
:root.theme-dark body.page-admin .healthcheck-raw { background: #0b1220; border-color: #334155; }
:root.theme-dark body.page-admin .healthcheck-raw summary { color: #e2e8f0; }
:root.theme-dark body.page-admin .healthcheck-raw pre { background: #020617; border-top-color: #334155; color: #e2e8f0; }
:root.theme-dark body.page-setup-admin .card { background: rgba(17, 24, 39, 0.80); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-color: rgba(99, 102, 241, 0.15); }
:root.theme-dark body.page-setup-admin h1,
:root.theme-dark body.page-setup-admin p,
:root.theme-dark body.page-setup-admin label { color: #e2e8f0; }
:root.theme-dark body.page-setup-admin input { background: #0b1220; border-color: #334155; color: #e2e8f0; }

:root.theme-dark body.page-login .theme-toggle:not(.theme-toggle-inline),
:root.theme-dark body.page-profile .theme-toggle:not(.theme-toggle-inline),
:root.theme-dark body.page-admin .theme-toggle:not(.theme-toggle-inline),
:root.theme-dark body.page-setup-admin .theme-toggle:not(.theme-toggle-inline) {
    background: #111827;
    color: #e2e8f0;
    border-color: #334155;
}

@media (max-width: 820px) {
    body.page-login .split { grid-template-columns: 1fr; gap: 18px; }
    body.page-login .divider { width: 100%; min-height: 1px; }
    body.page-login .logo-pane img { width: min(220px, 85%); }
}

@media (max-width: 760px) {
    .account-bar {
        gap: 8px;
        padding: 8px 10px;
    }

    .account-left {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .account-left::-webkit-scrollbar {
        display: none;
    }

    .account-icon-link,
    .account-bar .theme-toggle-inline {
        width: 40px;
        min-width: 40px;
        height: 40px;
        margin-top: 0;
        padding: 0;
        border-radius: 999px;
        flex: 0 0 40px;
    }

    .account-icon-link i,
    .account-bar .theme-toggle-inline i {
        font-size: 1rem;
    }

    body.page-profile .top,
    body.page-admin .top {
        display: block;
        margin-bottom: 14px;
    }

    body.page-profile .page-top-brand,
    body.page-admin .page-top-brand {
        gap: 4px;
        margin-bottom: 6px;
    }

    body.page-profile .top-links,
    body.page-admin .top-links {
        display: flex;
        flex-wrap: nowrap;
        gap: 8px;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    body.page-profile .page-site-tagline,
    body.page-admin .page-site-tagline {
        margin-bottom: 20px;
    }

    body.page-profile .top-links::-webkit-scrollbar,
    body.page-admin .top-links::-webkit-scrollbar {
        display: none;
    }

    body.page-profile .top-links .link,
    body.page-admin .top-links .link {
        flex: 0 0 auto;
        min-height: 40px;
        height: 40px;
        white-space: nowrap;
        border-radius: 999px;
    }

    body.page-profile .top-links .link:not(.icon-link),
    body.page-admin .top-links .link:not(.icon-link) {
        padding: 0 12px;
        font-size: 0.9rem;
    }

    body.page-profile .icon-link,
    body.page-admin .icon-link {
        min-width: 40px;
        width: 40px;
        height: 40px;
    }

    body.page-profile .icon-link i,
    body.page-admin .icon-link i {
        font-size: 1rem;
    }

    body.page-profile .row { grid-template-columns: 1fr; }
    body.page-admin .row { grid-template-columns: 1fr; }
    body.page-admin .accounts-table-scroll table { min-width: 860px; }
}

/* Footer link tone */
.footer .made-with a,
.footer .footer-legal a {
    color: #6366f1 !important;
    font-weight: 400 !important;
}

.footer .license a {
    color: inherit !important;
    font-weight: 400 !important;
}

.footer .year,
.footer .made-with .fa-heart {
    color: inherit !important;
}
