﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #FEFDFB;
    --bg-secondary: #FAF8F5;
    --accent-brown: #8B7355;
    --accent-light: #B8A088;
    --accent-lighter: rgba(139, 115, 85, 0.08);
    --text-primary: #3A3632;
    --text-secondary: #6B635B;
    --text-light: #9B938B;
    --border-light: rgba(139, 115, 85, 0.15);
    --safe-area-inset-top: env(safe-area-inset-top);
    --safe-area-inset-bottom: env(safe-area-inset-bottom);
}

@font-face {
    font-family: 'System';
    src: local('-apple-system'), local('BlinkMacSystemFont'), local('Segoe UI'), local('Roboto');
}

body {
    font-family: 'System', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    padding-top: var(--safe-area-inset-top);
    padding-bottom: calc(60px + var(--safe-area-inset-bottom));
    color: var(--text-primary);
    line-height: 1.6;
}

/* Экраны */
.screen {
    display: none;
    animation: fadeIn 0.4s ease;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.screen.active {
    display: block;
    /* Сброс скролла при активации экрана */
    scroll-margin-top: 0;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Шапка */
.header {
    padding: 20px;
    padding-top: calc(20px + var(--safe-area-inset-top));
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}


.header-title {
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.header-icon {
    position: absolute;
    right: 0px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.header-icon:active {
    background: var(--accent-lighter);
}

.header-icon.left {
    left: 0px;
}

.header-icon svg {
    width: 20px;
    height: 20px;
}

/* Главная страница */
.home-content {
    padding: 0 20px 20px;
}

/* Таймер */
.countdown-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: center;
}

.countdown-wrapper {
  display: grid;
  /* 1-я, 3-я, 5-я колонки — цифры; 2-я и 4-я — разделители ":" */
  grid-template-columns: minmax(56px,1fr) auto minmax(56px,1fr) auto minmax(56px,1fr);
  grid-template-rows: auto auto; /* верх — числа, низ — подписи */
  justify-content: center;
  align-items: center;
  row-gap: 6px;
  text-align: center;
}

.countdown-labels .countdown-separator {
  opacity: 0;           /* можно заменить на color: transparent; */
  pointer-events: none; /* на всякий случай убираем ховеры/клики */
}

.countdown-labels {
    display: flex;
    justify-content: center;
    gap: 35px;
    margin-top: 8px;
    font-size: 10px;
    text-transform: lowercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.countdown-numbers {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 32px;
    font-weight: 300;
    color: var(--accent-brown);
    letter-spacing: 2px;
}

.countdown-separator {
    color: var(--accent-light);
    opacity: 0.5;
}

.countdown-numbers,
.countdown-labels {
  /* «Сплющить» обёртки, чтобы элементы двух рядов делили одни и те же колонки */
  display: contents !important;
}

.countdown-numbers > span,
.countdown-labels > span {
  justify-self: center; /* центрируем каждый элемент в своей колонке */
}


/* Фото блоки */
.photo-block {
    background: var(--bg-secondary);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
}

.photo-block:active {
    transform: scale(0.98);
}

.photo-block-image {
    width: 100%;
    height: 300px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
}

.photo-block-text {
    position: relative;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(254, 253, 251, 0.98), rgba(254, 253, 251, 0.85));
}

.photo-block-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent-brown);
    margin-bottom: 4px;
    font-weight: 500;
}

.photo-block-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    max-height: none;
    overflow: visible;
}

/* Undo */

.undo-bar {
    position: fixed;
    bottom: 100px;
    left: 20px;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 20px;
    border-radius: 24px;
    display: none;
    align-items: center;
    z-index: 3000;
    font-size: 13px;
    cursor: pointer;
    max-width: 160px;
}

.undo-bar.show {
    display: block;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-120%);
    }
    to {
        transform: translateX(0);
    }
}

/* Ограничить размер фото */
#selectedPhoto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.photo-upload {
    overflow: hidden;
}

/* Оптимизация качества изображений для Retina дисплеев */
.photo-block-image,
.moment-image img,
.disappointment-thumb img,
.achievement-photo img,
.detail-photo img,
.fullscreen-image-container img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Для фоновых изображений */
.photo-block-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* Форсируем высокое качество */
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
}

/* Увеличиваем разрешение превью */
.moment-image {
    min-height: 200px; /* Было 150px */
}

.photo-block-image {
    height: 450px; /* Было 300px */
}

/* Для загруженных пользователем фото */
.photo-upload {
    height: 200px; /* Было 160px */
}

/* Полноэкранный просмотр */
@media (-webkit-min-device-pixel-ratio: 3) {
    /* Специально для iPhone 15 Pro с 3x Retina */
    .fullscreen-image-container img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        image-rendering: high-quality;
    }
}

/* Счетчики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.stat-card:active {
    background: var(--accent-lighter);
    border-color: var(--border-light);
}

.stat-number {
    font-size: 28px;
    font-weight: 300;
    color: var(--accent-brown);
    letter-spacing: 1px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Изучаем слова */
.flip-card {
    width: 100%;
    height: 200px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 24px;
}

.flip-card-back {
    transform: rotateY(180deg);
}

.chinese-character {
    font-size: 48px;
    color: var(--accent-brown);
    font-weight: 500;
}

.pinyin {
    font-size: 24px;
    color: var(--accent-brown);
    margin-bottom: 10px;
}

.translation {
    font-size: 18px;
    color: var(--text-primary);
}

/* Разочарования */
.disappointment-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
}

.disappointment-thumb {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    filter: grayscale(30%);
    flex-shrink: 0;
}

.disappointment-info {
    flex: 1;
}

.disappointment-title {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.disappointment-date {
    color: var(--text-light);
    font-size: 11px;
}

/* Навигация */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    padding-bottom: calc(12px + var(--safe-area-inset-bottom));
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-light);
}

.nav-item.active {
    color: var(--accent-brown);
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

/* Masonry через две реальные колонны (без grid) */
.moments-container {
    padding: 16px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    isolation: isolate;
    justify-content: center;
}

.moments-container.single-column {
    display: block; /* на 1 колонку — обычный поток */
}

/* Колонки */
.moments-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.moment-card {
    position: relative;
    break-inside: avoid;
    margin-bottom: 8px;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    break-inside: avoid;
    -webkit-column-break-inside: avoid; /* Safari */
    page-break-inside: avoid;           /* печать/лента */
    display: block;              /* критично для колонок Safari */
    width: 100%;
}

/* Тень только для карточек с фото */
.moment-card:not(.no-photo) {
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.moment-card:active {
    transform: scale(0.98);
}

/* Изображение на всю карточку */
.moment-image {
    width: 100%;
    position: relative;
    background: linear-gradient(135deg, var(--accent-lighter) 0%, var(--bg-secondary) 100%);
}

.moment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Размеры карточек */
.moment-short .moment-image {
    height: 160px;
}

.moment-medium .moment-image {
    height: 220px;
}

.moment-tall .moment-image {
    height: 280px;
}

/* Оверлей с текстом поверх фото */
.moment-image .moment-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.7) 0%, 
        rgba(0, 0, 0, 0.4) 50%, 
        transparent 100%);
    color: white;
}

/* Контент для карточек БЕЗ фото - обычный блок */
.moment-card.no-photo .moment-content {
    position: relative;
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px;
}

.moment-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

/* Стили текста для карточек с фото */
.moment-image .moment-title {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.moment-image .moment-location {
    font-size: 11px;
    color: white;
    opacity: 0.9;
    margin-bottom: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.moment-image .moment-date {
    font-size: 10px;
    color: white;
    opacity: 0.8;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Стили текста для карточек БЕЗ фото */
.moment-card.no-photo .moment-title {
    color: var(--text-primary);
    text-shadow: none;
}

.moment-card.no-photo .moment-location {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    text-shadow: none;
}

.moment-card.no-photo .moment-date {
    font-size: 10px;
    color: var(--text-light);
    text-shadow: none;
}

/* Заглушка когда нет фото */
.moment-image-placeholder {
    width: 100%;
    background: linear-gradient(135deg, 
        var(--accent-lighter) 0%, 
        rgba(184, 160, 136, 0.08) 35%,
        rgba(184, 160, 136, 0.03) 65%,
        transparent 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.moment-short .moment-image-placeholder  { height: 160px; }
.moment-medium .moment-image-placeholder { height: 220px; }
.moment-tall .moment-image-placeholder   { height: 280px; }

/* ===== ИЗБРАННЫЕ СЛОВА ===== */
/* Кнопка избранного на карточке слова дня */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background:none;
}

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

.favorite-icon {
    width: 25px;
    height: 25px;
    color: #8B7355;
    transition: all 0.3s ease;
}

.favorite-btn.active .favorite-icon {
    fill: #8B7355;
}

/* Контейнер избранных слов */
.favorite-words-container {
    padding: 20px;
    padding-top: calc(10px + var(--safe-area-inset-top));
    padding-bottom: calc(10px + var(--safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
}

/* Категории целей */
.goal-category {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 10px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

.category-travel {
    background: rgba(147, 197, 253, 0.25);
    color: #2563EB;
}

.category-sport {
    background: rgba(167, 243, 208, 0.25);
    color: #059669;
}

.category-food {
    background: rgba(254, 215, 170, 0.25);
    color: #EA580C;
}

.category-development {
    background: rgba(221, 214, 254, 0.25);
    color: #7C3AED;
}

.category-health {
    background: rgba(254, 202, 202, 0.25);
    color: #DC2626;
}

.category-education {
    background: rgba(252, 231, 121, 0.25);
    color: #CA8A04;
}

/* Добавляем точку важности */
.goal-item::before {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0.65;
}

.goal-item.priority-high::before {
    background: #EF4444;
}

.goal-item.priority-medium::before {
    background: #fbb73c;
}

/* Для low priority точка не показывается */
.goal-item.priority-low::before {
    opacity: 0;
}

/* Счетчик повторений */
.goal-counter {
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent-brown);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-brown);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}

.goal-counter:active {
    transform: scale(0.95);
}

/* Анимация добавления */
@keyframes counterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 15px rgba(139, 115, 85, 0.3); }
    100% { transform: scale(1); }
}

.goal-counter.pulse {
    animation: counterPulse 0.3s ease;
}

/* Индикатор удержания - прогресс-бар */
.goal-counter::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--accent-brown);
    opacity: 0;
    transition: opacity 0.2s;
    animation: counterRotate 1.5s linear infinite;
}

.goal-counter.holding::before {
    opacity: 1;
}

/* Анимация +1 */
.increment-animation {
    position: absolute;
    bottom: 8px;
    right: 16px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-brown);
    pointer-events: none;
    z-index: 100;
    /* 1 секунда, и сохраняем финальное состояние в анимации */
    animation: flyUp 1s ease-out both;
    will-change: transform, opacity;
}

@keyframes flyUp {
    0%   { opacity: 0; transform: translateY(10px) scale(0.5); }
    5%   { opacity: 1; transform: translateY(0)     scale(1.2); }  /* быстро появилось */
    95%  { opacity: 1; transform: translateY(-32px) scale(1.0); }  /* почти всю секунду видно */
    100% { opacity: 0; transform: translateY(-40px) scale(0.9); }  /* мягко погасло */
}

@keyframes counterRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Поле ввода счетчика в форме */
.counter-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.counter-input {
    width: 60px;
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

/* Drag and Drop для целей */
.goal-item {
    touch-action: none;
    user-select: none;
    transition: all 0.2s ease;
}

.goal-item.dragging {
    opacity: 0.3;
    transform: scale(0.95);
}

.goal-item.drag-active {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(139, 115, 85, 0.3);
    z-index: 100;
    position: relative;
}

.goal-item.drag-over {
    transform: translateY(5px);
}

/* Сортировка целей */
.sort-button {
    position: absolute;
    right: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.sort-button:active {
    background: var(--accent-lighter);
}

.sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: -10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 8px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 180px;
    display: none;
}

.sort-menu.active {
    display: block;
}

.sort-option {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.sort-option:active {
    background: var(--accent-lighter);
}

.sort-option.active {
    color: var(--accent-brown);
    font-weight: 500;
}

/* Группировка по категориям */
.category-group {
    margin-bottom: 24px;
}

.category-group-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 4px;
}

/* Карточка избранного слова */
.favorite-word-card {
    position: relative;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border-radius: 20px;
    overflow: hidden;
    height: 140px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.favorite-word-card:active {
    transform: scale(0.98);
}

.favorite-word-card .flip-card {
    width: 100%;
    height: 100%;
}

.favorite-word-card .flip-card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.favorite-word-card .flip-card-inner.flipped {
    transform: rotateY(180deg);
}

.favorite-word-card .flip-card-front,
.favorite-word-card .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.favorite-word-card .flip-card-back {
    transform: rotateY(180deg);
}

.favorite-word-card .chinese-character {
    font-size: 36px;
    color: var(--accent-brown);
    font-weight: 500;
}

.favorite-word-card .pinyin {
    font-size: 18px;
    color: var(--accent-brown);
    margin-bottom: 4px;
}

.favorite-word-card .translation {
    font-size: 16px;
    color: var(--text-primary);
    text-align: center;
}

.favorite-word-card .favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    z-index: 10;
}

.favorite-word-card .favorite-icon {
    width: 18px;
    height: 18px;
}

/* Пустое состояние */
.empty-favorites {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

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

.empty-favorites-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-favorites-hint {
    font-size: 13px;
    opacity: 0.8;
}

/* ИСПРАВЛЕНА ЗАГЛУШКА - рамка + кружок */
.moment-image-placeholder::before {
    content: '';
    position: absolute;
    width: 48px;
    height: 48px;
    border: 2px solid var(--accent-brown);
    border-radius: 12px;
    opacity: 0.4;
}

.moment-image-placeholder::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--accent-brown);
    border-radius: 50%;
    opacity: 0.35;
}

/* Список достижений и целей */
.list-container, .moments-container {
    padding: 20px;
    padding-top: 20px !important; /* Гарантируем отступ сверху */
    min-height: calc(100vh - 140px); /* Высота экрана минус хедер и навигация */
}

/* Предотвращение прыжков при загрузке контента */
#achievementsList,
#goalsList,
#momentsList,
#disappointmentsList {
    min-height: 100px; /* Минимальная высота для предотвращения коллапса */
}

.list-item {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.list-item:active {
    transform: scale(0.98);
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.achievement-photo {
    width: 48px;
    height: 48px;
    background: var(--accent-lighter);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.achievement-info {
    flex: 1;
}

.achievement-title {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.achievement-date {
    color: var(--text-light);
    font-size: 11px;
}

/* Цели */
.goal-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative; /* Для позиционирования точки */
}

.goal-checkbox {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--accent-brown);
    border-radius: 6px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.goal-item.completed .goal-checkbox {
    background: var(--accent-brown);
}

.goal-item.completed .goal-checkbox::after {
    content: '✓';
    color: var(--bg-primary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

.goal-content {
    flex: 1;
}

.goal-text {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.goal-item.completed .goal-text {
    text-decoration: line-through;
    opacity: 0.5;
}

.goal-priority {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 8px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(58, 54, 50, 0.5);
    z-index: 2000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    margin: 20px;
    max-width: 400px;
    width: 100%;
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

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

/* Детальный просмотр с фото */
.detail-photo {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, var(--accent-lighter) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    position: relative;
}

.detail-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(to top, var(--bg-primary), transparent);
}

.detail-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.detail-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.detail-description {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.detail-content-no-photo {
    padding: 24px;
}

/* Форма */
.form-content {
    padding: 24px;
}

.form-header {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-brown);
    background: var(--bg-primary);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

.photo-upload {
    width: 100%;
    height: 160px;
    border: 2px dashed var(--border-light);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.photo-upload:hover {
    border-color: var(--accent-brown);
    background: var(--accent-lighter);
}

.photo-upload-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.photo-upload-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Кнопки */
.btn {
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

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

.btn-primary:active {
    background: var(--accent-brown);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:active {
    background: var(--accent-lighter);
}

.modal-actions {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Кнопка добавления */
.fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-primary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 999;
}

.fab:active {
    transform: scale(0.9);
    background: var(--accent-brown);
}

.fab.hidden {
    display: none;
}

/* Письмо */
.letter-container {
    padding: 24px;
}

.letter-card {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 24px;
}

.letter-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.letter-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 400;
}

.letter-date {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.letter-body {
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 14px;
}

.letter-body p {
    margin-bottom: 16px;
}

.letter-signature {
    text-align: right;
    margin-top: 24px;
    font-style: italic;
    color: var(--accent-brown);
    font-size: 14px;
}

/* Настройки */
.settings-list {
    padding: 20px;
}

.settings-item {
    background: var(--bg-secondary);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-item:active {
    transform: scale(0.98);
}

.settings-label {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.settings-value {
    color: var(--text-light);
    font-size: 12px;
}

/* Всплывающие сообщения */
.floating-message {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    display: none;
    align-items: center;
    gap: 12px;
    max-width: 280px;
    cursor: pointer;
    animation: floatIn 0.5s ease;
    z-index: 1500;
}

.floating-message.active {
    display: flex;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--accent-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 13px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Полноэкранное фото - ОБНОВЛЕННАЯ ВЕРСИЯ */
.fullscreen-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: none;
    z-index: 3000;
}

.fullscreen-view.active {
    display: block;
}

/* Упрощенный хедер только с кнопкой закрыть */
.fullscreen-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    padding-top: calc(20px + var(--safe-area-inset-top));
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

.fullscreen-close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border: none;
}

.fullscreen-close-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 1);
}

.fullscreen-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Контейнер изображения на весь экран */
.fullscreen-image-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
}

/* Режим 1: Полное заполнение (cover) - по умолчанию */
.fullscreen-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Режим 2: По ширине экрана (fit-width) */
.fullscreen-image-container.contain-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.fullscreen-image-container.fit-width img {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 100%;
}

/* Заглушка в полноэкранном режиме */
.fullscreen-placeholder {
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.fullscreen-placeholder-icon {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-placeholder-icon::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid var(--accent-brown);
    border-radius: 20px;
    opacity: 0.35;
}

.fullscreen-placeholder-icon::after {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    background: var(--accent-brown);
    border-radius: 50%;
    opacity: 0.3;
}


/* Для темных изображений в fit-width режиме */
.fullscreen-view.dark-image .fullscreen-image-container.contain-mode {
    background: #000;
}

/* Нижняя панель с контентом и кнопками */
.fullscreen-bottom-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(254, 253, 251, 0.98) 0%, rgba(254, 253, 251, 0.95) 70%, transparent 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-area-inset-bottom));
}

/* Контент в нижней панели */
.fullscreen-content-info {
    margin-bottom: 20px;
}

.fullscreen-content-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.fullscreen-content-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    opacity: 0.8;
}

.fullscreen-content-description {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    opacity: 0.9;
}

/* Кнопки действий */
.fullscreen-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.fullscreen-btn {
    flex: 1;
    max-width: 140px;
    padding: 12px 20px;
    border-radius: 14px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fullscreen-btn-edit {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.fullscreen-btn-edit:active {
    background: var(--accent-lighter);
    transform: scale(0.98);
}

.fullscreen-btn-delete {
    background: rgba(232, 90, 79, 0.1);
    color: #E85A4F;
    border: 1px solid rgba(232, 90, 79, 0.2);
}

.fullscreen-btn-delete:active {
    background: rgba(232, 90, 79, 0.2);
    transform: scale(0.98);
}

.fullscreen-btn svg {
    width: 16px;
    height: 16px;
}

/* Кнопка переключения режима просмотра */
.fullscreen-toggle-btn {
    position: absolute;
    top: calc(20px + var(--safe-area-inset-top));
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    border: none;
    z-index: 10;
}

.fullscreen-toggle-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 1);
}

.fullscreen-toggle-btn svg {
    width: 20px;
    height: 20px;
}

/* Режим contain для изображения */
.fullscreen-image-container.contain-mode img {
    object-fit: contain !important;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.fullscreen-image-container.contain-mode {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Адаптация кнопки для темного режима */
.fullscreen-view.dark-image .fullscreen-toggle-btn {
    background: rgba(58, 54, 50, 0.9);
    color: var(--bg-primary);
}

.fullscreen-view.dark-image .fullscreen-toggle-btn:active {
    background: rgba(58, 54, 50, 1);
}

/* Адаптация под темную тему если фото темное */
.fullscreen-view.dark-image .fullscreen-bottom-panel {
    background: linear-gradient(to top, rgba(58, 54, 50, 0.98) 0%, rgba(58, 54, 50, 0.95) 70%, transparent 100%);
}

.fullscreen-view.dark-image .fullscreen-content-title {
    color: var(--bg-primary);
}

.fullscreen-view.dark-image .fullscreen-content-meta {
    color: rgba(254, 253, 251, 0.8);
}

.fullscreen-view.dark-image .fullscreen-content-description {
    color: rgba(254, 253, 251, 0.9);
}

.fullscreen-view.dark-image .fullscreen-btn-edit {
    background: rgba(254, 253, 251, 0.2);
    color: var(--bg-primary);
    border-color: rgba(254, 253, 251, 0.3);
}

.fullscreen-view.dark-image .fullscreen-btn-edit:active {
    background: rgba(254, 253, 251, 0.3);
}

/* Добавьте эти стили для заглушки фото */
.photo-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-lighter) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.photo-placeholder::before {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    border: 2px solid var(--border-light);
    border-radius: 16px;
    opacity: 0.3;
}

.photo-placeholder::after {
    content: '';
    position: absolute;
    width: 40%;
    height: 40%;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    transform: rotate(45deg);
    opacity: 0.2;
}

/* Layout переключатель */
.layout-toggle {
    position: absolute;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.layout-option {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.layout-option.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.moments-container.single-column {
    column-count: 1;
}

/* Система заглушек */
.app-blocker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
    text-align: center;
}

.blocker-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.blocker-title {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.blocker-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 320px;
}

.blocker-timer {
    font-size: 32px;
    color: var(--accent-brown);
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 20px;
}

.password-input {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    letter-spacing: 4px;
    margin-bottom: 20px;
}

.password-input:focus {
    outline: none;
    border-color: var(--accent-brown);
    background: var(--bg-primary);
}

.blocker-button {
    padding: 14px 32px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.blocker-button:active {
    background: var(--accent-brown);
    transform: scale(0.98);
}

/* Разочарования */
.disappointment-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

disappointment-card:active {
    transform: scale(0.98);
}

.disappointment-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    position: relative;
}

.disappointment-thumb {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--accent-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.disappointment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.disappointment-info {
    flex: 1;
}

.disappointment-title {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 2px;
}

.disappointment-date {
    color: var(--text-light);
    font-size: 11px;
}

/* Swipe индикатор */
.swipe-indicator {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to left, rgba(232, 90, 79, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 16px;
    color: #E85A4F;
    font-size: 12px;
}

.list-item.swiping .swipe-indicator {
    opacity: 1;
}
