:root {
    --primary: #2563eb;
    --bg-color: #f3f4f6;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    display: block; 
    padding: 20px 10px;
    min-height: 100vh;
    box-sizing: border-box;
    color: var(--text-main);
}

.app-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto; 
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Вкладки (СЕТКА 4 в ряд) --- */
.tabs-wrapper {
    background: transparent; /* Убрал фон контейнера */
    padding: 0;
}

.tabs {
    display: grid;
    /* Ровно 4 колонки одинаковой ширины */
    grid-template-columns: repeat(4, 1fr); 
    gap: 8px; /* Расстояние между кнопками */
}

.tab-btn {
    width: 100%;
    padding: 12px 4px; /* Чуть меньше боковых отступов, чтобы влезли */
    border: none;
    background: #e5e7eb; /* Серый фон для неактивных */
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-sub);
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary); /* Синий фон для активной */
    color: #ffffff;             /* Белый текст */
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

/* --- Контент --- */
.content-wrapper {
    display: flex;
    flex-direction: column;
}

#blocks-container {
    width: 100%;
}

.tab-content {
    display: none;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: flex;
}

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

/* --- Карточка вопроса --- */
.card {
    background: var(--accent-gradient);
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.text-en {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.text-ru {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* --- Таймер --- */
.timer-container {
    width: 100%;
    height: 6px;
    background-color: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 20px;
}

.timer-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    border-radius: 3px;
}

.timer-bar.animating {
    width: 100%;
    transition: width 4s linear;
}

/* --- Управление --- */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; 
    gap: 12px;
    margin-bottom: 16px;
}

.btn-repeat {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 16px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 1rem;
    padding: 16px;
}

.btn-next {
    background: var(--text-main); 
    border: none;
    border-radius: 16px;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.controls-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 30px;
}

.btn-setting {
    background: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-sub);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-setting.active-mode {
    background: #fffbeb; 
    color: #b45309;
    border: 1px solid #fcd34d;
}

.btn-setting.auto-on {
    background: #fef2f2; 
    color: #dc2626;
    border: 1px solid #fca5a5;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.2); }
    70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* --- Список (Карточки) --- */
.pattern-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pattern-list li {
    background: #ffffff;
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pattern-list span.en {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.pattern-list span.ru {
    font-size: 0.95rem;
    color: #9ca3af;
}

/* --- Кнопка сброса --- */
.footer-actions {
    display: flex;
    justify-content: center;
    padding: 20px 0 50px 0;
}

.btn-reset-app {
    background: transparent;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 12px 24px;
    text-transform: uppercase;
    width: 100%;
}