/* --- Reset & base --- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
    background: #f6f7f9;
    color: #1a1a1a;
    line-height: 1.5;
    font-size: 16px;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

.page-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}
.page-footer a { color: #6b7280; text-decoration: none; border-bottom: 1px dotted #d1d5db; }
.page-footer a:hover { color: #111827; border-bottom-color: #6b7280; }

.flag { font-size: 18px; line-height: 1; vertical-align: -2px; }
.country { white-space: nowrap; }

/* --- Card --- */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card.narrow { max-width: 400px; margin: 60px auto; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 16px 0 12px; }
.muted { color: #6b7280; }
.small { font-size: 13px; }

/* --- Forms --- */
label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    color: #374151;
}
label > input[type="text"],
label > input[type="password"],
label > input[type="number"],
label > select,
label > textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    color: #111;
    background: #fff;
}
textarea { resize: vertical; }
label > input:focus, label > textarea:focus, label > select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -1px;
    border-color: #3b82f6;
}
fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    margin: 0 0 16px;
}
legend { font-size: 14px; color: #374151; padding: 0 6px; }
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    white-space: nowrap;
}
.checkbox-inline input { margin: 0; }

.option-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}
.option-row input[type="text"] {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
}
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.1s, border-color 0.1s;
}
.btn-primary { background: #111827; color: #fff; }
.btn-primary:hover { background: #1f2937; }
.btn-secondary { background: #fff; color: #111; border-color: #d1d5db; }
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fca5a5; }
.btn-danger:hover { background: #fee2e2; }
.btn-give-up {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05), 0 0 0 3px rgba(220, 38, 38, 0.15);
    font-weight: 600;
}
.btn-give-up:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-link { background: none; border: none; color: #6b7280; padding: 0; cursor: pointer; }
.btn-link:hover { color: #111; text-decoration: underline; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon {
    padding: 4px 9px;
    line-height: 1;
    font-size: 14px;
}
.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}
.inline { display: inline-block; margin: 0; }
.move-arrows { display: inline-flex; gap: 4px; }

/* --- Test question --- */
.progress {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}
.progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 24px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: #111827;
    transition: width 0.3s;
}
.timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #111;
}
.timer-warn {
    color: #dc2626;
}
.question-text {
    font-size: 17px;
    font-weight: 400;
    margin: 16px 0 24px;
    line-height: 1.55;
    color: #1a1a1a;
}
.question-text > p,
.question-text > ul,
.question-text > ol,
.question-text > h2,
.question-text > h3,
.question-text > blockquote {
    margin: 0 0 12px;
}
.question-text > p:first-child,
.question-text > ul:first-child,
.question-text > ol:first-child,
.question-text > h2:first-child,
.question-text > h3:first-child { margin-top: 0; }
.question-text > p:last-child,
.question-text > ul:last-child,
.question-text > ol:last-child { margin-bottom: 0; }
.question-text strong { font-weight: 600; color: #111; }
.question-text em { font-style: italic; }
.question-text h2,
.question-text h3 { font-size: 17px; font-weight: 600; line-height: 1.4; margin-top: 18px; }
.question-text ul, .question-text ol { padding-left: 22px; }
.question-text li { margin: 4px 0; }
.question-text code {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: "SF Mono", Menlo, monospace;
    font-size: 0.92em;
}
.question-text blockquote {
    border-left: 3px solid #e5e7eb;
    padding-left: 12px;
    color: #4b5563;
}
.question-text a { color: #2563eb; }

/* Same paragraph rules for the smaller question text in admin views. */
.question-text-small > p,
.question-text-small > ul,
.question-text-small > ol { margin: 0 0 6px; }
.question-text-small > p:last-child { margin-bottom: 0; }
.question-text-small strong { font-weight: 600; color: #111; }
.question-text-small em { font-style: italic; }

.question-card-text > p { margin: 0 0 6px; }
.question-card-text > p:last-child { margin-bottom: 0; }
.question-card-text strong { font-weight: 600; color: #111; }
.question-card-text em { font-style: italic; }
.question-card-text ul, .question-card-text ol { padding-left: 20px; margin: 4px 0; }
.options {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}
.options li {
    margin-bottom: 10px;
}

/* Custom radio / checkbox option rows. Native input is hidden;
   the visible mark is .opt-mark-pick. */
.opt-pick {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    margin: 0;
    color: #111;
    background: #fff;
    transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.opt-pick:hover { background: #f9fafb; border-color: #d1d5db; }
.opt-pick input {
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.opt-mark-pick {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border: 1.5px solid #cbd2da;
    border-radius: 50%;
    background: #fff;
    transition: border-color .12s, background-color .12s;
    position: relative;
}
.opt-pick-square .opt-mark-pick { border-radius: 5px; }
.opt-pick:hover .opt-mark-pick { border-color: #94a3b8; }

/* Checked state */
.opt-pick input:checked ~ .opt-mark-pick {
    border-color: #111827;
    background: #111827;
}
.opt-pick:has(input:checked) {
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827 inset;
    background: #fafbfc;
}
/* Radio: inner dot */
.opt-pick:not(.opt-pick-square) .opt-mark-pick::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%) scale(0);
    transition: transform .12s;
}
.opt-pick:not(.opt-pick-square) input:checked ~ .opt-mark-pick::after {
    transform: translate(-50%, -50%) scale(1);
}
/* Checkbox: tick */
.opt-pick-square .opt-mark-pick::after {
    content: "";
    position: absolute;
    top: 3px; left: 7px;
    width: 4px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .12s;
}
.opt-pick-square input:checked ~ .opt-mark-pick::after {
    transform: rotate(45deg) scale(1);
}

.opt-pick:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
.opt-label { flex: 1; font-size: 15px; line-height: 1.4; }

textarea[name="text_answer"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    margin-bottom: 20px;
}

/* --- Admin top bar --- */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}
.topbar nav a {
    color: #6b7280;
    text-decoration: none;
    margin-right: 18px;
    font-size: 14px;
}
.topbar nav a.active, .topbar nav a:hover { color: #111; }

.head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.head-row h1 { margin: 0; }
.back-link {
    display: inline-block;
    color: #6b7280;
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 12px;
}
.back-link:hover { color: #111; }

/* --- Stats --- */
.stats {
    display: flex;
    gap: 32px;
    margin-bottom: 24px;
    padding: 18px 20px;
    background: #f9fafb;
    border: 1px solid #eef0f3;
    border-radius: 8px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px 20px;
}
.stat-num { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }
.stat-sub { font-size: 11px; color: #6b7280; margin-top: 2px; }
.stat-attention .stat-num { color: #b45309; }
.stat-attention .stat-label { color: #92400e; }

/* --- Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
}
.data-table th {
    color: #6b7280;
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tr.row-reviewed { background: #fafbfc; color: #6b7280; }
.data-table tr.row-reviewed strong { color: #6b7280; font-weight: 500; }
.data-table tr.row-reviewed:hover { background: #f3f4f6; }

.reviewed-toggle {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #9ca3af;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background-color .12s, color .12s, border-color .12s;
}
.reviewed-toggle:hover {
    background: #f3f4f6;
    border-color: #94a3b8;
    color: #374151;
}
.row-reviewed .reviewed-toggle {
    background: #d1fae5;
    border-color: #10b981;
    color: #047857;
}
.row-reviewed .reviewed-toggle:hover {
    background: #a7f3d0;
}

.card.card-reviewed {
    border-color: #10b981;
    background: #f7fefb;
}

/* --- Question cards (admin list) --- */
.question-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: border-color .12s, box-shadow .12s;
}
.question-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.question-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.question-card-body { padding: 12px 14px; }
.question-card-body p { margin: 0 0 8px; }
.options-preview {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}
.options-preview li { padding: 2px 0; }
.options-preview li.opt-correct { color: #047857; }
.actions { display: flex; gap: 6px; }

/* --- Submission detail --- */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
}
.answer-block {
    border: 1px solid #e5e7eb;
    border-left-width: 3px;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.answer-correct { border-left-color: #10b981; }
.answer-wrong { border-left-color: #ef4444; }
.answer-text { border-left-color: #9ca3af; }
.answer-deleted { border-left-color: #d1d5db; opacity: 0.85; }
.answer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.answer-num { font-size: 13px; color: #6b7280; }
.question-text-small { margin: 0 0 10px; font-weight: 500; }
.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-bad { background: #fee2e2; color: #991b1b; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-neutral { background: #f3f4f6; color: #4b5563; }
.answer-flags { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.answer-options { list-style: none; padding: 0; margin: 0; }
.answer-options .opt {
    padding: 6px 10px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    gap: 8px;
    align-items: baseline;
}
.opt-mark {
    font-family: "SF Mono", Menlo, monospace;
    width: 16px;
    color: #6b7280;
}
.opt.opt-correct { background: #d1fae5; }
.opt.opt-correct .opt-mark { color: #047857; }
.opt.opt-wrong { background: #fee2e2; }
.opt.opt-wrong .opt-mark { color: #b91c1c; }

.text-answer-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 10px 12px;
    white-space: pre-wrap;
    font-size: 14px;
}

/* --- Markdown toolbar (admin question form) --- */
.md-toolbar {
    display: flex;
    gap: 4px;
    align-items: center;
    margin: 6px 0 0;
    flex-wrap: wrap;
}
.md-toolbar button[data-md] {
    background: #fff;
    border: 1px solid #d1d5db;
    color: #111;
    padding: 4px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.2;
    min-width: 30px;
}
.md-toolbar button[data-md]:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.md-toolbar-hint {
    margin-left: 8px;
    color: #6b7280;
    font-size: 12px;
}
.md-toolbar-hint code {
    font-family: "SF Mono", Menlo, monospace;
    background: #f3f4f6;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
}

/* --- Composer (textarea + integrated attachment chip) --- */
.composer {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    margin-bottom: 20px;
    transition: border-color .12s, box-shadow .12s, background-color .12s;
}
.composer:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.composer.drag-over {
    border-color: #3b82f6;
    background: #f0f7ff;
}
.composer.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.composer textarea {
    width: 100%;
    border: none;
    outline: none;
    padding: 14px 14px 8px;
    font: inherit;
    resize: vertical;
    background: transparent;
    min-height: 140px;
    border-radius: 10px 10px 0 0;
    margin: 0;
}
.composer-attachment {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafbfc;
    margin-bottom: 6px;
}
.composer-attachment[hidden] { display: none; }
.composer-attachment img,
.composer-thumb-fallback {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    flex: 0 0 auto;
}
.composer-thumb-fallback {
    background: #1f2937;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border-color: #1f2937;
}
.composer-attachment-info {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}
.composer-attachment-info .name {
    color: #111;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.composer-attachment-info .meta {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}
.composer-attachment-remove {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background-color .12s, color .12s;
}
.composer-attachment-remove:hover {
    background: #fee2e2;
    color: #991b1b;
}
.composer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border-top: 1px solid #f3f4f6;
}
.composer-attach-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 7px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    transition: background-color .12s, color .12s;
}
.composer-attach-btn:hover {
    background: #f3f4f6;
    color: #111;
}
.composer-hint {
    flex: 1;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}
.composer-required-tag {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 6px;
    vertical-align: 1px;
}
.composer input[type="file"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}
.composer-error {
    display: none;
    color: #991b1b;
    font-size: 12px;
    padding: 0 14px 10px;
}
.composer.error .composer-error { display: block; }

/* --- Admin preview banner --- */
.preview-banner {
    background: #fef3c7;
    color: #92400e;
    padding: 10px 16px;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.preview-banner a { color: #78350f; font-weight: 500; }

/* --- Lightbox (full-size gallery viewer) --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 72px;
    cursor: zoom-out;
    animation: lightbox-fade .12s ease-out;
}
.lightbox[hidden] { display: none; }
@keyframes lightbox-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: pointer;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: background-color .12s, transform .12s;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.22);
}
.lightbox-close {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 24px;
}
.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    font-size: 30px;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(2px); }
.lightbox-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
body.lightbox-open { overflow: hidden; }

@media (max-width: 540px) {
    .lightbox { padding: 8px; }
    .lightbox-prev, .lightbox-next {
        width: 44px; height: 44px; font-size: 24px;
    }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }
}

/* --- Gallery (multiple images attached to a question) --- */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin: 14px 0 22px;
}
.gallery-item {
    display: block;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #eef0f3;
    background: #fafbfc;
    aspect-ratio: 1 / 1;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.gallery-item:hover {
    transform: translateY(-1px);
    border-color: #cbd2da;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Admin gallery editor --- */
.gallery-admin {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.gallery-admin-item {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}
.gallery-admin-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
}

/* --- Download attachment button --- */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 0 20px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #111;
    font-size: 14px;
    text-decoration: none;
    transition: background-color .12s, border-color .12s;
}
.download-btn:hover { background: #f3f4f6; border-color: #94a3b8; }
.download-icon {
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #111827; color: #fff;
    font-size: 14px;
}

/* --- Media (question / response) --- */
.media {
    margin: 14px 0 22px;
    text-align: center;
}
.media img, .media video {
    display: inline-block;
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 1px solid #eef0f3;
    background: #fafbfc;
}
.media-preview {
    margin: 8px 0 12px;
    border-radius: 6px;
    overflow: hidden;
    background: #f3f4f6;
    max-width: 100%;
}
.media-preview img, .media-preview video {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    background: #000;
}
.media-preview-small img, .media-preview-small video {
    max-height: 200px;
}

.file-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 18px;
    padding: 28px 20px;
    border: 2px dashed #cbd2da;
    border-radius: 12px;
    background: #fafbfc;
    font-size: 14px;
    color: #374151;
    text-align: center;
    cursor: pointer;
    transition: border-color .12s, background-color .12s, transform .12s;
}
.file-pick:hover { border-color: #6b7280; background: #f4f6f9; }
.file-pick.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.005);
}
.file-pick.has-file {
    border-style: solid;
    background: #fff;
}
.file-pick-icon {
    color: #6b7280;
    line-height: 0;
}
.file-pick-label {
    color: #111;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    gap: 6px;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: center;
}
.file-pick-required {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}
.file-pick-hint {
    font-size: 12px;
    color: #6b7280;
}
.file-pick input[type="file"] {
    /* Hide the native input — the whole .file-pick label triggers the picker. */
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    pointer-events: none;
}
.file-pick-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.file-pick-preview:empty { display: none; }
.file-pick-preview img {
    max-width: 240px;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}
.file-pick-thumb-video {
    width: 80px; height: 80px;
    background: #1f2937;
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}
.file-pick-name {
    font-size: 12px;
    color: #6b7280;
    word-break: break-all;
}

/* --- Alerts --- */
.alert {
    padding: 10px 14px;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* --- Responsive --- */
@media (max-width: 540px) {
    .container { padding: 20px 14px 60px; }
    .card { padding: 22px 18px; }
    .stats { gap: 20px; padding: 14px 16px; }
    .stat-num { font-size: 22px; }
    .meta-row { gap: 14px; padding: 10px 12px; }
    .topbar nav a { margin-right: 14px; }
    .opt-pick { padding: 12px 14px; }
    .data-table th, .data-table td { padding: 8px 8px; font-size: 13px; }
}
