/* ========================================================================
   ИГРАЙ — ДАШБОРД + слим-топбар + nav (редизайн 2026-06)
   Только новые dash-* / tb1-* классы. Токены — из styles.css :root.
   Mobile-first (~390px), тап-таргеты ≥44px, лейблы ≥11-12px, контент ≥15px.
   ======================================================================== */

/* ===================== TOPBAR — одна строка ===================== */
.topbar.topbar-slim { gap: 0; }
.topbar-row-single {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}
.topbar-row-single > button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 0 6px;
    border-radius: 6px;
}
.topbar-row-single > button:active { background: rgba(95, 180, 201, 0.08); }

.tb1-lvl {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}
.tb1-lvl span { color: var(--text-primary); }

/* день: тонкий XP-бар, растягивается */
.tb1-day { flex: 1 1 auto; min-width: 0; gap: 8px; }
.tb1-bar {
    flex: 1 1 auto;
    height: 5px;
    min-width: 40px;
    background: var(--bg-elev);
    border-radius: 3px;
    overflow: hidden;
}
.tb1-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--ds-chiral), var(--accent-light));
    transition: width 0.4s ease;
}
.tb1-bar-fill.full {
    background: linear-gradient(90deg, var(--ds-chiral), var(--ds-amber), var(--gold));
    box-shadow: 0 0 6px rgba(244, 209, 54, 0.5);
}
.tb1-day-xp {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.tb1-streak {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.tb1-money {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
#tb-balance.negative { color: var(--danger); }
#tb-balance.positive { color: var(--accent); }

/* ===================== BOTTOM NAV — 5 кнопок ===================== */
.nav.nav-bottom .nav-btn {
    min-height: 52px;
    flex: 1 1 0;     /* 5 кнопок ровно делят ширину, без скролла */
    min-width: 0;
}
.nav.nav-bottom .nav-label {
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* ===================== ДАШБОРД: карточки ===================== */
/* ВАЖНО: только .active — иначе ID-селектор перебьёт .view { display:none } */
#view-dashboard.active { display: flex; flex-direction: column; gap: 10px; }

.dash-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px 16px;
}
/* cyan-полоска сверху-слева, как у .card / cargo-карточек */
.dash-card::before {
    content: '';
    position: absolute;
    top: -1px; left: 0;
    width: 50px; height: 2px;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(95, 180, 201, 0.5);
    border-radius: 0 1px 1px 0;
}

.dash-sec-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.dash-sec-meta { color: var(--text-secondary); letter-spacing: 1px; }

.dash-placeholder {
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px 0;
    line-height: 1.5;
}

/* ===================== [ДЕНЬ] ===================== */
/* закрытый день — золотая рамка */
.dash-day-card.closed {
    border-color: rgba(244, 209, 54, 0.45);
    box-shadow: 0 0 16px rgba(244, 209, 54, 0.08);
}
.dash-day-card.closed::before { background: var(--gold); box-shadow: 0 0 6px rgba(244, 209, 54, 0.6); }

.dash-day-badge {
    display: inline-block;
    margin: 10px 0 2px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--gold);
    border: 1px solid rgba(244, 209, 54, 0.4);
    border-radius: 4px;
    background: rgba(244, 209, 54, 0.07);
}

/* крупный XP-бар дня */
.dash-xp-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.dash-xp-bar {
    flex: 1 1 auto;
    height: 12px;
    background: var(--bg-elev);
    border-radius: 6px;
    overflow: hidden;
}
.dash-xp-fill {
    height: 100%;
    border-radius: 6px;
    /* градиент cyan → amber → gold; видимая часть зависит от ширины заливки */
    background: linear-gradient(90deg, var(--ds-chiral) 0%, var(--ds-amber) 70%, var(--gold) 100%);
    transition: width 0.45s ease;
}
.dash-xp-num {
    font-size: 18px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.dash-xp-num b { color: var(--text-primary); font-weight: 700; }

/* МЖД — 3 чипа */
.dash-mjd {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.dash-mjd-chip {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 4px;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dash-mjd-chip:active { transform: scale(0.97); }
.dash-mjd-chip .dash-mjd-icon { font-size: 14px; }
.dash-mjd-chip .dash-mjd-check { font-size: 12px; opacity: 0.8; }
.dash-mjd-chip.done {
    background: rgba(95, 180, 201, 0.16);
    border-color: var(--accent);
    color: var(--accent-light);
}

/* чекины: сон / энергия / настроение */
.dash-checkins {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.dash-checkin {
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}
.dash-checkin:active { background: rgba(95, 180, 201, 0.08); }
.dash-checkin-val {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.dash-checkin-lbl {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
}
.dash-checkin.empty { border-style: dashed; }
.dash-checkin.empty .dash-checkin-val { color: var(--text-muted); font-weight: 400; }

/* привычки на сегодня */
.dash-habits {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dash-habit {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 4px 2px;
    border-bottom: 1px solid var(--glass-border-light);
}
.dash-habit:last-child { border-bottom: none; }
.dash-habit.done { opacity: 0.55; }
.dash-habit.done .dash-habit-name { text-decoration: line-through; text-decoration-color: var(--text-muted); }

.dash-habit-check {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--habit-c, var(--accent));
    background: transparent;
    color: var(--habit-c, var(--accent));
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.16s, background 0.18s, box-shadow 0.18s;
}
.dash-habit-check:active { transform: scale(0.9); }
.dash-habit-check.done {
    background: var(--habit-c, var(--accent));
    color: var(--bg-dark);
    box-shadow: 0 0 12px rgba(95, 180, 201, 0.35);
}

.dash-habit-emoji { font-size: 16px; flex-shrink: 0; }
.dash-habit-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-habit-streak {
    font-size: 12px;
    color: #E0A060;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.dash-habit-xp {
    font-size: 12px;
    color: var(--accent);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ===================== [РАУНД] ===================== */
.dash-round-start {
    width: 100%;
    min-height: 54px;
    background: rgba(95, 180, 201, 0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: var(--accent-light);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.dash-round-start:active { transform: scale(0.98); background: rgba(95, 180, 201, 0.2); }
/* когда раунд идёт (body.round-active ставит ROUNDS.setCurrent) — кнопка прячется,
   виден hero pixel-таймер #dash-round-pixel (им управляет ROUNDS) */
body.round-active .dash-round-start { display: none; }
.dash-round-card .round-pixel-dash { margin-bottom: 0; }

/* ===================== [СЕГОДНЯ ИЗ APPLE] ===================== */
.dash-evs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}
.dash-ev {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-height: 28px;
    padding: 3px 8px 3px 10px;
    border-left: 2px solid transparent;
}
.dash-ev-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    min-width: 86px;
}
.dash-ev.allday .dash-ev-time { min-width: 86px; }
.dash-ev-title {
    font-size: 15px;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-ev.now {
    border-left-color: var(--accent);
    background: rgba(95, 180, 201, 0.06);
}
.dash-ev.now .dash-ev-time { color: var(--accent); }
.dash-ev.past { opacity: 0.45; }

.dash-rems {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dash-rem {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 4px 6px 4px 8px;
    border-left: 2px solid transparent;
    border-bottom: 1px solid var(--glass-border-light);
}
.dash-rem:last-child { border-bottom: none; }
.dash-rem.overdue { border-left-color: var(--ds-amber); }
.dash-rem.done { opacity: 0.5; }
.dash-rem.done .dash-rem-title { text-decoration: line-through; text-decoration-color: var(--text-muted); }

.dash-rem-check {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.16s, background 0.18s;
}
.dash-rem-check:active { transform: scale(0.9); }
.dash-rem-check.done { background: var(--accent); color: var(--bg-dark); }
.dash-rem.overdue .dash-rem-check { border-color: var(--ds-amber); color: var(--ds-amber); }

.dash-rem-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.dash-rem-title {
    font-size: 15px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-rem-list {
    font-size: 11px;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
.dash-rem.overdue .dash-rem-list { color: var(--ds-amber); }

.dash-rem-go {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.dash-rem-go:active { background: rgba(95, 180, 201, 0.12); color: var(--accent); }

/* ===================== [СТОДНЕВКА] ===================== */
.dash-hundred-card { cursor: pointer; }
.dash-hundred-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
}
.dash-hd {
    aspect-ratio: 1;
    border-radius: 2px;
    background: var(--cal-level-0-bg);
    border: 1px solid var(--cal-level-0-border);
}
.dash-hd.on {
    background: var(--accent);
    border-color: transparent;
    box-shadow: 0 0 4px rgba(95, 180, 201, 0.4);
}
.dash-hd.off { background: #0B1015; border-color: #1C242E; }
.dash-hd.future { opacity: 0.22; }
.dash-hd.today {
    outline: 2px solid var(--ds-amber);
    outline-offset: 1px;
    animation: dashHdPulse 2s ease-in-out infinite;
}
@keyframes dashHdPulse {
    0%, 100% { box-shadow: 0 0 0 rgba(220, 141, 24, 0); }
    50% { box-shadow: 0 0 8px rgba(220, 141, 24, 0.7); }
}

.dash-hundred-meta {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===================== [ВЕКТОРЫ · 7 ДНЕЙ] ===================== */
.dash-vectors-card #dash-vectors-body {
    display: flex;
    flex-direction: column;
}
.dash-vec {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 2px 4px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--glass-border-light);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    width: 100%;
}
.dash-vec:last-child { border-bottom: none; }
.dash-vec:active { background: rgba(95, 180, 201, 0.06); }

.dash-vec-icon {
    flex-shrink: 0;
    width: 18px; height: 18px;
    color: var(--v-color, var(--accent));
    display: flex; align-items: center; justify-content: center;
}
.dash-vec-icon svg { width: 100%; height: 100%; }

.dash-vec-name {
    flex-shrink: 0;
    width: 92px;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    white-space: nowrap;
}
.dash-vec-weak {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--ds-amber);
    box-shadow: 0 0 5px rgba(220, 141, 24, 0.8);
    flex-shrink: 0;
}

.dash-vec-bar {
    flex: 1 1 auto;
    height: 6px;
    background: var(--bg-elev);
    border-radius: 3px;
    overflow: hidden;
}
.dash-vec-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--v-color, var(--accent));
    opacity: 0.85;
    transition: width 0.4s ease;
}

.dash-vec-num {
    flex-shrink: 0;
    width: 38px;
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* ===================== последняя ачивка ===================== */
.dash-ach-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass-bg);
}
.dash-ach-icon {
    flex-shrink: 0;
    width: 20px; height: 20px;
    color: var(--gold);
    display: flex; align-items: center; justify-content: center;
}
.dash-ach-icon svg { width: 100%; height: 100%; }
.dash-ach-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
}
.dash-ach-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===================== desktop (≥900px) ===================== */
@media (min-width: 900px) {
    /* дашборд-грид из styles.css раскладывает .dash-card по колонкам;
       день и apple — на всю ширину, они самые плотные */
    #view-dashboard.active { display: grid; }
    #view-dashboard.active > .dash-day-card,
    #view-dashboard.active > .dash-apple-card,
    #view-dashboard.active > .dash-ach-row { grid-column: 1 / -1; }
    /* карта в СТАТАХ — full row, по центру */
    #view-stats.active > .card-map {
        grid-column: 1 / -1;
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
    }
}

/* ===================== reduced motion ===================== */
@media (prefers-reduced-motion: reduce) {
    .dash-hd.today { animation: none; }
    .dash-xp-fill, .dash-vec-fill, .tb1-bar-fill { transition: none; }
}
