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

:root {
    --bg: var(--tg-theme-bg-color, #17212b);
    --bg-secondary: var(--tg-theme-secondary-bg-color, #232e3c);
    --text: var(--tg-theme-text-color, #ffffff);
    --hint: var(--tg-theme-hint-color, #7d8b99);
    --link: var(--tg-theme-link-color, #5288c1);
    --button: var(--tg-theme-button-color, #5288c1);
    --button-text: var(--tg-theme-button-text-color, #ffffff);
    --positive: #4caf50;
    --negative: #ef5350;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    overflow: hidden;
}

.app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* === Экраны === */
.screen {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px 90px;
    display: block;
    animation: fadeIn 0.2s ease;
}
.screen.hidden { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Заголовки === */
.header { margin-bottom: 20px; }
.header h1 { font-size: 26px; font-weight: 600; }
.date { color: var(--hint); font-size: 14px; margin-top: 4px; }
.subtitle { color: var(--hint); font-size: 14px; margin-bottom: 20px; }

/* === Карточки === */
.card {
    background: var(--bg-secondary);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
}
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 500;
    color: var(--hint);
}
.card-icon { font-size: 18px; }
.card-title { text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; }

.card-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.stat {
    flex: 1;
    min-width: 0;
}
.stat-label {
    font-size: 12px;
    color: var(--hint);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 17px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat-value.positive { color: var(--positive); }
.stat-value.negative { color: var(--negative); }

.card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 13px;
    color: var(--hint);
}
.card-footer span { color: var(--text); font-weight: 500; }

.coach-hint {
    font-size: 14px;
    color: var(--hint);
    line-height: 1.5;
}

/* === Кнопка === */
.btn-primary {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: var(--button);
    color: var(--button-text);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn-primary:active { opacity: 0.7; }

/* === Нижнее меню === */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
    z-index: 100;
}
.tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--hint);
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: color 0.15s;
}
.tab-icon { font-size: 20px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 500; }
.tab.active { color: var(--link); }
