.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-50);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

.btn-block {
    width: 100%;
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: all var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.input::placeholder {
    color: var(--text-muted);
}

.search-box {
    position: relative;
}

.search-box .input {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-desc {
    font-size: 14px;
    margin-bottom: 24px;
}

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

.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.tag:hover,
.tag.active {
    background: var(--primary-50);
    color: var(--primary);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.list-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-50);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.list-item-desc {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-meta {
    font-size: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--primary-50);
    color: var(--primary);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    margin-right: 12px;
}

.question-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    margin-left: 12px;
}

.question-text {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.question-text p {
    margin-bottom: 12px;
}

.question-text code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.question-text pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 12px 0;
}

.question-text pre code {
    background: none;
    padding: 0;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.option-item:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
}

.option-item.selected {
    background: var(--primary-50);
    border-color: var(--primary);
}

.option-item.correct {
    background: var(--success-light);
    border-color: var(--success);
}

.option-item.wrong {
    background: var(--danger-light);
    border-color: var(--danger);
}

.option-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.answer-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.answer-result {
    padding: 16px;
    border-radius: var(--radius);
    margin-top: 16px;
}

.answer-result.correct {
    background: var(--success-light);
    border: 1px solid var(--success);
    color: #065f46;
}

.answer-result.wrong {
    background: var(--danger-light);
    border: 1px solid var(--danger);
    color: #991b1b;
}

.answer-explanation {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-top: 16px;
}

.answer-explanation h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.answer-explanation p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 18px;
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.knowledge-content {
    line-height: 1.8;
}

.knowledge-content h2 {
    font-size: 22px;
    font-weight: 600;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.knowledge-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px;
}

.knowledge-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 10px;
}

.knowledge-content p {
    margin-bottom: 16px;
}

.knowledge-content ul,
.knowledge-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.knowledge-content li {
    margin-bottom: 8px;
}

.knowledge-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.knowledge-content pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}

.knowledge-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    background: var(--primary-50);
    margin: 16px 0;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.knowledge-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.knowledge-content th,
.knowledge-content td {
    padding: 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.knowledge-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.knowledge-content img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-muted);
    box-shadow: var(--shadow-md);
    z-index: 50;
    display: none;
}

.keyboard-hint.show {
    display: block;
}

.keyboard-hint kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    margin: 0 2px;
}

@media (min-width: 769px) {
    .keyboard-hint {
        display: block;
    }
}

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
}

.search-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.search-input-wrapper svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    margin-right: 12px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: var(--text-primary);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-50);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.search-result-text {
    flex: 1;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
}

.search-result-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.search-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading-skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring circle {
    transition: stroke-dashoffset 0.3s ease;
}

.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--warning-light);
    border: 1px solid var(--warning);
    border-radius: var(--radius-xl);
    font-size: 13px;
    font-weight: 500;
    color: var(--warning);
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti-fall 3s ease-in-out forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100%) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
