:root {
    --tg-theme-bg-color: #0f172a;
    --tg-theme-text-color: #f8fafc;
    --tg-theme-hint-color: #94a3b8;
    --tg-theme-button-color: #3b82f6;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #1e293b;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2dd4bf 100%);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

.wrapper {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Full Screen States */
.full-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: var(--tg-theme-bg-color);
}

.loader-container {
    text-align: center;
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loader-text {
    font-weight: 800;
    letter-spacing: 2px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 45px;
    height: 45px;
    background: var(--accent-gradient);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.name {
    font-weight: 700;
    font-size: 1.1rem;
}

.status-online {
    font-size: 0.75rem;
    color: #2dd4bf;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-online::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #2dd4bf;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #2dd4bf;
}

.logo-text {
    font-weight: 900;
    font-size: 0.8rem;
    opacity: 0.2;
    letter-spacing: 3px;
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--tg-theme-hint-color);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ping-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--tg-theme-hint-color);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.ping-badge.active {
    background: rgba(45, 212, 191, 0.05);
    color: #f8fafc;
}

.ping-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.ping-badge.good .ping-dot { background: #2dd4bf; box-shadow: 0 0 8px #2dd4bf; }
.ping-badge.mid .ping-dot { background: #facc15; box-shadow: 0 0 8px #facc15; }
.ping-badge.bad .ping-dot { background: #f43f5e; box-shadow: 0 0 8px #f43f5e; }

.ping-badge.loading .ping-dot {
    animation: pulse 1s infinite;
}

.status-badge.active {
    background: rgba(45, 212, 191, 0.1);
    color: #2dd4bf;
}

.traffic-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--tg-theme-hint-color);
}

.stat-divider {
    width: 1px; height: 25px; background: var(--glass-border);
}

.progress-bg {
    height: 8px; background: rgba(255, 255, 255, 0.05); border-radius: 4px; overflow: hidden; margin-bottom: 8px;
}

.progress-fill {
    height: 100%; background: var(--accent-gradient); transition: width 1s ease;
}

.progress-labels {
    display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--tg-theme-hint-color);
}

/* Locations */
.locations-section { margin-bottom: 20px; }
.section-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; color: var(--tg-theme-hint-color); padding-left: 5px; }
.locations-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.locations-scroll::-webkit-scrollbar { display: none; }
.location-chip {
    white-space: nowrap; background: var(--glass-bg); padding: 8px 14px; border-radius: 12px; border: 1px solid var(--glass-border); font-size: 0.8rem; font-weight: 600;
}
.location-chip.special { background: rgba(59, 130, 246, 0.15); border-color: rgba(59, 130, 246, 0.3); }

/* Support Cards */
.help-card { padding: 0; overflow: hidden; margin-bottom: 25px; }
.help-item { display: flex; align-items: center; gap: 15px; padding: 15px; transition: background 0.2s; }
.help-item:active { background: rgba(255, 255, 255, 0.05); }
.help-icon { font-size: 1.4rem; width: 40px; height: 40px; display: flex; justify-content: center; align-items: center; background: rgba(255, 255, 255, 0.03); border-radius: 12px; }
.help-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 2px; }
.help-desc { font-size: 0.75rem; color: var(--tg-theme-hint-color); }
.help-divider { height: 1px; background: var(--glass-border); margin: 0 15px; }

/* Grid Info */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.mini-card { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 18px 15px; 
    border-radius: 22px; 
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#show-qr-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(30, 41, 59, 0.7) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

#install-btn {
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.15) 0%, rgba(30, 41, 59, 0.7) 100%);
    border-color: rgba(45, 212, 191, 0.3);
}

.mini-card:active {
    transform: scale(0.95);
}

#show-qr-btn:hover {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
}

#install-btn:hover {
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.2);
    border-color: rgba(45, 212, 191, 0.5);
}
.mini-icon { font-size: 1.1rem; transition: transform 0.3s ease; display: flex; align-items: center; justify-content: center; }

.custom-emoji {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.custom-emoji-small {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Кастомные анимации для "оживления" эмодзи */
.float-anim {
    animation: float 3s ease-in-out infinite;
    display: inline-block;
}

.pulse-anim {
    animation: pulse 2s ease-in-out infinite;
    display: inline-block;
}

.spin-anim {
    animation: spin-slow 8s linear infinite;
    display: inline-block;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.mini-value { font-size: 0.85rem; font-weight: 700; }

/* Store Buttons */
.store-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.store-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--glass-border); border-radius: 20px; background: var(--glass-bg); color: #fff; cursor: pointer; }
.store-btn span { font-size: 0.85rem; font-weight: 700; }

/* Accordion */
.accordion { text-align: left; margin-top: 10px; }
.accordion-item { border-bottom: 1px solid var(--glass-border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 15px 0; background: none; border: none; color: #fff; font-size: 0.95rem; font-weight: 700; cursor: pointer; }
.accordion-icon { font-size: 0.7rem; transition: transform 0.3s ease; opacity: 0.5; }
.accordion-item.active .accordion-icon { transform: rotate(180deg); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.accordion-item.active .accordion-body { max-height: 300px; padding-bottom: 15px; }

/* Scheme buttons layout in accordion */
.accordion-body .scheme-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scheme-btn { width: 100%; text-align: center; }

/* Modals */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); }
.modal-content { position: relative; width: 100%; max-width: 340px; padding: 25px; text-align: center; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.close-modal { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
.qr-container { background: #fff; padding: 15px; border-radius: 15px; margin-bottom: 15px; display: inline-block; }
.qr-container img { width: 200px; height: 200px; display: block; }
.qr-tip { font-size: 0.8rem; color: var(--tg-theme-hint-color); }

/* Install Options */
.os-group { margin-bottom: 20px; text-align: left; }
.os-label { font-size: 0.8rem; font-weight: 800; color: #3b82f6; margin-bottom: 10px; text-transform: uppercase; }
.scheme-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.scheme-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 0.8rem; font-weight: 600; cursor: pointer; }
.scheme-btn:active { background: #3b82f6; }

/* Buttons */
.footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.btn-main { background: var(--accent-gradient); color: #fff; border: none; padding: 16px; border-radius: 18px; font-size: 1rem; font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; box-shadow: 0 8px 15px rgba(59, 130, 246, 0.3); }
.btn-secondary { background: transparent; border: 1px solid var(--glass-border); color: var(--tg-theme-hint-color); padding: 14px; border-radius: 18px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }

/* Animations */
.animate-in { opacity: 0; transform: translateY(15px); animation: fadeInUp 0.5s forwards; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
.clickable:active { transform: scale(0.98); opacity: 0.8; }
