/* General styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    max-width: 500px; /* Максимальная ширина всего приложения */
    padding: 20px;
    box-sizing: border-box;
}

/* Selection Screen */
.selection-screen {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}
.selection-screen h1 {
    margin-top: 0;
    font-size: 1.5em;
    color: #333;
}
.controls select {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-top: 15px;
    cursor: pointer;
}

/* Study Screen */
.study-screen header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}
.study-screen header h2 {
    margin: 0 0 0 15px;
    font-size: 1.2em;
    flex-grow: 1;
    text-align: center;
}
.study-screen header button {
    background-color: #007bff; /* Blue background */
    border: none;
    cursor: pointer;
    color: white; /* White icon color */
    padding: 8px; /* Adjust padding as needed */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* Square shape */
    height: 40px; /* Square shape */
    border-radius: 8px; /* Rounded corners */
    font-size: 24px; /* Adjust icon size if necessary */
}
.study-screen header button .material-icons {
    /* Ensure the icon itself doesn't have extra margins or padding */
    margin: 0;
    padding: 0;
    display: flex; /* Helps with centering if the icon font has weird spacing */
    align-items: center;
    justify-content: center;
}
/* Remove styles for previous SVG icon if they exist */
.study-screen header button svg {
    display: none;
}
.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 5px;
}
.progress-bar {
    height: 100%;
    background-color: #4caf50;
    border-radius: 10px;
    transition: width 0.3s ease;
}
.progress-text {
    text-align: center;
    color: #606770;
    margin-bottom: 20px;
}

/* Card Stack */
.card-stack {
    perspective: 1000px;
    position: relative;
    /* Высота карточки будет зависеть от ширины (сохраняем пропорции) */
    width: 100%;
    padding-top: 120%; /* Соотношение сторон, например 5:6. Можно поменять на 100% для квадрата */
    height: 0;
}
.card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s, opacity 0.3s;
    user-select: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 15px;
}
.card.is-flipped {
    transform: rotateY(180deg);
}
.card:not(.is-swiping) {
    transition: transform 0.3s ease-out;
}
.card.swipe-left {
    opacity: 0;
    transform: translateX(-200%) rotate(-30deg) !important;
}
.card.swipe-right {
    opacity: 0;
    transform: translateX(200%) rotate(30deg) !important;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px; /* Немного увеличим отступы */
    box-sizing: border-box;
    background-color: white;
    border-radius: 15px;
    /* Добавляем overflow, чтобы текст не вылезал при слишком большом объеме */
    overflow-y: auto;
    touch-action: pan-y;
}

/* --- ИЗМЕНЕНИЯ ЗДЕСЬ --- */

/* Стили для передней стороны (вопрос) */
.card-face-front {
    text-align: center; /* Вопрос оставляем по центру */
    /* Используем clamp для адаптивного размера шрифта */
    font-size: clamp(1rem, 5vw, 1.6rem);
}

/* Стили для задней стороны (ответ) */
.card-face-back {
    transform: rotateY(180deg);
    line-height: 1.6;
    align-items: flex-start; /* Выравниваем контент по верху карточки */
    
    /* 1. Выравниваем текст по левому краю */
    text-align: left;
    
    /* 2. Используем clamp для адаптивного размера шрифта */
    font-size: clamp(0.9rem, 3.5vw, 1.1rem); 
    /* Для ответа делаем шрифт чуть меньше, т.к. текста обычно больше */
}

/* ----------------------- */

.completion-message {
    text-align: center;
    padding: 50px 20px;
}
.completion-message button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid #4caf50;
    background-color: #4caf50;
    color: white;
}
.instructions {
    text-align: center;
    color: #888;
    margin-top: 20px;
}