/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: #ffffff !important;
    color: #1e293b !important;
    line-height: 1.5;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    padding-bottom: 90px;
    /* Safe area for mobile */
    min-height: 100vh;
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 18px 40px;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
    color: #1e293b !important;
    letter-spacing: -0.02em;
}

/* Utilities */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn var(--transition-normal) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Component */
.card {
    background: #f8fafc !important;
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-md);
    margin-bottom: 22px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Primary Button */
.btn-primary {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--highlight-color));
    color: #fff;
    padding: 16px 18px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 12px 24px rgba(14, 165, 161, 0.35);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 8px 18px rgba(14, 165, 161, 0.35);
}

/* Outline Button */
.btn-outline {
    display: block;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 14px 18px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.btn-outline:active {
    background-color: #f1f5f9;
    transform: scale(0.98);
}

/* Secondary Button (for History) */
.btn-secondary {
    display: block;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 16px 18px;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
    color: var(--text-main);
}

.btn-secondary:active {
    transform: scale(0.98);
    background-color: var(--border-color);
}

/* Option Buttons (The "Creative" Part) */
.options {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 18px 20px;
    border-radius: 18px;
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    color: #1e293b !important;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    border-color: var(--primary-color);
    background-color: #f0fdfa;
    /* Very light primary tint */
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.option-btn:active {
    transform: scale(0.99);
}

/* Selected State */
.option-btn.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--highlight-color));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(34, 211, 238, 0.3);
}

/* Typography styles matching inline overrides */
h1 {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

/* Savol rasmlari */
.question-image-wrap {
    background: #ffffff !important;
}
.question-image {
    max-width: 100%;
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

.subtitle {
    text-align: center;
    color: #475569 !important;
    margin-bottom: 26px;
    font-size: 16px;
}

/* Subject Card */
.subject-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Header & Progress Bar */
.test-header {
    background: #f8fafc !important;
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--surface-color) 25%, var(--border-color) 50%, var(--surface-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    background-color: var(--border-color);
}

.skeleton-card {
    height: 80px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

/* KaTeX formula styling */
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 10px 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.option-btn .katex {
    font-size: 1em;
}