* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    /* Пламя и Тьма: статичный градиент */
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 30%, #3a3a3a 60%, #2a2a2a 100%);
    min-height: 100vh;
    color: #f7fafc;
    overflow-x: hidden;
    /* Telegram WebApp safe area support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    /* Добавляем тонкие блики */
    position: relative;
}

/* Специальные стили для Telegram WebApp */
@media (display-mode: standalone) {
    body {
        padding-top: max(env(safe-area-inset-top), 50px);
    }
}

/* Дополнительный отступ для iOS в Telegram */
@supports (-webkit-touch-callout: none) {
    body {
        padding-top: max(env(safe-area-inset-top), 44px);
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(29, 78, 216, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 20px 100px 20px; /* Базовые отступы */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Дополнительные отступы для Telegram WebApp */
@media (display-mode: standalone) {
    .container {
        padding-top: max(env(safe-area-inset-top), 60px);
    }
}

/* Отступы для iOS в Telegram */
@supports (-webkit-touch-callout: none) {
    .container {
        padding-top: max(env(safe-area-inset-top), var(--tg-safe-top, 50px));
    }
}

/* Использование переменной для всех Telegram WebApp */
body.telegram-webapp .container {
    padding-top: max(env(safe-area-inset-top), var(--tg-safe-top, 60px)) !important;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.exercise-btn[disabled] {
    cursor: not-allowed;
    opacity: .6;
}

.emoji {
    font-size: 1.5em;
    margin-right: 10px;
}

.session-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
}

.session-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.session-item {
    text-align: center;
}

.session-count {
    font-size: 2em;
    font-weight: bold;
    /* Синие цифры активности */
    color: #3b82f6;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.session-label {
    font-size: 0.9em;
    opacity: 0.8;
    color: #cbd5e0;
}

.button {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.button-primary {
    /* Синяя кнопка */
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.button-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.button-test {
    background: #fbbf24;
    color: #1f2937;
}

.button-danger {
    background: #ef4444;
    color: white;
}

.exercise-screen {
    display: none;
}

.exercise-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.exercise-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.exercise-btn.active {
    /* Синяя активная кнопка упражнения */
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.exercise-btn.inactive {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.camera-container {
    background: #333333;
    border-radius: 20px;
    padding: 5px;
    margin-bottom: 20px;
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
}

.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6b7280;
}

.camera-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transform: scaleX(-1);
}

.camera-status {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.status-recording {
    background: #ef4444;
}

.status-paused {
    background: #ffffff0a;
}

.pose-indicator {
    position: absolute;
    top: 60px;
    left: 15px;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.pose-up {
    background: #22c55e;
}

.pose-down {
    background: #3b82f6;
}

.pose-neutral {
    background: #6b7280;
}

.count-display {
    text-align: center;
    margin-bottom: 30px;
}

.count-number {
    position: absolute;
    top: 8px;
    z-index: 10;          /* выше видео/канваса */
    right: 8px;
    font-size: 2.3em;
    font-weight: bold;
    /* Синий счетчик */
    color: #3b82f6;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
    margin-bottom: 10px;
}

.count-label {
    font-size: 1.1em;
    opacity: 0.8;
}

.diagnostic-panel {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 15px;
    margin-top: 20px;
    font-size: 0.8em;
}

.diagnostic-title {
    font-weight: 600;
    margin-bottom: 10px;
}

.diagnostic-item {
    margin-bottom: 5px;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.back-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1em;
    cursor: pointer;
    margin-bottom: 20px;
}

.back-btn:hover {
    color: white;
}

h3 {
  margin: 0 0 12px; /* сверху 0, снизу 12px */
}

p {
  margin: 12px 0 12px; /* снизу 12px — чаще всего достаточно */
}

/* ===== ИГРОВОЙ НИЖНИЙ ТАББАР: СИНИЙ И ТЕМНЫЙ ===== */
.game-tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    /* Угольно-черный таббар */
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(45, 45, 45, 0.5);
    display: flex;
    justify-content: space-around;
    padding: 6px 20px calc(20px + env(safe-area-inset-bottom));
    z-index: 1000;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.8);
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px 12px;
    border-radius: 15px;
    position: relative;
    min-width: 50px;
}

.tab-item:hover {
    /* Темное свечение при наведении */
    background: rgba(45, 45, 45, 0.3);
    transform: translateY(-2px);
    animation: darkGlow 1s ease-in-out infinite alternate;
}

.tab-item.active {
    /* Активный таб без оранжевого фона */
    background: rgba(45, 45, 45, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(80, 80, 80, 0.3);
}

.tab-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tab-item.disabled:hover {
    background: none;
    transform: none;
    animation: none;
}

.tab-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    transition: all 0.3s ease;
}

.tab-item.active .tab-icon {
    animation: pulse 2s infinite;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.tab-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.tab-item.active .tab-label {
    opacity: 1;
    color: #ffffff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

.tab-item.disabled .tab-label::after {
    content: " 🔒";
    font-size: 8px;
}

/* ===== ГЕЙМИФИЦИРОВАННЫЕ СТИЛИ: СИНИЙ И ТЕМНЫЙ ===== */
.game-header {
    /* Темная угольная основа */
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.9), rgba(45, 45, 45, 0.7));
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(80, 80, 80, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.game-header h1 {
    /* Синий градиент для заголовка */
    background: linear-gradient(135deg, #3b82f6, #2563eb, #1d4ed8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    animation: blueGlow 3s ease-in-out infinite alternate;
}

.game-card {
    /* Темная угольная карточка */
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.8), rgba(45, 45, 45, 0.6));
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid rgba(80, 80, 80, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(80, 80, 80, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.xp-bar-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 15px;
}

.xp-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.xp-percentage {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 0px;
}

.level-left,
.level-right {
    font-weight: 700;
    font-size: 16px;
    color: #3b82f6;
    min-width: 20px;
    text-align: center;
    text-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
}

.xp-bar {
    background: rgba(0, 0, 0, 0.6);
    height: 8px;
    flex-grow: 1;
    overflow: hidden;
    border: 1px solid rgba(80, 80, 80, 0.4);
    align-items: center;
}

.xp-progress {
    /* Синий прогресс бар */
    background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
    height: 100%;
    border-radius: 10px;
    animation: blueShimmer 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Стили для профиля */
.character-stats .xp-bar {
    width: 200px;
    margin: 0px auto 0;
}

.character-stats .xp-bar-row {
    align-items: center;
}

.character-medals {
    display: flex;
    align-items: center;
    gap: 5px;
}

.character-medals::before {
    content: '';
    display: block;
    width: 24px;
    height: 25px;
    background: url('./icons/medal-icons.svg') no-repeat center;
    background-size: contain;
}


/* ===== АНИМАЦИИ: ПЛАМЯ И ТЬМА ===== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes blueGlow {
    0% { text-shadow: 0 0 15px rgba(59, 130, 246, 0.4), 0 0 25px rgba(59, 130, 246, 0.3); }
    100% { text-shadow: 0 0 25px rgba(59, 130, 246, 0.6), 0 0 35px rgba(59, 130, 246, 0.4); }
}

@keyframes blueShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes darkGlow {
    0% { box-shadow: 0 0 8px rgba(80, 80, 80, 0.3); }
    100% { box-shadow: 0 0 15px rgba(80, 80, 80, 0.5); }
}

@keyframes subtleGradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes subtleGlow {
    0% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* ===== СТРАНИЦЫ ТАБОВ ===== */
.tab-screen {
    display: none;
    flex: 1;
}

.tab-screen.active {
    display: flex;
    flex-direction: column;
}

.coming-soon {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0.7;
}

.coming-soon-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.coming-soon h2 {
    margin-bottom: 10px;
    font-size: 1.5em;
}

.coming-soon p {
    opacity: 0.7;
    max-width: 250px;
}

/* ===== ЦЕНТРАЛЬНЫЙ ТАБ КАРЬЕРА (теперь обычного размера) ===== */
/* Специальные стили для карьеры убраны - теперь обычный таб */

/* ===== КАРЬЕРА - УРОВНИ И ПРОГРЕСС ===== */
.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 0.9em;
}

.level-progress {
    opacity: 0.8;
}

.level-requirements {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.requirement-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px 15px;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.requirement-icon {
    grid-row: 1 / 3;
    font-size: 2em;
    opacity: 0.8;
}

.requirement-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.requirement-name {
    font-weight: 600;
    font-size: 1.1em;
}

.requirement-progress {
    font-size: 0.9em;
    opacity: 0.8;
    color: #3b82f6;
}

.requirement-bar {
    grid-column: 2 / 4;
    height: 6px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(80, 80, 80, 0.3);
}

.requirement-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 4px rgba(59, 130, 246, 0.4);
}

.rewards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;        /* расстояние между элементами */
    padding: 8px;     /* отступ от краёв контейнера */
}

.rewards-grid > * {
    padding: 8px;     /* внутренний отступ самой карточки */
    box-sizing: border-box;
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-icon {
    font-size: 1.5em;
}

.reward-text {
    font-weight: 600;
    color: #3b82f6;
}

/* ===== ПРОФИЛЬ - ПЕРСОНАЖ И ИНВЕНТАРЬ ===== */
.character-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
}

.character-avatar {
    font-size: 4em;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(59, 130, 246, 0.3);
    margin-bottom: 15px;
}

.character-name {
    font-size: 1.3em;
    font-weight: 700;
    color: #3b82f6;
}

.character-level {
    font-size: 1.1em;
    font-weight: 600;
    color: #fbbf24;
    margin-top: 5px;
}

.character-medals {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 1.1em;
    font-weight: 700;
    color: #3b82f6;
    text-shadow: 0 0 4px rgba(59, 130, 246, 0.3);
}

.character-stats {
    font-size: 0.9em;
    margin-top: 15px;
    opacity: 0.8;
}

.inventory-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.inventory-tab {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.inventory-tab.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
}

.inventory-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.inventory-item.active {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.inventory-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.item-preview {
    font-size: 2em;
    margin-bottom: 8px;
}

.item-name {
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 4px;
}

.item-status {
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-price {
    font-size: 0.7em;
    color: #3b82f6;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: #3b82f6;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}