/* ── Переменные Telegram-темы ── */
:root {
    --bg: var(--tg-theme-bg-color, #fff);
    --text: var(--tg-theme-text-color, #000);
    --hint: var(--tg-theme-hint-color, #999);
    --link: var(--tg-theme-link-color, #2678b6);
    --btn: var(--tg-theme-button-color, #2678b6);
    --btn-text: var(--tg-theme-button-text-color, #fff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f0);
    /* Светлая тема: фон серый, карточки белые */
    --screen-bg: var(--tg-theme-secondary-bg-color, #f0f0f0);
    --card-bg: var(--tg-theme-bg-color, #ffffff);
    --border: rgba(0,0,0,0.06);
    --separator: rgba(0,0,0,0.06);
    --card-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
/* Тёмная тема: фиксированные цвета */
html.dark body, body.dark {
    --screen-bg: #232d3b;
    --card-bg: #18212b;
    --text: #e8edf2;
    --hint: #6b7a8d;
    --border: rgba(255,255,255,0.06);
    --separator: rgba(255,255,255,0.07);
    --card-shadow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--screen-bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Экраны (слайд вправо/влево) ── */
.screen {
    position: absolute;
    top: 0; left: 0; right: 0;
    min-height: 100vh;
    padding: 16px;
    padding-bottom: 90px;
    background: var(--screen-bg);
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s ease;
}
.screen.hidden    { transform: translateX(100%); opacity: 0; pointer-events: none; }
.screen.slide-out { transform: translateX(-28%); opacity: 0; pointer-events: none; }

/* ── Спиннер ── */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 12px;
    color: var(--hint);
    font-size: 14px;
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--secondary-bg);
    border-top-color: var(--btn);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Карточки ── */
.card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow, none);
}

/* ── Шапка главного экрана ── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 2px 0;
}
.top-city {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.top-city-name { font-size: 18px; font-weight: 700; }
.top-city-arrow { font-size: 20px; color: var(--hint); }
.top-city:active { opacity: 0.6; }
.top-notify-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px; height: 36px;
    font-size: 20px;
    color: var(--hint);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}
.top-notify-btn:active { opacity: 0.6; }

/* ── Баннер ифтара/сухура ── */
.time-banner {
    background: linear-gradient(135deg, #1a237e, #4a148c);
    color: #fff;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.time-banner.suhur-banner { background: linear-gradient(135deg, #0d2137, #1b3a5c); }
.banner-left .b-label { font-size: 12px; opacity: 0.75; margin-bottom: 2px; }
.banner-left .b-timer { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.banner-right { text-align: right; }
.banner-right .b-icon { font-size: 32px; }
.banner-right .b-sub { font-size: 11px; opacity: 0.6; margin-top: 2px; }

/* ── Навигация по дням ── */
.day-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.day-nav-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.day-nav-btn:active { opacity: 0.5; }
.day-nav-label { font-size: 14px; font-weight: 600; min-width: 110px; text-align: center; }

/* ── Список намазов ── */
.prayer-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--separator); }
.prayer-row:last-child { border-bottom: none; }
.prayer-left { display: flex; align-items: center; gap: 10px; }
.prayer-icon { font-size: 20px; width: 22px; text-align: center; color: var(--hint); }
.s-icon { font-size: 20px; width: 22px; text-align: center; color: var(--hint); }
.setting-row { border-bottom: 1px solid var(--separator); }
.setting-row:last-child { border-bottom: none; }
.prayer-name { font-size: 15px; }
.prayer-tag { font-size: 10px; color: var(--btn); background: rgba(38,120,182,0.1); padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.prayer-time { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prayer-row.active .prayer-name,
.prayer-row.active .prayer-time { color: var(--link); }
.prayer-row.active .prayer-tag { background: rgba(38,120,182,0.15); }

/* ── Кнопка «На месяц» ── */
.month-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    cursor: pointer;
    color: var(--text);
    margin-bottom: 12px;
    transition: transform .1s;
    box-shadow: var(--card-shadow, none);
}
.month-btn:active { transform: scale(0.98); }
html.dark .modal-sheet, body.dark .modal-sheet {
    background: #18212b;
}
html.dark .search-input, body.dark .search-input {
    background: #232d3b;
    border-color: rgba(255,255,255,0.08);
}
.month-btn-icon { font-size: 20px; flex-shrink: 0; color: var(--hint); }
.month-btn-text { font-size: 15px; flex: 1; text-align: left; }
.month-btn-arrow { font-size: 16px; color: var(--hint); flex-shrink: 0; }

/* ── Месячная таблица ── */
.month-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }
.month-header h2 { font-size: 18px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav-label { font-size: 13px; color: var(--hint); min-width: 100px; text-align: center; }
.month-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.month-table th { padding: 8px 2px; color: var(--hint); font-weight: 500; font-size: 11px; }
.month-table td { padding: 7px 2px; text-align: center; border-bottom: 1px solid rgba(128,128,128,0.06); font-variant-numeric: tabular-nums; }
.month-table tr.today td { color: var(--link); font-weight: 600; }
.month-table .day-cell { font-weight: 600; color: var(--hint); width: 32px; }

/* ── Заглушка «нет города» ── */
.nocity { text-align: center; padding: 60px 20px; color: var(--hint); }
.nocity .n-icon { font-size: 48px; margin-bottom: 12px; }
.nocity .n-text { font-size: 15px; }
.nocity-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--btn);
    color: var(--btn-text);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}

/* ── Модалка выбора города ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    transition: opacity .25s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-sheet {
    background: var(--card-bg);
    border-radius: 18px 18px 0 0;
    padding: 16px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(0);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.modal-overlay.hidden .modal-sheet { transform: translateY(100%); }
.modal-handle { width: 36px; height: 4px; background: rgba(128,128,128,0.3); border-radius: 2px; margin: 0 auto 14px; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; text-align: center; }
.search-wrap { position: relative; margin-bottom: 10px; flex-shrink: 0; }
.search-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--screen-bg);
    color: var(--text);
    font-size: 15px;
    outline: none;
}
.search-input::placeholder { color: var(--hint); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--hint); font-size: 16px; }
.city-list { overflow-y: auto; flex: 1; }
.city-item { display: flex; justify-content: space-between; align-items: center; padding: 13px 4px; border-bottom: 1px solid rgba(128,128,128,0.08); cursor: pointer; }
.city-item:active { opacity: 0.6; }
.city-item .c-name { font-size: 15px; }
.city-item .c-code { font-size: 12px; color: var(--hint); }
.city-item .c-active { font-size: 11px; color: var(--btn); margin-left: 6px; }

/* ── Тогглы ── */
.toggle {
    width: 44px; height: 26px;
    border-radius: 13px;
    background: rgba(128,128,128,0.25);
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.toggle::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    top: 3px; left: 3px;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle.on { background: var(--btn); }
.toggle.on::after { transform: translateX(18px); }

/* ── VPN-подсказка ── */
.vpn-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.25);
    border-radius: 14px;
    max-width: 260px;
    text-align: center;
    animation: fadeIn .4s ease;
}
.vpn-hint-icon {
    font-size: 28px;
    line-height: 1;
}
.vpn-hint-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.vpn-hint-text {
    font-size: 13px;
    color: var(--hint);
    line-height: 1.5;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Блок дат ── */
.date-card { padding: 12px 16px; }
.date-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--separator);
}
.date-row:last-child { border-bottom: none; }
.date-icon { font-size: 18px; width: 22px; text-align: center; color: var(--hint); flex-shrink: 0; }
.date-label { font-size: 14px; color: var(--hint); flex: 1; }
.date-value { font-size: 14px; font-weight: 600; text-align: right; }

/* ── Утилиты ── */
.hidden { display: none !important; }
