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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f7fb;
    color: #1a2332;
    line-height: 1.5;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 1.75rem;
}

.subtitle {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.95rem;
}

.card-grid {
    display: grid;
    gap: 12px;
}

.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.menu-item a,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #1a2332;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.menu-item a:hover,
.btn:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
    text-decoration: none;
}

.menu-item--all a {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    font-weight: 600;
}

.menu-item--all a:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.btn-danger {
    background: #fff;
    border-color: #fecaca;
    color: #b91c1c;
}

.btn-secondary {
    background: #fff;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.875rem;
}

.panel {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    padding: 20px;
}

.empty-state {
    padding: 32px 20px;
    text-align: center;
    color: #64748b;
}

.quiz-layout {
    display: grid;
    gap: 16px;
}

.quiz-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.quiz-counter {
    font-size: 0.95rem;
    color: #64748b;
}

.quiz-category {
    font-size: 0.875rem;
    color: #475569;
    background: #eef2ff;
    padding: 6px 10px;
    border-radius: 999px;
}

.quiz-card {
    position: relative;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    min-height: 320px;
    cursor: pointer;
    user-select: none;
}

.quiz-card img {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    margin: 0 auto;
    background: #0f172a;
}

.quiz-hint {
    position: absolute;
    left: 16px;
    bottom: 16px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.875rem;
}

.quiz-nav {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.quiz-nav .btn {
    flex: 1;
}

.quiz-nav .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.form-grid {
    display: grid;
    gap: 16px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 500;
}

input[type="text"],
input[type="file"],
select.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    font: inherit;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

th {
    font-size: 0.875rem;
    color: #64748b;
}

.preview-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
}

.preview-thumb--edit {
    width: 120px;
    height: 120px;
}

.field-hint {
    font-size: 0.875rem;
    font-weight: 400;
    color: #64748b;
}

.panel-edit {
    border-color: #93c5fd;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.admin-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .quiz-nav {
        flex-direction: column;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 16px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px;
        background: #fff;
    }

    td {
        border: 0;
        padding: 8px 0;
    }
}
