:root {
    --bg-color: #0b1118;
    --card-bg: rgba(23, 33, 43, 0.8);
    --text-main: #ffffff;
    --text-dim: #8ba3ad;
    --accent: #00d2ff;
    --accent-glow: rgba(0, 210, 255, 0.3);
    --success: #2ecc71;
    --nav-bg: #17212b;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at top right, #1a2a3a, var(--bg-color));
    color: var(--text-main);
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 100px; 
}

/* --- HEADER (ШАПКА) --- */
.user-header {
    padding: 12px 15px;
    background: var(--nav-bg);
    display: grid;
    grid-template-columns: 3fr 4fr 3fr; 
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.user-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--accent), #0080ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px var(--accent-glow);
    background-size: cover;
    background-position: center;
}

.name-status {
    display: flex;
    flex-direction: column;
}

.name-status h3 {
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
}

.status {
    font-size: 9px;
    color: var(--success);
    margin-top: -1px;
    opacity: 0.9;
}

.balance-center {
    display: flex;
    justify-content: center;
}

.balance-badge {
    background: rgba(0, 210, 255, 0.1);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    color: var(--accent);
    font-size: 14px;
    box-shadow: inset 0 0 5px var(--accent-glow);
}

.header-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.mini-btn {
    border: none;
    padding: 4px 0;
    border-radius: 6px;
    font-size: 9px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    width: 85px;
    text-align: center;
    transition: 0.2s;
}

.mini-btn.deposit {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.mini-btn.withdraw {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mini-btn:active {
    transform: scale(0.95);
}

/* --- КОНТЕНТ ТА КАРТКИ --- */
.content {
    background-color: #0d2a35 !important;
    height: calc(100vh - 140px); 
    padding: 20px 15px;
    overflow-y: auto; 
    overflow-x: hidden;
    padding-bottom: 50px !important; 
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch; 
}

.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 10px;
}

.card {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(0, 255, 255, 0.1) !important;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.card h4 {
    color: #00d4ff;
    margin-top: 0;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-item {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 12px;
    text-align: center;
}

.stat-item span { font-size: 11px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.stat-item strong { color: var(--accent); font-size: 1.1em; }

.action-btn {
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: bold;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
    transition: transform 0.2s;
}

.action-btn:active { transform: scale(0.98); }

.ref-box {
    background: rgba(0,0,0,0.3);
    border: 1px dashed rgba(255,255,255,0.2);
    color: var(--accent);
}

/* --- СТОРІНКИ ТА АНІМАЦІЯ --- */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- FLOATING DOCK (iOS 26 STYLE) --- */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 15px;
    right: 15px;
    background: rgba(23, 33, 43, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex; 
    justify-content: space-around;
    padding: 8px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.nav-item {
    position: relative;
    flex: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 20px; /* Для емодзі */
}

.nav-item span {
    margin-top: 4px;
    font-size: 9px;
    font-weight: 600;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 90%;
    background: rgba(0, 210, 255, 0.2); 
    border-radius: 18px;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.15);
    z-index: -1;
}

.nav-item.active {
    color: #fff;
    transform: translateY(-2px);
}

.nav-item.active span {
    opacity: 1;
    color: var(--accent);
}

@keyframes glowPulse {
    0% { background: rgba(0, 210, 255, 0.1); }
    50% { background: rgba(0, 210, 255, 0.25); }
    100% { background: rgba(0, 210, 255, 0.1); }
}



.ios-share-btn-green {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    background: linear-gradient(135deg, #34c759 0%, #2ecc71 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
    margin: 0 auto;
}

.ios-share-btn-green:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.2);
    filter: brightness(0.9);
}

#refs-count-label {
    font-variant-numeric: tabular-nums;
}



/* ЗАВДАННЯ */
.top-tabs .tab-item {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 9px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.top-tabs .tab-item.active {
    background: var(--nav-bg);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.task-card-manage {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.mini-ctrl-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    background: rgba(255,255,255,0.05);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-ctrl-btn.deposit { background: rgba(46, 204, 113, 0.15); color: #2ecc71; border: 1px solid rgba(46, 204, 113, 0.2); }
.mini-ctrl-btn.pause { background: rgba(255, 183, 3, 0.15); color: #ffb703; border: 1px solid rgba(255, 183, 3, 0.2); }
.mini-ctrl-btn.delete { background: rgba(231, 76, 60, 0.15); color: #e74c3c; border: 1px solid rgba(231, 76, 60, 0.2); }
.mini-ctrl-btn.stats { background: var(--accent); color: #000; }
.mini-ctrl-btn:active { transform: scale(0.9); }

.radio-tab {
    display: block;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85em;
    cursor: pointer;
    transition: 0.2s;
}

.radio-tab:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--accent);
}

.radio-tab input {
    margin-right: 8px;
}

/* Додаткові стилі для альтернативних табів */
.top-tabs .tab-item-alt {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 9px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.top-tabs .tab-item-alt.active-alt {
    background: var(--nav-bg);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* --- СТИЛІ ДЛЯ ТРЕТЬОЇ СТОРІНКИ (EXTERNAL) --- */
.top-tabs .tab-item-ext {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    font-size: 0.75em;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 9px;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Активний стан для третьої сторінки */
.top-tabs .tab-item-ext.active-ext {
    background: var(--nav-bg);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}



/* Для внутрішніх завдань */
.tab-item-alt.active-alt {
    background: rgba(255, 183, 3, 0.2) !important;
    color: #ffb703 !important;
}

/* Для зовнішніх завдань */
.tab-item-ext.active-ext {
    background: rgba(255, 183, 3, 0.2) !important;
    color: #ffb703 !important;
}

/* Для "Додати завдання" */
.tab-item.active {
    background: rgba(255, 183, 3, 0.2) !important;
    color: #ffb703 !important;
}



/* Плитки выбора типа */
.task-type-card {
    display: block;
    cursor: pointer;
    position: relative;
}

.task-type-card input {
    position: absolute;
    opacity: 0;
}

.task-type-card .card-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: 0.2s;
}

.task-type-card .icon {
    font-size: 1.5em;
    background: rgba(255, 255, 255, 0.05);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.task-type-card .title {
    font-weight: bold;
    font-size: 0.9em;
    color: #fff;
}

.task-type-card .desc {
    font-size: 0.7em;
    color: var(--text-dim);
}

/* Активний стан плитки */
.task-type-card input:checked + .card-content {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.task-type-card input:checked + .card-content .icon {
    background: var(--accent);
    color: #000;
}

/* Переключатели (Chips) */
.method-chip {
    flex: 1;
    cursor: pointer;
    text-align: center;
}

.method-chip input { position: absolute; opacity: 0; }

.method-chip span {
    display: block;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 0.8em;
    color: var(--text-dim);
}

.method-chip input:checked + span {
    background: #fff;
    color: #000;
    font-weight: bold;
}

.ios-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 12px;
    color: #fff;
    box-sizing: border-box;
    outline: none;
}

#channel-verify-info, #bot-verify-token, #verification-method-block {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Анімація появи */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-field {
    animation: slideIn 0.3s ease forwards;
}

@keyframes textPulsate {
    0% {
        opacity: 1;
        text-shadow: 0 0 0px rgba(255, 255, 0, 0);
    }
    50% {
        opacity: 0.7; /* Текст стає трохи прозорішим */
        color: #fffb00; /* Або змінює колір на яскраво-жовтий */
        text-shadow: 0 0 8px rgba(255, 255, 0, 0.6); /* Додаємо легке світіння навколо літер */
    }
    100% {
        opacity: 1;
        text-shadow: 0 0 0px rgba(255, 255, 0, 0);
    }
}

/* Для підтримки старих браузерів */
@-webkit-keyframes textPulsate {
    0% { opacity: 1; }
    50% { opacity: 0.7; color: #fffb00; text-shadow: 0 0 8px rgba(255, 255, 0, 0.6); }
    100% { opacity: 1; }
}