/* ==========================================================================
   DREAMBOARD - DESIGN SYSTEM & PREMIUM STYLESHEET
   ========================================================================== */

/* 1. ПЕРЕМЕННЫЕ И ДИЗАЙН-ТОКЕНЫ */
:root {
    /* Цветовая палитра темы */
    --bg-dark: #07050f;
    --bg-space: radial-gradient(circle at 50% 50%, #150f35 0%, #06040a 100%);
    --panel-glass: rgba(13, 10, 26, 0.45);
    --panel-glass-border: rgba(255, 255, 255, 0.08);
    --panel-glass-hover: rgba(255, 255, 255, 0.05);
    --text-primary: #f3f1f8;
    --text-secondary: #9ea0b6;
    --text-muted: #64667d;
    --shadow-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Цвета категорий */
    --career-color: #00f2fe;
    --career-grad: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --career-glow: rgba(0, 242, 254, 0.15);
    
    --wealth-color: #00e676;
    --wealth-grad: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
    --wealth-glow: rgba(0, 230, 118, 0.15);
    
    --health-color: #ff2d55;
    --health-grad: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    --health-glow: rgba(255, 45, 85, 0.15);
    
    --travel-color: #ff9100;
    --travel-grad: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --travel-glow: rgba(255, 145, 0, 0.15);
    
    --relationships-color: #f50057;
    --relationships-grad: linear-gradient(135deg, #ee9ca7 0%, #ffdde1 100%);
    --relationships-glow: rgba(245, 0, 87, 0.15);
    
    --growth-color: #b388ff;
    --growth-grad: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    --growth-glow: rgba(179, 136, 255, 0.15);

    --manifested-color: #ffd700;
    --manifested-grad: linear-gradient(135deg, #ffe259 0%, #ffa751 100%);
    --manifested-glow: rgba(255, 215, 0, 0.3);
}

/* 2. СБРОС И БАЗОВЫЕ СТИЛИ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-dark);
    background-image: var(--bg-space);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Задний фон с частицами */
.ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* 3. КЛАССЫ ЭФФЕКТОВ GLASSMORPHISM */
.glass-card {
    background: var(--panel-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--panel-glass-border);
    box-shadow: var(--shadow-glow);
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* 4. ОСНОВНАЯ РАЗМЕТКА И КОНТЕЙНЕРЫ */
.app-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ШАПКА / ПАНЕЛЬ УПРАВЛЕНИЯ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: rgba(13, 10, 26, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid var(--panel-glass-border);
    height: 76px;
    flex-shrink: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, #a18cd1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ФИЛЬТРЫ КАТЕГОРИЙ */
.category-filters {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}

.filter-btn .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Цвета точек категорий */
.filter-btn[data-color="career"] .dot { background: var(--career-color); box-shadow: 0 0 8px var(--career-color); }
.filter-btn[data-color="wealth"] .dot { background: var(--wealth-color); box-shadow: 0 0 8px var(--wealth-color); }
.filter-btn[data-color="health"] .dot { background: var(--health-color); box-shadow: 0 0 8px var(--health-color); }
.filter-btn[data-color="travel"] .dot { background: var(--travel-color); box-shadow: 0 0 8px var(--travel-color); }
.filter-btn[data-color="relationships"] .dot { background: var(--relationships-color); box-shadow: 0 0 8px var(--relationships-color); }
.filter-btn[data-color="growth"] .dot { background: var(--growth-color); box-shadow: 0 0 8px var(--growth-color); }

.filter-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.filter-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.filter-btn[data-category="career"].active { background: var(--career-grad); }
.filter-btn[data-category="wealth"].active { background: var(--wealth-grad); }
.filter-btn[data-category="health"].active { background: var(--health-grad); }
.filter-btn[data-category="travel"].active { background: var(--travel-grad); }
.filter-btn[data-category="relationships"].active { background: var(--relationships-grad); }
.filter-btn[data-category="growth"].active { background: var(--growth-grad); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ПЕРЕКЛЮЧАТЕЛЬ ВИДОВ */
.view-toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 3px;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.toggle-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ИКОНОЧНЫЕ КНОПКИ */
.icon-btn {
    background: var(--panel-glass);
    border: 1px solid var(--panel-glass-border);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--panel-glass-hover);
    transform: translateY(-2px);
}

.icon-btn.muted .audio-on-icon { display: none; }
.icon-btn:not(.muted) .audio-off-icon { display: none; }

/* КНОПКИ С ГОРЯЩИМИ ЭФФЕКТАМИ */
.glow-btn {
    background: linear-gradient(135deg, #7f00ff 0%, #ff007f 100%);
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 30px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(255, 0, 127, 0.3);
    transition: var(--transition-bounce);
}

.glow-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    transform: scale(0);
    transition: transform 0.6s ease-out;
}

.glow-btn:hover {
    transform: scale(1.03) translateY(-1px);
    box-shadow: 0 6px 24px rgba(255, 0, 127, 0.5), 0 0 15px rgba(127, 0, 255, 0.4);
}

.glow-btn:hover::before {
    transform: scale(1);
}

.glow-btn active {
    transform: scale(0.97);
}

/* v14-ux: мобильное меню — desktop (base) состояние.
   .header-top-row и #mobile-menu-panel на desktop «растворяются»
   (display: contents), сохраняя прежний flex-layout шапки 1-в-1;
   мобильные кнопки скрыты. */
.header-top-row {
    display: contents;
}

#mobile-menu-panel {
    display: contents;
}

.mobile-menu-toggle,
.mobile-manifest-btn {
    display: none;
}

/* РАБОЧАЯ ОБЛАСТЬ */
.storage-help {
    flex: 0 0 auto;
    padding: 0 24px;
    background: #151020;
    color: #d9d2e8;
    border-bottom: 1px solid var(--panel-glass-border);
    max-height: min(48dvh, 360px);
    overflow-y: auto;
}
.storage-help summary {
    padding: 12px 0;
    min-height: 44px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}
.storage-help summary:focus-visible {
    outline: 2px solid #b4f5ee;
    outline-offset: -2px;
}
.storage-help-content { padding: 0 0 16px; max-width: 820px; }
.storage-help-content p { font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.storage-help-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.storage-help-actions .btn { min-height: 44px; white-space: normal; }
@media (max-width: 620px) {
    .storage-help { padding: 0 12px; }
    .storage-help-actions .btn { width: 100%; }
}

.app-workspace {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

.workspace-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.workspace-section.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

/* ==========================================================================
   5. МАКЕТ 1: MASONRY GRID (СЕТКА)
   ========================================================================== */
#grid-view-section {
    padding: 32px;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.section-header h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.5px;
}

.neon-btn {
    background: var(--panel-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-bounce);
}

.neon-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
    transform: translateY(-2px);
}

.dreams-masonry-grid {
    column-count: 3;
    column-gap: 24px;
    width: 100%;
}

@media (max-width: 1200px) {
    .dreams-masonry-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .dreams-masonry-grid {
        column-count: 1;
    }
    .app-header {
        flex-direction: column;
        height: auto;
        gap: 16px;
        padding: 16px;
    }
    .category-filters {
        overflow-x: auto;
        max-width: 100%;
        white-space: nowrap;
    }
}

/* ==========================================================================
   6. КАРТОЧКА МЕЧТЫ (DREAM CARD)
   ========================================================================== */
.dream-card {
    break-inside: avoid;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* В режиме Canvas позиционирование абсолютное */
.spatial-canvas .dream-card {
    position: absolute;
    margin-bottom: 0;
    cursor: grab;
    z-index: 10;
}

.spatial-canvas .dream-card:active {
    cursor: grabbing;
}

.spatial-canvas .dream-card.dragging {
    z-index: 999 !important;
    opacity: 0.9;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* Обложка карточки */
.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background-color: rgba(0,0,0,0.2);
}

.spatial-canvas .dream-card .card-image-wrapper {
    height: calc(100% - 150px); /* Адаптируем под высоту на Canvas */
    min-height: 120px;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dream-card:hover .card-image {
    transform: scale(1.08);
}

/* Градиентный оверлей на картинке */
.card-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 40%, rgba(7, 5, 15, 0.8) 100%);
    pointer-events: none;
}

/* Ярлык категории */
.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.category-career .card-badge { background: var(--career-grad); }
.category-wealth .card-badge { background: var(--wealth-grad); }
.category-health .card-badge { background: var(--health-grad); }
.category-travel .card-badge { background: var(--travel-grad); }
.category-relationships .card-badge { background: var(--relationships-grad); }
.category-growth .card-badge { background: var(--growth-grad); }
.category-manifested .card-badge { background: var(--manifested-grad); color: #000; }

/* Целевой Год */
.card-year {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

/* Действия на карточке при ховере */
.card-quick-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    display: flex;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-bounce);
    z-index: 5;
}

.dream-card:hover .card-quick-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.action-round-btn {
    background: rgba(13, 10, 26, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.action-round-btn:hover {
    transform: scale(1.15);
    background: #ffffff;
    color: #07050f;
    border-color: #ffffff;
}

.action-round-btn.manifest-btn:hover {
    background: var(--manifested-color);
    color: #000;
    box-shadow: 0 0 15px var(--manifested-color);
}

.action-round-btn.delete-btn {
    /* Нейтральное состояние — как остальные quick actions (danger только на hover/focus-visible/active) */
}

.action-round-btn.delete-btn:hover,
.action-round-btn.delete-btn:focus-visible,
.action-round-btn.delete-btn:active {
    background: #ff2d55;
    color: #ffffff;
    box-shadow: 0 0 15px #ff2d55;
    border-color: #ff2d55;
}

/* На touch-устройствах без взаимодействия красного акцента быть не должно:
   убираем постоянный danger-стиль; активная (нажатая) кнопка сохраняет индикацию */
@media (hover: none), (pointer: coarse) {
    .action-round-btn.delete-btn {
        color: #ffffff;
        border-color: rgba(255,255,255,0.15);
        background: rgba(13, 10, 26, 0.85);
    }
    .action-round-btn.delete-btn:active {
        background: #ff2d55;
        color: #ffffff;
        box-shadow: 0 0 15px #ff2d55;
        border-color: #ff2d55;
    }
}

/* Тело карточки */
.card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
    flex-grow: 1;
}

/* Вехи / Микро-прогресс */
.card-milestones {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 14px;
    margin-top: auto;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    cursor: pointer;
}

.milestone-item:last-child {
    margin-bottom: 0;
}

.milestone-checkbox {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1.5px solid var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.milestone-item.checked .milestone-checkbox {
    border-color: transparent;
    background: var(--text-primary);
}

.category-career .milestone-item.checked .milestone-checkbox { background: var(--career-color); }
.category-wealth .milestone-item.checked .milestone-checkbox { background: var(--wealth-color); }
.category-health .milestone-item.checked .milestone-checkbox { background: var(--health-color); }
.category-travel .milestone-item.checked .milestone-checkbox { background: var(--travel-color); }
.category-relationships .milestone-item.checked .milestone-checkbox { background: var(--relationships-color); }
.category-growth .milestone-item.checked .milestone-checkbox { background: var(--growth-color); }

.milestone-checkbox svg {
    opacity: 0;
    transform: scale(0.5);
    transition: var(--transition-bounce);
}

.milestone-item.checked .milestone-checkbox svg {
    opacity: 1;
    transform: scale(1);
    stroke: #07050f;
}

.milestone-item.checked span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Цветные тени и границы в зависимости от категорий */
.category-career { border-top: 3px solid var(--career-color); }
.category-career:hover { box-shadow: 0 10px 30px var(--career-glow); border-color: var(--career-color); }

.category-wealth { border-top: 3px solid var(--wealth-color); }
.category-wealth:hover { box-shadow: 0 10px 30px var(--wealth-glow); border-color: var(--wealth-color); }

.category-health { border-top: 3px solid var(--health-color); }
.category-health:hover { box-shadow: 0 10px 30px var(--health-glow); border-color: var(--health-color); }

.category-travel { border-top: 3px solid var(--travel-color); }
.category-travel:hover { box-shadow: 0 10px 30px var(--travel-glow); border-color: var(--travel-color); }

.category-relationships { border-top: 3px solid var(--relationships-color); }
.category-relationships:hover { box-shadow: 0 10px 30px var(--relationships-glow); border-color: var(--relationships-color); }

.category-growth { border-top: 3px solid var(--growth-color); }
.category-growth:hover { box-shadow: 0 10px 30px var(--growth-glow); border-color: var(--growth-color); }

/* ЗОЛОТАЯ КАРТОЧКА: МАНИФЕСТИРОВАНО */
.category-manifested {
    border-top: 3px solid var(--manifested-color);
    box-shadow: 0 8px 32px var(--manifested-glow);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(13, 10, 26, 0.5) 100%);
}

.category-manifested:hover {
    box-shadow: 0 15px 40px var(--manifested-glow);
    border-color: var(--manifested-color);
}

.category-manifested .card-title {
    color: var(--manifested-color);
}

.category-manifested::after {
    content: '★ Воплощено';
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--manifested-color);
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* Ресайзер для холста */
.card-resizer {
    position: absolute;
    width: 14px;
    height: 14px;
    right: 3px;
    bottom: 3px;
    cursor: se-resize;
    z-index: 100;
}

.card-resizer::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
}

.dream-card:hover .card-resizer::after {
    border-color: var(--text-secondary);
}

/* ==========================================================================
   7. МАКЕТ 2: SPATIAL CANVAS (СВОБОДНЫЙ ХОЛСТ)
   ========================================================================== */
#canvas-view-section {
    background-color: #04020a;
}

.canvas-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.canvas-viewport:active {
    cursor: grabbing;
}

.canvas-viewport.space-held {
    cursor: grab !important;
}

.spatial-canvas {
    position: absolute;
    width: 5000px;
    height: 5000px;
    transform-origin: 0 0;
    left: 0;
    top: 0;
    will-change: transform;
}

/* Клетчатый чертежный фон */
.canvas-grid-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.007) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.007) 1px, transparent 1px);
    background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position: -1px -1px;
    pointer-events: none;
}

/* Всплывающая подсказка */
.canvas-tip {
    position: absolute;
    bottom: 24px;
    left: 24px;
    background: rgba(13, 10, 26, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-glass-border);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.canvas-tip strong {
    color: var(--text-primary);
}

/* Плавающие элементы управления холстом */
.canvas-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(13, 10, 26, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-glass-border);
    padding: 6px;
    border-radius: 12px;
    z-index: 50;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.canvas-control-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.canvas-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.canvas-control-btn.primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #000;
}

.canvas-control-btn.primary:hover {
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
    transform: scale(1.05);
}

#canvas-zoom-indicator {
    font-size: 12px;
    font-weight: 600;
    padding: 0 6px;
    min-width: 48px;
    text-align: center;
    user-select: none;
}

.canvas-controls .divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

/* ==========================================================================
   8. МОДАЛЬНЫЕ ОКНА (MODALS)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 2, 10, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-content.wide {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

/* Формы */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    width: 50%;
}

label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="url"],
select,
textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 14px;
    transition: var(--transition-smooth);
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #00f2fe;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

/* Вкладки для добавления картинок */
.image-source-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #00f2fe;
}

.tab-content.hidden {
    display: none;
}

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 118px;
    gap: 8px;
    padding: 18px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.upload-dropzone:hover {
    border-color: #00f2fe;
    background: rgba(0, 242, 254, 0.06);
    color: var(--text-primary);
}

.upload-dropzone input {
    display: none;
}

.upload-dropzone-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 14px;
}

.upload-dropzone-hint {
    max-width: 360px;
    font-size: 12px;
    line-height: 1.45;
}

.local-image-preview {
    margin-top: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.18);
}

.local-image-preview.hidden {
    display: none;
}

.local-image-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.local-image-preview-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Поиск Unsplash */
.unsplash-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.simple-btn {
    background: var(--panel-glass-border);
    border: 1px solid var(--panel-glass-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.simple-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.unsplash-results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
    padding-right: 4px;
}

.unsplash-img-item {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-smooth);
}

.unsplash-img-item:hover {
    transform: scale(1.05);
}

.unsplash-img-item.selected {
    border-color: #00f2fe;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}

/* Вехи в модалке */
.modal-milestones-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.modal-milestone-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-glass-border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.delete-milestone-btn {
    background: transparent;
    border: none;
    color: #ff2d55;
    cursor: pointer;
    font-size: 16px;
}

.add-milestone-row {
    display: flex;
    gap: 8px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.btn.primary {
    background: linear-gradient(135deg, #00f2fe 0%, #a18cd1 100%);
    border: none;
    color: #000;
}

.btn.primary:hover {
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
    transform: translateY(-2px);
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--panel-glass-border);
    color: var(--text-primary);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   9. ПОЛНОЭКРАННЫЙ «РЕЖИМ МАНИФЕСТАЦИИ»
   ========================================================================== */
.manifest-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* динамическая высота вьюпорта (мобильные) с fallback */
    background: #020106;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s cubic-bezier(0.25, 1, 0.5, 1);
    /* Безопасные зоны (вырезы/жесты): контент не уходит под них */
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    box-sizing: border-box;
}

.manifest-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.manifest-starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Кнопка выхода */
.exit-manifest-btn {
    position: absolute;
    top: 32px;
    right: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 50;
}

.exit-manifest-btn:hover {
    background: #ffffff;
    color: #000000;
    transform: rotate(90deg);
}

/* Главный контент по центру */
.manifest-content {
    position: relative;
    width: 85%;
    max-width: 1100px;
    height: 60vh;
    height: 60dvh;
    min-height: 0;
    display: flex;
    align-items: center;
    z-index: 5;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 30px 100px rgba(0,0,0,0.8);
}

/* Слайдер с эффектом Ken Burns */
.manifest-slider-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.manifest-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.manifest-slide.active {
    opacity: 1;
}

.manifest-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Анимация Ken Burns */
.manifest-slide.active .manifest-slide-img {
    animation: kenburns 15s ease-out forwards;
}

@keyframes kenburns {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.08) translate(10px, -5px);
    }
}

.manifest-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
}

/* Текст мечты на переднем плане */
.manifest-card-info {
    position: relative;
    z-index: 10;
    width: 45%;
    margin-left: 64px;
    padding: 40px;
    border-radius: var(--radius-md);
    background: rgba(2, 1, 6, 0.6) !important;
    border-color: rgba(255, 255, 255, 0.05);
    /* Страховка при малой высоте: внутренняя прокрутка вместо обрезки */
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.manifest-card-info h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    margin-top: 16px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.manifest-card-info p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.manifest-milestones-progress {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ГИД ПО ДЫХАНИЮ (ПЛАВАЮЩИЙ) */
.breath-guide-container {
    position: absolute;
    top: 32px;
    left: 32px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10;
    background: rgba(0,0,0,0.3);
    padding: 12px 24px;
    border-radius: 40px;
    border: 1px solid rgba(255,255,255,0.05);
}

.breath-circle-outer {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.breath-circle-inner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, #00f2fe 0%, #a18cd1 100%);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.6);
    will-change: transform;
}

#breath-text {
    position: absolute;
    left: 55px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.breath-subtext {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Состояния дыхательного круга */
.breath-circle-inner.inhale {
    animation: inhale-anim 4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.breath-circle-inner.hold {
    transform: scale(2.2);
    box-shadow: 0 0 25px rgba(161, 140, 209, 0.8);
}

.breath-circle-inner.exhale {
    animation: exhale-anim 4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes inhale-anim {
    0% { transform: scale(1); box-shadow: 0 0 10px rgba(0, 242, 254, 0.5); }
    100% { transform: scale(2.2); box-shadow: 0 0 25px rgba(0, 242, 254, 0.8); }
}

@keyframes exhale-anim {
    0% { transform: scale(2.2); box-shadow: 0 0 25px rgba(0, 242, 254, 0.8); }
    100% { transform: scale(1); box-shadow: 0 0 10px rgba(0, 242, 254, 0.5); }
}

/* Нижняя панель аффирмаций */
.manifest-affirmation-slider {
    position: absolute;
    bottom: 120px;
    width: 60%;
    text-align: center;
    z-index: 5;
}

#manifest-affirmation-text {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    opacity: 0.9;
    letter-spacing: 0.5px;
    transition: opacity 0.8s ease;
}

/* Нижнее управление плеером */
.manifest-controls {
    position: absolute;
    bottom: 40px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 5;
    background: rgba(13, 10, 26, 0.7);
    border: 1px solid var(--panel-glass-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px;
    border-radius: 40px;
}

.manifest-rotate-prompt {
    display: none;
}

.rotate-phone-icon {
    display: flex;
    justify-content: center;
    color: #00f2fe;
    margin-bottom: 14px;
}

.manifest-control-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-bounce);
}

.manifest-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: scale(1.05);
}

.manifest-control-btn#manifest-play-btn {
    background: #ffffff;
    color: #07050f;
}

.manifest-control-btn#manifest-play-btn:hover {
    box-shadow: 0 0 15px rgba(255,255,255,0.4);
}

.manifest-control-btn#manifest-play-btn.active .pause-icon { display: block; }
.manifest-control-btn#manifest-play-btn.active .play-icon { display: none; }
.manifest-control-btn#manifest-play-btn:not(.active) .pause-icon { display: none; }
.manifest-control-btn#manifest-play-btn:not(.active) .play-icon { display: block; }

/* ==========================================================================
   10. АРХИВ БЛАГОДАРНОСТИ (ГРАТИК)
   ========================================================================== */
.archive-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.archive-intro {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.archived-dreams-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 8px;
}

@media (max-width: 768px) {
    .archived-dreams-grid {
        grid-template-columns: 1fr;
    }
}

.empty-archive-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text-muted);
    gap: 16px;
}

/* ==========================================================================
   11. УВЕДОМЛЕНИЯ (TOASTS)
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.toast {
    background: rgba(13, 10, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.25) forwards;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(92vw, 620px);
}

.toast-message { min-width: 0; }

.toast-action {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 22px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* ==========================================================================
   ПОЛНОЭКРАННЫЙ ПРОСМОТР ЦЕЛИ (READ-ONLY)
   ========================================================================== */
/* Нативный <dialog> — browser top layer: выше header и всех stacking contexts.
   Полноэкранный viewer: fixed, inset 0, 100vw x 100dvh, без рамок/отступов. */
#dream-view-modal.dream-view-dialog {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    padding: 0;
    background: rgba(7, 5, 15, 0.96);
    color: var(--text-primary);
    overflow: hidden;
}

#dream-view-modal.dream-view-dialog::backdrop {
    background: rgba(2, 1, 6, 0.88);
}

.dream-view-content {
    max-width: 720px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    margin: 0 auto;
}

.dream-view-content .modal-header {
    flex: 0 0 auto;
}

.dream-view-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 20px 28px 28px;
    overflow-y: auto;
    min-height: 0;
    flex: 1 1 auto;
}

.dream-view-image-wrap {
    border-radius: var(--radius-lg);
    overflow: hidden;
    flex: 0 0 auto;
    background: rgba(255,255,255,0.04);
}

.dream-view-image {
    display: block;
    width: 100%;
    max-height: 46vh;
    max-height: 46dvh;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
}

.dream-view-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.dream-view-info .card-badge {
    align-self: flex-start;
}

#dream-view-dream-title {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.dream-view-year {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

.dream-view-desc {
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
    white-space: pre-wrap;
}

.dream-view-milestones {
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dream-view-milestone {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.dream-view-milestone.checked {
    color: var(--text-primary);
}

.dream-view-check {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    margin-top: 1px;
}

.dream-view-milestone.checked .dream-view-check {
    background: var(--wealth-color, #00b09b);
    border-color: var(--wealth-color, #00b09b);
    color: #fff;
}

/* Expand-кнопка: как остальные quick actions; на телефоне touch target >= 44x44 */
.action-round-btn.expand-btn:hover {
    background: #ffffff;
    color: #07050f;
    border-color: #ffffff;
}

@media (hover: none), (pointer: coarse) {
    .action-round-btn.expand-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 620px) {
    .dream-view-body {
        padding: 14px 16px 20px;
        gap: 14px;
    }
    .dream-view-image {
        max-height: 38vh;
        max-height: 38dvh;
    }
    #dream-view-dream-title {
        font-size: 19px;
    }
}

.toast-action:focus-visible,
.trash-restore-btn:focus-visible,
.trash-delete-btn:focus-visible,
#trash-toggle-btn:focus-visible {
    outline: 3px solid var(--career-color);
    outline-offset: 2px;
}

@keyframes toast-in {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.toast.success { border-color: var(--wealth-color); }
.toast.info { border-color: var(--career-color); }

/* Недавно удалённые */
#trash-toggle-btn { position: relative; }

.trash-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ff2d55;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
}

.trash-items-list {
    display: grid;
    gap: 12px;
}

.trash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    background: rgba(0,0,0,0.2);
}

.trash-item-content { min-width: 0; }
.trash-item-content h4 { margin: 0 0 4px; overflow-wrap: anywhere; }
.trash-item-content p,
.empty-trash-state { margin: 0; color: var(--text-secondary); font-size: 12px; }
.empty-trash-state { padding: 32px 12px; text-align: center; }
.trash-item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.trash-item-actions .btn { min-height: 44px; }
.trash-delete-btn {
    color: #fff;
    border-color: rgba(255,45,85,0.65);
    background: rgba(125,15,43,0.7);
}

@media (max-width: 620px) {
    .trash-item { align-items: stretch; flex-direction: column; }
    .trash-item-actions { display: grid; grid-template-columns: 1fr; }
    .toast { padding: 8px 10px 8px 16px; }
}

/* ==========================================================================
   12. СТИЛИЗАЦИЯ СКРОЛЛБАРОВ
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   13. MOBILE OPTIMIZATIONS (TOUCH & RESPONSIVE)
   ========================================================================== */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        height: auto;
        align-items: stretch;
        padding: 10px 12px;
        gap: 10px;
    }

    .header-logo {
        justify-content: center;
    }

    .header-logo h1 {
        font-size: 20px;
    }

    .board-selector-group {
        display: none;
        align-items: center;
        width: 100%;
        justify-content: center;
        gap: 8px;
        margin-bottom: 0;
    }

    .board-selector {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        max-width: 240px;
        height: 40px;
    }

    .board-selector-group .icon-btn.small {
        display: none;
    }

    .category-filters {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-filters::-webkit-scrollbar {
        display: none;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        max-width: 100%;
        gap: 8px;
        overflow: visible;
    }

    #start-manifest-btn {
        flex: 1 0 100%;
        justify-content: center;
        min-height: 46px;
        max-width: 100%;
        white-space: normal;
    }

    .icon-btn,
    .toggle-btn,
    .canvas-control-btn,
    .manifest-control-btn {
        min-width: 44px;
        min-height: 44px;
    }

    #grid-view-section {
        padding: 16px;
    }

    .section-header {
        gap: 12px;
        align-items: flex-start;
    }

    .section-header h2 {
        font-size: 22px;
    }

    .neon-btn,
    .glow-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .dream-card {
        margin-bottom: 16px;
    }

    .card-title {
        font-size: 16px;
    }

    .card-quick-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
        background: rgba(0, 0, 0, 0.42);
        padding: 8px;
        border-radius: 30px;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .action-round-btn {
        width: 44px;
        height: 44px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-row,
    .add-milestone-row,
    .unsplash-search-row {
        flex-direction: column;
        gap: 8px;
    }

    .form-group.half {
        width: 100%;
    }

    .unsplash-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .manifest-content {
        width: 94%;
        height: 49vh;
        margin-top: 116px;
    }

    .manifest-card-info {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
        padding: 20px;
    }

    #manifest-title {
        font-size: 24px;
    }

    #manifest-desc {
        font-size: 14px;
    }

    .breath-guide-container {
        top: 14px;
        left: 50%;
        transform: translateX(-50%);
        display: block;
        width: 170px;
        height: 96px;
        padding: 0;
        text-align: center;
    }

    .breath-circle-outer {
        position: absolute;
        top: 14px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 40px;
    }

    #breath-text {
        position: absolute !important;
        top: 66px;
        left: 0 !important;
        width: 100%;
        min-width: 0;
        font-size: 15px;
        line-height: 1.1;
        letter-spacing: 0.5px;
        text-align: center;
        white-space: nowrap;
    }

    .breath-subtext {
        display: none;
    }

    .manifest-affirmation-slider {
        width: 88%;
        bottom: 96px;
        padding: 8px 12px;
        border-radius: 18px;
        background: rgba(2, 1, 6, 0.46);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    #manifest-affirmation-text {
        font-size: 15px;
        line-height: 1.2;
        letter-spacing: 0;
    }

    .manifest-controls {
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }

    .canvas-controls {
        bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }

    .canvas-tip {
        display: none;
    }

    .manifest-affirmation-slider {
        bottom: calc(158px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 900px) and (orientation: landscape), (max-height: 520px) {
    .app-header {
        padding: 6px 10px;
        gap: 6px;
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
    }

    .header-logo h1 {
        font-size: 18px;
    }

    .board-selector {
        height: 34px;
        max-width: 220px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .header-actions {
        gap: 6px;
    }

    .icon-btn,
    .toggle-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    #start-manifest-btn {
        min-height: 40px;
        padding: 7px 12px;
    }

    #grid-view-section {
        padding: 10px 14px 92px;
    }

    .section-header {
        margin-bottom: 14px;
    }

    .card-image-wrapper {
        height: clamp(150px, 42vh, 230px);
    }

    .manifest-content {
        width: 82%;
        height: calc(100dvh - 118px);
        height: calc(100vh - 118px);
        margin-top: 10px;
        min-height: 0;
    }

    .manifest-card-info {
        width: 54%;
        max-height: 78%;
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        padding: 16px;
        margin-left: 18px;
        margin-right: auto;
    }

    #manifest-title {
        font-size: 20px;
        margin-top: 8px;
        margin-bottom: 8px;
    }

    #manifest-desc {
        font-size: 12px;
        line-height: 1.35;
        margin-bottom: 12px;
    }

    .breath-guide-container {
        top: 8px;
        left: 12px;
        transform: none;
        width: 118px;
        height: 74px;
    }

    .breath-circle-outer {
        top: 8px;
    }

    #breath-text {
        top: 48px;
        font-size: 12px;
    }

    .exit-manifest-btn {
        top: 8px;
        right: 12px;
        width: 42px;
        height: 42px;
    }

    .manifest-affirmation-slider {
        width: 58%;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        padding: 6px 10px;
    }

    #manifest-affirmation-text {
        font-size: 13px;
    }

    .manifest-controls,
    .canvas-controls {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    .manifest-overlay.active .manifest-content,
    .manifest-overlay.active .manifest-affirmation-slider,
    .manifest-overlay.active .manifest-controls,
    .manifest-overlay.active .breath-guide-container {
        display: none;
    }

    .manifest-overlay.active .manifest-rotate-prompt {
        display: block;
        position: relative;
        z-index: 20;
        width: min(82vw, 360px);
        padding: 28px 24px;
        text-align: center;
        background: rgba(2, 1, 6, 0.72) !important;
    }

    .manifest-rotate-prompt h3 {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .manifest-rotate-prompt p {
        color: var(--text-secondary);
        line-height: 1.45;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .manifest-overlay {
        justify-content: flex-start;
        align-items: flex-start;
    }

    .manifest-rotate-prompt {
        display: none !important;
    }

    .manifest-content {
        position: absolute;
        left: 72px;
        right: 112px;
        top: 76px;
        bottom: 24px;
        width: auto;
        height: auto;
        max-width: none;
        margin: 0;
        border-radius: 18px;
    }

    .manifest-slide-overlay {
        background: linear-gradient(to right, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.62) 38%, rgba(0,0,0,0.12) 100%);
    }

    .manifest-card-info {
        width: min(43%, 520px);
        max-height: calc(100% - 24px);
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        margin-left: 20px;
        margin-right: auto;
        padding: 14px 18px;
        border-radius: 16px;
    }

    .manifest-card-info .card-badge {
        position: static;
        display: inline-block;
        margin-bottom: 6px;
    }

    #manifest-title {
        font-size: clamp(18px, 3vw, 26px);
        line-height: 1.12;
        margin: 2px 0 8px;
    }

    #manifest-desc {
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: clamp(11px, 1.8vw, 14px);
        line-height: 1.35;
        margin-bottom: 10px;
    }

    .manifest-milestones-progress {
        gap: 6px;
        font-size: 11px;
    }

    .breath-guide-container {
        top: 14px;
        left: 18px;
        transform: none;
        width: 118px;
        height: 70px;
        display: block;
    }

    .breath-circle-outer {
        top: 6px;
    }

    #breath-text {
        top: 46px;
        font-size: 12px;
    }

    .exit-manifest-btn {
        top: 14px;
        right: 96px;
        width: 44px;
        height: 44px;
    }

    .manifest-affirmation-slider {
        left: 154px;
        right: 164px;
        top: 18px;
        bottom: auto;
        transform: none;
        width: auto;
        padding: 6px 12px;
        border-radius: 16px;
        background: rgba(2, 1, 6, 0.62);
    }

    #manifest-affirmation-text {
        font-size: clamp(12px, 2vw, 15px);
        line-height: 1.2;
    }

    .manifest-controls {
        display: none;
    }

    .manifest-control-btn {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }

    .manifest-control-btn#manifest-play-btn {
        width: 54px;
        height: 54px;
    }

    .manifest-slide {
        transition: opacity 0.15s linear;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .manifest-overlay.active .manifest-affirmation-slider {
        top: 18px;
        bottom: auto;
    }

    .manifest-overlay.active .manifest-content {
        top: 76px;
        bottom: 24px;
    }
}

@media (max-width: 900px) and (orientation: landscape) and (max-height: 620px) {
    .manifest-content {
        left: 84px;
        right: 92px;
        top: 92px;
        bottom: 16px;
        min-height: 0;
        border-radius: 16px;
    }

    .manifest-card-info {
        width: min(42%, 360px);
        max-height: calc(100% - 18px);
        overflow-y: auto;
        overflow-x: hidden;
        min-height: 0;
        padding: 10px 14px;
        margin-left: 16px;
    }

    .manifest-card-info .card-badge {
        margin-bottom: 4px;
        padding: 3px 8px;
        font-size: 10px;
    }

    #manifest-title {
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: clamp(16px, 2.8vw, 22px);
        line-height: 1.08;
        margin: 0;
    }

    #manifest-desc,
    .manifest-milestones-progress {
        display: none;
    }

    .breath-guide-container {
        top: 8px;
        left: 10px;
        width: 104px;
        height: 62px;
    }

    .breath-circle-outer {
        top: 4px;
        width: 34px;
        height: 34px;
    }

    #breath-text {
        top: 40px;
        font-size: 11px;
    }

    .exit-manifest-btn {
        top: 10px;
        right: 78px;
        width: 40px;
        height: 40px;
    }

    .manifest-affirmation-slider {
        left: 132px;
        right: 132px;
        top: 12px;
        padding: 5px 10px;
    }

    #manifest-affirmation-text {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: clamp(11px, 1.8vw, 13px);
    }
}

@media (max-width: 760px) and (orientation: landscape) and (max-height: 520px) {
    .manifest-content {
        left: 74px;
        right: 70px;
        top: 78px;
        bottom: 12px;
    }

    .manifest-card-info {
        width: min(44%, 300px);
        padding: 8px 12px;
        margin-left: 12px;
    }

    #manifest-title {
        -webkit-line-clamp: 2;
        font-size: clamp(15px, 3vw, 19px);
    }

    .exit-manifest-btn {
        right: 58px;
    }

    .manifest-affirmation-slider {
        left: 118px;
        right: 112px;
    }
}

/* v14-ux: сверхнизкий landscape (полезная высота может быть ~180-200px после
   панелей Chrome). Overlay становится scroll-контейнером, контент уходит
   в поток, чтобы можно было доскроллить до самого нижнего элемента.
   Не используем фиксированную min-height > viewport; уменьшаем только
   декоративные отступы, affirmation/header и размер изображения. */
@media (orientation: landscape) and (max-height: 500px) {
    .manifest-overlay {
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
        align-items: stretch;
        /* safe-area справа/слева (вырезы/жесты в landscape) */
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
    }

    /* Кнопка закрытия всегда видима при скролле */
    .exit-manifest-btn {
        position: sticky;
        top: calc(8px + env(safe-area-inset-top, 0px));
        right: calc(8px + env(safe-area-inset-right, 0px));
        align-self: flex-end;
        width: 40px;
        height: 40px;
        margin: 8px 8px 0 0;
        flex: 0 0 auto;
        z-index: 60;
    }

    /* Контент в потоке: высота определяется содержимым, не фиксирована */
    .manifest-content {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 0;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        flex: 1 0 auto;
        box-shadow: none;
    }

    /* Изображение: уменьшено, но видимо; задаёт высоту блока */
    .manifest-slider-container {
        position: relative;
        width: 100%;
        height: clamp(110px, 30dvh, 240px);
        flex: 0 0 auto;
        min-height: 0;
    }

    .manifest-card-info {
        position: relative;
        width: 100%;
        max-width: none;
        max-height: none;
        min-height: 0;
        overflow-y: visible;
        margin: 0;
        padding: 10px 14px;
        border-radius: 0;
        flex: 1 1 auto;
    }

    /* Возвращаем полный текст (сброс обрезок из max-height:620/520 блоков) */
    #manifest-title {
        display: block;
        -webkit-line-clamp: unset;
        overflow: visible;
        font-size: 17px;
        line-height: 1.15;
        margin: 2px 0 6px;
    }

    #manifest-desc,
    .manifest-milestones-progress {
        display: block;
        -webkit-line-clamp: unset;
        overflow: visible;
    }

    #manifest-desc {
        font-size: 12px;
        line-height: 1.35;
        margin-bottom: 8px;
    }

    .manifest-milestones-progress {
        gap: 5px;
        font-size: 11px;
    }

    .manifest-card-info .card-badge {
        position: static;
        display: inline-block;
        margin-bottom: 4px;
        padding: 3px 8px;
        font-size: 10px;
    }

    /* Гид по дыханию: компактный, в потоке (не перекрывает контент) */
    .breath-guide-container {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: auto;
        height: auto;
        gap: 8px;
        padding: 4px 12px;
        margin: 6px 8px 0;
        flex: 0 0 auto;
        align-self: flex-start;
        border-radius: 20px;
    }

    .breath-circle-outer {
        width: 28px;
        height: 28px;
    }

    .breath-circle-inner {
        width: 14px;
        height: 14px;
    }

    #breath-text {
        position: static;
        font-size: 10px;
        letter-spacing: 0.5px;
    }

    /* Affirmation: компактная, в потоке */
    .manifest-affirmation-slider {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        width: auto;
        padding: 4px 12px;
        margin: 6px 8px 0;
        flex: 0 0 auto;
        border-radius: 14px;
    }

    #manifest-affirmation-text {
        display: block;
        -webkit-line-clamp: unset;
        overflow: visible;
        font-size: 12px;
        line-height: 1.25;
    }

    /* Управление: возвращаем в поток, доступно по скроллу до самого низа */
    .manifest-controls {
        position: relative;
        bottom: auto;
        display: flex;
        gap: 10px;
        padding: 6px 8px;
        margin: 8px auto 12px;
        flex: 0 0 auto;
    }

    .manifest-control-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .manifest-control-btn#manifest-play-btn {
        width: 46px;
        height: 46px;
    }

    .manifest-rotate-prompt {
        display: none !important;
    }
}

/* v14-ux: мобильное меню — один ряд фильтров и один ряд действий (≤600px):
   nowrap + горизонтальный скролл, корзина не переносится одна на новую
   строку, touch targets ≥44×44; уменьшены только gaps и декоративные
   padding. Сворачивание — кнопка #mobile-menu-toggle (native button,
   aria-expanded/aria-controls; состояние только в памяти вкладки). */
@media (max-width: 600px) {
    .header-top-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
        background: var(--panel-glass);
        border: 1px solid var(--panel-glass-border);
        color: var(--text-primary);
        cursor: pointer;
    }

    .menu-collapse-icon { display: block; }
    .menu-expand-icon { display: none; }
    .app-header.menu-collapsed .menu-collapse-icon { display: none; }
    .app-header.menu-collapsed .menu-expand-icon { display: block; }

    #mobile-menu-panel {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .app-header.menu-collapsed #mobile-menu-panel {
        display: none;
    }

    .mobile-manifest-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 1 1 auto;
        min-height: 44px;
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Один горизонтально прокручиваемый ряд */
    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-filters::-webkit-scrollbar,
    .header-actions::-webkit-scrollbar {
        display: none;
    }

    .header-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    /* Основная manifest-кнопка скрыта: компактный доступ — в header-top-row */
    #start-manifest-btn {
        display: none;
    }

    /* Touch targets ≥44×44 */
    .icon-btn,
    .toggle-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .filter-btn {
        min-height: 44px;
        padding: 8px 14px;
    }
}

/* v14-ux: короткий landscape (max-height: 500px) — меню по умолчанию свёрнуто
   (состояние задаёт JS: только short landscape), компактная шапка минимальна,
   раскрытие доступно пользователю; desktop не затрагивается. */
@media (orientation: landscape) and (max-height: 500px) {
    .header-top-row {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 0;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 12px;
        background: var(--panel-glass);
        border: 1px solid var(--panel-glass-border);
        color: var(--text-primary);
        cursor: pointer;
    }

    .menu-collapse-icon { display: block; }
    .menu-expand-icon { display: none; }
    .app-header.menu-collapsed .menu-collapse-icon { display: none; }
    .app-header.menu-collapsed .menu-expand-icon { display: block; }

    .mobile-manifest-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        min-height: 44px;
        padding: 6px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    #mobile-menu-panel {
        display: flex;
        flex-direction: column;
        gap: 6px;
        width: 100%;
        max-height: calc(100dvh - 60px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .app-header.menu-collapsed #mobile-menu-panel {
        display: none;
    }

    .header-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
}

@media (hover: none), (pointer: coarse) {
    .card-quick-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* v14: скрытые нереализованные контролы (мульти-доски, экспорт/импорт JSON/PNG) —
   функции запланированы на следующие этапы v14; правило защищает от авторских стилей */
[hidden] { display: none !important; }

/* v14: индикатор состояния локального хранения */
.storage-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary, #9a9ab0);
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0.85;
    transition: opacity 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.storage-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-secondary, #9a9ab0);
    flex: 0 0 auto;
}
.storage-status-retry {
    font: inherit;
    font-size: 12px;
    color: var(--career-color, #00f2fe);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 2px 10px;
    cursor: pointer;
}
.storage-status-retry:disabled { opacity: 0.5; cursor: default; }
.storage-status-retry:focus-visible { outline: 2px solid var(--career-color, #00f2fe); outline-offset: 2px; }

/* saved — приглушённый, не отвлекает */
.storage-status[data-status="saved"] { opacity: 0.7; }
.storage-status[data-status="saved"] .storage-status-dot { background: var(--wealth-color, #00b09b); }
/* migrated / recovered — краткий акцент после миграции/восстановления */
.storage-status[data-status="migrated"],
.storage-status[data-status="recovered"] { border-color: rgba(0, 242, 254, 0.35); opacity: 1; }
.storage-status[data-status="migrated"] .storage-status-dot,
.storage-status[data-status="recovered"] .storage-status-dot { background: var(--career-color, #00f2fe); }
/* saving — без бесконечной анимации */
.storage-status[data-status="saving"] { opacity: 0.6; }
.storage-status[data-status="saving"] .storage-status-dot { background: var(--text-secondary, #9a9ab0); }
/* error / readonly / unavailable — заметны и остаются до устранения причины */
.storage-status[data-status="error"] { border-color: rgba(255, 82, 82, 0.55); background: rgba(255, 82, 82, 0.12); opacity: 1; }
.storage-status[data-status="error"] .storage-status-dot { background: #ff5252; }
.storage-status[data-status="readonly"],
.storage-status[data-status="unavailable"] { border-color: rgba(255, 183, 77, 0.5); background: rgba(255, 183, 77, 0.1); opacity: 1; }
.storage-status[data-status="readonly"] .storage-status-dot,
.storage-status[data-status="unavailable"] .storage-status-dot { background: #ffb74d; }

/* Мобильные: сокращаем визуальный текст, полное описание остаётся в aria-label/title */
@media (max-width: 620px) {
    .storage-status .storage-status-text { display: none; }
    .storage-status { padding: 4px 8px; }
}

/* prefers-reduced-motion: декоративные анимации и переходы отключаются
   независимо от устройства (toast сохраняет короткое появление — он не
   вызывает blur и не влияет на композитинг) */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
    *:not(.toast):not(.toast *) {
        animation: none !important;
    }
    .manifest-slide.active .manifest-slide-img {
        animation: none !important;
    }
    .breath-circle-inner.inhale,
    .breath-circle-inner.exhale {
        transform: none !important;
        box-shadow: none !important;
        opacity: 0.85;
    }
    .breath-circle-inner.hold {
        transform: none !important;
        box-shadow: none !important;
    }
    .storage-status { transition: none; }
}

/* ==========================================================================
   PERFORMANCE-LITE PROFILE (СЛАБЫЕ И МОБИЛЬНЫЕ УСТРОЙСТВА)
   Класс performance-lite на <html> выставляется performance.js.
   Визуально: без стекла/свечений/декоративных анимаций; функциональность,
   focus-visible, accessibility и кликабельность не изменяются.
   ========================================================================== */

/* Фоновые частицы не нужны: экономия постоянного RAF и GPU */
html.performance-lite #ambient-particles {
    display: none;
}

/* Отключаем дорогой backdrop-filter (композитинг) внутри приложения */
html.performance-lite *,
html.performance-lite *::before,
html.performance-lite *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* Тяжёлые/многослойные тени и свечения убраны */
html.performance-lite .glass-card,
html.performance-lite .dream-card,
html.performance-lite .modal-content,
html.performance-lite .glow-btn,
html.performance-lite .neon-btn,
html.performance-lite .icon-btn,
html.performance-lite .canvas-control-btn,
html.performance-lite .toast,
html.performance-lite .breath-circle-inner,
html.performance-lite .card-image-overlay,
html.performance-lite .manifest-slide-overlay {
    box-shadow: none !important;
}

/* Hover-свечения категорий не нужны (на тач-устройствах они липнут) */
html.performance-lite .category-career:hover,
html.performance-lite .category-wealth:hover,
html.performance-lite .category-health:hover,
html.performance-lite .category-travel:hover,
html.performance-lite .category-relationships:hover,
html.performance-lite .category-growth:hover,
html.performance-lite .category-manifested:hover,
html.performance-lite .glass-card:hover,
html.performance-lite .dream-card:hover {
    box-shadow: none !important;
}

/* Декоративные переходы отключены; анимации — тоже, кроме toast
   (короткое появление/уход без blur, удаление тоста зависит от animationend) */
html.performance-lite * {
    transition: none !important;
}
html.performance-lite *:not(.toast):not(.toast *) {
    animation: none !important;
}

/* Ken Burns выключен; функциональный гид дыхания настроен отдельно ниже. */
html.performance-lite .manifest-slide.active .manifest-slide-img {
    animation: none !important;
}
/* Stage 7B: optional account UI. Hidden while the production feature flag is off. */
.account-toggle-btn[hidden] {
    display: none !important;
}

.auth-dialog {
    position: fixed;
    inset: 0;
    width: min(94vw, 560px);
    max-width: 560px;
    max-height: min(90dvh, 760px);
    margin: auto;
    padding: 0;
    border: 0;
    color: var(--text-primary);
    background: transparent;
}

.auth-dialog::backdrop {
    background: rgba(4, 3, 12, 0.82);
    backdrop-filter: blur(8px);
}

.auth-content {
    display: flex;
    flex-direction: column;
    max-height: min(90dvh, 760px);
    overflow-y: auto;
}

.auth-local-note,
.auth-sync-note {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.45;
}

.auth-sync-note {
    margin: 0 1.5rem 1.5rem;
}

.auth-mode-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0 1.5rem 0.75rem;
    overflow-x: auto;
}

.auth-mode-tabs .btn {
    flex: 0 0 auto;
    min-height: 44px;
}

.auth-session-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 1.5rem 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(119, 232, 193, 0.28);
    border-radius: 12px;
}

.auth-session-panel[hidden] { display: none; }
.auth-session-status { margin: 0; overflow-wrap: anywhere; }

.auth-form {
    padding-top: 0;
}

.auth-form input:not([type="hidden"]) {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    border: 1px solid var(--panel-glass-border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    caret-color: var(--text-primary);
    font: inherit;
}

.auth-form input:not([type="hidden"]):hover,
.auth-form input:not([type="hidden"]):focus {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
}

.auth-form input:-webkit-autofill,
.auth-form input:-webkit-autofill:hover,
.auth-form input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    caret-color: var(--text-primary);
    box-shadow: 0 0 0 1000px #0a0814 inset;
}

.auth-password-field { position: relative; }
.auth-password-field[hidden] { display: none; }
.auth-password-field #auth-password { padding-right: 52px; }

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.auth-password-toggle:focus-visible {
    outline: 2px solid #00f2fe;
    outline-offset: -2px;
}

.auth-password-toggle[aria-pressed="true"] .auth-password-toggle-slash { display: none; }

.auth-turnstile:empty {
    display: none;
}

.auth-message {
    min-height: 1.4em;
    margin: 0;
    font-size: 0.9rem;
}

.auth-message[data-kind="error"] { color: #ff879e; }
.auth-message[data-kind="success"] { color: #77e8c1; }

@media (max-width: 600px) {
    .auth-dialog {
        width: 100vw;
        max-width: none;
        max-height: 100dvh;
        margin: 0;
    }

    .auth-content {
        min-height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Читаемая форма и спокойная библиотека обложек. */
#dream-modal .modal-content { background: #131d30; border: 1px solid #3a4963; }
#dream-modal .modal-form input:not([type="hidden"]),
#dream-modal .modal-form textarea, #dream-modal .modal-form select { background: #0e1728; color: #f2f5fc; border-color: #43516a; }
#dream-modal .modal-form input::placeholder, #dream-modal textarea::placeholder { color: #aab7cc; }
#dream-modal .image-source-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#dream-modal .tab-btn { min-height: 44px; padding: 10px 5px; font-size: 14px; white-space: normal; }
.image-library-hint { color: #b6c4d9; font-size: 13px; line-height: 1.5; margin: 8px 0 12px; }
.image-library-source-label { font-size: 12px; }
#image-library-source { margin-bottom: 10px; width: 100%; }
#dream-modal .unsplash-search-row { display: flex; gap: 8px; }
#unsplash-search-input { min-width: 0; flex: 1; }
#dream-modal .unsplash-results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 330px; gap: 10px; padding: 3px; }
.image-library-item { min-width: 0; padding: 0; background: #1b2940; color: #e7eef9; border: 2px solid transparent; border-radius: 12px; overflow: hidden; text-align: left; cursor: pointer; }
.image-library-item img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.image-library-item span { display: block; padding: 8px; font-size: 12px; line-height: 1.35; }
.image-library-item:disabled { opacity: .55; cursor: default; }
.image-library-item[aria-pressed="true"] { border-color: #88dacf; }
.image-library-item:hover:not(:disabled) { border-color: #94b7ce; }
#dream-modal button:focus-visible, #dream-modal input:focus-visible, #dream-modal select:focus-visible { outline: 2px solid #88dacf; outline-offset: 2px; }
.image-choice-preview { padding: 10px; border: 1px solid #526681; border-radius: 12px; margin-bottom: 12px; }
.image-choice-preview img { display: block; width: 100%; max-height: 230px; object-fit: contain; border-radius: 8px; }
.image-choice-preview p { margin: 10px 0; }
.image-choice-preview.hidden { display: none; }
.image-choice-actions { display: flex; gap: 8px; align-items: center; }
#dream-modal .modal-footer { background: #131d30; padding-top: 16px; }
@media (max-width: 600px) {
    #dream-modal .modal-content { padding: 20px 16px; max-height: 94dvh; }
    #dream-modal .unsplash-search-row { flex-direction: row; }
    #dream-modal .form-row { flex-wrap: wrap; }
    #dream-modal .form-group.half { min-width: 130px; }
    #dream-modal .modal-header h3 { font-size: 21px; }
}

.photo-credit { display: block; color: #b5d4e6; font-size: 11px; line-height: 1.5; padding: 6px 2px; text-decoration: underline; }
#photo-provider-credit a { color: #b5d4e6; }
#photo-search-more { width: 100%; margin-top: 12px; min-height: 44px; }
#photo-search-more[hidden], #photo-provider-credit[hidden] { display: none; }
.image-library-item { width: 100%; }
.project-info { margin-top: 12px; }
.project-info a { color: inherit; text-decoration: underline; text-underline-offset: 3px; display: inline-block; padding: 10px 0; }
