/* JUMMA — светлая природная тема: спокойный фон, зелёные акценты, мягкие карточки. */
:root {
    --tg-safe-bottom: 0px;            /* safe-area Telegram, из JS */

    /* Тёплая «бумажная» палитра: кремовый фон, коричневый текст, зелёный акцент */
    --bg-top: #f6f1e6;
    --bg-bottom: #eee5d3;
    --card: #fdf9f0;
    --card-border: rgba(95, 75, 50, 0.13);
    --shadow: 0 2px 14px rgba(95, 75, 50, 0.08);

    --text: #41372a;
    --text-dim: #9b8a72;

    --accent: #2f9e66;               /* росток/зелень */
    --accent-strong: #1f7d4f;
    --accent-soft: rgba(47, 158, 102, 0.14);   /* фон выполненного */
    --accent-border: rgba(47, 158, 102, 0.36);

    --track: #e7dcc7;                /* пустые ячейки/обводки */
    --row-bg: #fbf5e9;               /* фон строки намаза */
    --tabbar-bg: rgba(253, 249, 240, 0.92);
}

/* Тёмная тема — спокойная ночь, зелень сохраняется */
:root[data-theme="dark"] {
    --bg-top: #0e1714;
    --bg-bottom: #0a1310;
    --card: #16211d;
    --card-border: rgba(255, 255, 255, 0.09);
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);

    --text: #e9efea;
    --text-dim: #93a69c;

    --accent: #3fb27a;
    --accent-strong: #66cf94;
    --accent-soft: rgba(63, 178, 122, 0.16);
    --accent-border: rgba(63, 178, 122, 0.42);

    --track: #243029;
    --row-bg: #131d19;
    --tabbar-bg: rgba(14, 23, 20, 0.92);
}

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

body {
    font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(170deg, var(--bg-top), var(--bg-bottom));
    background-attachment: fixed;
    transition: color .25s ease;
}

.app { max-width: 480px; margin: 0 auto; padding: 22px 16px calc(96px + var(--tg-safe-bottom)); }

.header {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 20px;
}
.logo { font-size: 22px; font-weight: 800; letter-spacing: 0.2px; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 10px; }
.date { color: var(--text-dim); font-size: 14px; font-weight: 500; }
.theme-toggle {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card);
    font-size: 16px; line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
    transition: transform .1s;
}
.theme-toggle:active { transform: scale(0.92); }

/* Нижняя навигация */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    background: var(--tabbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -2px 16px rgba(20, 70, 45, 0.05);
    padding: 8px 8px calc(10px + var(--tg-safe-bottom));
    z-index: 10;
}
.tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px;
    border: none; background: transparent;
    color: var(--text-dim); cursor: pointer; font-family: inherit;
    transition: color .15s;
}
.tab-icon { font-size: 20px; line-height: 1; opacity: .55; transition: opacity .15s, transform .15s; }
.tab-label { font-size: 11px; font-weight: 600; }
.tab.active { color: var(--accent-strong); }
.tab.active .tab-icon { opacity: 1; transform: translateY(-1px) scale(1.08); }

.tab-panel { animation: fade-in .25s ease; }
.tab-panel.hidden { display: none; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
    0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); }
}

/* Карточки */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text-dim); text-transform: none; }

/* Герой: следующий намаз */
.next-card {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border-radius: 20px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: 0 6px 20px rgba(31, 125, 79, 0.28);
}
.next-label { font-size: 13px; font-weight: 600; opacity: .9; }
.next-main { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; gap: 12px; }
.next-name { font-size: 26px; font-weight: 800; }
.next-time { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.next-countdown { margin-top: 5px; font-size: 13px; opacity: .92; }

/* Намазы */
.prayers { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.loading { color: var(--text-dim); }

.prayer {
    display: flex; align-items: center; gap: 14px;
    padding: 15px 16px;
    border-radius: 15px;
    background: var(--row-bg);
    border: 1px solid var(--card-border);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .08s;
}
.prayer:active { transform: scale(0.985); }
.prayer.done { background: var(--accent-soft); border-color: var(--accent-border); }
.prayer.is-next { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent-border) inset; }
.prayer .name { flex: 1; }
.prayer-time { color: var(--text-dim); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.prayer.done .prayer-time { color: var(--accent-strong); }

.check {
    width: 26px; height: 26px; flex: 0 0 26px;
    border-radius: 50%;
    border: 2px solid var(--track);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: transparent;
    transition: all .15s;
}
.prayer.done .check {
    background: var(--accent); border-color: var(--accent); color: #fff;
    animation: pop .3s ease;
}
.prayer .name { font-size: 17px; font-weight: 600; }

/* Доп. времена-ориентиры (восход, тахаджуд) */
.extra-times { list-style: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--card-border); display: flex; flex-direction: column; gap: 8px; }
.extra-times li { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; color: var(--text-dim); font-size: 14px; }
.extra-times .et-time { font-weight: 700; font-variant-numeric: tabular-nums; }

.hint { margin-top: 18px; text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.5; }

/* Сад деяний + серия */
.garden { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; cursor: pointer; }
.garden:active { transform: scale(0.99); }
.garden-emoji { font-size: 42px; line-height: 1; transition: transform .2s ease; }
.garden-emoji.grew { animation: pop .5s ease; }
.garden-info { flex: 1; min-width: 0; }
.garden-label { font-size: 16px; font-weight: 700; }
.garden-label::before { content: "ⓘ "; color: var(--text-dim); font-size: 13px; font-weight: 600; }
.garden-next { margin-top: 3px; font-size: 12px; color: var(--text-dim); }
.streaks { text-align: center; }
.streak { display: flex; flex-direction: column; align-items: center; }
.streak span { font-size: 26px; font-weight: 800; color: var(--accent-strong); line-height: 1; }
.streak small { margin-top: 2px; font-size: 11px; color: var(--text-dim); }

/* Сунны */
.sunnahs { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.sunnah {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .08s;
}
.sunnah:active { transform: scale(0.99); }
.sunnah.done { background: var(--accent-soft); border-color: var(--accent-border); }

.sunnah-head { display: flex; align-items: flex-start; gap: 12px; }
.sunnah-head .check {
    margin-top: 2px; width: 24px; height: 24px; flex: 0 0 24px;
}
.sunnah.done .check { background: var(--accent); border-color: var(--accent); color: #fff; animation: pop .3s ease; }
.sunnah-group-title { margin: 6px 2px 2px; font-size: 13px; font-weight: 800; color: var(--accent-strong); }
.sunnahs .sunnah-group-title:first-child { margin-top: 0; }
.sunnah-title { font-size: 16px; font-weight: 700; }
.sunnah-desc { margin-top: 6px; color: var(--text); font-size: 14px; line-height: 1.45; opacity: .85; }
.sunnah-text { margin-top: 8px; font-size: 14px; line-height: 1.5; }
.sunnah-source {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--card-border);
    font-size: 12px; color: var(--text-dim);
}
.empty { color: var(--text-dim); text-align: center; padding: 24px 8px; line-height: 1.5; }

/* Азкары */
.azkar-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.azkar-tabs::-webkit-scrollbar { display: none; }
.azkar-chip {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--card-border);
    color: var(--text-dim);
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    transition: background .15s, color .15s, border-color .15s;
}
.azkar-chip.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.azkar-cat-title { font-size: 15px; font-weight: 800; color: var(--text); margin: 4px 2px 6px; }
.azkar-note { font-size: 13px; color: var(--text-dim); line-height: 1.45; margin: 0 2px 12px; }
.azkar-hadith {
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 2px 10px;
}
.azkar-hadith-text { font-size: 14px; line-height: 1.5; }
.azkar-hadith-src { margin-top: 8px; font-size: 12px; color: var(--text-dim); }

/* Свайп-колода: листаем по одной карточке */
.azkar-deck {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}
.azkar-deck::-webkit-scrollbar { display: none; }
.azkar.slide { flex: 0 0 100%; scroll-snap-align: center; max-height: 62vh; overflow-y: auto; }
.azkar-counter { text-align: center; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--text-dim); }

.azkar {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow);
}
.azkar.done { background: var(--accent-soft); border-color: var(--accent-border); }
.azkar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.azkar-title { font-size: 14px; font-weight: 700; color: var(--text-dim); }
.azkar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.azkar-repeat { font-size: 12px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.azkar-check { width: 26px; height: 26px; flex: 0 0 26px; cursor: pointer; }
.azkar.done .azkar-check { background: var(--accent); border-color: var(--accent); color: #fff; animation: pop .3s ease; }
.azkar-arabic {
    direction: rtl; text-align: right;
    font-size: 28px; line-height: 2.1;
    font-family: "Geeza Pro", "Traditional Arabic", "Scheherazade New", serif;
}
.azkar-translit { margin-top: 10px; font-size: 14px; line-height: 1.5; font-style: italic; color: var(--text-dim); }
.azkar-translation { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.azkar-source { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--card-border); font-size: 12px; color: var(--text-dim); }

/* Экран прогресса */
.stats { display: flex; gap: 12px; margin-bottom: 14px; }
.stat { flex: 1; text-align: center; }
.stat-row { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.stat-row span { font-size: 24px; font-weight: 800; color: var(--accent-strong); }
.stat-row small { font-size: 11px; color: var(--text-dim); }
.stat-name { margin-top: 6px; font-size: 12px; color: var(--text-dim); }

.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 5px; justify-content: start; }
.cell { width: 100%; aspect-ratio: 1; min-width: 14px; border-radius: 4px; background: var(--track); }
.cell.future { background: transparent; }
.cell.lvl1 { background: rgba(47,158,102,0.28); }
.cell.lvl2 { background: rgba(47,158,102,0.45); }
.cell.lvl3 { background: rgba(47,158,102,0.62); }
.cell.lvl4 { background: rgba(47,158,102,0.80); }
.cell.lvl5 { background: var(--accent); }

.legend { display: flex; align-items: center; gap: 5px; margin-top: 12px; justify-content: flex-end; }
.legend span { font-size: 11px; color: var(--text-dim); }
.legend .lvl { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.legend .lvl0 { background: var(--track); }
.legend .lvl1 { background: rgba(47,158,102,0.28); }
.legend .lvl2 { background: rgba(47,158,102,0.45); }
.legend .lvl3 { background: rgba(47,158,102,0.62); }
.legend .lvl4 { background: rgba(47,158,102,0.80); }
.legend .lvl5 { background: var(--accent); }
