

/* ===== БАЗОВЫЕ ПЕРЕМЕННЫЕ ===== */
:root {
    /* Spotify-like dark base */
    --bg-primary: #0b0b10;
    --bg-secondary: #0f101a;

    /* Card */
    --bg-card: rgba(20, 24, 40, 0.55);

    /* Accent palette (neon/spotify-ish) */
    --accent-green: #1ed760; /* spotify green */
    --accent-red: #ff4757;
    --accent-blue: #4facfe;
    --accent-purple: #7c5cff;
    --accent-orange: #f093fb;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.68);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(255, 255, 255, 0.16);

    --shadow-glow: 0 0 20px rgba(79, 172, 254, 0.25);

    /* Background blobs (spotify-like) */
    --blob-green: rgba(30, 215, 96, 0.22);
    --blob-purple: rgba(124, 92, 255, 0.22);
    --blob-blue: rgba(79, 172, 254, 0.18);
    --blob-pink: rgba(240, 147, 251, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;

    /* Base gradient */
    background:
        radial-gradient(900px 700px at 15% 10%, var(--blob-green), transparent 60%),
        radial-gradient(900px 700px at 85% 15%, var(--blob-purple), transparent 60%),
        radial-gradient(800px 700px at 60% 85%, var(--blob-blue), transparent 58%),
        radial-gradient(700px 600px at 20% 85%, var(--blob-pink), transparent 58%),
        linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Subtle noise + extra depth like Spotify */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.06), transparent 2px),
        radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.05), transparent 2px),
        radial-gradient(1px 1px at 40% 80%, rgba(255,255,255,0.04), transparent 2px);
    opacity: 0.55;
    mix-blend-mode: overlay;
}

#app {
    width: 100%;
    max-width: 480px;
    /* Animate.css integration */
    --animate-duration: 0.6s;
}

/* ===== ОБЩИЕ ЭЛЕМЕНТЫ ===== */
.screen {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.screen.active {
  display: flex;
  animation: screenIn 0.35s ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

#connectionIndicatorText.connected {
    color: #4cd964;
    font-weight: 700;
}
#connectionIndicatorText.disconnected {
    color: #ff3b30;
    font-weight: 700;
}

/* ===== ЭКРАН ПОДКЛЮЧЕНИЯ ===== */
.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}

.status-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.3s ease;
}
.status-icon.status-online {
    background: var(--accent-green);
    box-shadow: 0 0 0 4px rgba(30, 215, 96, 0.22);
    animation: pulse-green 2s infinite;
}
.status-icon.status-connecting {
    background: var(--accent-orange);
    animation: blink 1s infinite;
}
.status-icon.status-offline { background: var(--accent-red); }

.status-indicator span {
    font-size: 15px;
    font-weight: 700;
}

.room-info-container {
    text-align: center;
}
.room-info-container h3 {
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 700;
}
.room-info-container .hint {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.code-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.code-input {
    width: 48px;
    height: 58px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    border: 2px solid var(--glass-border);
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    transition: all 0.25s ease;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    color: var(--text-primary);
}
.code-input:focus {
    outline: none;
    border-color: rgba(79, 172, 254, 0.85);
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.18);
    transform: scale(1.05);
}

.room-user-count {
    margin-top: 15px;
    padding: 12px;
    background: rgba(79, 172, 254, 0.15);
    border-radius: 12px;
    color: rgba(79, 172, 254, 0.95);
    font-weight: 700;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.25s ease;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    box-shadow: 0 8px 30px rgba(79, 172, 254, 0.25);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(79, 172, 254, 0.35);
}
.btn-primary:active { transform: translateY(0); }

/* ===== ЭКРАН КОМНАТЫ ===== */
.controls-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.room-card {
    padding: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
    backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
    position: relative;
    overflow: hidden;
}
.room-card::before {
    content: '';
    position: absolute;
    inset: -80px -120px auto -120px;
    height: 220px;
    background: radial-gradient(circle at 30% 40%, rgba(30,215,96,0.18), transparent 60%),
                radial-gradient(circle at 70% 30%, rgba(124,92,255,0.18), transparent 60%);
    filter: blur(12px);
    pointer-events: none;
}

.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.room-info { display: flex; align-items: center; gap: 16px; }

.room-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.22);
}

.room-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}
.room-status { font-size: 13px; color: var(--text-secondary); }

.pulse-bar {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg,
        rgba(30, 215, 96, 0.95), rgba(79, 172, 254, 0.95),
        rgba(124, 92, 255, 0.95), rgba(30, 215, 96, 0.95));
    background-size: 220% 100%;
    box-shadow: 0 0 28px rgba(79, 172, 254, 0.22), 0 0 18px rgba(30, 215, 96, 0.18);
    opacity: 0.9;
    animation: barflow 3.2s linear infinite, pulsebar 2.2s ease-in-out infinite;
}

.participants-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.14);
    position: relative;
    z-index: 1;
}
.participants-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.participants-label i { font-size: 18px; color: var(--accent-purple); }
.participants-value {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 40px;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.14);
    position: relative;
    overflow: hidden;
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}
.timer-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue), var(--accent-purple));
    animation: gradient-flow 3s linear infinite;
    background-size: 200% 100%;
}
.timer-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.timer-label i { color: var(--accent-green); }
.timer-display {
    font-size: 48px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(135deg, var(--text-primary), rgba(79, 172, 254, 0.95));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.volume-control {
    padding: 20px 24px;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 18px 60px rgba(0,0,0,0.30);
}
.volume-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.volume-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.volume-label i { font-size: 18px; color: var(--accent-blue); }
.volume-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-blue);
    background: rgba(79, 172, 254, 0.18);
    padding: 4px 12px;
    border-radius: 20px;
}
.volume-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 8px;
    border-radius: 10px;
    background: linear-gradient(
        90deg,
        var(--accent-blue) 0%,
        var(--accent-purple) var(--value, 80%),
        rgba(255,255,255,0.10) var(--value, 80%)
    );
    outline: none; cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(79, 172, 254, 0.45);
    transition: transform 0.2s ease;
}
.volume-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.volume-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    height: 40px;
    margin-top: 16px;
}
.volume-bar {
    width: 6px;
    background: linear-gradient(to top, var(--accent-green), var(--accent-blue));
    border-radius: 3px;
    animation: equalizer 0.5s ease infinite alternate;
}
.volume-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.volume-bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.volume-bar:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.volume-bar:nth-child(4) { height: 60%; animation-delay: 0.3s; }
.volume-bar:nth-child(5) { height: 80%; animation-delay: 0.4s; }
.volume-bar:nth-child(6) { height: 50%; animation-delay: 0.5s; }
.volume-bar:nth-child(7) { height: 90%; animation-delay: 0.6s; }

.control-buttons { display: flex; gap: 20px; justify-content: center; }
.control-btn {
    position: relative; width: 72px; height: 72px;
    border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.14);
    color: var(--text-primary);
}
.control-btn:hover { transform: scale(1.08); box-shadow: var(--shadow-glow); }
.control-btn:active { transform: scale(0.96); }

.mic-btn.active {
    background: linear-gradient(135deg, var(--accent-green), #00b85c);
    box-shadow: 0 0 30px rgba(30, 215, 96, 0.35);
    animation: pulse-green 2s infinite;
}
.mic-btn.muted {
    background: linear-gradient(135deg, var(--accent-red), #e84040);
    box-shadow: 0 0 30px rgba(255, 71, 87, 0.35);
}
.speaker-btn.speaker-on {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    box-shadow: 0 0 30px rgba(79, 172, 254, 0.35);
    animation: pulse-blue 2s infinite;
}

.end-call-btn {
    padding: 18px; border: none; border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-red), #c0392b);
    color: white; font-size: 16px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 10px; transition: all 0.25s ease;
}
.end-call-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 71, 87, 0.30);
}
.end-call-btn:active { transform: translateY(0); }

/* ===== НОВЫЙ БЛОК: АНИМИРОВАННЫЙ ФОН ДЛЯ ЭКРАНА КОМНАТЫ ===== */

/*
  Этот класс добавляется на <body> через JS при входе в комнату.
  Создаёт анимированный градиент по периферии экрана.
*/
.call-active-bg::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1; /* Помещает фон позади всего контента */

    /* Градиент из pulse-bar */
    background: linear-gradient(90deg,
        rgba(30, 215, 96, 0.95),
        rgba(79, 172, 254, 0.95),
        rgba(124, 92, 255, 0.95),
        rgba(30, 215, 96, 0.95)
    );
    background-size: 220% 100%;

    /* Маска для создания эффекта периферии (прозрачно в центре) */
    -webkit-mask: radial-gradient(ellipse 60% 80% at 50% 50%, transparent 50%, black 100%);
    mask: radial-gradient(ellipse 60% 80% at 50% 50%, transparent 50%, black 100%);

    /* Анимация: движение градиента + пульсация */
    animation:
        barflow 4s linear infinite,
        pulse-glow 2.5s ease-in-out infinite;

    /* Плавное появление */
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

/* Активация фона (плавное появление) */
.call-active-bg.active-glow::after {
    opacity: 1;
}

/* Пульсация яркости и насыщенности */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.4;
        filter: brightness(0.8) saturate(0.9);
    }
    50% {
        opacity: 0.7;
        filter: brightness(1.1) saturate(1.1);
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 18px rgba(30, 215, 96, 0.28); }
    50% { box-shadow: 0 0 44px rgba(30, 215, 96, 0.55); }
}
@keyframes pulse-blue {
    0%, 100% { box-shadow: 0 0 18px rgba(79, 172, 254, 0.28); }
    50% { box-shadow: 0 0 44px rgba(79, 172, 254, 0.55); }
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}
@keyframes equalizer {
    0% { transform: scaleY(0.3); }
    100% { transform: scaleY(1); }
}
@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
@keyframes barflow {
    0% { background-position: 0% 50%; }
    100% { background-position: 220% 50%; }
}
@keyframes pulsebar {
    0%, 100% { transform: scaleY(1); opacity: 0.65; }
    50% { transform: scaleY(1.25); opacity: 1; }
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.notification {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white; padding: 16px 28px; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000; opacity: 0; transition: all 0.3s ease;
    font-weight: 700;
}
.notification.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 480px) {
    body { padding: 12px; }
    .screen { gap: 16px; }
    .timer-display { font-size: 36px; }
    .control-btn { width: 64px; height: 64px; font-size: 24px; }
    .code-input { width: 42px; height: 52px; font-size: 20px; }
    .participants-value { font-size: 30px; }
}


/* ===== WEB micro-effects ===== */

/* Pulse-bar: классы будут навешиваться из app.js */
.pulse-bar.pulse-online {
    opacity: 0.95;
    animation: barflow 3.2s linear infinite, pulsebar 2.2s ease-in-out infinite;
    box-shadow: 0 0 28px rgba(79, 172, 254, 0.22), 0 0 18px rgba(30, 215, 96, 0.18);
}

.pulse-bar.pulse-in-call {
    opacity: 1;
    /* 1 раз в секунду синхронно с таймером */
    animation: barflow 2.2s linear infinite, pulseSync 1s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(79, 172, 254, 0.28), 0 0 28px rgba(30, 215, 96, 0.22);
}

.pulse-bar.pulse-offline {
    opacity: 0.65;
    animation: none;
    background: linear-gradient(90deg,
        rgba(255, 71, 87, 0.95),
        rgba(255, 71, 87, 0.60));
    box-shadow: 0 0 18px rgba(255, 71, 87, 0.22);
}

/* pulseSync: пульс с “1Hz” */
@keyframes pulseSync {
    0%, 100% { transform: scaleY(1); }
    50%      { transform: scaleY(1.42); }
}

/* Glow когда микрофон включён */
.mic-glow .room-card {
    box-shadow:
        0 20px 70px rgba(0, 0, 0, 0.45),
        0 0 80px rgba(30, 215, 96, 0.18),
        0 0 40px rgba(79, 172, 254, 0.14);
}

.mic-glow .pulse-bar {
    box-shadow: 0 0 50px rgba(30, 215, 96, 0.35), 0 0 22px rgba(79, 172, 254, 0.18);
    filter: saturate(1.15) brightness(1.05);
}

/* Иконка комнаты слегка “дышит” от микрофона */
.mic-glow .room-icon {
    animation: micRoomGlow 1.0s ease-in-out infinite;
}

@keyframes micRoomGlow {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}

/* Анимация status-icon на подключении/офлайне */
.status-icon.status-offline {
    animation: blinkRed 1.1s infinite;
}

@keyframes blinkRed {
    0%, 100% { opacity: 1; box-shadow: none; }
    50%       { opacity: 0.35; box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.18); }
}

.status-icon.status-connecting {
    /* было blink 1s: усилим “живость” */
    animation: blink 1s infinite, connectWiggle 0.9s ease-in-out infinite;
    transform-origin: center;
}

@keyframes connectWiggle {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.7); }
}





.apk-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #3ddc84;
}

.apk-text {
  flex: 1;
  min-width: 200px;
}

.apk-title {
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.apk-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-top: 4px;
}





.apk-banner {
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1f2937, #111827);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  z-index: 9999;
  backdrop-filter: blur(10px);
}

.apk-banner-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.apk-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #3ddc84;
}

.apk-text {
  flex: 1;
  min-width: 200px;
}

.apk-title {
  color: white;
  font-size: 16px;
  font-weight: 700;
}

.apk-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  margin-top: 4px;
}

.v2ray-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.apk-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.apk-download-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

#v2rayDownloadBtn { background: #0969da; }
#v2rayLocalBtn { background: #2d7d46; }
#v2rayCopyBtn { background: #6b4c9a; }

#v2rayBanner {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

