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

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: #e2e8f0;
    background: #0f172a;
}

/* ── Navigation ── */

nav {
    background: #0a1020;
    padding: 0 1.5rem;
    display: flex;
    gap: 0.25rem;
    align-items: stretch;
    border-bottom: 1px solid #1e293b;
}

nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 0.875rem 1rem;
    display: block;
    font-size: 0.9rem;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

nav a:hover {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

nav a.active {
    color: #f1f5f9;
    border-bottom-color: #3b82f6;
}

/* ── Main content ── */

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #f1f5f9;
}

p {
    color: #94a3b8;
}

/* ── Forms and buttons ── */

input[type="text"],
input[type="password"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 16rem;
    background: #1e293b;
    color: #e2e8f0;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #1d4ed840;
}

button {
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    background: #3b82f6;
    color: #fff;
}

button:hover {
    background: #2563eb;
}

button.button-secondary {
    background: #334155;
    color: #cbd5e1;
}

button.button-secondary:hover {
    background: #475569;
}

button.button-danger {
    background: #7f1d1d;
    color: #fca5a5;
}

button.button-danger:hover {
    background: #991b1b;
}

/* ── Category list ── */

.category-items {
    list-style: none;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
}

.category-item form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.empty-state {
    color: #475569;
    font-style: italic;
    margin-bottom: 1.5rem;
}

.error-message {
    color: #fca5a5;
    background: #450a0a;
    border: 1px solid #7f1d1d;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* ── Search form ── */

.search-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 6px;
}

.search-input {
    width: 20rem;
}

.search-select {
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #0f172a;
    color: #e2e8f0;
}

.search-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #1d4ed840;
}

.difficulty-range {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.difficulty-input {
    width: 4.5rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #0f172a;
    color: #e2e8f0;
}

.difficulty-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #1d4ed840;
}

.difficulty-separator {
    color: #64748b;
    font-size: 0.875rem;
}

/* ── Question list ── */

#question-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-summary {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

/* ── Question table ── */

.question-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.question-table thead tr {
    border-bottom: 2px solid #334155;
}

.question-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.question-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid #1e293b;
    color: #e2e8f0;
    line-height: 1.4;
}

.question-table tbody tr:hover td {
    background: #1e293b;
}

.col-difficulty {
    width: 3.5rem;
    text-align: center;
}

.col-question {
    /* takes remaining space */
}

.col-categories {
    width: 16rem;
}

.col-answers {
    width: 14rem;
    min-width: 14rem;
}

/* ── Action column ── */

.col-actions {
    width: 6rem;
}

td.col-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.button-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

.button-icon {
    padding: 0.5rem 0.65rem;
    font-size: 0.95rem;
    line-height: 1;
}

/* ── Sort headers ── */

.sort-header {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
}

.sort-header:hover {
    color: #f1f5f9;
}

.sort-indicator {
    color: #3b82f6;
    font-weight: 700;
}

/* ── Difficulty badges ── */

.difficulty-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    min-width: 2rem;
    text-align: center;
}

.difficulty-badge--easy   { background: #14532d; color: #86efac; }
.difficulty-badge--medium { background: #713f12; color: #fde68a; }
.difficulty-badge--hard   { background: #450a0a; color: #fca5a5; }
.difficulty-badge--none   { background: #1e293b; color: #475569; border: 1px solid #334155; }

/* ── Answer reveal ── */

td.col-answers {
    height: 6rem;
    vertical-align: top;
    padding: 0.4rem 0.6rem;
}

.answer-reveal {
    display: block;
    height: 100%;
}

.answer-reveal-btn {
    list-style: none;
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid #1e40af;
    user-select: none;
    transition: background 0.1s;
}

.answer-reveal-btn::-webkit-details-marker {
    display: none;
}

.answer-reveal-btn:hover {
    background: #1e40af;
    color: #eff6ff;
}

.answer-reveal-label-hide { display: none; }
.answer-reveal[open] .answer-reveal-label-show { display: none; }
.answer-reveal[open] .answer-reveal-label-hide { display: inline; }

.answer-reveal[open] .answer-reveal-btn {
    background: #1e40af;
    color: #eff6ff;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
}

.answer-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.35rem 0.5rem;
    background: #0f172a;
    border: 1px solid #1e40af;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow-y: auto;
    max-height: 4rem;
}

.answer-list li {
    font-size: 0.85rem;
    color: #e2e8f0;
    padding: 0.15rem 0.35rem;
    border-left: 2px solid #22c55e;
}

/* ── Category tags ── */

.category-tag {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid #1e40af;
    margin: 0.1rem 0.15rem 0.1rem 0;
    white-space: nowrap;
}

/* ── Pagination ── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 0.75rem;
}

.pagination-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    font-size: 0.875rem;
    text-decoration: none;
    background: #334155;
    color: #cbd5e1;
    cursor: pointer;
}

.pagination-btn:hover {
    background: #475569;
}

.pagination-btn--disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.page-info {
    font-size: 0.875rem;
    color: #94a3b8;
}

/* ── Page actions ── */

.page-actions {
    margin-bottom: 1.5rem;
}

/* ── Modal dialog ── */

dialog {
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 0;
    max-width: 560px;
    width: 100%;
    margin: auto;
    background: #1e293b;
    color: #e2e8f0;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.modal-box {
    padding: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #f1f5f9;
}

/* ── Form groups ── */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.form-group label,
.form-group legend {
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
}

.form-group textarea {
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    background: #0f172a;
    color: #e2e8f0;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #1d4ed840;
}

.form-group input[type="number"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid #334155;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 6rem;
    background: #0f172a;
    color: #e2e8f0;
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #1d4ed840;
}

fieldset.form-group {
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.75rem;
}

.category-search-input {
    width: 100%;
    margin-bottom: 0.5rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: normal;
    cursor: pointer;
    color: #cbd5e1;
}

/* ── Difficulty selector (form) ── */

.difficulty-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.difficulty-option {
    cursor: pointer;
    position: relative;
}

.difficulty-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.difficulty-option span {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.1s;
    min-width: 2rem;
    text-align: center;
}

.difficulty-option:hover span {
    transform: scale(1.1);
}

.difficulty-option input[type="radio"]:checked + span {
    outline: 2px solid #f1f5f9;
    outline-offset: 3px;
    transform: scale(1.15);
}

/* ── Answer fields ── */

#answer-fields {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.answer-field {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.answer-field input[type="text"] {
    flex: 1;
    width: auto;
}

.answer-remove-button {
    padding: 0.3rem 0.6rem;
    font-size: 1rem;
    line-height: 1;
}

/* ── Form actions ── */

.form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #334155;
}

/* ── Quiz Play ── */

.quiz-start {
    max-width: 860px;
    margin: 3rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-start h1 {
    text-align: center;
}

.quiz-start-options {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.quiz-start-option--wide {
    width: 100%;
    margin-top: 1rem;
}

.quiz-start-option {
    flex: 1;
    min-width: 220px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.6rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.quiz-intro {
    color: #94a3b8;
    font-size: 0.95rem;
}

.quiz-option-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #334155;
}

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

.quiz-option-title {
    flex: 1;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.quiz-option-count {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
}

.quiz-start-btn {
    margin-top: 0.5rem;
    padding: 0.65rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    align-self: flex-start;
}

.quiz-play-again-btn {
    margin-top: 1.5rem;
}

/* Round header & results */

.quiz-round-header {
    margin-bottom: 1.25rem;
}

.quiz-round-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.quiz-round-title {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.quiz-round-results {
    max-width: 720px;
    margin: 2rem auto;
}

.quiz-round-summary {
    margin-bottom: 1.5rem;
}

.quiz-round-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* Category quiz modal */

.category-quiz-modal-box {
    min-width: 380px;
    max-width: 520px;
    width: 90vw;
}

.category-quiz-fieldset {
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin: 0 0 1rem;
}

.category-quiz-legend {
    padding: 0 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-quiz-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.4rem 1rem;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.category-quiz-count-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.category-quiz-count-label {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.category-quiz-count-input {
    width: 80px;
}

.category-available-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 1.25rem;
    min-height: 1.2em;
}

/* Active quiz form */

.quiz-form {
    max-width: 720px;
    margin: 2rem auto;
}

.quiz-question-list {
    list-style: none;
    counter-reset: quiz-counter;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0;
}

.quiz-question-item {
    counter-increment: quiz-counter;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-question-item::before {
    content: counter(quiz-counter) ".";
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
}

.quiz-question-text {
    font-size: 1rem;
    line-height: 1.55;
    color: #e2e8f0;
}

.quiz-answer-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 0.375rem;
    color: #e2e8f0;
    font-size: 0.95rem;
    transition: border-color 0.15s;
}

.quiz-answer-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.quiz-submit-row {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.quiz-submit-btn {
    padding: 0.65rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Results */

.quiz-results {
    max-width: 720px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
}

.quiz-score-summary {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.quiz-score-fraction {
    font-size: 2rem;
    font-weight: 700;
    color: #f1f5f9;
}

.quiz-score-percent {
    font-size: 1.25rem;
    color: #94a3b8;
}

.quiz-running-total {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #334155;
    width: 100%;
}

.quiz-running-total-label {
    color: #64748b;
}

.quiz-running-total-score {
    font-weight: 700;
    color: #f1f5f9;
}

.score-label {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.score-label--excellent { background: #14532d; color: #86efac; }
.score-label--good      { background: #1e3a5f; color: #93c5fd; }
.score-label--ok        { background: #422006; color: #fcd34d; }
.score-label--poor      { background: #450a0a; color: #fca5a5; }

.quiz-results-list {
    list-style: none;
    counter-reset: result-counter;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0;
}

.quiz-result-item {
    counter-increment: result-counter;
    border-radius: 0.5rem;
    border-left: 4px solid transparent;
    background: #1e293b;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-correct { border-left-color: #22c55e; }
.result-close   { border-left-color: #f59e0b; }
.result-wrong   { border-left-color: #ef4444; }

.quiz-result-question {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.45;
}

.quiz-result-question::before {
    content: counter(result-counter) ". ";
    font-weight: 700;
    color: #64748b;
}

.quiz-result-answer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    align-items: baseline;
}

.quiz-result-submitted {
    color: #e2e8f0;
    font-size: 0.95rem;
}

.result-label {
    color: #64748b;
    font-size: 0.8rem;
}

.result-empty {
    color: #475569;
}

.quiz-result-accepted {
    font-size: 0.9rem;
    color: #22c55e;
}

.quiz-result-accepted.quiz-result-close {
    color: #f59e0b;
}

.quiz-result-accepted.quiz-result-wrong {
    color: #ef4444;
}

.quiz-result-note {
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #64748b;
}

.quiz-result-note summary {
    cursor: pointer;
    color: #475569;
    font-style: italic;
}

.quiz-result-note p {
    margin-top: 0.4rem;
    color: #94a3b8;
    padding-left: 0.75rem;
    border-left: 2px solid #334155;
}

/* ── Quiz Planner ── */

.quiz-planner-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-planner-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.quiz-planner-header h1 {
    flex: 0 0 auto;
}

.quiz-create-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.quiz-title-input {
    flex: 1;
    min-width: 0;
}

/* Quiz list */

.quiz-items {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quiz-item {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quiz-item-title {
    flex: 1;
    color: #e2e8f0;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
}

.quiz-item-title:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.quiz-item-count {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
}

.quiz-item-actions {
    display: flex;
    gap: 0.4rem;
}

/* Quiz detail page */

.quiz-detail-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.quiz-detail-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.breadcrumb {
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
}

.breadcrumb:hover {
    color: #94a3b8;
}

.quiz-rename-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.quiz-detail-title-input {
    font-size: 1.3rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid #334155;
    border-radius: 0.375rem;
    padding: 0.4rem 0.65rem;
    color: #f1f5f9;
    flex: 1;
}

.quiz-detail-title-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #1e293b;
}

.section-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.section-count {
    color: #64748b;
    font-weight: 400;
}

/* Ordered question list */

.quiz-question-ordered-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.quiz-question-row {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.4rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.qq-drag-handle {
    flex: 0 0 auto;
    color: #475569;
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 0.25rem 0.35rem;
    touch-action: none;
    user-select: none;
}

.qq-drag-handle:hover {
    color: #94a3b8;
}

.qq-drag-handle svg {
    pointer-events: none;
    display: block;
}

.sortable-ghost {
    opacity: 0.4;
    background: #0f172a;
}

.sortable-drag {
    opacity: 1;
}

.qq-position {
    flex: 0 0 1.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    padding-top: 0.15rem;
    text-align: right;
}

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

.qq-text {
    font-size: 0.95rem;
    color: #e2e8f0;
    line-height: 1.45;
}

.qq-meta {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.qq-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

.qq-actions button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Question picker */

.question-picker {
    border-top: 1px solid #1e293b;
    padding-top: 1.5rem;
}

.question-picker-search {
    width: 100%;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

.question-picker-results {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.picker-result-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.picker-result-item {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.4rem;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.picker-result-body {
    flex: 1;
    min-width: 0;
}

.picker-result-text {
    font-size: 0.9rem;
    color: #e2e8f0;
}

.picker-result-meta {
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.picker-empty {
    font-size: 0.9rem;
}

.button--small {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

/* ── Duplicate confirmation dialog ── */

.duplicate-warning-intro {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.duplicate-question-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    max-height: 260px;
    overflow-y: auto;
}

.duplicate-question-item {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.375rem;
    padding: 0.6rem 0.85rem;
}

.duplicate-question-text {
    font-size: 0.9rem;
    color: #e2e8f0;
    margin-bottom: 0.25rem;
}

.duplicate-question-answers {
    font-size: 0.8rem;
    color: #64748b;
}

/* ── Data management page ── */

.data-page {
    max-width: 760px;
}

.data-page h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.data-page-intro {
    color: #94a3b8;
    margin-bottom: 2rem;
}

.data-section {
    margin-bottom: 2rem;
}

.data-section-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.75rem;
}

.data-action {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.data-action-description {
    flex: 1;
}

.data-action-description strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #f1f5f9;
}

.data-action-description p {
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.4;
}

.data-import-form {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.file-input {
    font-size: 0.85rem;
    color: #94a3b8;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    max-width: 180px;
}

.file-input::file-selector-button {
    background: #0f172a;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 0.375rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 0.5rem;
}

.file-input::file-selector-button:hover {
    background: #1e293b;
    color: #f1f5f9;
}

.data-quiz-export-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
    width: 100%;
}

.data-quiz-export-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}

.data-quiz-title {
    flex: 1;
    font-size: 0.9rem;
}

.data-quiz-count {
    font-size: 0.8rem;
    color: #64748b;
}

.success-message {
    color: #4ade80;
    font-size: 0.875rem;
    margin-top: 0.4rem;
}

/* ── Confirm dialog ── */

.confirm-dialog-message {
    font-size: 1rem;
    color: #e2e8f0;
    margin-bottom: 0.25rem;
}

/* ── Loading bar ── */

#loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: #3b82f6;
    z-index: 9999;
    transition: width 0.3s ease, opacity 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

#loading-bar.loading-bar--active {
    opacity: 1;
    width: 70%;
    transition: width 2s ease-out, opacity 0.2s ease;
}

#loading-bar.loading-bar--finishing {
    width: 100%;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.4s ease 0.1s;
}

/* ── Toast notifications ── */

#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9000;
    pointer-events: none;
}

.toast {
    background: #1e293b;
    border: 1px solid #334155;
    border-left: 4px solid #3b82f6;
    color: #e2e8f0;
    font-size: 0.875rem;
    padding: 0.7rem 1rem;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 340px;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
}

.toast--error {
    border-left-color: #ef4444;
}

/* ── Button loading state (htmx in-flight) ── */

button.htmx-request,
a.htmx-request {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

/* ── Modal entry animation ── */

dialog[open] {
    animation: dialog-appear 0.18s ease-out;
}

@keyframes dialog-appear {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Field hints ── */

.field-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: #475569;
}

/* ── Nav logout button ── */

.nav-logout-form {
    margin-left: auto;
    display: flex;
    align-items: center;
    padding: 0 0.25rem;
}

.nav-logout-btn {
    background: transparent;
    color: #64748b;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #334155;
    border-radius: 4px;
    cursor: pointer;
}

.nav-logout-btn:hover {
    background: #1e293b;
    color: #94a3b8;
}

/* ── Login page ── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 2.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f1f5f9;
    text-align: center;
    margin-bottom: 2rem;
}

.login-form .form-group input[type="text"],
.login-form .form-group input[type="password"] {
    width: 100%;
}

.login-form-actions {
    margin-top: 1.5rem;
    border-top: none;
    padding-top: 0;
    justify-content: stretch;
}

.login-submit-btn {
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
    font-weight: 600;
}

/* ── Picker add-to-quiz button ── */

.picker-add-btn {
    background: #15803d;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.picker-add-btn:hover {
    background: #166534;
}
