/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* border: 1px solid red !important; */
}

/* Основные стили */
body {
    font-family: Helvetica, Arial, sans-serif;
    background-color: #F7ECDD;
    color: #000000;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Спиннер загрузки для историй */
.stories-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    gap: 30px;
    min-height: 50vh;
}

/* Полноэкранный спиннер для главной страницы */
.fullscreen-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F7ECDD;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    z-index: 10000;
}

.spinner-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(146, 113, 97, 0.15);
    border-top: 4px solid #927161;
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.spinner-logos {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.spinner-logos img {
    opacity: 0.3;
}

.spinner-logos img:first-child {
    width: 120px;
    height: auto;
}

.spinner-logos img:last-child {
    width: 70px;
    height: auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #927161;
    font-size: 16px;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
}

/* Экраны */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Шапка с логотипами */
.header-logos {
    height: 32px;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    margin-bottom: 24px;
}

/* Отступ сверху для мобильных устройств в полноэкранном режиме */
body.mobile-fullscreen .header-logos {
    margin-top: 100px;
}

.logo-biolage {
    width: 164px;
    height: 32px;
    object-fit: contain;
}

.logo-voice {
    width: 94px;
    height: 25px;
    object-fit: contain;
}

/* Основной контент */
.content {
    padding: 0 30px 200px 30px;
}

/* Заголовок */
.main-title {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 120%;
    letter-spacing: -1px;
    color: #000000;
    margin-bottom: 16px;
}

/* Текст описания */
.intro-text {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 20px;
}

#nickname {
    font-weight: 700;
}

/* Основное изображение */
.main-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 0;
    margin-bottom: 20px;
}

/* Текст условий конкурса */
.conditions-text {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 20px;
}

/* Список жюри */
.jury-list {
    margin-bottom: 20px;
}

.jury-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

.jury-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #927161 0%, #C4A088 100%);
    flex-shrink: 0;
    margin-right: 16px;
}

.jury-info {
    flex: 1;
}

.jury-name {
    font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 20px;
    line-height: 120%;
    letter-spacing: -1.5px;
    color: #000000;
    margin-bottom: 4px;
}

.jury-title {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 120%;
    letter-spacing: 0px;
    color: rgba(0, 0, 0, 0.6);
    margin: 0;
    white-space: pre-wrap;
}

/* Текст итогов */
.results-text {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 20px;
}

/* Призывающий текст */
.cta-text {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: -0.45px;
    color: #000000;
    margin-bottom: 24px;
}

/* Контейнер кнопок */
.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 30px 24px 30px;
    background: #F7ECDD;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Базовые стили кнопок */
.btn {
    display: inline-block;
    height: 48px;
    width: 100%;
    border: none;
    border-radius: 0;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-style: oblique;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: -0.45px;
    text-align: center;
    text-decoration: none;
    padding: 14px 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:active {
    opacity: 0.8;
}

/* Коричневая кнопка */
.btn-primary-brown {
    background: #412722;
    color: #F7ECDD;
}

/* Зелёная кнопка */
.btn-primary-green {
    background: #5E794B;
    color: #F7ECDD;
}

/* Кнопка с обводкой */
.btn-outline {
    background: transparent;
    border: 1px solid #412722;
    color: #412722;
}

/* Футер со ссылкой */
.footer-link {
    text-align: center;
    padding: 20px 0;
}

.privacy-link {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 120%;
    color: #000000;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* === ФОРМА === */

/* Контейнер формы */
.form-container {
    background: #F7ECDD;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Основной контент формы */
.form-content {
    padding: 0 30px 24px 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mobile-fullscreen .form-content {
    padding: 0 30px 24px 30px;
}

.form-main-title {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 120%;
    letter-spacing: -1px;
    color: #000000;
    margin: 0 0 20px 0;
}

.form-description {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-style: normal;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: -0.45px;
    color: #000000;
    margin-bottom: 24px;
}

#storyForm {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Поля формы */
.form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.form-textarea {
    width: 100%;
    min-height: 24px;
    background: #F7ECDD;
    border: none;
    border-bottom: 1px solid #927161;
    padding: 12px 0;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    color: #000000;
    resize: none;
    overflow: hidden;
    box-sizing: border-box;
}

.form-textarea::placeholder {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 12px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #927161;
}

.form-textarea:focus {
    outline: none;
    border-bottom-color: #927161;
}

.char-count {
    text-align: right;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 120%;
    color: #927161;
    margin-top: 4px;
}

.delete-story-btn {
    background: none;
    border: none;
    color: #927161;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    text-align: right;
    padding: 8px 0;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: fit-content;
    align-self: flex-end;
}

.delete-story-btn:hover {
    opacity: 1;
}

.delete-story-btn:active {
    opacity: 0.5;
}

/* Кнопки формы */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 30px 24px 30px;
    background: #F7ECDD;
}

.form-submit-btn {
    margin-bottom: 0;
}

.form-submit-btn:last-child {
    margin-bottom: 0;
}

/* === STORIES === */

/* Контейнер историй */
.stories-container {
    background: #F7ECDD;
    min-height: 100vh;
}

.stories-container .content {
    padding: 0 30px 0 30px;
}

.mobile-fullscreen .stories-container .content {
    padding: 0 30px 0 30px;
}

.stories-container .main-title {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 120%;
    letter-spacing: -1px;
    color: #000000;
    margin: 0 0 24px 0;
}

/* Список историй */
.stories-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 0 30px 200px 30px;
}

/* Карточка истории */
.story-card {
    background: #F7ECDD;
    padding: 20px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Шапка истории */
.story-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.story-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #927161 0%, #C4A088 100%);
    flex-shrink: 0;
}

.story-author-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-author-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.story-author {
    font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 20px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
}

.story-rating-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jury-like-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #412722;
    flex-shrink: 0;
    position: relative;
}

.jury-like-avatar:first-child {
    margin-left: 0 !important;
}

.story-rating {
    display: flex;
    align-items: center;
    gap: 4px;
}

.story-rating.clickable {
    cursor: pointer;
}

.heart-icon {
    width: 16px;
    height: 16px;
    color: #000000;
    fill: none;
    stroke: #000000;
    flex-shrink: 0;
    transition: fill 0.3s ease-in-out, stroke 0.3s ease-in-out;
    transform-origin: center;
}

.heart-icon.liked {
    fill: #000000;
    stroke: #000000;
}

/* Анимация только при добавлении класса (не при загрузке) */
.heart-icon:not(.liked).animating,
.heart-icon.liked.animating {
    animation: heartPop 0.6s ease-in-out;
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.2);
    }
    60% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.rating-count {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
}

/* Метка своей истории */
.own-story-label {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 120%;
    letter-spacing: 0px;
    color: rgba(0, 0, 0, 0.5);
}

/* Текст истории */
.story-text {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 140%;
    letter-spacing: 0px;
    color: #000000;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state p {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 8px;
}

/* Кнопка "Рассказать о себе" */
.submit-story-button {
    padding: 30px;
    position: sticky;
    bottom: 0;
    background: #F7ECDD;
    z-index: 1000;
}

.submit-story-button .btn {
    width: 100%;
}

/* Плавающая кнопка переключения режима (только для админа) */
.admin-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.admin-toggle-btn {
    background: #412722;
    color: #F7ECDD;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.admin-toggle-btn:active {
    transform: scale(0.95);
}

/* Финальная страница */
.final-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    margin-bottom: 20px;
}

.final-description {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: 0px;
    color: #000000;
    margin-bottom: 20px;
}

.final-subtitle {
    font-family: Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 120%;
    letter-spacing: -0.45px;
    color: #000000;
    margin-bottom: 24px;
}

/* Список историй на финальной странице */
#finalScreen .stories-list {
    padding: 0 30px 40px 30px;
}

/* Убираем огромный padding у content на финальной странице */
#finalScreen .content {
    padding: 0 30px 0 30px;
}

/* Цвет панели управления Telegram */
:root {
    --tg-theme-bg-color: #927161;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: rgba(255, 255, 255, 0.7);
    --tg-theme-link-color: #ffffff;
    --tg-theme-button-color: #927161;
    --tg-theme-button-text-color: #ffffff;
}
