* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

body.admin-body {
    background: #eef2f8;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(16px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 72px;
}

.site-footer {
    margin-top: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #e5e7eb;
}

.site-footer-inner {
    display: flex;
    align-items: center;
    min-height: 72px;
    padding: 16px 0;
}

.site-footer-content {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
}

.site-footer-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    color: #475569;
    line-height: 1.7;
}

.site-footer-text {
    color: #64748b;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
}

.site-footer-links a {
    color: #2563eb;
}

.mobile-bottom-nav {
    display: none;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    flex-wrap: nowrap;
}

.brand-title {
    color: #0f172a;
}

.brand-intro {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.4;
}

.brand-intro p,
.brand-intro div {
    margin: 0;
}

.brand-intro a {
    color: #2563eb;
}

.brand-badge {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.22);
}

.brand-logo {
    width: auto;
    height: 42px;
    max-width: 180px;
    display: block;
    object-fit: contain;
}

.topbar-actions,
.hero-actions,
.card-actions,
.toolbar,
.tab-row,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.btn-light {
    background: #fff;
    color: #1f2937;
    border-color: #d1d5db;
}

.btn-outline {
    background: transparent;
    border-color: #cbd5e1;
    color: #334155;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.hero {
    padding: 36px 0 24px;
}

.hero-card,
.panel,
.content-card,
.subject-card,
.question-card,
.exam-card,
.auth-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.hero-card {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 24px;
    padding: 32px;
}

.hero-card h1,
.page-title {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.2;
}

.hero-card p,
.muted {
    margin: 0;
    color: #64748b;
    line-height: 1.7;
}

.hero-side {
    display: grid;
    gap: 16px;
}

.stat-grid,
.subject-grid,
.feature-grid,
.card-grid,
.metric-grid {
    display: grid;
    gap: 16px;
}

.stat-grid {
    grid-template-columns: repeat(3, 1fr);
}

.subject-grid,
.feature-grid,
.card-grid {
    grid-template-columns: repeat(3, 1fr);
}

.metric-grid {
    grid-template-columns: repeat(4, 1fr);
}

.stack-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.stat-card,
.mini-card,
.feature-card {
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff, #f1f5f9);
    border: 1px solid #e2e8f0;
}

.feature-card-button {
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.stat-card strong,
.feature-card strong,
.metric-value {
    display: block;
    font-size: 24px;
    margin-top: 8px;
}

.section {
    padding: 12px 0 32px;
}

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

.section-header h2,
.section-title {
    margin: 0;
    font-size: 24px;
}

.subject-card,
.feature-card,
.content-card,
.question-card,
.exam-card,
.panel {
    padding: 22px;
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}

.chip-gray {
    background: #f1f5f9;
    color: #334155;
}

.chip-green {
    background: #ecfdf5;
    color: #047857;
}

.collapsible-panel {
    padding: 0;
    overflow: hidden;
}

.collapsible-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px;
    cursor: pointer;
}

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

.collapsible-summary h3 {
    margin: 0 0 6px;
}

.collapsible-indicator {
    min-width: 60px;
    text-align: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 13px;
    font-weight: 700;
}

.collapsible-panel[open] .collapsible-indicator {
    background: #e0f2fe;
    color: #0369a1;
}

.collapsible-panel[open] .collapsible-indicator::before {
    content: "收起";
}

.collapsible-panel[open] .collapsible-indicator {
    font-size: 0;
}

.collapsible-panel[open] .collapsible-indicator::before,
.collapsible-panel:not([open]) .collapsible-indicator::before {
    font-size: 13px;
}

.collapsible-panel:not([open]) .collapsible-indicator::before {
    content: "展开";
}

.collapsible-content {
    padding: 0 22px 22px;
    border-top: 1px solid #eef2f7;
}

.chip-red {
    background: #fef2f2;
    color: #dc2626;
}

.activation-category-picker {
    display: grid;
    gap: 10px;
}

.activation-category-selected {
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.activation-category-options {
    display: grid;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.activation-category-option {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    justify-content: flex-start;
    width: fit-content;
    max-width: 100%;
}

.activation-category-option.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.activation-category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    line-height: 1;
}

.activation-category-chip-remove {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #dbeafe;
    color: #1d4ed8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    padding: 0;
}

.activation-category-picker.is-disabled .activation-category-options,
.activation-category-picker.is-disabled .activation-category-selected {
    opacity: 0.55;
}

.activation-category-tree {
    display: grid;
    gap: 10px;
}

.activation-category-tree-children {
    margin-top: 10px;
    margin-left: 18px;
    padding-left: 14px;
    border-left: 1px dashed #cbd5e1;
}

.activation-category-tree-item {
    display: grid;
    gap: 0;
}

.activation-category-tree-item.has-children > .activation-category-option {
    font-weight: 700;
}

.activation-category-tree.level-0 > .activation-category-tree-item > .activation-category-option {
    min-height: 38px;
}

.list {
    margin: 0;
    padding-left: 18px;
    color: #475569;
    line-height: 1.8;
}

.empty {
    padding: 24px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    color: #64748b;
    background: #f8fafc;
}

.alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    background: #fff7ed;
    color: #9a3412;
}

.alert-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.form-grid,
.filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

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

.field label {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    outline: none;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.rich-editor-source {
    display: none;
}

.rich-editor-box {
    position: relative;
    border: 1px solid #d1d5db;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rich-editor-box.is-uploading {
    opacity: 0.75;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    overflow-x: hidden;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
    scrollbar-width: thin;
}

.editor-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    max-width: 100%;
    padding-right: 6px;
    border-right: 1px solid #e5e7eb;
}

.editor-toolbar-group:last-child {
    padding-right: 0;
    border-right: none;
}

.btn-editor {
    flex: 0 0 auto;
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    box-shadow: none;
    border-radius: 7px;
}

.btn-editor svg,
.editor-select-icon svg,
.editor-color-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.btn-editor:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.editor-select-wrap,
.editor-color-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.editor-select-icon,
.editor-color-icon {
    position: absolute;
    left: 10px;
    color: #475569;
    pointer-events: none;
}

.editor-select,
.editor-color {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 8px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #fff;
    color: #1f2937;
    font-size: 12px;
}

.editor-select-compact {
    min-width: 74px;
    padding-left: 28px;
}

.editor-color {
    width: 32px;
    padding: 4px;
    border-radius: 7px;
    color: transparent;
    cursor: pointer;
}

.editor-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.editor-color::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.editor-color-icon {
    left: 11px;
}

.editor-color-wrap .editor-color {
    padding-left: 28px;
}

.rich-editor {
    min-height: 150px;
    padding: 16px 18px;
    outline: none;
    font-size: 14px;
    line-height: 1.75;
    background: #fff;
}

.rich-editor-box-analysis .rich-editor {
    min-height: 72px;
    padding: 2px 4px;
    line-height: 1.6;
}

.rich-editor-box-analysis .rich-editor p,
.rich-editor-box-analysis .rich-editor div,
.rich-editor-box-analysis .rich-editor blockquote,
.rich-editor-box-analysis .rich-editor ul,
.rich-editor-box-analysis .rich-editor ol,
.rich-editor-box-analysis .rich-editor h1,
.rich-editor-box-analysis .rich-editor h2,
.rich-editor-box-analysis .rich-editor h3,
.rich-editor-box-analysis .rich-editor h4 {
    margin-top: 0;
    margin-bottom: 2px;
}

.rich-editor-box-analysis .rich-editor > :last-child {
    margin-bottom: 0;
}

.rich-editor-file-input {
    display: none;
}

.question-option-list {
    display: grid;
    gap: 14px;
}

.question-option-item {
    display: grid;
    gap: 10px;
}

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

.question-option-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
}

.btn-option-add,
.btn-option-remove {
    min-height: 36px;
}

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

.rich-editor-option {
    min-height: 92px;
}

.rich-editor:empty:before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.rich-editor:focus-within,
.rich-editor-box:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.rich-editor-box.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

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

.sms-send-button {
    min-width: 124px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-wrap {
    overflow-x: auto;
}

.study-subject-list {
    display: grid;
    gap: 20px;
}

.study-subject-item {
    padding: 18px 20px;
    border: 1px solid #60a5fa;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

.study-subject-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.study-subject-row + .study-subject-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.study-subject-row-meta {
    align-items: flex-start;
}

.study-subject-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.study-modal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.study-summary-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #eff6ff;
}

.study-summary-card strong {
    font-size: 14px;
    color: #1e3a8a;
}

.study-summary-card span {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.study-progress-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 20px;
    padding: 16px 18px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #eff6ff;
}

.study-progress-pill-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.study-progress-pill-item-right {
    align-items: flex-end;
    text-align: right;
}

.study-progress-pill-item strong {
    font-size: 14px;
    color: #1e3a8a;
}

.study-progress-pill-item span {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.study-record-section {
    margin-top: 20px;
}

.exam-intro-list {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.exam-intro-item {
    padding: 14px 18px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #f8fbff;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.exam-intro-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.exam-timer-card {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #dbeafe;
    border-radius: 16px;
    background: #eff6ff;
}

.exam-timer-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: #1d4ed8;
}

.exam-timer-value.is-warning {
    color: #dc2626;
}

.study-record-list {
    display: grid;
    gap: 12px;
}

.study-record-item {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr 0.8fr;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    color: #334155;
}

.study-record-cell {
    display: block;
    min-width: 0;
}

.study-record-label {
    display: none;
}

.study-record-value {
    display: inline;
    white-space: nowrap;
}

.study-record-value-mobile {
    display: none;
}

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
    vertical-align: top;
}

th {
    color: #475569;
    font-weight: 700;
    background: #f8fafc;
}

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

.tag-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
}

.tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
}

.tabs a.active {
    background: #1d4ed8;
    color: #fff;
}

.top-category-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.top-category-tabs a {
    flex: 0 0 auto;
    min-width: 132px;
    justify-content: center;
    font-weight: 700;
}

.mobile-top-category-select {
    display: none;
}

.mobile-top-category-select summary {
    list-style: none;
}

.mobile-top-category-select summary::-webkit-details-marker {
    display: none;
}

.question-card h3,
.subject-card h3,
.feature-card h3 {
    margin: 0 0 10px;
    font-size: 20px;
}

.question-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

#practice-content {
    scroll-margin-top: 96px;
}

.practice-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
    gap: 20px;
}

.practice-sidebar {
    position: sticky;
    top: 96px;
    display: grid;
    gap: 16px;
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
}

.practice-side-section {
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.practice-side-section:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.practice-breadcrumb {
    margin-bottom: 14px;
    font-size: 12px;
    color: #94a3b8;
}

.practice-breadcrumb a,
.practice-breadcrumb span {
    color: #94a3b8;
}

.practice-side-header {
    margin-bottom: 12px;
}

.practice-side-header h2,
.practice-side-header h3 {
    margin: 0 0 6px;
    color: #0f172a;
}

.practice-side-header h2 {
    font-size: 28px;
}

.practice-side-header h3 {
    font-size: 22px;
}

.practice-side-actions {
    margin-top: 14px;
}

.practice-mode-switch {
    margin-bottom: 16px;
}

.practice-side-tabs {
    align-items: flex-start;
}

.practice-side-tabs a {
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 12px;
}

.answer-sheet-card {
    min-height: 0;
}

.answer-sheet-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.answer-sheet-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: auto;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 13px;
    font-weight: 700;
}

.answer-sheet-tag::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: currentColor;
    flex: 0 0 14px;
}

.answer-sheet-tag.is-correct {
    color: #52b67a;
}

.answer-sheet-item.is-correct {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.answer-sheet-tag.is-wrong {
    color: #f0732d;
}

.answer-sheet-item.is-wrong {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.answer-sheet-tag.is-answered {
    color: #2563eb;
}

.answer-sheet-item.is-answered {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.answer-sheet-tag.is-pending {
    color: #d9d9d9;
}

.answer-sheet-item.is-pending {
    background: #f8fafc;
    color: #64748b;
    border-color: #e2e8f0;
}

.answer-sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 12px;
}

.answer-sheet-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    justify-self: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: #ececec;
    box-shadow: none;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.answer-sheet-item:hover {
    transform: translateY(-1px);
}

.answer-sheet-item.is-active {
    box-shadow: 0 0 0 2px #1d4ed8 inset;
}

.answer-sheet-item.is-current {
    box-shadow: 0 0 0 2px #1d4ed8 inset;
}

.answer-sheet-item.is-correct {
    background: #dcefe0;
    color: #52b67a;
    border-color: #dcefe0;
}

.answer-sheet-item.is-wrong {
    background: #f8e0d4;
    color: #e86f35;
    border-color: #f8e0d4;
}

.answer-sheet-item.is-pending {
    background: #ececec;
    color: #111827;
    border-color: #ececec;
}

.answer-sheet-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.answer-sheet-page-btn {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
}

.answer-sheet-page-btn:disabled {
    border-color: #d1d5db;
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
    opacity: 1;
}

.answer-sheet-page-status {
    min-width: 72px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.answer-sheet-jump {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #475569;
}

.answer-sheet-jump input {
    width: 68px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    color: #111827;
    background: #fff;
}

.special-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 8px;
}

.practice-main-panel {
    min-width: 0;
    width: 100%;
}

.mobile-practice-progress-card,
.mobile-practice-toolbar {
    display: none;
}

.mobile-exam-timer-bar,
.mobile-exam-toolbar {
    display: none;
}

.mobile-practice-progress-card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.mobile-practice-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
}

.mobile-practice-progress-header strong {
    color: #2563eb;
    font-size: 18px;
}

.mobile-practice-progress-track {
    height: 10px;
    margin-top: 12px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.mobile-practice-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
}

.mobile-practice-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.mobile-practice-tool-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    color: inherit;
    flex: 0 0 18px;
}

.mobile-practice-tool-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-practice-favorite-form,
.mobile-practice-mode-link {
    margin: 0;
}

.mobile-practice-tool.is-active {
    color: #2563eb;
}

.mobile-practice-tool.is-active .mobile-practice-tool-icon svg {
    fill: rgba(37, 99, 235, 0.18);
}

.mobile-practice-exit-link {
    border-radius: 6px;
    background: #ef4444;
    color: #fff;
    padding: 1mm;
    font-weight: 700;
}

.mobile-practice-exit-link:hover,
.mobile-practice-exit-link:focus-visible {
    background: #dc2626;
    color: #fff;
}

.mobile-practice-radio {
    width: 14px;
    height: 14px;
    border: 1.5px solid #94a3b8;
    border-radius: 999px;
    position: relative;
    flex: 0 0 14px;
}

.mobile-practice-mode-link.is-active .mobile-practice-radio {
    border-color: #2563eb;
}

.mobile-practice-mode-link.is-active .mobile-practice-radio::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 999px;
    background: #2563eb;
}

.mobile-practice-answer-sheet-modal .modal-panel {
    width: min(520px, 100%);
}

.mobile-exam-timer-bar {
    margin-bottom: 14px;
    padding: 12px 16px;
    border-radius: 14px;
    background: #1683ff;
    color: #fff;
    text-align: center;
    box-shadow: 0 8px 20px rgba(22, 131, 255, 0.18);
}

.mobile-exam-timer-bar [data-exam-timer-text] {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.mobile-exam-timer-bar [data-exam-timer-text].is-warning {
    color: #fff0a8;
}

.mobile-exam-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 0 10px;
    border: none;
    background: transparent;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.mobile-exam-tool.is-active {
    color: #2563eb;
}

.mobile-exam-favorite-form {
    margin: 0;
}

.mobile-exam-submit-button,
.mobile-exam-exit-link {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: #ff1d1d;
    color: #fff;
}

.mobile-exam-answer-sheet-modal .modal-panel {
    width: min(520px, 100%);
}

.exam-result-card {
    display: grid;
    gap: 22px;
    position: relative;
}

.exam-result-top-back {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #111827;
    text-decoration: none;
}

.exam-result-top-back svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.exam-result-main,
.exam-result-outcome {
    text-align: center;
}

.exam-result-title,
.exam-result-outcome-title {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}

.exam-result-score {
    margin-top: 10px;
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    color: #000;
}

.exam-result-outcome-text {
    margin-top: 8px;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.exam-result-stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
}

.exam-result-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
}

.exam-result-stat.is-correct span {
    color: #65a30d;
}

.exam-result-stat.is-wrong span {
    color: #dc2626;
}

.exam-result-actions {
    justify-content: center;
    gap: 14px;
}

.exam-result-actions .btn {
    min-width: 132px;
}

.exam-result-extra {
    max-width: 420px;
    margin: 0 auto;
}

.metric-progress-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
}

.metric-progress-card .muted {
    margin: 0;
}

.metric-progress-card .metric-value {
    margin-top: 0;
    font-size: 18px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    body.mobile-practice-enhanced-page {
        padding-bottom: 72px;
    }

    body.mobile-exam-enhanced-page {
        padding-bottom: 78px;
    }

    body.mobile-exam-result-page {
        padding-bottom: 0;
    }

    body.mobile-practice-enhanced-page .container {
        width: min(100% - 20px, 100%);
    }

    body.mobile-exam-enhanced-page .container {
        width: min(100% - 20px, 100%);
    }

    .mobile-practice-enhanced-page .mobile-bottom-nav {
        display: none;
    }

    .mobile-exam-enhanced-page .mobile-bottom-nav {
        display: none;
    }

    .mobile-exam-result-page .mobile-bottom-nav {
        display: none;
    }

    body.mobile-practice-enhanced-page .practice-layout .practice-sidebar,
    .practice-layout.is-mobile-practice-enhanced .practice-sidebar {
        display: none !important;
    }

    .practice-layout.is-mobile-exam-enhanced .practice-sidebar {
        display: none !important;
    }

    body.mobile-practice-enhanced-page .practice-layout,
    .practice-layout.is-mobile-practice-enhanced {
        grid-template-columns: 1fr !important;
    }

    .practice-layout.is-mobile-exam-enhanced {
        grid-template-columns: 1fr !important;
    }

    body.mobile-exam-result-page .practice-layout {
        grid-template-columns: 1fr !important;
    }

    body.mobile-practice-enhanced-page .practice-layout .practice-mode-switch,
    body.mobile-practice-enhanced-page .practice-layout .practice-favorite-form,
    body.mobile-practice-enhanced-page .practice-layout .question-meta,
    .practice-layout.is-mobile-practice-enhanced .practice-mode-switch,
    .practice-layout.is-mobile-practice-enhanced .practice-favorite-form,
    .practice-layout.is-mobile-practice-enhanced .question-meta {
        display: none;
    }

    body.mobile-practice-enhanced-page .practice-layout .question-card,
    .practice-layout.is-mobile-practice-enhanced .question-card {
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.mobile-practice-enhanced-page .practice-layout .question-title,
    .practice-layout.is-mobile-practice-enhanced .question-title {
        margin-top: 0;
        margin-bottom: 12px;
        font-size: 18px;
        line-height: 1.6;
    }

    body.mobile-practice-enhanced-page .practice-layout .practice-card-actions,
    .practice-layout.is-mobile-practice-enhanced .practice-card-actions {
        justify-content: space-between;
        gap: 10px;
    }

    body.mobile-practice-enhanced-page .practice-layout .practice-card-actions .btn,
    .practice-layout.is-mobile-practice-enhanced .practice-card-actions .btn {
        flex: 1 1 0;
        min-height: 38px;
        border-radius: 10px;
    }

    body.mobile-practice-enhanced-page .practice-layout .mobile-practice-progress-card,
    .practice-layout.is-mobile-practice-enhanced .mobile-practice-progress-card {
        display: block;
        margin-bottom: 10px;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .mobile-practice-toolbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        display: grid;
        grid-template-columns: auto auto 1fr 1fr auto;
        align-items: center;
        gap: 8px;
        padding: 1mm 10px;
        border-top: 1px solid #e5e7eb;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
    }

    .mobile-practice-toolbar .mobile-practice-tool,
    .mobile-practice-toolbar .mobile-practice-favorite-form {
        min-width: 0;
    }

    .mobile-practice-toolbar .mobile-practice-favorite-form {
        display: flex;
    }

    .mobile-practice-toolbar .mobile-practice-favorite-form .mobile-practice-tool,
    .mobile-practice-toolbar .mobile-practice-mode-link,
    .mobile-practice-toolbar .mobile-practice-sheet-button,
    .mobile-practice-toolbar .mobile-practice-exit-link {
        min-height: 32px;
        width: 100%;
        justify-content: center;
        white-space: nowrap;
    }

    .mobile-practice-tool-text {
        white-space: nowrap;
        line-height: 1.2;
    }

    .mobile-practice-answer-sheet-modal {
        z-index: 85;
    }

    .mobile-practice-answer-sheet-modal .modal-panel {
        padding: 18px;
        border-radius: 18px;
    }

    .practice-layout.is-mobile-exam-enhanced .exam-card,
    .practice-layout.is-mobile-exam-enhanced .exam-question-panel {
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .practice-layout.is-mobile-exam-enhanced .question-meta {
        margin-bottom: 12px;
    }

    .practice-layout.is-mobile-exam-enhanced .question-title {
        margin-top: 0;
        margin-bottom: 12px;
        font-size: 18px;
        line-height: 1.6;
    }

    .practice-layout.is-mobile-exam-enhanced .option-list {
        gap: 0;
        margin: 12px 0 16px;
    }

    .practice-layout.is-mobile-exam-enhanced .option-item {
        padding: 12px 0;
        border: none;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 0;
        background: transparent;
    }

    .practice-layout.is-mobile-exam-enhanced .option-item:first-child {
        border-top: 1px solid #e5e7eb;
    }

    .practice-layout.is-mobile-exam-enhanced .option-content {
        gap: 8px;
        line-height: 1.65;
    }

    .practice-layout.is-mobile-exam-enhanced .exam-question-actions {
        justify-content: space-between;
        gap: 10px;
    }

    .practice-layout.is-mobile-exam-enhanced .exam-question-actions .btn {
        flex: 1 1 0;
        min-height: 38px;
        border-radius: 999px;
    }

    .mobile-exam-timer-bar {
        display: block;
    }

    .mobile-exam-toolbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        display: grid;
        grid-template-columns: auto auto auto auto;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border-top: 1px solid #e5e7eb;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
    }

    .mobile-exam-toolbar .mobile-exam-favorite-form {
        display: flex;
    }

    .mobile-exam-toolbar .mobile-exam-tool,
    .mobile-exam-toolbar .mobile-exam-favorite-form {
        min-width: 0;
    }

    .mobile-exam-answer-sheet-modal {
        z-index: 85;
    }

    .mobile-exam-answer-sheet-modal .modal-panel {
        padding: 18px;
        border-radius: 18px;
    }

    body.mobile-exam-result-page .practice-sidebar {
        display: none !important;
    }

    body.mobile-exam-result-page .exam-card,
    body.mobile-exam-result-page .question-card {
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.mobile-exam-result-page .exam-result-card {
        min-height: calc(100vh - 120px);
        align-content: center;
        gap: 30px;
        padding: 24px 0 40px;
    }

    body.mobile-exam-result-page .exam-result-title,
    body.mobile-exam-result-page .exam-result-outcome-title {
        font-size: 28px;
    }

    body.mobile-exam-result-page .exam-result-score {
        margin-top: 16px;
        font-size: 84px;
    }

    body.mobile-exam-result-page .exam-result-outcome-text {
        margin-top: 10px;
        font-size: 24px;
    }

    body.mobile-exam-result-page .exam-result-stats {
        gap: 18px;
    }

    body.mobile-exam-result-page .exam-result-stat {
        font-size: 18px;
    }

    body.mobile-exam-result-page .exam-result-extra {
        display: none;
    }

    body.mobile-exam-result-page .exam-result-top-back {
        display: inline-flex;
        position: absolute;
        top: 0;
        left: 0;
    }

    body.mobile-exam-result-page .exam-result-actions {
        justify-content: space-around;
        gap: 16px;
        margin-top: 10px;
    }

    body.mobile-exam-result-page .exam-result-actions .btn {
        min-width: 0;
        padding: 0;
        border: none;
        background: transparent;
        color: #111827;
        box-shadow: none;
        font-size: 18px;
        font-weight: 500;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-list {
        gap: 0;
        margin: 12px 0 16px;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-item {
        padding: 12px 10px;
        border: 1.5px solid transparent;
        border-radius: 12px;
        background: transparent;
        box-shadow: none;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-item:not(.is-selected) {
        padding-left: 10px;
        padding-right: 10px;
        border: none;
        border-bottom: 1px solid #e5e7eb;
        border-radius: 0;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-item:first-child:not(.is-selected) {
        border-top: 1px solid #e5e7eb;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-item.is-selected {
        border-color: #3b82f6;
        background: rgba(59, 130, 246, 0.05);
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.08);
    }

    body.mobile-practice-enhanced-page .practice-layout .option-item input {
        margin-top: 6px;
    }

    body.mobile-practice-enhanced-page .practice-layout .option-content {
        gap: 8px;
        line-height: 1.65;
    }

    body.mobile-practice-enhanced-page .practice-layout .answer-card {
        margin-top: 12px;
        padding: 10px 0 0;
        border: none;
        border-top: 1px solid #e5e7eb;
        border-radius: 0;
        background: transparent;
    }

    body.mobile-practice-enhanced-page .practice-layout .rich-content img {
        border-radius: 8px;
    }
}

.option-list {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #f8fafc;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 3px 0 0;
    padding: 0;
    border: 1.5px solid #94a3b8;
    border-radius: 50%;
    background: #fff;
    box-sizing: border-box;
    flex: 0 0 20px;
    position: relative;
    overflow: visible;
}

.option-item input[type="checkbox"] {
    border-radius: 6px;
}

.option-item input[type="radio"]::after,
.option-item input[type="checkbox"]::after {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: #2563eb;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.option-item input[type="checkbox"]::after {
    inset: 3px;
    border-radius: 3px;
}

.option-item input[type="radio"]:checked,
.option-item input[type="checkbox"]:checked {
    border-color: #2563eb;
}

.option-item input[type="radio"]:checked::after,
.option-item input[type="checkbox"]:checked::after {
    opacity: 1;
    transform: scale(1);
}

.option-item input[type="radio"]:focus-visible,
.option-item input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.option-item.is-selected {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.08) inset;
}

.option-item.is-selected .option-content strong {
    color: #1d4ed8;
}

.option-content {
    display: flex;
    gap: 10px;
    flex: 1;
    line-height: 1.75;
}

.rich-content {
    line-height: 1.8;
    word-break: break-word;
}

.rich-content p:first-child,
.rich-content ul:first-child,
.rich-content ol:first-child,
.rich-content blockquote:first-child,
.rich-content div:first-child {
    margin-top: 0;
}

.rich-content p:last-child,
.rich-content ul:last-child,
.rich-content ol:last-child,
.rich-content blockquote:last-child,
.rich-content div:last-child {
    margin-bottom: 0;
}

.rich-content img,
.rich-editor img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin-top: 10px;
}

.rich-editor img {
    cursor: pointer;
    user-select: none;
}

.rich-editor img.is-selected {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.rich-editor-image-handle {
    position: absolute;
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
    z-index: 4;
}

.rich-editor-image-handle.active {
    display: block;
}

.rich-editor-image-handle-nw {
    cursor: nwse-resize;
}

.rich-editor-image-handle-se {
    cursor: nwse-resize;
}

.rich-editor-image-handle-ne {
    cursor: nesw-resize;
}

.rich-editor-image-handle-sw {
    cursor: nesw-resize;
}

.rich-content a,
.rich-editor a {
    color: #2563eb;
    text-decoration: underline;
}

.rich-content code,
.rich-editor code {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    background: #eef2ff;
    color: #3730a3;
    font-family: Consolas, "Courier New", monospace;
    text-decoration: none;
}

.answer-card {
    margin-top: 18px;
    padding: 2px 8px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    height: auto;
}

.answer-card p {
    margin: 0;
    line-height: 1.5;
}

.answer-card p:last-child {
    margin-bottom: 0;
}

.answer-card > div {
    margin-top: 0;
}

.answer-card .rich-content {
    margin-top: 0;
    line-height: 1.5;
}

.answer-card strong {
    line-height: 1.4;
}

.answer-card .rich-content p,
.answer-card .rich-content div,
.answer-card .rich-content ul,
.answer-card .rich-content ol,
.answer-card .rich-content blockquote,
.answer-card .rich-content h1,
.answer-card .rich-content h2,
.answer-card .rich-content h3,
.answer-card .rich-content h4 {
    margin-top: 0;
    margin-bottom: 0;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    color: #64748b;
    font-size: 14px;
}

.layout-admin {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    color: #e2e8f0;
    padding: 24px 18px;
}

.sidebar .brand {
    color: #fff;
    margin-bottom: 26px;
}

.nav-list {
    display: grid;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    color: #cbd5e1;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
}

.nav-group {
    display: grid;
    gap: 8px;
}

.nav-group summary {
    list-style: none;
    cursor: pointer;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group-toggle {
    justify-content: space-between;
}

.nav-caret::before {
    content: ">";
    display: inline-block;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.nav-group[open] .nav-caret::before {
    transform: rotate(90deg);
}

.nav-sub-list {
    display: grid;
    gap: 8px;
    padding-left: 14px;
}

.nav-sub-link {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    color: #94a3b8;
    font-size: 14px;
}

.nav-sub-link.active,
.nav-sub-link:hover {
    background: rgba(59, 130, 246, 0.14);
    color: #fff;
}

.admin-main {
    padding: 28px;
}

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

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.55);
    z-index: 80;
}

.modal.active {
    display: flex;
}

.modal-panel {
    width: min(560px, 100%);
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.24);
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.modal-panel-large {
    width: min(960px, 100%);
}

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

.modal-close {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: #f1f5f9;
    cursor: pointer;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
}

.auth-card h1 {
    margin: 0 0 8px;
}

.helper-text {
    font-size: 13px;
    color: #64748b;
}

.admin-category-tree-wrap {
    margin-top: 16px;
    background: #fff;
    border-radius: 18px;
    padding: 8px 18px;
}

.admin-category-tree {
    display: grid;
    gap: 0;
}

.admin-category-tree.level-1,
.admin-category-tree.level-2,
.admin-category-tree.level-3 {
    margin-top: 6px;
    margin-left: 14px;
    padding-left: 14px;
    border-left: 1px dashed #dbe2ea;
}

.admin-category-item,
.admin-category-leaf {
    border-bottom: 1px solid #eef2f7;
    background: transparent;
}

.admin-category-item {
    position: relative;
}

.admin-category-summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    padding: 14px 0;
}

.admin-category-summary::-webkit-details-marker {
    display: none;
}

.admin-category-summary-main {
    display: grid;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}

.admin-category-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-category-title-row strong {
    font-size: 18px;
    color: #0f172a;
}

.admin-category-summary-tip {
    font-size: 12px;
    color: #94a3b8;
}

.admin-category-item[open] .admin-category-head {
    border-bottom: none;
}

.admin-category-item[open] .admin-category-summary {
    border-bottom: 1px solid #eef2f7;
}

.admin-category-body {
    padding: 8px 0 12px;
}

.admin-category-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.admin-category-leaf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.admin-category-action-link {
    min-width: 46px;
    height: 28px;
    padding: 0 12px;
    border: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.admin-category-action-link.is-edit {
    background: #eff6ff;
    color: #2563eb;
}

.admin-category-action-link.is-delete {
    background: #ef4444;
    color: #fff;
}

.admin-category-actions form {
    margin: 0;
}

.admin-category-summary-main .muted {
    font-size: 14px;
    color: #94a3b8;
}

.admin-pagination {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.admin-pagination-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-page-btn {
    min-height: 34px;
    padding: 0 14px;
}

.admin-page-status {
    min-width: 92px;
    text-align: center;
    font-weight: 600;
    color: #0f172a;
}

.admin-pagination-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.admin-pagination-form .field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.admin-pagination-form .field-inline label {
    margin: 0;
    white-space: nowrap;
}

.admin-pagination-form .field-inline input,
.admin-pagination-form .field-inline select {
    width: auto;
    min-width: 96px;
}

.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 20px 0;
}

@media (max-width: 720px) {
    .mobile-top-category-select {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #dbe4f0;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
        overflow: hidden;
    }

    .mobile-top-category-select summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 14px;
        cursor: pointer;
    }

    .mobile-top-category-select-text {
        min-width: 0;
        display: grid;
        gap: 2px;
    }

    .mobile-top-category-select-hint {
        font-size: 12px;
        color: #64748b;
        line-height: 1.35;
    }

    .mobile-top-category-select-label {
        display: block;
        font-weight: 700;
        font-size: 20px;
        color: #0f172a;
        line-height: 1.3;
    }

    .mobile-top-category-select-icon {
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        color: #64748b;
    }

    .mobile-top-category-select-icon svg {
        width: 100%;
        height: 100%;
        display: block;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: transform 0.2s ease;
    }

    .mobile-top-category-select[open] .mobile-top-category-select-icon svg {
        transform: rotate(180deg);
    }

    .mobile-top-category-select-menu {
        display: grid;
        gap: 0;
        border-top: 1px solid #e5e7eb;
        padding: 4px 0;
    }

    .mobile-top-category-select-menu a {
        display: block;
        padding: 11px 14px;
        font-size: 14px;
        color: #334155;
        line-height: 1.4;
    }

    .mobile-top-category-select-menu a + a {
        border-top: 1px solid #f1f5f9;
    }

    .top-category-tabs {
        display: none;
    }

    .hero-card,
    .layout-admin,
    .subject-grid,
    .card-grid,
    .metric-grid,
    .study-modal-summary {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-grid,
    .form-grid,
    .form-grid-3,
    .filters {
        grid-template-columns: 1fr;
    }

    .study-progress-pill {
        gap: 16px;
        padding: 14px 16px;
    }

    .study-progress-pill-item span {
        font-size: 18px;
    }

    .admin-main {
        padding: 18px;
    }

    .practice-sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

    .practice-layout {
        grid-template-columns: 1fr;
    }

    .special-type-grid {
        grid-template-columns: 1fr;
    }

    body.subject-page .feature-card,
    body.subject-page .feature-card-button {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 52px;
        padding: 10px 8px;
        border: 1px solid #dbe4f0;
        border-radius: 14px;
        background: #f8fafc;
        box-shadow: none;
    }

    body.subject-page .feature-card .chip,
    body.subject-page .feature-card p {
        display: none;
    }

    body.subject-page .feature-card h3 {
        margin: 0;
        font-size: 15px;
        line-height: 1.35;
        text-align: center;
    }
}

@media (max-width: 720px) {
    .container {
        width: min(100% - 20px, 100%);
    }

    body {
        padding-bottom: 58px;
    }

    .topbar-inner,
    .admin-header,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-inner {
        min-height: auto;
        padding: 1mm 0;
    }

    .topbar-user-actions,
    .topbar-guest-actions {
        display: none;
    }

    .site-footer {
        display: none;
    }

    .site-footer-inner,
    .site-footer-content,
    .site-footer-section {
        align-items: flex-start;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        align-items: stretch;
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.06);
    }

    body.subject-records-page .metric-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    body.subject-records-page .metric-grid .content-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    body.subject-records-page .metric-grid .content-card .muted {
        margin: 0;
        color: #111827;
        line-height: 1.5;
        white-space: nowrap;
    }

    body.subject-records-page .metric-grid .content-card .metric-value {
        margin-top: 0;
        font-size: 18px;
        line-height: 1.4;
        white-space: nowrap;
    }


    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 1mm 4px;
        border: 0;
        background: transparent;
        color: #0f172a;
        font-size: 14px;
        font-weight: 600;
        text-align: center;
        line-height: 1.2;
        gap: 2px;
    }

    .mobile-bottom-nav a span:last-child,
    .mobile-bottom-nav button span:last-child {
        white-space: nowrap;
    }

    .mobile-bottom-nav-icon {
        width: 16px;
        height: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-bottom-nav-icon svg {
        width: 16px;
        height: 16px;
        stroke: currentColor;
        stroke-width: 1.8;
        fill: none;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .hero-card {
        padding: 20px;
    }

    .page-title {
        font-size: 28px;
    }

    .study-subject-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: flex-start;
    }

    .study-record-item {
        grid-template-columns: 1.45fr 0.85fr 0.7fr;
        gap: 8px;
        align-items: start;
    }

    .study-record-cell {
        display: flex;
        flex-direction: column;
        gap: 4px;
        min-width: 0;
    }

    .study-record-label {
        display: block;
        font-size: 11px;
        color: #64748b;
    }

    .study-record-value {
        display: block;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        color: #334155;
    }

    .study-record-cell-time .study-record-value {
        font-size: 11px;
    }

    .study-record-value-desktop {
        display: none;
    }

    .study-record-value-mobile {
        display: block;
    }
}
