/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #000;
    --secondary-color: #333;
    --danger-color: #000;
    --warning-color: #333;
    --success-color: #000;
    --info-color: #000;
    --dark-color: #000;
    --light-color: #f5f5f5;
    --border-color: #000;
    --border-light: #ddd;
    --shadow: none;
    --border-radius: 8px;
    --transition: all 0.2s ease;
    --border-width: 2px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

.app {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 220px;
    background: #fff;
    color: #000;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
    border-right: 2px solid #000;
    border-radius: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0;
}

.close-sidebar {
    display: none;
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    width: 32px;
    height: 32px;
    color: #000;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-sidebar:hover {
    background: #000;
    color: #fff;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #000;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border-bottom: 1px solid transparent;
    margin: 0 10px;
}

.nav-item:hover {
    background-color: #f5f5f5;
}

.nav-item.active {
    background-color: #000;
    color: #fff;
}

.nav-icon {
    margin-right: 12px;
    font-size: 1rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.nav-text {
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
    transition: var(--transition);
    background: #fafafa;
}

.header {
    background: white;
    padding: 15px 20px;
    border-bottom: 2px solid #000;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.page-content {
    padding: 24px;
}

.page {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-section {
    background: #fff;
    color: #000;
    padding: 32px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    text-align: center;
}

.welcome-section h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.welcome-section p {
    font-size: 0.95rem;
    color: #666;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.action-btn {
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    padding: 24px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #000;
}

.action-btn:hover {
    background: #000;
    color: #fff;
}

.action-btn:hover .btn-icon svg {
    stroke: #fff;
}

.btn-icon {
    width: 24px;
    height: 24px;
}

.btn-icon svg {
    width: 24px;
    height: 24px;
    stroke: #000;
    stroke-width: 2;
    fill: none;
    transition: var(--transition);
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    background: #000;
    color: #fff;
}

.stat-card:hover .stat-value {
    color: #fff;
}

.stat-card:hover .stat-label {
    color: #ccc;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 4px;
    transition: var(--transition);
}

.stat-label {
    color: #666;
    font-size: 0.85rem;
    transition: var(--transition);
}

.default-banks-section {
    margin-bottom: 24px;
}

.default-banks-section h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: #000;
}

.default-banks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.subject-category {
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.subject-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #000;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.subject-header:hover {
    opacity: 0.85;
}

.subject-icon {
    font-size: 1rem;
}

.subject-name {
    flex: 1;
}

.subject-count {
    font-size: 0.75rem;
    background: #fff;
    color: #000;
    padding: 2px 8px;
}

.subject-toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.subject-toggle-icon.expanded {
    transform: rotate(180deg);
}

.subject-banks {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.subject-banks .bank-item {
    border-left: none;
    border-right: none;
    border-top: none;
}

.subject-banks .bank-item:first-child {
    border-top: 2px solid #ddd;
}

.subject-banks .bank-item:last-child {
    border-bottom: none;
}

.default-bank-item {
    background: #fafafa;
    padding: 16px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
}

.default-bank-item:hover {
    border-color: #000;
    background: #fff;
}

.default-bank-info {
    flex: 1;
}

.default-bank-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #000;
}

.default-bank-description {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.bank-stat {
    font-size: 0.8rem;
    color: #999;
    margin-top: 4px;
}

.default-bank-action {
    min-width: 80px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: #000;
    background: #fafafa;
}

.btn {
    padding: 10px 16px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    background: #fff;
    color: #000;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.btn:hover {
    background: #000;
    color: #fff;
}

.btn-primary {
    background: #000;
    color: #fff;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

.btn-success {
    background: #000;
    color: #fff;
}

.btn-success:hover {
    background: #333;
}

.btn-danger {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

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

.btn-warning {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-warning:hover {
    background: #f5f5f5;
}

.btn-info {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.btn-info:hover {
    background: #f5f5f5;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn.added {
    background: #f5f5f5;
    color: #999;
    border-color: #ddd;
}

.btn.added:hover {
    background: #f5f5f5;
    color: #999;
}

.practice-setup {
    background: #fff;
    padding: 32px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    max-width: 720px;
    margin: 0 auto;
}

.setup-header {
    text-align: center;
    margin-bottom: 24px;
}

.setup-header h2 {
    font-size: 1.4rem;
    color: #000;
    margin-bottom: 8px;
    font-weight: 600;
}

.setup-header p {
    color: #666;
    font-size: 0.9rem;
}

.active-banks-section {
    margin-bottom: 24px;
}

.active-banks-section h3 {
    font-size: 1rem;
    color: #000;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
}

.active-banks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
}

.active-bank-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fafafa;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.active-bank-item:hover {
    border-color: #000;
    background: #fff;
}

.active-bank-item-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #000;
}

.active-bank-item-info {
    display: flex;
    gap: 12px;
    color: #666;
    font-size: 0.85rem;
}

.setup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
}

.practice-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.practice-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    background: #fff;
    padding: 16px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.practice-area {
    background: #fff;
    padding: 24px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.progress-bar {
    background: #f5f5f5;
    height: 36px;
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
}

.progress-fill {
    background: #000;
    height: 100%;
    width: 0%;
    transition: width 0.2s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: #000;
    font-size: 0.85rem;
    background: #fff;
    padding: 2px 8px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.question-container {
    margin-bottom: 24px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
}

.question-number {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
}

.question-type {
    padding: 4px 12px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 500;
    color: #000;
}

.question-type.single_choice {
    background: #fff;
}

.question-type.multiple_choice {
    background: #fff;
}

.question-type.true_false {
    background: #fff;
}

.question-type.fill_blank {
    background: #fff;
}

.question-content {
    font-size: 1rem;
    margin-bottom: 16px;
    line-height: 1.7;
}

.question-images {
    margin: 12px 0;
}

.question-images img {
    max-width: 100%;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.question-diagram {
    margin: 12px 0;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow-x: auto;
    text-align: center;
}

.question-diagram svg {
    max-width: 100%;
    height: auto;
}

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

.option-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
}

.option-item:hover {
    border-color: #000;
    background: #fafafa;
}

.option-item.selected {
    border-color: #000;
    border-width: 2px;
    background: #fafafa;
}

.option-item.correct {
    border-color: #000;
    border-width: 2px;
    background: #000;
    color: #fff;
}

.option-item.correct .option-label {
    background: #fff;
    color: #000;
}

.option-item.wrong {
    border-color: #000;
    border-width: 2px;
    background: #fff;
    text-decoration: line-through;
    color: #999;
}

.option-label {
    width: 24px;
    height: 24px;
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-size: 0.95rem;
}

.question-explanation {
    margin-top: 16px;
    padding: 16px;
    background: #fafafa;
    border-left: 3px solid #000;
    display: none;
}

.question-explanation.show {
    display: block;
}

.explanation-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #000;
    font-size: 0.9rem;
}

.correct-answer {
    margin-top: 16px;
    padding: 16px;
    background: #f5f5f5;
    border-left: 3px solid #000;
}

.correct-answer-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: #000;
    font-size: 0.9rem;
}

.correct-answer-text {
    font-size: 1rem;
    color: #000;
}

.add-wrong-btn-container {
    margin-top: 16px;
    text-align: center;
}

.multiple-choice-submit {
    margin-top: 12px;
    text-align: center;
}

.export-wrong-bank {
    margin-top: 16px;
    text-align: center;
    padding: 16px;
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.question-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

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

.wrong-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

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

.wrong-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wrong-item {
    background: #fff;
    padding: 16px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    border-left: 4px solid #000;
}

.wrong-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.wrong-item-question {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.wrong-item-info {
    display: flex;
    gap: 12px;
    font-size: 0.85rem;
    color: #666;
}

.wrong-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

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

.bank-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.bank-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bank-item {
    background: #fff;
    padding: 8px 12px;
    transition: var(--transition);
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 40px;
}

.bank-item:hover {
    background: #fafafa;
    border-color: #000;
}

.bank-item.active {
    background: #f5f5f5;
    border-color: #000;
}

.bank-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bank-checkbox-wrapper {
    display: flex;
    align-items: center;
}

.bank-checkbox-wrapper input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #000;
}

.bank-item-name {
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bank-item-description {
    display: none;
}

.bank-item-info {
    display: contents;
    font-size: 0.8rem;
    color: #666;
    word-break: break-word;
}

.bank-item-stat {
    font-size: 0.8rem;
    color: #666;
    word-break: break-word;
}

.bank-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bank-item-actions .btn {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.active-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #000;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: var(--border-radius);
}

.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
}

.select-all-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.select-all-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #000;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.bank-stats {
    background: #fff;
    padding: 20px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.bank-stats h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}

.bank-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 2px solid #ddd;
}

.bank-stat-item:last-child {
    border-bottom: none;
}

.settings-list {
    background: #fff;
    padding: 20px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 2px solid #ddd;
}

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

.setting-item label {
    font-size: 0.95rem;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #000;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 2px solid #000;
    border-radius: var(--border-radius);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid #000;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #000;
    line-height: 1;
}

.close-modal:hover {
    color: #666;
}

.modal-body {
    padding: 20px;
}

.import-methods {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.import-method {
    padding: 16px;
    border: 2px dashed #000;
    border-radius: var(--border-radius);
}

.import-method h4 {
    margin-bottom: 12px;
    color: #000;
    font-size: 0.95rem;
    font-weight: 600;
}

.help-text {
    color: #666;
    font-size: 0.85rem;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #999;
    font-size: 0.9rem;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 90;
}

.overlay.show {
    display: block;
}

.menu-btn {
    display: none;
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    width: 40px;
    height: 40px;
    cursor: pointer;
    margin-right: 12px;
    color: #000;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.menu-btn:hover {
    background: #000;
    color: #fff;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .close-sidebar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-btn {
        display: flex !important;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .stats-summary {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .question-actions {
        flex-direction: column;
    }

    .question-actions .btn {
        width: 100%;
    }

    .bank-item-header {
        flex-direction: column;
    }

    .bank-item-actions {
        flex-wrap: wrap;
    }
    
    .bank-item {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.fill-blank-input {
    display: inline-block;
    width: 200px;
    padding: 8px 12px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    margin: 0 4px;
    background: #fff;
}

.fill-blank-input:focus {
    outline: none;
    background: #fafafa;
}

.short-answer-input {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: var(--transition);
    background: #fff;
}

.short-answer-input:focus {
    outline: none;
    background: #fafafa;
}

.short-answer-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.material-section {
    background: #fafafa;
    border-left: 4px solid #000;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
}

.material-title {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #000;
    display: inline-block;
}

.material-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #333;
    text-align: justify;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    margin-right: 4px;
    margin-bottom: 4px;
}

.difficulty {
    display: inline-block;
    padding: 3px 10px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 500;
}

.difficulty.easy {
    background: #fff;
    color: #000;
}

.difficulty.medium {
    background: #f5f5f5;
    color: #000;
}

.difficulty.hard {
    background: #000;
    color: #fff;
}
  
@media (max-width: 768px) {
    .default-banks-list {
        grid-template-columns: 1fr;
    }
    
    .subject-banks {
        grid-template-columns: 1fr;
    }
}

.default-banks-panel {
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #000;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.panel-header:hover {
    opacity: 0.85;
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.panel-toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.panel-toggle-icon.expanded {
    transform: rotate(180deg);
}

.panel-actions {
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.panel-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
}

.panel-actions .btn span {
    font-size: 1rem;
}

.panel-search {
    padding: 12px 16px;
    border-bottom: 2px solid #ddd;
}

.panel-search input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.panel-search input:focus {
    outline: none;
    background: #fafafa;
}

.panel-content {
    max-height: 400px;
    overflow-y: auto;
    transition: max-height 0.2s ease;
}

.panel-content .default-banks-list {
    padding: 12px;
}

.unfinished-practice-alert {
    background: #fff;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 24px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; }
    to { opacity: 1; }
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.alert-icon {
    width: 32px;
    height: 32px;
}

.alert-icon svg {
    width: 32px;
    height: 32px;
    stroke: #000;
    stroke-width: 2;
    fill: none;
}

.alert-text {
    flex: 1;
    min-width: 200px;
}

.alert-text strong {
    display: block;
    font-size: 1rem;
    color: #000;
    margin-bottom: 4px;
}

.alert-text p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

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

.alert-actions .btn {
    padding: 8px 14px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .alert-content {
        flex-direction: column;
        text-align: center;
    }
    
    .alert-actions {
        width: 100%;
        justify-content: center;
    }
    
    .alert-actions .btn {
        flex: 1;
    }
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.keyboard-hints {
    margin-top: 24px;
    padding: 16px;
    background: #f8f9fa;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 13px;
    color: #666;
}

.keyboard-hints .hint-row {
    text-align: center;
    line-height: 1.8;
}

.keyboard-hints .hint-row:first-child {
    margin-bottom: 4px;
}

.keyboard-hints a {
    color: #000;
    text-decoration: underline;
    transition: var(--transition);
}

.keyboard-hints a:hover {
    color: #666;
}

/* KPS monochrome console refresh */
:root {
    --primary-color: #070707;
    --secondary-color: #1c1c1c;
    --danger-color: #070707;
    --warning-color: #070707;
    --success-color: #070707;
    --info-color: #070707;
    --dark-color: #070707;
    --light-color: #f7f7f2;
    --border-color: #070707;
    --border-light: #d9d9cf;
    --border-radius: 8px;
    --border-width: 1px;
    --accent-color: #0aa6a6;
    --paper-color: #f7f7f2;
    --panel-color: rgba(255, 255, 250, 0.94);
    --muted-color: #5f625e;
    --shadow: 8px 8px 0 rgba(0, 0, 0, 0.08);
    --transition: 180ms ease;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #111 #ecece5;
}

html {
    background: var(--paper-color);
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--dark-color);
    background:
        linear-gradient(90deg, rgba(7, 7, 7, 0.055) 1px, transparent 1px),
        linear-gradient(0deg, rgba(7, 7, 7, 0.055) 1px, transparent 1px),
        radial-gradient(circle at 18% 12%, rgba(10, 166, 166, 0.12), transparent 28%),
        var(--paper-color);
    background-size: 28px 28px, 28px 28px, auto, auto;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.028) 0 1px, transparent 1px 14px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(247, 247, 242, 0));
    z-index: 0;
}

.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.sidebar {
    width: 252px;
    left: 18px;
    top: 18px;
    height: calc(100vh - 36px);
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 250, 0.96), rgba(244, 244, 237, 0.94)),
        linear-gradient(90deg, transparent 0, transparent 92%, rgba(10, 166, 166, 0.25) 92%, rgba(10, 166, 166, 0.25) 93%, transparent 93%);
    color: #070707;
    border: 1px solid #070707;
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.sidebar::before {
    content: "LEARN OS";
    position: absolute;
    right: -34px;
    top: 130px;
    transform: rotate(90deg);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 10px;
    letter-spacing: 0;
    color: rgba(0, 0, 0, 0.38);
}

.sidebar-header {
    min-height: 92px;
    padding: 20px 18px;
    border-bottom: 1px solid #070707;
    background:
        linear-gradient(90deg, rgba(7, 7, 7, 0.04) 1px, transparent 1px),
        linear-gradient(0deg, rgba(7, 7, 7, 0.04) 1px, transparent 1px);
    background-size: 12px 12px;
}

.sidebar-header h2 {
    position: relative;
    padding-top: 18px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0;
}

.sidebar-header h2::before {
    content: "KPS / NODE-01";
    position: absolute;
    top: 0;
    left: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--accent-color);
}

.sidebar-nav {
    height: calc(100% - 92px);
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    position: relative;
    gap: 12px;
    min-height: 48px;
    margin: 0 0 8px;
    padding: 12px 14px;
    color: #070707;
    border: 1px solid rgba(7, 7, 7, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 250, 0.55);
    transform-origin: left center;
}

.nav-item:hover {
    color: #070707;
    border-color: #070707;
    background: #fff;
    transform: translateX(4px) scale(1.02);
}

.nav-item.active {
    color: #fff;
    background: #070707;
    border-color: #070707;
    box-shadow: inset 4px 0 0 var(--accent-color);
    transform: translateX(8px) scale(1.04);
}

.nav-item.active::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
    transform: translateY(-50%);
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-right: 0;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.nav-text {
    font-size: 0.92rem;
    font-weight: 700;
}

.main-content {
    margin-left: 288px;
    min-height: 100vh;
    background: transparent;
}

.header {
    top: 18px;
    z-index: 60;
    min-height: 70px;
    margin: 18px 24px 0 0;
    padding: 12px 14px 12px 18px;
    border: 1px solid #070707;
    border-radius: 8px;
    background: rgba(255, 255, 250, 0.9);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(16px);
}

.header h1 {
    position: relative;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0;
}

.header h1::after {
    content: " / LEARNING CENTER";
    display: inline-block;
    margin-left: 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--accent-color);
    vertical-align: middle;
}

.header-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.header-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #070707;
    border-radius: 999px;
    color: #070707;
    background: rgba(255, 255, 255, 0.68);
    font-size: 0.85rem;
    font-weight: 800;
    text-decoration: none;
    transition: var(--transition);
}

.header-link:hover {
    color: #fff;
    background: #070707;
}

.header-link-primary {
    color: #fff;
    background: #070707;
    box-shadow: inset 0 -3px 0 var(--accent-color);
}

.page-content {
    width: min(100%, 1240px);
    margin: 0 auto;
    padding: 28px 28px 48px 4px;
}

.page {
    animation: consoleFade 220ms ease;
}

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

.welcome-section,
.practice-setup,
.practice-area,
.bank-stats,
.settings-list,
.default-banks-panel,
.unfinished-practice-alert,
.modal-content,
.export-wrong-bank {
    position: relative;
    overflow: hidden;
    border: 1px solid #070707;
    border-radius: 8px;
    background: var(--panel-color);
    box-shadow: var(--shadow);
}

.welcome-section::before,
.practice-setup::before,
.practice-area::before,
.bank-stats::before,
.settings-list::before,
.default-banks-panel::before,
.unfinished-practice-alert::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(7, 7, 7, 0.04) 1px, transparent 1px),
        linear-gradient(0deg, rgba(7, 7, 7, 0.04) 1px, transparent 1px);
    background-size: 18px 18px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 70%);
}

.welcome-section {
    min-height: 210px;
    margin-bottom: 22px;
    padding: 34px;
    text-align: left;
}

.welcome-section h2 {
    max-width: 760px;
    font-size: clamp(2rem, 4vw, 4.6rem);
    line-height: 0.95;
    font-weight: 900;
    letter-spacing: 0;
}

.welcome-section p {
    max-width: 520px;
    margin-top: 14px;
    color: var(--muted-color);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.quick-actions,
.stats-summary,
.stats-grid,
.default-banks-list {
    gap: 14px;
}

.action-btn,
.stat-card,
.default-bank-item,
.subject-category,
.bank-item,
.wrong-item,
.active-bank-item,
.import-method,
.keyboard-hints,
.material-section,
.question-explanation,
.correct-answer,
.bulk-actions {
    border: 1px solid #070707;
    border-radius: 8px;
    background: rgba(255, 255, 250, 0.88);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.06);
}

.action-btn {
    align-items: flex-start;
    min-height: 140px;
    padding: 18px;
    color: #070707;
}

.action-btn:hover {
    color: #fff;
    background: #070707;
    transform: translateY(-3px);
    box-shadow: 6px 6px 0 rgba(10, 166, 166, 0.25);
}

.btn-icon {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.btn-icon svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
}

.stat-card {
    position: relative;
    min-height: 124px;
    padding: 20px 18px;
    text-align: left;
}

.stat-card::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 16px;
    width: 30px;
    height: 18px;
    border-top: 1px solid #070707;
    border-right: 1px solid #070707;
}

.stat-card:hover {
    color: #070707;
    background: #fff;
    transform: translateY(-2px);
}

.stat-card:hover .stat-value,
.stat-card:hover .stat-label {
    color: inherit;
}

.stat-value {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 2.35rem;
    line-height: 1;
}

.stat-label {
    margin-top: 10px;
    color: var(--muted-color);
    font-size: 0.82rem;
    font-weight: 800;
}

.btn,
.form-control,
.menu-btn,
.close-sidebar,
.close-modal,
.panel-search input,
.fill-blank-input,
.short-answer-input {
    border-width: 1px;
    border-radius: 7px;
}

.btn {
    min-height: 36px;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.07);
}

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

.btn-primary,
.btn-success {
    background: #070707;
    color: #fff;
    box-shadow: inset 0 -3px 0 var(--accent-color);
}

.btn-primary:hover,
.btn-success:hover {
    background: #222;
}

.btn-secondary,
.btn-warning,
.btn-info,
.btn-danger {
    background: #fff;
    color: #070707;
}

.btn-danger:hover {
    color: #fff;
    background: #070707;
    box-shadow: inset 0 -3px 0 #d93b3b;
}

.form-control,
.panel-search input,
.fill-blank-input,
.short-answer-input {
    background: rgba(255, 255, 255, 0.9);
    color: #070707;
}

.form-control:focus,
.panel-search input:focus,
.fill-blank-input:focus,
.short-answer-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(10, 166, 166, 0.14);
}

.practice-setup {
    max-width: 860px;
    padding: 28px;
}

.setup-header {
    text-align: left;
}

.setup-header h2,
.wrong-header h2,
.bank-header h2,
#statsPage > h2,
#settingsPage > h2 {
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: 0;
}

.setup-header p {
    color: var(--muted-color);
}

.active-banks-section h3,
.bank-stats h3,
.import-method h4 {
    border-bottom-width: 1px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.84rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.active-bank-item {
    align-items: flex-start;
}

.active-bank-item-info,
.wrong-item-info {
    flex-wrap: wrap;
}

.practice-header,
.wrong-header,
.bank-header {
    gap: 12px;
}

.practice-area {
    padding: 22px;
}

.progress-bar {
    height: 30px;
    border: 1px solid #070707;
    border-radius: 999px;
    background: #fff;
}

.progress-fill {
    background:
        repeating-linear-gradient(90deg, #070707 0 10px, #202020 10px 16px);
}

.progress-text {
    border-width: 1px;
    border-radius: 999px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.question-header {
    align-items: flex-start;
    gap: 10px;
    padding: 0 0 14px;
    border-bottom: 1px solid #070707;
}

.question-number {
    font-size: 1.1rem;
    font-weight: 900;
}

.question-type,
.difficulty,
.tag,
.active-badge {
    border-width: 1px;
    border-radius: 999px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.72rem;
    font-weight: 800;
}

.question-type,
.difficulty.easy,
.difficulty.medium {
    background: #fff;
}

.difficulty.hard,
.active-badge {
    color: #fff;
    background: #070707;
}

.question-content {
    font-size: 1.05rem;
    line-height: 1.85;
}

.option-item {
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(7, 7, 7, 0.28);
    border-radius: 8px;
    background: #fff;
}

.option-item:hover,
.option-item.selected {
    border-color: #070707;
    background:
        linear-gradient(90deg, rgba(10, 166, 166, 0.12), transparent 36%),
        #fff;
    transform: translateX(3px);
}

.option-item.correct {
    color: #fff;
    background: #070707;
    box-shadow: inset 4px 0 0 var(--accent-color);
}

.option-item.wrong {
    color: #5f625e;
    background:
        repeating-linear-gradient(-45deg, rgba(7, 7, 7, 0.04) 0 7px, transparent 7px 14px),
        #fff;
    text-decoration: none;
    box-shadow: inset 4px 0 0 #d93b3b;
}

.option-label {
    margin-right: 0;
    border-width: 1px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.question-explanation,
.correct-answer,
.material-section {
    border-left: 4px solid var(--accent-color);
}

.explanation-title,
.correct-answer-title,
.material-title {
    color: #070707;
    font-weight: 900;
}

.keyboard-hints {
    color: var(--muted-color);
    font-size: 0.78rem;
}

.keyboard-hints .hint-row {
    text-align: left;
}

.wrong-item,
.bank-item {
    position: relative;
    padding: 16px;
}

.wrong-item {
    border-left: 4px solid #070707;
}

.bank-list {
    gap: 10px;
}

.bank-item:hover,
.default-bank-item:hover,
.active-bank-item:hover,
.wrong-item:hover {
    border-color: #070707;
    background: #fff;
    transform: translateY(-2px);
}

.bank-item.active {
    background:
        linear-gradient(90deg, rgba(10, 166, 166, 0.14), transparent 35%),
        #fff;
    box-shadow: inset 4px 0 0 var(--accent-color), 4px 4px 0 rgba(0, 0, 0, 0.06);
}

.bank-item-name {
    font-size: 0.95rem;
    font-weight: 900;
}

.bank-item-stat,
.default-bank-description,
.bank-stat,
.help-text,
.alert-text p {
    color: var(--muted-color);
}

.bulk-actions {
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.subject-header,
.panel-header {
    background: #070707;
    color: #fff;
}

.panel-actions,
.panel-search {
    border-bottom: 1px solid rgba(7, 7, 7, 0.2);
    background: rgba(255, 255, 250, 0.72);
}

.panel-content {
    max-height: min(460px, 62vh);
}

.bank-stat-item,
.setting-item {
    border-bottom-width: 1px;
}

.setting-item input[type="checkbox"],
.select-all-checkbox input[type="checkbox"],
.bank-checkbox-wrapper input[type="checkbox"] {
    accent-color: #070707;
}

.modal {
    background: rgba(7, 7, 7, 0.46);
    backdrop-filter: blur(8px);
}

.modal-content {
    max-width: 760px;
}

.modal-header {
    border-bottom-width: 1px;
}

.modal-header h3 {
    font-weight: 900;
}

.import-methods {
    gap: 14px;
}

.close-sidebar,
.close-modal,
.menu-btn {
    box-shadow: none;
}

.empty-state {
    color: var(--muted-color);
    border: 1px dashed rgba(7, 7, 7, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 250, 0.52);
}

.unfinished-practice-alert {
    border-left: 4px solid var(--accent-color);
}

.alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid #070707;
    border-radius: 50%;
    background: #fff;
}

.alert-icon svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 1024px) {
    .sidebar {
        left: 0;
        top: 0;
        height: 100vh;
        border-radius: 0 8px 8px 0;
    }

    .main-content {
        margin-left: 252px;
    }

    .header {
        margin-right: 16px;
    }

    .page-content {
        padding-right: 16px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: min(86vw, 320px);
        transform: translateX(calc(-100% - 18px));
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        top: 0;
        min-height: 62px;
        margin: 0;
        border-width: 0 0 1px;
        border-radius: 0;
    }

    .header h1::after {
        display: none;
    }

    .header-links {
        gap: 6px;
    }

    .header-link {
        min-height: 32px;
        padding: 0 10px;
        font-size: 0.78rem;
    }

    .page-content {
        padding: 18px 14px 34px;
    }

    .welcome-section {
        min-height: 180px;
        padding: 24px;
    }

    .welcome-section h2 {
        font-size: 2.4rem;
    }

    .stats-summary,
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-header,
    .wrong-header,
    .bank-header,
    .setup-actions,
    .setting-item,
    .active-bank-item {
        flex-direction: column;
        align-items: stretch;
    }

    .wrong-header-actions,
    .bank-item-actions,
    .alert-actions,
    .header-links {
        flex-wrap: wrap;
    }

    .question-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-summary,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .welcome-section h2 {
        font-size: 2rem;
    }

    .header-link {
        padding: 0 8px;
    }
}

/* Device, theme, and touch refinements */
:root {
    --accent-color: #00a6a6;
    --accent-strong: #007f86;
    --accent-soft: rgba(0, 166, 166, 0.14);
    --paper-color: #f4f6f8;
    --panel-color: rgba(255, 255, 255, 0.94);
    --muted-color: #667085;
    --shadow: 0 18px 45px rgba(16, 24, 40, 0.1);
}

html,
body,
.app,
.main-content {
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(244, 246, 248, 0.96)),
        var(--paper-color);
}

body::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(244, 246, 248, 0));
}

.sidebar {
    height: calc(100dvh - 36px);
}

.btn,
.header-link,
.menu-btn,
.close-sidebar,
.close-modal,
.option-item {
    touch-action: manipulation;
}

.btn,
.header-link,
.menu-btn,
.close-sidebar,
.close-modal {
    min-height: 40px;
}

.option-item {
    min-height: 52px;
    cursor: pointer;
}

.option-label {
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fill-blank-input {
    width: min(100%, 420px);
    min-width: min(100%, 220px);
    min-height: 42px;
}

.question-options:has(.fill-blank-input),
.question-options:has(.short-answer-input) {
    align-items: stretch;
}

.question-options:has(.fill-blank-input) {
    display: flex;
    flex-wrap: wrap;
}

.short-answer-input {
    width: 100%;
    min-height: 140px;
    resize: vertical;
}

.modal {
    padding:
        calc(16px + env(safe-area-inset-top))
        calc(16px + env(safe-area-inset-right))
        calc(16px + env(safe-area-inset-bottom))
        calc(16px + env(safe-area-inset-left));
}

.modal-content {
    width: min(760px, 100%);
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.question-actions {
    flex-wrap: wrap;
}

.question-actions .btn {
    min-width: 120px;
}

.keyboard-hints {
    overflow-wrap: anywhere;
}

.keyboard-hints a {
    color: var(--accent-strong);
}

@media (max-width: 1024px) {
    .sidebar {
        height: 100dvh;
    }
}

@media (max-width: 768px) {
    body {
        min-height: 100dvh;
    }

    .sidebar {
        width: min(88vw, 330px);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .header {
        min-height: calc(62px + env(safe-area-inset-top));
        padding-top: calc(12px + env(safe-area-inset-top));
    }

    .header h1 {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-links {
        margin-left: 0;
        justify-content: flex-end;
    }

    .page-content {
        padding:
            18px
            calc(14px + env(safe-area-inset-right))
            calc(34px + env(safe-area-inset-bottom))
            calc(14px + env(safe-area-inset-left));
    }

    .practice-area,
    .practice-setup,
    .welcome-section,
    .settings-list,
    .bank-stats,
    .default-banks-panel,
    .unfinished-practice-alert {
        box-shadow: none;
    }

    .question-options {
        gap: 10px;
    }

    .option-item {
        padding: 14px 12px;
    }

    .fill-blank-input {
        width: 100%;
        min-width: 0;
    }

    .multiple-choice-submit .btn,
    .question-options:has(.fill-blank-input) .btn,
    .question-options:has(.short-answer-input) .btn {
        width: 100%;
    }

    .keyboard-hints .hint-row:first-child {
        display: none;
    }
}

@media (max-width: 480px) {
    .header {
        gap: 8px;
        padding-inline: 10px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .header-link {
        min-height: 34px;
        font-size: 0.74rem;
    }

    .menu-btn {
        width: 40px;
        min-width: 40px;
    }

    .practice-area,
    .practice-setup,
    .welcome-section {
        padding: 18px;
    }

    .question-content {
        font-size: 1rem;
        line-height: 1.75;
    }

    .option-label {
        width: 34px;
        min-width: 34px;
        height: 34px;
    }
}

html[data-theme='dark'] {
    color-scheme: dark;
    --primary-color: #e6edf3;
    --secondary-color: #c9d1d9;
    --danger-color: #f97066;
    --warning-color: #f4c430;
    --success-color: #00c2c2;
    --info-color: #00c2c2;
    --dark-color: #e6edf3;
    --light-color: #0d1117;
    --border-color: #3a485b;
    --border-light: #2b3645;
    --accent-color: #00c2c2;
    --accent-strong: #41dede;
    --accent-soft: rgba(0, 194, 194, 0.16);
    --paper-color: #0d1117;
    --panel-color: rgba(17, 24, 39, 0.92);
    --muted-color: #9aa7b6;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

html[data-theme='dark'],
html[data-theme='dark'] body {
    background: #0d1117;
}

html[data-theme='dark'] body {
    color: var(--dark-color);
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.78), rgba(13, 17, 23, 0.98)),
        var(--paper-color);
}

html[data-theme='dark'] body::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(13, 17, 23, 0));
}

html[data-theme='dark'] .sidebar,
html[data-theme='dark'] .header,
html[data-theme='dark'] .welcome-section,
html[data-theme='dark'] .practice-setup,
html[data-theme='dark'] .practice-area,
html[data-theme='dark'] .bank-stats,
html[data-theme='dark'] .settings-list,
html[data-theme='dark'] .default-banks-panel,
html[data-theme='dark'] .unfinished-practice-alert,
html[data-theme='dark'] .modal-content,
html[data-theme='dark'] .export-wrong-bank,
html[data-theme='dark'] .action-btn,
html[data-theme='dark'] .stat-card,
html[data-theme='dark'] .default-bank-item,
html[data-theme='dark'] .subject-category,
html[data-theme='dark'] .bank-item,
html[data-theme='dark'] .wrong-item,
html[data-theme='dark'] .active-bank-item,
html[data-theme='dark'] .import-method,
html[data-theme='dark'] .keyboard-hints,
html[data-theme='dark'] .material-section,
html[data-theme='dark'] .question-explanation,
html[data-theme='dark'] .correct-answer,
html[data-theme='dark'] .bulk-actions,
html[data-theme='dark'] .option-item {
    color: var(--dark-color);
    border-color: var(--border-color);
    background: var(--panel-color);
}

html[data-theme='dark'] .subject-header,
html[data-theme='dark'] .panel-header,
html[data-theme='dark'] .btn-primary,
html[data-theme='dark'] .btn-success,
html[data-theme='dark'] .option-item.correct,
html[data-theme='dark'] .nav-item.active,
html[data-theme='dark'] .difficulty.hard,
html[data-theme='dark'] .active-badge {
    color: #07191b;
    background: var(--accent-color);
}

html[data-theme='dark'] .btn-secondary,
html[data-theme='dark'] .btn-warning,
html[data-theme='dark'] .btn-info,
html[data-theme='dark'] .btn-danger,
html[data-theme='dark'] .header-link,
html[data-theme='dark'] .question-type,
html[data-theme='dark'] .difficulty.easy,
html[data-theme='dark'] .difficulty.medium,
html[data-theme='dark'] .empty-state {
    color: var(--dark-color);
    background: #111827;
    border-color: var(--border-color);
}

html[data-theme='dark'] .header-link-primary {
    color: #07191b;
    background: var(--accent-color);
}

html[data-theme='dark'] .form-control,
html[data-theme='dark'] .panel-search input,
html[data-theme='dark'] .fill-blank-input,
html[data-theme='dark'] .short-answer-input,
html[data-theme='dark'] input,
html[data-theme='dark'] textarea,
html[data-theme='dark'] select {
    color: var(--dark-color);
    background: #0d1117;
    border-color: var(--border-color);
}

html[data-theme='dark'] .option-item:hover,
html[data-theme='dark'] .option-item.selected,
html[data-theme='dark'] .bank-item.active {
    background:
        linear-gradient(90deg, rgba(0, 194, 194, 0.16), transparent 42%),
        #111827;
}

html[data-theme='dark'] .option-item.wrong {
    color: #ffb4ab;
    background: #1d1518;
}

html[data-theme='dark'] .progress-bar {
    background: #0d1117;
    border-color: var(--border-color);
}

html[data-theme='dark'] .progress-fill {
    background: linear-gradient(90deg, var(--accent-color), var(--accent-strong));
}

html[data-theme='dark'] .keyboard-hints a {
    color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme='light']) {
        color-scheme: dark;
    }
}
