/**
 * Семейный портал - Основные стили
 */

/* Переменные */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --sidebar-width: 240px;
    --mobile-navbar-offset: 70px;
}

/* Мобильная навигация — выравнивание по вертикали */
.navbar .navbar-nav {
    align-items: center;
}

/* Единый стиль заголовков страниц */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.page-header-text h2 {
    margin-bottom: 0;
}

.page-header-text small {
    display: block;
    margin-top: 0.25rem;
}

.page-header .btn {
    flex-shrink: 0;
}

.btn-page-action {
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-page-action:hover {
    transform: translateY(-1px);
}

.btn-page-action:active {
    transform: translateY(0);
}

.btn-action-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 202, 240, 0.3);
}

.btn-action-info:hover {
    background: linear-gradient(135deg, #0aa2c0 0%, #088fa8 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 202, 240, 0.4);
}

.btn-action-success {
    background: linear-gradient(135deg, #198754 0%, #157347 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
}

.btn-action-success:hover {
    background: linear-gradient(135deg, #157347 0%, #115a3a 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.4);
}

.btn-action-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.btn-action-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #c69500 100%);
    color: #212529;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.btn-action-danger {
    background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-action-danger:hover {
    background: linear-gradient(135deg, #bb2d3b 0%, #a71d2a 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-action-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.btn-action-primary:hover {
    background: linear-gradient(135deg, #0b5ed7 0%, #0a58ca 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

@media (max-width: 575.98px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    .page-header .btn {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Общие стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Аватары */
.avatar,
img.rounded-circle {
    object-fit: cover;
    box-shadow: none !important;
    border: none !important;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.avatar-sm {
    width: 30px;
    height: 30px;
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.avatar-xl {
    width: 120px;
    height: 120px;
}

/* Карточки */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Чат стили */
.chat-container {
    height: 100dvh;
    height: 100vh; /* fallback */
    overflow: hidden;
}

body.modal-open {
    scrollbar-gutter: stable;
}

/* Поиск по сообщениям */
.search-result-item {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.search-result-item:hover {
    background: #f0f0f0;
}
.search-highlight {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}
.search-message-highlight {
    animation: searchHighlightPulse 2s ease-out;
}
@keyframes searchHighlightPulse {
    0% { background: #fff3cd; }
    100% { background: transparent; }
}

.chat-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    margin-top: 3px;
}

.chat-layout > .container-fluid {
    flex: 1;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-container > .row {
    height: 100% !important;
    margin: 0;
}

.chat-container > .row > [class*="col-"] {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chatArea {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

#chatArea > .chat-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    overflow: visible;
}

#chatArea > .chat-messages,
#chatArea > #messagesContainer,
#chatArea #messagesContainer {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden !important;
    min-height: 0;
    padding-bottom: 80px;
}

#chatArea > .chat-input {
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
    min-height: 60px;
    overflow: visible;
    position: sticky;
    bottom: 0;
    z-index: 10;
    background: white;
    border-top: 1px solid #dee2e6;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

/* Шапка чата — выделенный блок */
.chat-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-bottom: 2px solid #90caf9;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#currentChatName {
    background: #1976d2;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Панель инструментов над полем ввода */
.chat-tools-bar {
    display: flex;
    gap: 4px;
    padding: 6px 0;
    margin-bottom: 0;
    border-bottom: 1px solid #e9ecef;
}

.chat-tools-bar .btn {
    padding: 6px 10px;
    font-size: 0.9rem;
}

.chat-info-title {
    font-size: 1.1rem !important;
}

.chat-info-row {
    font-size: 0.85rem;
    flex-wrap: nowrap;
    white-space: nowrap;
}

#chatList {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.message {
    margin-bottom: 1rem;
    max-width: 70%;
}

/* Десктоп: пузыри сообщений чуть шире */
@media (min-width: 769px) {
    .message { max-width: 78%; }
}

.message-grouped {
    margin-bottom: 0.2rem;
}

.message-grouped .message-avatar-wrapper,
.message-grouped .message-name {
    display: none !important;
}

/* Смещение для сгруппированных сообщений других пользователей — выравнивание с аватаркой */
.message-other.message-grouped {
    padding-left: 40px;
}

/* Смещение для сгруппированных своих сообщений без аватарки */
.message-own.message-grouped {
    padding-right: 40px;
}

.message-own {
    margin-left: auto;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 8px;
}

.message-other {
    margin-right: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 8px;
}

/* Анимация появления новых сообщений: чужие летят слева, свои — справа */
@keyframes famMsgInLeft {
    from { opacity: 0; transform: translateX(-100vw); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes famMsgInRight {
    from { opacity: 0; transform: translateX(100vw); }
    to   { opacity: 1; transform: translateX(0); }
}
.message.message-enter-anim {
    animation-duration: 0.45s;
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
    animation-fill-mode: backwards;
}
.message-other.message-enter-anim {
    animation-name: famMsgInLeft;
}
.message-own.message-enter-anim {
    animation-name: famMsgInRight;
}
/* Чат-поп-ап (мини-окно чата) — такой же влёт сообщений */
.chat-popup-messages .chat-popup-bubble-other {
    animation: famMsgInLeft 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.chat-popup-messages .chat-popup-bubble-own {
    animation: famMsgInRight 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* Вылет сообщения при удалении: свои — вправо, чужие — влево */
@keyframes famMsgOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-100vw); }
}
@keyframes famMsgOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100vw); }
}
.message-other.message-exit-anim {
    animation: famMsgOutLeft 0.3s ease-in forwards;
}
.message-own.message-exit-anim {
    animation: famMsgOutRight 0.3s ease-in forwards;
}

.message-body {
    max-width: 100%;
    min-width: 60px;
    overflow: hidden;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-bubble img,
.message-bubble video {
    max-width: 100%;
    height: auto;
}

.message-bubble video {
    max-height: 300px;
    object-fit: contain;
}

/* === Custom Audio Player === */
.audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    min-width: 200px;
    max-width: 100%;
    margin-top: 4px;
}

.audio-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s;
}
.audio-play-btn:active { transform: scale(0.92); }

.audio-player-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.audio-waveform-wrap {
    position: relative;
    height: 32px;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.audio-progress-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
    transition: left 0.1s linear;
    display: none;
}

.audio-progress-line.active {
    display: block;
}

.message-own .audio-progress-line {
    background: #fff;
    box-shadow: 0 0 4px rgba(255,255,255,0.6);
}

.message-other .audio-progress-line {
    background: #1565c0;
    box-shadow: 0 0 4px rgba(21,101,192,0.5);
}

.audio-waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.audio-time-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Own message theme */
.message-own .audio-player {
    background: rgba(255,255,255,0.15);
}
.message-own .audio-play-btn {
    background: rgba(255,255,255,0.25);
    color: #fff;
}
.message-own .audio-play-btn:hover {
    background: rgba(255,255,255,0.35);
}
.message-own .audio-time-row {
    color: rgba(255,255,255,0.7);
}

/* Other message theme */
.message-other .audio-player {
    background: #f0f2f5;
}
.message-other .audio-play-btn {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.message-other .audio-play-btn:hover {
    background: #e4e6eb;
}
.message-other .audio-time-row {
    color: #65676b;
}

/* Popup own message audio theme */
.chat-popup-bubble-own .audio-player { background: rgba(255,255,255,0.15); }
.chat-popup-bubble-own .audio-play-btn { background: rgba(255,255,255,0.25); color: #fff; }
.chat-popup-bubble-own .audio-play-btn:hover { background: rgba(255,255,255,0.35); }
.chat-popup-bubble-own .audio-time-row { color: rgba(255,255,255,0.7); }

/* Popup other message audio theme */
.chat-popup-bubble-other .audio-player { background: #f0f2f5; }
.chat-popup-bubble-other .audio-play-btn { background: #fff; color: #333; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.chat-popup-bubble-other .audio-play-btn:hover { background: #e4e6eb; }
.chat-popup-bubble-other .audio-time-row { color: #65676b; }

.message-own .message-bubble {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.message-other .message-bubble {
    background: #fff;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 0.25rem;
}

.random-member-subtitle { color: #6c757d; }
.message-own .random-member-subtitle { color: rgba(255,255,255,0.7); }
.chat-popup-bubble-own .random-member-subtitle { color: rgba(255,255,255,0.7); }

/* Погода в чате */
.weather-block {
    position: relative;
    overflow: hidden;
    background: #f0f2f5;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 200px;
}
.weather-block-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.weather-block-main {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.weather-block-temp {
    font-size: 1.6rem;
    font-weight: 700;
}
.weather-block-desc {
    color: #6c757d;
    font-size: 0.9rem;
}
.weather-block-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}
.weather-block-item {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
}
.weather-block-label {
    color: #6c757d;
    font-size: 0.7rem;
}
.weather-block-value {
    font-weight: 500;
}
.weather-block-cloud {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: 100%;
}

/* Анимация погоды на карточке */
.weather-anim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.weather-anim::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(12, 16, 24, 0.45) 0%, rgba(12, 16, 24, 0) 32%, rgba(12, 16, 24, 0) 55%, rgba(12, 16, 24, 0.55) 100%);
}
.weather-block-header,
.weather-block-main,
.weather-block-details {
    position: relative;
    z-index: 2;
}
.wa-snow,
.wa-drop {
    position: absolute;
    display: block;
}
.wa-snow {
    top: -24px;
    color: #9db8ff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
    animation-name: wa-snow-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes wa-snow-fall {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.9; }
    25%  { transform: translate(-10px, 42px) rotate(40deg); }
    50%  { transform: translate(9px, 85px) rotate(90deg); }
    75%  { transform: translate(-8px, 128px) rotate(140deg); }
    100% { transform: translate(1px, 170px) rotate(200deg); opacity: 0.2; }
}
.wa-drop {
    top: -22px;
    width: 2px;
    border-radius: 2px;
    background: linear-gradient(to bottom, rgba(130, 180, 255, 0.15), #6ea8ff);
    animation-name: wa-drop-fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
@keyframes wa-drop-fall {
    0%   { transform: translateY(0); opacity: 0; }
    12%  { opacity: 0.9; }
    100% { transform: translateY(180px); opacity: 0.2; }
}
.wa-drop-tilted {
    animation-name: wa-drop-tilt;
}
@keyframes wa-drop-tilt {
    0%   { transform: translate(0, 0) rotate(8deg); opacity: 0; }
    12%  { opacity: 0.9; }
    100% { transform: translate(-26px, 180px) rotate(8deg); opacity: 0.2; }
}
.wa-storm-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 120% at 50% -20%, #1b2236 0%, #0d101c 55%, #05060a 100%);
}
.wa-snow-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 120% at 50% -20%, #4f7bff 0%, #2b57c9 55%, #14307e 100%);
}
.wa-fog-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 120% at 50% -20%, #5c616b 0%, #3d4149 55%, #24262c 100%);
}
.wa-cloudy-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #3d424d 0%, #2a2e37 55%, #1d2027 100%);
}
.wa-cloudy-gap {
    position: absolute;
    background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(180, 189, 204, 0.30) 0%, rgba(180, 189, 204, 0.12) 55%, rgba(180, 189, 204, 0) 100%);
    filter: blur(3px);
    pointer-events: none;
}
.wa-cloudy-puff {
    position: absolute;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(20, 24, 32, 0.90) 0%, rgba(20, 24, 32, 0.55) 55%, rgba(20, 24, 32, 0) 100%);
    filter: blur(3px);
    pointer-events: none;
}
.weather-block:has(.wa-cloudy-anim) {
    border-color: #2c313b;
}
.wa-cloudy-anim ~ .weather-block-header,
.wa-cloudy-anim ~ .weather-block-main,
.wa-cloudy-anim ~ .weather-block-details {
    color: #eef1f6;
    text-shadow: 0 1px 4px rgba(10, 12, 16, 0.6);
}
.wa-cloudy-anim ~ .weather-block-main .weather-block-desc,
.wa-cloudy-anim ~ .weather-block-details .weather-block-label {
    color: #b9c0cd;
    text-shadow: 0 1px 3px rgba(10, 12, 16, 0.65);
}
.wa-cloud-body-dark {
    fill: rgba(214, 221, 233, 0.92);
}
.weather-block:has(.wa-fog-anim) {
    border-color: #464b54;
}
.wa-fog-anim ~ .weather-block-header,
.wa-fog-anim ~ .weather-block-main,
.wa-fog-anim ~ .weather-block-details {
    color: #f2f4f8;
    text-shadow: 0 1px 4px rgba(25, 28, 35, 0.55);
}
.wa-fog-anim ~ .weather-block-main .weather-block-desc,
.wa-fog-anim ~ .weather-block-details .weather-block-label {
    color: #c6ccd7;
    text-shadow: 0 1px 3px rgba(25, 28, 35, 0.6);
}
.wa-fog-anim .wa-fog {
    background-image:
        radial-gradient(ellipse 45% 100% at 25% 50%, rgba(235, 240, 248, 0.42) 0%, rgba(235, 240, 248, 0) 70%),
        radial-gradient(ellipse 45% 100% at 75% 50%, rgba(235, 240, 248, 0.38) 0%, rgba(235, 240, 248, 0) 70%);
}
.wa-fog-anim .wa-fog-veil {
    background: radial-gradient(ellipse at 50% 100%, rgba(230, 236, 246, 0.26) 0%, rgba(230, 236, 246, 0.1) 40%, rgba(230, 236, 246, 0) 75%);
}
.wa-few-anim ~ .weather-block-header,
.wa-few-anim ~ .weather-block-main,
.wa-few-anim ~ .weather-block-details {
    color: #f2f4f8;
    text-shadow: 0 1px 4px rgba(25, 28, 35, 0.55);
}
.wa-few-anim ~ .weather-block-main .weather-block-desc,
.wa-few-anim ~ .weather-block-details .weather-block-label {
    color: #c6ccd7;
    text-shadow: 0 1px 3px rgba(25, 28, 35, 0.6);
}
.wa-blue-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #2f6fe0 0%, #5aa0f5 35%, #9ccdf9 60%, rgba(154, 205, 249, 0) 100%);
    pointer-events: none;
}
.weather-block:has(.wa-blue-sky) {
    border-color: #5aa0f5;
}
.weather-block:has(.wa-blue-sky) .weather-block-header,
.weather-block:has(.wa-blue-sky) .weather-block-main,
.weather-block:has(.wa-blue-sky) .weather-block-details {
    color: #f2f4f8;
    text-shadow: 0 1px 4px rgba(25, 28, 35, 0.55);
}
.weather-block:has(.wa-blue-sky) .weather-block-main .weather-block-desc,
.weather-block:has(.wa-blue-sky) .weather-block-details .weather-block-label {
    color: #c6ccd7;
    text-shadow: 0 1px 3px rgba(25, 28, 35, 0.6);
}
.wa-night-sky {
    position: absolute;
    inset: 0;
    background: radial-gradient(130% 120% at 50% -20%, #1c2b4f 0%, #0e1629 55%, #050810 100%);
    pointer-events: none;
}
.wa-star {
    position: absolute;
    display: block;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.85);
    animation-name: wa-star-twinkle;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    pointer-events: none;
}
@keyframes wa-star-twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}
.weather-block:has(.wa-night-anim) {
    border-color: #1c2b4f;
}
.weather-block:has(.wa-night-anim) .weather-block-header,
.weather-block:has(.wa-night-anim) .weather-block-main,
.weather-block:has(.wa-night-anim) .weather-block-details {
    color: #f2f4f8;
    text-shadow: 0 1px 4px rgba(10, 12, 16, 0.6);
}
.weather-block:has(.wa-night-anim) .weather-block-main .weather-block-desc,
.weather-block:has(.wa-night-anim) .weather-block-details .weather-block-label {
    color: #b9c0cd;
    text-shadow: 0 1px 3px rgba(10, 12, 16, 0.65);
}

/* LightningFX — canvas-молния (цвета через CSS-переменные, тема по prefers-color-scheme) */
.lfx-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    --lfx-core: #fff6dd;
    --lfx-glow: #ffd973;
    --lfx-halo: #ffbd55;
    --lfx-flash: 255 236 185;
}
@media (prefers-color-scheme: dark) {
    .lfx-canvas {
        --lfx-glow: #ffd060;
        --lfx-flash: 255 233 175;
    }
}
.weather-block:has(.wa-storm-anim) {
    border-color: #232a3b;
}
.wa-storm-anim ~ .weather-block-header,
.wa-storm-anim ~ .weather-block-main,
.wa-storm-anim ~ .weather-block-details {
    color: #e8ecf4;
}
.wa-storm-anim ~ .weather-block-main .weather-block-desc,
.wa-storm-anim ~ .weather-block-details .weather-block-label {
    color: #9aa6bd;
}
.weather-block:has(.wa-snow-anim) {
    border-color: #2b57c9;
}
.wa-snow-anim ~ .weather-block-header,
.wa-snow-anim ~ .weather-block-main,
.wa-snow-anim ~ .weather-block-details {
    color: #fff;
}
.wa-snow-anim ~ .weather-block-main .weather-block-desc,
.wa-snow-anim ~ .weather-block-details .weather-block-label {
    color: #c8d6ff;
}
.wa-snow-anim .wa-snow {
    color: #ffffff;
    text-shadow: 0 0 7px rgba(200, 220, 255, 0.95);
}
.wa-sun-glow {
    position: absolute;
    top: -80px;
    right: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 214, 90, 0.35) 0%, rgba(255, 214, 90, 0.12) 45%, rgba(255, 214, 90, 0) 70%);
    pointer-events: none;
}
.wa-sun-rays {
    position: absolute;
    top: -116px;
    right: -116px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 214, 90, 0.30) 0deg 5deg, rgba(255, 214, 90, 0) 5deg 16deg);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0) 68%);
    mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0) 68%);
    opacity: 0.8;
    animation: wa-sun-rays-spin 46s linear infinite;
    pointer-events: none;
}
@keyframes wa-sun-rays-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.wa-sun {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 42% 38%, #fffbe0 0%, #ffe27a 35%, #ffc93c 60%, #ffb400 100%);
    box-shadow: 0 0 24px 6px rgba(255, 200, 80, 0.55), 0 0 60px 22px rgba(255, 200, 80, 0.28);
    animation: wa-sun-pulse 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wa-sun-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
.wa-moon-glow {
    position: absolute;
    top: -80px;
    right: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(205, 220, 255, 0.22) 0%, rgba(205, 220, 255, 0.07) 45%, rgba(205, 220, 255, 0) 70%);
    pointer-events: none;
}
.wa-moon {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 42% 38%, #ffffff 0%, #eef3ff 40%, #c9d6f2 70%, #a8b9e0 100%);
    box-shadow: 0 0 24px 6px rgba(200, 215, 255, 0.40), 0 0 60px 22px rgba(200, 215, 255, 0.18);
    animation: wa-moon-pulse 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes wa-moon-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
.wa-cloud-svg {
    position: absolute;
    pointer-events: none;
    filter: blur(1px) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.10));
    animation-name: wa-cloud-drift;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.wa-cloud-body {
    fill: rgba(255, 255, 255, 0.95);
}
.wa-cloud-underside {
    fill: rgba(148, 163, 184, 0.30);
}
.wa-cloud-static {
    position: absolute;
    right: -8px;
    top: 8px;
    width: 92px;
    height: auto;
    pointer-events: none;
    filter: blur(0.5px) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.12));
    transform-origin: 50% 20%;
    animation: wa-cloud-breathe 5s ease-in-out infinite;
}
@keyframes wa-cloud-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}
@keyframes wa-cloud-drift {
    0%   { transform: translateX(-20%); opacity: 0; }
    8%   { opacity: 0.95; }
    92%  { opacity: 0.95; }
    100% { transform: translateX(280%); opacity: 0; }
}
.wa-fog-veil {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 100%, rgba(205, 215, 230, 0.30) 0%, rgba(205, 215, 230, 0.12) 40%, rgba(205, 215, 230, 0) 75%);
    pointer-events: none;
}
.wa-fog {
    position: absolute;
    left: -50%;
    width: 200%;
    background-image:
        radial-gradient(ellipse 45% 100% at 25% 50%, rgba(205, 215, 230, 0.55) 0%, rgba(205, 215, 230, 0) 70%),
        radial-gradient(ellipse 45% 100% at 75% 50%, rgba(205, 215, 230, 0.50) 0%, rgba(205, 215, 230, 0) 70%);
    background-size: 50% 100%;
    background-repeat: repeat-x;
    filter: blur(3px);
    animation-name: wa-fog-drift;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    will-change: transform;
}
@keyframes wa-fog-drift {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
.message-own .weather-block {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}
.message-own .weather-block-temp {
    color: #fff;
}
.message-own .weather-block-desc,
.message-own .weather-block-label {
    color: rgba(255, 255, 255, 0.85);
}

/* Погода в popup-чате (свои пузыри — на цветном фоне, чужие — на белом) */
#weatherCityInput {
    text-transform: capitalize;
}
.popup-weather {
    position: relative;
    overflow: hidden;
    min-width: 180px;
    max-width: 100%;
}
.popup-weather-head,
.popup-weather-temp,
.popup-weather-desc,
.popup-weather-details {
    position: relative;
    z-index: 1;
}
.popup-weather-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.popup-weather-head i {
    font-size: 0.95rem;
}
.popup-weather-temp {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.1;
}
.popup-weather-desc {
    font-size: 0.82rem;
    opacity: 0.9;
    margin-top: 2px;
}
.popup-weather-details {
    font-size: 0.72rem;
    opacity: 0.8;
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
}
.popup-weather-sep {
    opacity: 0.5;
    margin: 0 2px;
}
.chat-popup-bubble-own .popup-weather-head a { color: rgba(255,255,255,0.8); }
.chat-popup-bubble-own .popup-weather { color: #fff; }

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* Галерея */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photo-grid-sm {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
}

.photo-grid-sm .photo-item img {
    border-radius: 0.25rem;
}

.photo-grid-lg {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
}

@media (max-width: 576px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .photo-grid-sm {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.25rem;
    }
    .photo-grid-lg {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.empty-row {
    background: #f0f0f0;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-item-wrapper.selected .photo-item {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Семейное древо */
.tree-node {
    text-align: center;
    padding: 0.5rem;
}

.tree-node-card {
    display: inline-block;
    padding: 0.75rem 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 0.5rem;
    background: #fff;
    min-width: 150px;
}

.tree-connector {
    width: 2px;
    height: 30px;
    background: var(--primary-color);
    margin: 0 auto;
}

/* Списки покупок */
.shopping-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.shopping-item.purchased {
    opacity: 0.6;
    text-decoration: line-through;
}

.shopping-item-checkbox {
    margin-right: 1rem;
    transform: scale(1.2);
}

/* Календарь */
.calendar-month-header {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border-radius: 12px 12px 0 0;
    padding: 12px;
}
.calendar-year-bar {
    color: rgba(255,255,255,0.95);
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    padding: 6px 0 10px;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.calendar-month-header h5 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.calendar-month-nav {
    display: flex;
    align-items: stretch;
}
.calendar-nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    transition: all 0.2s;
    text-align: center;
    min-height: 44px;
}
.calendar-nav-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.3);
    transform: scale(1.02);
}
.calendar-nav-prev {
    border-right: 1px solid rgba(255,255,255,0.2);
}
.calendar-nav-next {
    border-left: 1px solid rgba(255,255,255,0.2);
}
.calendar-nav-current {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calendar-jump-bar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background: transparent;
    padding: 8px;
}
.calendar-day {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    min-height: 100px;
    padding: 0.5rem;
    overflow: hidden;
    min-width: 0;
    border-radius: 10px;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.08), -2px -2px 4px rgba(255,255,255,0.9), inset 0 1px 0 rgba(255,255,255,0.8);
    transition: transform 0.2s, box-shadow 0.2s;
}
.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 4px 6px 12px rgba(0,0,0,0.12), -2px -2px 4px rgba(255,255,255,0.9);
}
.calendar-day.today-3d {
    box-shadow: 3px 3px 6px rgba(0,0,0,0.08), 0 0 0 2px #0d6efd, 0 0 12px rgba(13,110,253,0.25);
}
.calendar-day-header {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    padding: 0.5rem;
    text-align: center;
    font-weight: bold;
    border-radius: 8px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}
.calendar-event {
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
}
@media (max-width: 575.98px) {
    .calendar-day {
        min-height: 60px;
        padding: 0.25rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }
    .calendar-day-header {
        padding: 0.35rem 0.25rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    .calendar-event {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .calendar-event .event-title {
        display: none;
    }
}

/* Выходные дни */
.calendar-day.calendar-weekend {
    background: linear-gradient(145deg, #fff5eb, #ffe8d6);
}

/* Цели */
.goal-progress {
    height: 1.5rem;
    border-radius: 1rem;
}

.goal-card {
    border-left: 4px solid var(--primary-color);
}

/* Wish-list */
.wish-card {
    position: relative;
}

.wish-priority-1 {
    border-left: 4px solid #dc3545;
}

.wish-priority-2 {
    border-left: 4px solid #ffc107;
}

.wish-priority-3 {
    border-left: 4px solid #198754;
}

.wish-reserved {
    background: #fff3cd;
}

/* Уведомления */
.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
}

.notification-item.unread {
    background: #e7f1ff;
}

.notification-item:hover {
    background: #f8f9fa;
}

/* Статус онлайн */
.status-online {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-online.active {
    background: var(--success-color);
}

.status-online.inactive {
    background: var(--secondary-color);
}

/* Typing indicator */
.typing-indicator {
    font-style: italic;
    color: var(--secondary-color);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Смайлы / Колобки */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    white-space: normal;
    flex-wrap: wrap;
    align-items: start;
    gap: 2px;
    max-height: 250px;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.emoji-picker.show {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
}

.cover-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: start;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.emoji-picker::-webkit-scrollbar {
    height: 10px;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
    min-height: 10px;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: transform 0.1s;
    flex-shrink: 0;
}

.emoji-item:hover {
    transform: scale(1.2);
}

.kolobok-item {
    cursor: pointer;
    display: inline-block;
    width: 28px;
    height: 28px;
    background-size: 448px 448px;
    background-repeat: no-repeat;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.kolobok-item:hover {
    background-color: #e9ecef;
}

.kolobok-emoji {
    height: 1.4em;
    width: auto;
    vertical-align: middle;
    margin: 0 1px;
}

/* Модальные окна */
.modal-header {
    background: var(--primary-color);
    color: #fff;
}

/* Загрузка файлов */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: #e7f1ff;
}

/* Лоадер */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state .btn i {
    font-size: 0.9em;
    margin-bottom: 0;
}

/* Ссылки в сообщениях чата */
.chat-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    background: #3d8bfd;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    word-break: break-all;
    transition: background 0.15s, color 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}
.chat-link:hover {
    background: #2563eb;
    color: #fff;
    text-decoration: none;
}
.chat-link i { font-size: 0.75rem; opacity: 0.8; }

/* Кнопка лайка сообщения - убираем подчёркивание */
.message-like-btn,
.message-like-btn:hover,
.message-like-btn:focus {
    text-decoration: none !important;
}

/* Активная семья в списке */
.family-item-active {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
}

/* Лайки — всплывающий список */
.likes-popup {
    position: fixed;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 6px 0;
    min-width: 160px;
    max-width: 260px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 11000;
    display: none;
    pointer-events: none;
}
.likes-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
}
.likes-popup.show {
    display: block;
    pointer-events: auto;
}
.likes-popup-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
}
.likes-popup-item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.likes-popup-item .fa-user-circle {
    font-size: 24px;
    color: #adb5bd;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.message-like-wrapper {
    position: relative;
    display: inline-block;
}

.like-count-btn {
    font-size: 0.85rem;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
}

/* Мобилка: увеличиваем область тапа */
@media (max-width: 768px) {
    .message-like-btn {
        padding: 8px !important;
        min-width: 34px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .like-count-btn {
        padding: 8px 10px;
        min-width: 34px;
        min-height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .likes-popup {
        max-width: 80vw;
    }
    .likes-popup::after {
        display: none;
    }
}

/* Кнопка "Назад" (мобилка) */
.chat-back-btn {
    display: none !important;
}

/* На ПК: ширина колонок */
@media (min-width: 769px) {
    .chat-container > .row > .col-md-4,
    .chat-container > .row > .col-lg-3 {
        flex: 0 0 30% !important;
        max-width: 30% !important;
        width: 30% !important;
        border-right: 2px solid #dee2e6 !important;
    }
    
    .chat-container > .row > .col-md-8,
    .chat-container > .row > .col-lg-9 {
        flex: 0 0 70% !important;
        max-width: 70% !important;
        width: 70% !important;
    }
}

/* Мобилка: полноэкранные панели */
@media (max-width: 768px) {
    .chat-container { height: 100%; }

    .chat-back-btn {
        display: inline-flex !important;
    }

    #chatArea > .chat-input {
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: white;
        border-top: 1px solid #dee2e6;
    }

    .chat-container > .row > .col-md-4,
    .chat-container > .row > .col-lg-3 {
        position: fixed;
        top: var(--mobile-navbar-offset);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: none !important;
        background: #fff;
        overflow-y: auto;
    }

    .chat-container > .row > .col-md-4 > .d-flex,
    .chat-container > .row > .col-lg-3 > .d-flex {
        min-height: 100%;
    }

    body.show-sidebar .chat-container > .row > .col-md-4,
    body.show-sidebar .chat-container > .row > .col-lg-3 {
        transform: translateX(0);
    }

    .chat-container > .row > .col-md-8,
    .chat-container > .row > .col-lg-9 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    body.show-sidebar .chat-container > .row > .col-md-8,
    body.show-sidebar .chat-container > .row > .col-lg-9 {
        visibility: hidden;
    }

    .message { max-width: 85%; }

    .chat-info-title {
        font-size: 1rem !important;
    }

    .chat-info-row {
        font-size: 0.75rem;
        gap: 0.25rem !important;
    }
}

/* На странице чата: запрет скролла страницы */
body:has(.chat-layout) {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    body:has(.chat-layout) {
        overflow: visible;
    }
}

/* Десктоп: сдвигаем main-контент для сайдбара */
@media (min-width: 992px) {
    main {
        margin-left: var(--sidebar-width);
    }
}

.form-control:disabled,
.form-select:disabled {
    cursor: not-allowed;
}

/* Галерея: модальное окно фото */
.photo-modal-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.photo-modal-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.photo-modal-actions .like-tooltip-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.photo-nav-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

#photoModalBody:hover .photo-nav-btn {
    opacity: 0.75;
}

#photoModalBody .photo-nav-btn:hover {
    opacity: 1;
}

.photo-rotate-group {
    gap: 0.15rem !important;
}

.photo-album-label {
    margin-left: 1rem;
}

@media (max-width: 575.98px) {
    #photoModal .bg-dark.text-white > .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .photo-modal-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .photo-modal-actions .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    .photo-nav-btn {
        opacity: 0.6;
        width: 36px !important;
        height: 36px !important;
    }
    #photoModalBody .photo-nav-btn:active {
        opacity: 1;
    }
    .photo-album-label {
        margin-left: 0;
    }
}

/* Email-автодополнение доменов */
.email-autocomplete-dropdown {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
}
.email-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.1s;
}
.email-autocomplete-item:last-child {
    border-bottom: none;
}
.email-autocomplete-item:hover {
    background: #e7f1ff;
    color: #0d6efd;
}

/* Random number generator */
@keyframes randomSpin {
    0% { transform: scale(1) rotateX(0); opacity: 1; }
    25% { transform: scale(1.1) rotateX(10deg); opacity: 0.8; }
    50% { transform: scale(0.95) rotateX(-5deg); opacity: 1; }
    75% { transform: scale(1.05) rotateX(5deg); opacity: 0.9; }
    100% { transform: scale(1) rotateX(0); opacity: 1; }
}

@keyframes randomFinal {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

.random-spin {
    animation: randomSpin 0.15s linear infinite;
    color: #dc3545 !important;
}

.random-final {
    animation: randomFinal 0.6s ease-out;
    color: #198754 !important;
    text-shadow: 0 0 20px rgba(25, 135, 84, 0.5);
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99999;
}

/* Functions dropdown — светлая тема */
#functionsDropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 4px 0;
    z-index: 1050;
    background-color: #fff;
}

#functionsDropdown.show {
    display: block;
}

#functionsDropdown .dropdown-item {
    padding: 8px 16px;
    font-size: 0.9rem;
}

#functionsDropdown .dropdown-item:hover {
    background: #f0f0f0;
    color: #000;
}

/* Онлайн-точка на аватарке */
.avatar-online-dot {
    position: absolute;
    background: #28a745;
    border-color: #fff;
    border-style: solid;
    border-radius: 50%;
    z-index: 3;
}

/* ========== Neon Glow Toast ========== */
#neon-toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.neon-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #0d0d1a;
    border: 1px solid;
    border-radius: 14px;
    min-width: 280px;
    max-width: 380px;
    pointer-events: auto;
    animation: neonToastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.neon-toast.hiding {
    animation: neonToastOut 0.3s ease-in forwards;
}
.neon-toast-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.neon-toast-body {
    flex: 1;
    min-width: 0;
}
.neon-toast-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    word-wrap: break-word;
}
.neon-toast-msg {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 2px;
    line-height: 1.4;
}
.neon-toast-close {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}
.neon-toast-close:hover {
    color: #fff;
}
@keyframes neonToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes neonToastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ===== Chat popup widget ===== */
@keyframes chatPopupIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-popup {
    display: none; position: fixed; bottom: 20px; right: 20px; width: 360px;
    background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    z-index: 2147483647; flex-direction: column; max-height: 50vh;
    animation: chatPopupIn 0.25s ease-out; overflow: hidden;
}
.chat-popup.show { display: flex; }
.chat-popup-header {
    display: flex; align-items: center; padding: 10px 14px; gap: 10px;
    background: var(--primary-color, #0d6efd); color: #fff; cursor: pointer;
    user-select: none; position: relative;
}
.chat-popup-header img {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3); flex-shrink: 0;
}
.chat-popup-header .chat-popup-name {
    flex: 1; font-weight: 600; font-size: 14px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.chat-popup-header .chat-popup-status {
    font-size: 11px; font-weight: 400; opacity: 0.8;
}
.chat-popup-close {
    background: none; border: none; color: #fff; font-size: 15px;
    cursor: pointer; padding: 4px 8px; line-height: 1; opacity: 0.7;
    transition: opacity 0.15s; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.chat-popup-close:hover { opacity: 1; }
.chat-popup-messages {
    flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px; min-height: 200px;
    display: flex; flex-direction: column; gap: 6px;
    background: #f8f9fa;
}
.chat-popup-messages::-webkit-scrollbar { width: 4px; }
.chat-popup-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.chat-popup-bubble {
    max-width: 85%; padding: 8px 12px; border-radius: 12px;
    font-size: 14px; line-height: 1.4; word-wrap: break-word;
    animation: chatPopupIn 0.15s ease-out;
}
.chat-popup-bubble-own {
    background: var(--primary-color, #0d6efd); color: #fff;
    border-radius: 12px 12px 0 12px; align-self: flex-end;
}
.chat-popup-bubble-other {
    background: #fff; color: #333; border: 1px solid #e9ecef;
    border-radius: 12px 12px 12px 0; align-self: flex-start;
}
.chat-popup-bubble-time {
    font-size: 10px; opacity: 0.6; margin-top: 4px; text-align: right;
}
.chat-popup-bubble-other .chat-popup-bubble-time { color: #999; }
.popup-sender-name { font-size: 11px; font-weight: 600; color: #1565c0; margin-bottom: 2px; }
.chat-popup-input {
    display: flex; padding: 8px 10px; gap: 8px; border-top: 1px solid #eee;
    background: #fff; align-items: center;
}
.chat-popup-input input {
    flex: 1; border: 1px solid #ddd; border-radius: 20px;
    padding: 8px 14px; font-size: 14px; outline: none; background: #f8f9fa;
    transition: border-color 0.15s;
}
.chat-popup-input input:focus { border-color: var(--primary-color, #0d6efd); }
.chat-popup-input button {
    background: var(--primary-color, #0d6efd); color: #fff; border: none;
    border-radius: 50%; width: 36px; height: 36px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.1s; flex-shrink: 0;
}
.chat-popup-input button:active { transform: scale(0.9); }
.chat-popup-input button:disabled { opacity: 0.5; cursor: default; transform: none; }
@media (max-width: 480px) {
    .chat-popup { width: calc(100% - 20px); right: 10px; bottom: 10px; }
}
body.dark-theme .chat-popup { background: var(--bg-card, #2b2f33); box-shadow: 0 4px 24px rgba(0,0,0,0.4); }
body.dark-theme .chat-popup-messages { background: var(--bg-body, #1a1d21); }
body.dark-theme .chat-popup-messages::-webkit-scrollbar-thumb { background: #555; }
body.dark-theme .chat-popup-bubble-other { background: var(--bg-input, #3a3f44); color: var(--text-primary, #e4e6ea); border-color: var(--border-color, #3d4148); }
body.dark-theme .chat-popup-bubble-other .chat-popup-bubble-time { color: var(--text-secondary, #9ca3af); }
body.dark-theme .popup-sender-name { color: #90caf9; }
body.dark-theme .chat-popup-input { background: var(--bg-card, #2b2f33); border-top-color: var(--border-color, #3d4148); }
body.dark-theme .chat-popup-input input { background: var(--bg-input, #3a3f44); color: var(--text-primary, #e4e6ea); border-color: var(--border-color, #3d4148); }
body.dark-theme .chat-popup-input input::placeholder { color: var(--text-secondary, #9ca3af); }
body.dark-theme .chat-popup-input input:focus { border-color: var(--primary-color, #0d6efd); }

/* Audio / video inside popup bubbles */
.chat-popup-bubble video { border-radius: 8px; max-width: min(300px, 100%); }
.chat-popup-bubble .bg-light { background: #f0f2f5 !important; }
.chat-popup-bubble-own .bg-light { background: rgba(255,255,255,0.15) !important; color: #fff; }
.chat-popup-bubble-own .bg-light small { color: rgba(255,255,255,0.7); }
body.dark-theme .chat-popup-bubble-other .bg-light { background: var(--bg-input, #3a3f44) !important; color: var(--text-primary, #e4e6ea); }
body.dark-theme .chat-popup-bubble-other .bg-light small { color: var(--text-secondary, #9ca3af); }

/* BBCode styles (popup + chat) */
.chat-spoiler { display: inline; }
.chat-spoiler .chat-spoiler-content { background: #222; color: transparent; border-radius: 3px; padding: 0 2px; cursor: pointer; transition: all .2s; user-select: none; }
.chat-spoiler.revealed .chat-spoiler-content { background: transparent; color: inherit; }
.chat-bbcode-quote { border-left: 3px solid var(--primary-color, #0d6efd); margin: 6px 0; padding: 4px 10px; background: var(--bg-hover, #f8f9fa); border-radius: 0 6px 6px 0; font-size: 0.9em; color: var(--text-secondary, #6c757d); }
.chat-bbcode-list { padding-left: 1.2em; margin: 4px 0; }
.chat-popup-bubble .chat-link,
.message-bubble .chat-link { color: #fff; text-decoration: none; word-break: break-all; }
.chat-popup-bubble img,
.message-bubble img { max-width: min(300px, 100%); border-radius: 8px; margin: 4px 0; }

/* ===== DateDropper модальные окна + анимации ===== */
.modal .datedropper.picker-modal {
    top: 45% !important;
    max-height: 80vh;
    overflow-y: auto;
}
.modal .datedropper .picker {
    max-height: 350px;
}
.modal .datedropper .pick-lg {
    max-height: 250px;
}
.modal .datedropper.picker-lg {
    width: 280px !important;
}
@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(5deg); }
    60% { transform: rotate(-5deg); }
    70% { transform: rotate(0deg); }
}

/* ===== Mobile navbar adjustments ===== */
@media (max-width: 991.98px) {
    #navbarNav .navbar-nav {
        align-items: flex-start !important;
    }
    #navbarNav .navbar-nav .nav-link {
        padding-left: 0;
    }
    /* Меню — свой скролл-контейнер под шапкой, без прокрутки страницы позади */
    #navbarNav.collapse.show,
    #navbarNav.collapsing {
        max-height: calc(100vh - 110px);
        max-height: calc(100dvh - 110px);
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    #profileDropdown + .dropdown-menu {
        position: fixed !important;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100% !important;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 1rem 1rem 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    }
}

/* ===== Online dot ===== */
.online-dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background: #28a745;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 2;
}
#profileDropdown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ===== Desktop sidebar ===== */
.desktop-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--primary-color, #0d6efd);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow: visible;
}
.sidebar-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-bottom {
    flex-shrink: 0;
    overflow: visible;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}
.sidebar-brand:hover {
    color: #fff;
    text-decoration: none;
}
.sidebar-family-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.65;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.mob-family-name {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.7;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.nav-group {
    position: relative;
    display: flex;
    align-items: stretch;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-group-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}
.nav-group-items {
    flex: 1;
    min-width: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-group.is-single .nav-group-label {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
}
.nav-group.is-single .nav-group-items {
    margin-left: 28px;
}
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.15);
    margin: 0 16px;
}
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    gap: 2px;
}
.sidebar-group {
    position: relative;
    display: flex;
    align-items: stretch;
}
.sidebar-group-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}
.sidebar-group-items {
    flex: 1;
    min-width: 0;
}
.sidebar-group.is-single .sidebar-group-label {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
}
.sidebar-group.is-single .sidebar-group-items {
    margin-left: 28px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.93rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}
.sidebar-link.active,
.sidebar-link.bg-primary-subtle {
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 600;
}
.sidebar-profile {
    padding: 12px 16px;
    position: relative;
}
.sidebar-profile .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}
.sidebar-profile .nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}
.sidebar-profile-info {
    min-width: 0;
    flex: 1;
}
.sidebar-profile-name {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-profile .dropdown-toggle::after {
    display: none;
}
.sidebar-profile .dropdown-menu {
    width: 220px;
    border-radius: 0.5rem;
    box-shadow: 2px 4px 20px rgba(0,0,0,0.2);
}
.sidebar-profile-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}
.sidebar-profile-toggle:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
    text-decoration: none;
}
.sidebar-dropdown-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 8px;
    right: 8px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e9ecef);
    border-radius: 0.5rem;
    box-shadow: 2px 4px 20px rgba(0,0,0,0.2);
    padding: 6px 0;
    margin: 0;
    list-style: none;
    z-index: 1050;
    max-height: 55vh;
    overflow-y: auto;
}
.sidebar-dropdown-menu.show {
    display: block;
}
.sidebar-dropdown-menu .dropdown-item {
    display: block;
    padding: 8px 16px;
    color: var(--text-primary, #333);
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background 0.15s;
}
.sidebar-dropdown-menu .dropdown-item:hover {
    background: var(--bg-hover, #f0f0f0);
    color: var(--text-primary, #111);
    text-decoration: none;
}
.sidebar-dropdown-menu .dropdown-divider {
    border-color: var(--border-color, #e9ecef);
    margin: 4px 0;
}
@media (min-width: 992px) {
    main {
        margin-left: var(--sidebar-width);
    }
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
main {
    flex: 1 0 auto;
}
.site-footer {
    flex-shrink: 0;
}
@media (min-width: 992px) {
    .site-footer {
        margin-left: var(--sidebar-width);
    }
}

.meal-plan-table {
    table-layout: fixed;
    width: 100%;
}
.meal-plan-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.meal-plan-badge {
    font-size: 0.6rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    z-index: 1;
}
.meal-plan-badge.cost-badge {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}
.meal-plan-badge.time-badge {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}
.meal-plan-badge.diff-badge {
    font-size: 0.55rem;
}
.meal-plan-badge.diff-badge.diff-easy {
    background: rgba(25, 135, 84, 0.15);
    color: #198754;
}
.meal-plan-badge.diff-badge.diff-medium {
    background: rgba(255, 193, 7, 0.2);
    color: #d4a00a;
}
.meal-plan-badge.diff-badge.diff-hard {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

#recipesListSection .card-title.fw-bold {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 3.2em;
}

/* === Рецепты: мобильная версия === */
@media (max-width: 575.98px) {
    .meal-plan-table {
        font-size: 0.75rem;
    }
    .meal-plan-table th {
        padding: 0.35rem 0.25rem;
        font-size: 0.7rem;
    }
    .meal-plan-table td {
        padding: 0.25rem;
        min-height: 50px;
    }
    .meal-plan-day {
        font-size: 0.7rem;
        padding: 0.3rem !important;
    }
    .meal-plan-cell img {
        width: 28px !important;
        height: 28px !important;
    }
    .meal-plan-badge {
        font-size: 0.5rem;
        padding: 1px 3px;
    }
    .meal-plan-cell small {
        font-size: 0.65rem;
    }
    .meal-plan-cell .btn-link {
        font-size: 0.5rem !important;
    }

    #recipesListSection .d-flex.flex-wrap {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    #recipesListSection .input-group {
        max-width: 100% !important;
        width: 100%;
    }
    #recipesListSection .btn-group {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
    }
    #recipesListSection .btn-group .btn {
        flex: 1 0 auto;
        font-size: 0.72rem;
        padding: 0.25rem 0.4rem;
    }

    .recipe-item-card .card-img-top {
        height: 130px !important;
    }
    .recipe-item-card .card-title {
        font-size: 0.9rem;
    }
    .recipe-item-card .card-text {
        font-size: 0.75rem;
    }
    .recipe-item-card .badge {
        font-size: 0.65rem;
    }
    .recipe-item-card .card-footer .btn {
        font-size: 0.72rem;
        padding: 0.2rem 0.4rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }
    .modal-body .row.g-3 {
        gap: 0.5rem;
    }
    .modal-body .form-label {
        font-size: 0.85rem;
    }
    .ingredient-row .form-control {
        font-size: 0.85rem;
        padding: 0.3rem 0.5rem;
    }
    .ingredient-row .btn-outline-danger {
        padding: 0.2rem 0.4rem;
    }
    .step-row textarea {
        font-size: 0.85rem;
    }
    .step-row .input-group-text {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .page-header {
        gap: 0.5rem;
    }
    .page-header .d-flex.gap-2 {
        width: 100%;
    }
    .page-header .d-flex.gap-2 .btn {
        flex: 1;
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }
}

/* ===== Сапёр ===== */
.ms-board {
    display: inline-grid;
    gap: 0;
    border: 2px solid var(--border-color, #ccc);
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
}
.ms-cell {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 14px; font-weight: bold;
    transition: background 0.1s;
    border: 1px solid rgba(0,0,0,0.08);
}
.ms-cell i { font-size: 15px; }
.ms-cell-mine i { color: #dc3545; }
.ms-cell-exploded i { color: #fff; }
.ms-cell-flag i { color: #ffc107; }
.ms-cell-closed {
    background: #e9ecef;
}
.ms-cell-closed:hover {
    background: #dee2e6;
}
.ms-cell-open {
    background: #fff;
}
.ms-cell-flag {
    background: #fff3cd;
}
.ms-cell-mine {
    background: #f8d7da;
}
.ms-cell-exploded {
    background: #dc3545 !important;
    color: #fff !important;
}
.ms-cell-1 { color: #0d6efd; }
.ms-cell-2 { color: #198754; }
.ms-cell-3 { color: #dc3545; }
.ms-cell-4 { color: #0f52ba; }
.ms-cell-5 { color: #842029; }
.ms-cell-6 { color: #0dcaf0; }
.ms-cell-7 { color: #333; }
.ms-cell-8 { color: #6c757d; }
.ms-panel {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 12px;
    background: var(--bg-input, #f8f9fa);
    border-radius: 8px;
}
.ms-counter {
    font-family: monospace; font-size: 1.1rem; font-weight: bold;
    min-width: 60px;
}
.ms-board-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ms-mode-btn.active { font-weight: bold; }
.ms-size-btn {
    --ms-size-color: #0d6efd;
    border-color: var(--ms-size-color);
    color: var(--ms-size-color);
    transition: all 0.2s ease;
}
.ms-size-btn:hover {
    background: var(--ms-size-color);
    border-color: var(--ms-size-color);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
    transform: translateY(-1px);
}
.ms-size-btn.active,
.ms-size-btn.btn-secondary {
    background: var(--ms-size-color);
    border-color: var(--ms-size-color);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.3);
}
.ms-size-btn .ms-size-min {
    font-size: 0.7rem;
    color: #fff;
}

/* Mobile minesweeper */
@media (max-width: 480px) {
    .ms-cell {
        width: calc((100vw - 60px) / var(--ms-cols, 9));
        height: calc((100vw - 60px) / var(--ms-cols, 9));
        font-size: 11px;
    }
    .ms-cell i { font-size: 12px; }
    .ms-counter { font-size: 0.95rem; min-width: 50px; }
    .ms-panel { padding: 6px 8px; gap: 4px; }
}

/* ===== PWA/standalone + нативное Android-приложение: отступ под «бровь» камеры =====
   Десктоп и мобильный браузер (display-mode: browser) не затрагиваются. */
@media (display-mode: standalone) {
    html {
        --safe-top: env(safe-area-inset-top);
        /* Шапка: 62px содержимого + max(6px, safe-top) + 8px нижнего padding */
        --mobile-navbar-offset: calc(62px + max(6px, var(--safe-top)));
    }
    /* Мобильная шапка — контент ниже выреза, фон закрашивает вырез */
    .navbar.bg-primary.sticky-top {
        padding-top: max(6px, var(--safe-top)) !important;
    }
    /* Десктопный сайдбар (планшет/десктоп PWA) */
    .desktop-sidebar {
        top: var(--safe-top);
        height: calc(100dvh - var(--safe-top));
    }
    /* Страницы без шапки (публичные) — контент не уходит под вырез */
    body:not(:has(.navbar.bg-primary.sticky-top)) {
        padding-top: var(--safe-top);
    }
}

/* Нативное Android-приложение (Capacitor WebView): display-mode не даёт standalone,
   поэтому среда определяется JS-классом html.native-app.
   Capacitor инжектирует --safe-area-inset-top (плагин SystemBars); фолбэк на env()
   нужен на случай, когда переменные ещё не установлены. Если WebView не перекрывает
   статус-бар — оба сигнала дают 0, лишнего отступа не будет. */
html.native-app {
    --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top));
    /* Шапка: 62px содержимого + max(6px, safe-top) + 8px нижнего padding */
    --mobile-navbar-offset: calc(62px + max(6px, var(--safe-top)));
}
html.native-app .navbar.bg-primary.sticky-top {
    padding-top: max(6px, var(--safe-top)) !important;
}
html.native-app .desktop-sidebar {
    top: var(--safe-top);
    height: calc(100dvh - var(--safe-top));
}
html.native-app body:not(:has(.navbar.bg-primary.sticky-top)) {
    padding-top: var(--safe-top);
}
