/* ===== Общие стили ===== */
:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border-radius: 12px;
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Индикатор подключения ===== */
.connection-status {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    transition: all 0.3s ease;
    user-select: none;
}

.connection-online {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.connection-offline {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.3);
    animation: pulse-offline 2s ease-in-out infinite;
}

.connection-connecting {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
    border: 1px solid rgba(243, 156, 18, 0.3);
    animation: pulse-connecting 1.5s ease-in-out infinite;
}

@keyframes pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes pulse-connecting {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: flex;
    justify-content: center;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
}

/* ===== Кнопки ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent);
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    padding: 8px;
}

.btn-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ===== Полоски статов ===== */
.stat-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.stat-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    width: 60px;
    flex-shrink: 0;
}

.stat-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.stat-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

.stat-fill.green { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.stat-fill.yellow { background: linear-gradient(90deg, #f39c12, #f1c40f); }
.stat-fill.red { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.stat-value {
    font-size: 12px;
    color: var(--text-secondary);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* ===== Сообщения ===== */
.message-bar {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 14px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.message-bar.info {
    background: rgba(46, 204, 113, 0.15);
    color: var(--success);
}

.message-bar.warning {
    background: rgba(243, 156, 18, 0.15);
    color: var(--warning);
}

.message-bar.error {
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger);
}

/* ===== Анимации ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== Адаптивность ===== */
/* ===== Экран смерти ===== */
.death-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.death-icon {
    font-size: 64px;
    animation: pulse 2s ease-in-out infinite;
}

.death-message {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.death-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
}

.death-actions .btn {
    width: 100%;
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
}

/* ===== Ряд ввода с кнопкой ===== */
.name-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.name-input-row input {
    flex: 1;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    padding: 8px 12px;
    cursor: pointer;
    border: 2px solid var(--accent);
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--text-primary);
    transition: all 0.2s ease;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: translateY(0);
}