:root {
    --bg-color: var(--tg-theme-bg-color, #1c1c1e);
    --text-color: var(--tg-theme-text-color, #ffffff);
    --card-bg: var(--tg-theme-secondary-bg-color, #2c2c2e);
    --hint-color: var(--tg-theme-hint-color, #8e8e93);
    --btn-blue: var(--tg-theme-button-color, #007aff);
    --btn-text: var(--tg-theme-button-text-color, #ffffff);
    --separator: rgba(128,128,128,0.2);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: 80px; /* Отступ под нижнее меню */
    -webkit-tap-highlight-color: transparent;
}

/* --- TABS (Нижнее меню) --- */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background-color: var(--card-bg);
    border-top: 1px solid var(--separator);
    display: flex; justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.tab-btn {
    background: none; border: none;
    color: var(--hint-color);
    font-size: 10px; font-weight: 600;
    display: flex; flex-direction: column; align-items: center;
    cursor: pointer;
}

.tab-btn.active { color: var(--btn-blue); }
.tab-icon { font-size: 20px; margin-bottom: 2px; }

/* --- SECTIONS --- */
.section { display: none; padding: 15px; }
.section.active { display: block; }

/* --- COMMON --- */
.header { font-size: 22px; font-weight: 800; margin-bottom: 15px; padding: 0 5px; }
.server-title { color: var(--hint-color); font-size: 12px; font-weight: 600; text-transform: uppercase; margin: 20px 0 8px 5px; }

.card {
    background-color: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

/* --- SIMULATORS LIST --- */
.sim-row { border-bottom: 1px solid var(--separator); }
.sim-row:last-child { border-bottom: none; }

.sim-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; cursor: pointer; transition: background 0.2s;
}
.sim-header:active { background-color: rgba(255,255,255,0.05); }

.sim-info-block { display: flex; align-items: center; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 12px; flex-shrink: 0; }
.status-green { background-color: #30d158; box-shadow: 0 0 6px rgba(48,209,88,0.4); }
.status-yellow { background-color: #ffd60a; }
.status-red { background-color: #ff453a; }
.status-gray { background-color: #8e8e93; }

.sim-name { font-size: 17px; font-weight: 500; }
.sim-meta { font-size: 13px; color: var(--hint-color); margin-top: 2px; }

.sim-actions {
    display: none; padding: 0 16px 16px 16px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* --- BUTTONS --- */
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn {
    background-color: var(--btn-blue);
    color: var(--btn-text);
    border: none; padding: 12px; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer; text-align: center;
    width: 100%;
}
.btn-secondary { background-color: rgba(128,128,128,0.2); color: var(--text-color); }
.btn-danger { background-color: rgba(255, 69, 58, 0.15); color: #ff453a; }
.btn-purple { background-color: #5856d6; color: white; }
.btn:active { opacity: 0.7; transform: scale(0.98); }

/* --- STATS --- */
.stats-box { 
    background: rgba(0,0,0,0.2); 
    border-radius: 12px; 
    padding: 10px; 
    margin-top: 15px; 
    border: 1px solid rgba(255,255,255,0.05);
}
.stat-row { display: flex; justify-content: space-between; margin-bottom: 8px; border-bottom: 1px solid #444; padding-bottom: 5px; }
.stat-label { font-size: 10px; color: var(--hint-color); }
.stat-val { font-weight: bold; }

.loader { text-align: center; padding: 40px; color: var(--hint-color); }

/* --- MODAL (Popups) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
    opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.open { display: flex; opacity: 1; }

.modal {
    background: var(--card-bg);
    width: 90%; max-width: 400px;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transform: scale(0.9); transition: transform 0.2s;
    max-height: 85vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 15px; }
.modal-body { margin-bottom: 20px; font-size: 14px; line-height: 1.5; }

/* Form Elements */
.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 12px; color: var(--hint-color); margin-bottom: 5px; }
.form-input, .form-select {
    width: 100%; padding: 12px;
    background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; color: var(--text-color); font-size: 16px;
    box-sizing: border-box;
}
.form-input:focus { border-color: var(--btn-blue); outline: none; }

.modal-footer { display: flex; gap: 10px; }

/* --- BROWSER BLOCKER --- */
#browser-blocker {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 9999;
    display: none; /* Скрыт, пока JS не решит показать */
    flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 20px;
}

/* --- BLOCKERS --- */
#browser-blocker, #permission-blocker {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: #000;
    z-index: 9999;
    display: none; /* Скрыты по умолчанию, JS включит нужный */
    flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 20px;
}

.blocker-icon { font-size: 60px; margin-bottom: 20px; }
.blocker-title { font-size: 24px; font-weight: bold; margin-bottom: 10px; color: #fff; }
.blocker-text { color: #8e8e93; font-size: 16px; max-width: 300px; line-height: 1.5; }

/* --- APP CONTENT --- */
/* ВАЖНО: Скрываем приложение по умолчанию! */
#app-content { 
    display: none; 
}