/**
         * DESIGN TOKENS & CSS VARIABLES
         * Описание: Ядро дизайн-системы. Все отступы, цвета и типографика хранятся здесь.
         */
:root {
    /* Colors */
    --bg-base: #0a0d14;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    --border-glass: rgba(255, 255, 255, 0.08);

    --accent-main: #57abc9;
    --accent-glow: rgba(87, 171, 201, 0.4);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --success: #4caf50;
    --danger: #ff5252;
    --warning: #ae5700;
    --warning-secondary: #857e00;
    --warning-glow: rgba(245, 124, 0, 0.4);

    /* Typography */
    --font-family: 'Inter', sans-serif;
    --text-h1: 600 20px/1.4 var(--font-family);
    --text-h2: 500 16px/1.4 var(--font-family);
    --text-body: 400 14px/1.5 var(--font-family);
    --text-caption: 400 12px/1.5 var(--font-family);

    /* Spacing */
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-24: 24px;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

button {
    background: none;
    border: none;
    cursor: pointer;
}

body {
    background-color: var(--bg-base);
    /* Outer background */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    font-family: var(--font-family);
    color: var(--text-primary);
    overflow: hidden;
}

/* Mobile Container 390x844 */
.app-container {
    width: 100%;
    height: 100dvh;
    background-color: var(--bg-base);
    position: relative;
    overflow: hidden;
    /* border-radius: 40px; */
    box-shadow: 0 0 50px rgba(87, 171, 201, 0.1);
    /* border: 8px solid #1a1f2e; */
}

/* Mobile Container Layout */
.app-container {
    display: flex;
    flex-direction: column;
}


/* Glassmorphism Mixin class */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

/* Typography Utilities */
h1 {
    font: var(--text-h1);
    margin-bottom: var(--space-16);
}

h2 {
    font: var(--text-h2);
    margin-bottom: var(--space-12);
}

p {
    font: var(--text-body);
}

.caption {
    font: var(--text-caption);
    color: var(--text-secondary);
}

/* Layout & Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 80px;
    /* Leave space for bottom nav */
    padding: var(--space-24) var(--space-16);
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
}

.screen::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.screen::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 6px;
}

/* Header Mini-profile */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-24);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: var(--space-12);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-main), #2c566b);
    overflow: hidden;
    padding: 2px;
    display: flex;
    align-items: center;
    animation: custom-rgb-rotate 3s linear infinite;
}

@keyframes custom-rgb-rotate {
    from {
        background-position: 50%;
    }

    to {
        background-position: 10%
    }
}

.balance-box {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    padding: var(--space-8) var(--space-12);
}

.balance-box i {
    color: var(--accent-main);
    font-size: 14px;
}

/* Announcements Carousel */
.carousel {
    display: flex;
    gap: var(--space-12);
    overflow-x: auto;
    /* scrollbar-width: 2px; 
            scrollbar-color: var(--border-glass) transparent;
            padding-bottom: var(--space-8); */
    margin-bottom: var(--space-24);
}

.carousel::-webkit-scrollbar {
    height: 3px;
}

.carousel::-webkit-scrollbar {
    display: none;
}

.announcement-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 240px;
    padding: var(--space-16);
    cursor: grab;
    /* Показываем, что контент можно схватить */
    user-select: none;
    /* Чтобы текст не выделялся при перетаскивании */
}

.announcement-card:hover {
    background: var(--bg-glass-hover);
}

.announcement-card h2 {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--accent-main);
    gap: 6px;
}

/* Main CTA Button */
.cta-container {
    position: sticky;
    top: var(--space-16);
    z-index: 10;
    margin-bottom: var(--space-24);
}

.btn {
    width: 100%;
    border: none;
    cursor: pointer;
    font: var(--text-h2);
    font-weight: 600;
    padding: var(--space-16);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-8);
}

.btn-primary {
    background: var(--accent-main);
    color: #000;
    box-shadow: 0 4px 20px var(--accent-glow);
    border: 1px solid transparent;
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-glass {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-glass:active {
    background: var(--bg-glass-hover);
}

/* Devices List */
.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-16);
    margin-bottom: var(--space-12);
}

.device-info {
    display: flex;
    align-items: center;
    gap: var(--space-12);
}

.ping-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font: var(--text-caption);
    color: var(--success);
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

/* Tariffs Cards */
.tariff-card {
    margin-bottom: var(--space-16);
    padding: var(--space-16);
    position: relative;
    overflow: hidden;
}

.tariff-card.active {
    border-color: var(--accent-main);
    box-shadow: inset 0 0 20px rgba(87, 171, 201, 0.05);
}

.tariff-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-12);
}

.price {
    color: var(--accent-main);
    font-weight: 600;
    font-size: 18px;
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(80px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(10, 13, 20, 0.8);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 20px;
}

.nav-item.active {
    color: var(--accent-main);
}

.nav-icon {
    width: 24px;
    height: 24px;
    background-color: currentColor;
    mask-size: cover;
    -webkit-mask-size: cover;
}

/* Modals */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    background: var(--bg-base);
    border-top: 1px solid var(--border-glass);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-24);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.modal-body {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 6px;
}

.device-row-container {
    display: grid;
    grid-template-rows: 0fr;
    /* Начальное состояние */
    transition: grid-template-rows 0.5s ease;
    overflow: hidden;
}

.device-row-container.expanded {
    grid-template-rows: 1fr;
    /* Конечный размер контента */
}

.device-row-content {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.device-row-content.visible {
    opacity: 1;
}

/* Добавляем в CSS */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.skel-shimmer {
    background: linear-gradient(
        90deg, 
        rgba(255, 255, 255, 0.03) 25%, 
        rgba(255, 255, 255, 0.08) 50%, 
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: skel-load 1.5s infinite linear;
}

.skel-text {
    border-radius: 4px;
}

@keyframes skel-load {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.promo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font: var(--text-h2);
    color: var(--accent-main);
    margin-bottom: 8px;
}

.promo-header i {
    font-size: 18px;
    padding: 4px;
    background-color: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    padding-right: 22px;
}

.modal-input {
    width: 100%;
    padding: var(--space-12);
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font: var(--text-body);
}

.other-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-16);
    margin-bottom: var(--space-16);
    gap: var(--space-16);
}

.other-item h2 {
    margin: 0;
}

.nickname-input {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-primary);
    font: var(--text-h2);
    font-weight: 600;
}
.nickname-input:focus {
    outline: none;
    border-bottom: 2px solid var(--accent-main);
}