/* VOYA UI — premium modern UX */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #050713;
    --card: rgba(255,255,255,0.08);
    --border: rgba(255,255,255,0.16);
    --text: #ffffff;
    --muted: rgba(255,255,255,0.72);
    --purple: #7a50ff;
    --violet: #a855f7;
    --cyan: #22d3fe;
    --green: #65df72;
    --red: #df312d;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    text-align: center;
    overflow: hidden;
}

button {
    font-family: inherit;
    user-select: none;
}

/* Base screens */
.welcome-container,
.search-container,
.call-container {
    min-height: 100vh;
    min-height: 100dvh;
    padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 25%, rgba(122,80,255,0.42), transparent 30%),
        radial-gradient(circle at 50% 68%, rgba(34,211,254,0.11), transparent 28%),
        linear-gradient(180deg, #090d1d 0%, #050713 58%, #02030a 100%);
}

/* subtle glass glow */
.welcome-container::after,
.search-container::after,
.call-container::after {
    content: "";
    position: absolute;
    inset: 18px;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.06);
    pointer-events: none;
}

/* Accueil logo */
.welcome-container::before {
    content: "V";
    width: 118px;
    height: 118px;
    margin: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 34px;
    background: linear-gradient(135deg, var(--violet), var(--purple) 48%, var(--cyan));
    box-shadow:
        0 0 54px rgba(122,80,255,0.48),
        0 26px 70px rgba(0,0,0,0.38);
    color: #fff;
    font-size: 64px;
    font-weight: 900;
    z-index: 2;
}

.welcome-container h1 {
    margin: 0;
    font-size: 0;
    z-index: 2;
}

.welcome-container h1::before {
    content: "VOYA";
    display: block;
    font-size: clamp(3.7rem, 13vw, 6.2rem);
    line-height: 0.95;
    font-weight: 900;
    letter-spacing: clamp(10px, 3vw, 16px);
    padding-left: clamp(10px, 3vw, 16px);
    color: #fff;
    text-shadow: 0 0 28px rgba(255,255,255,0.22);
}

.welcome-container h1::after {
    content: "NEW WAY TO CONNECT";
    display: block;
    margin-top: 24px;
    font-size: clamp(0.76rem, 2.6vw, 1.05rem);
    line-height: 1.4;
    font-weight: 600;
    letter-spacing: clamp(4px, 1.8vw, 7px);
    color: var(--muted);
}

/* Main call button */
.welcome-container button {
    width: 108px;
    height: 108px;
    margin-top: 86px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.24);
    background: radial-gradient(circle at 50% 35%, #b95fff 0%, var(--purple) 62%, #5f35d8 100%);
    color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,0.08),
        0 0 0 16px rgba(122,80,255,0.14),
        0 0 58px rgba(122,80,255,0.58),
        0 24px 58px rgba(0,0,0,0.42);
    transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.welcome-container button:hover {
    filter: brightness(1.06);
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,0.10),
        0 0 0 18px rgba(122,80,255,0.16),
        0 0 70px rgba(122,80,255,0.70),
        0 24px 58px rgba(0,0,0,0.42);
}

.welcome-container button::before {
    content: "";
    position: absolute;
    width: 70px;
    height: 70px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1C10.61 21 3 13.39 3 4c0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.24.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1C10.61 21 3 13.39 3 4c0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.24.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z'/%3E%3C/svg%3E") center / contain no-repeat;
    filter: drop-shadow(0 0 14px rgba(255,255,255,0.35));
}

.welcome-container button::after {
    content: "Appeler";
    position: absolute;
    left: 50%;
    top: 154px;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.94);
    font-size: 1.25rem;
    font-weight: 800;
}

/* Search */
.search-container h2 {
    margin: 0 0 52px;
    font-size: clamp(2rem, 8vw, 3.3rem);
    font-weight: 900;
    letter-spacing: -1px;
    z-index: 2;
}

.spinner {
    width: 104px;
    height: 104px;
    margin: 0 auto 58px;
    border-radius: 50%;
    border: 7px solid rgba(255,255,255,0.12);
    border-top-color: var(--violet);
    border-right-color: var(--cyan);
    animation: spin 0.9s linear infinite;
    z-index: 2;
    box-shadow:
        0 0 0 18px rgba(122,80,255,0.10),
        0 0 56px rgba(34,211,254,0.25);
}

.search-container button {
    width: min(100%, 350px);
    padding: 18px 24px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 2;
    box-shadow: 0 16px 38px rgba(0,0,0,0.30);
    transition: transform 0.16s ease, background 0.16s ease;
}

.search-container button:hover {
    background: rgba(255,255,255,0.12);
}

/* Call */
.call-avatar {
    width: 156px;
    height: 156px;
    margin: 0 auto 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(255,255,255,0.9) 0 34%, rgba(255,255,255,0.18) 35% 100%);
    box-shadow:
        0 0 0 24px rgba(122,80,255,0.10),
        0 0 62px rgba(34,211,254,0.20),
        0 22px 58px rgba(0,0,0,0.32);
    z-index: 2;
}

.call-avatar img {
    width: 82px;
    height: 82px;
    display: block;
}

.call-container h2 {
    margin: 0 0 14px;
    font-size: clamp(2.1rem, 8vw, 3.15rem);
    font-weight: 900;
    letter-spacing: -1px;
    z-index: 2;
}

.call-container h2::after {
    content: " ●";
    color: var(--green);
    font-size: 0.52em;
    vertical-align: middle;
}

.call-timer {
    margin: 0 0 26px;
    font-size: 2.05rem;
    font-weight: 600;
    opacity: 0.96;
    z-index: 2;
}

.call-status {
    margin: 0 0 54px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
    z-index: 2;
}

.call-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
    z-index: 2;
}

.call-container button {
    width: min(46%, 180px);
    min-height: 94px;
    padding: 14px 12px;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    cursor: pointer;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 2;
    box-shadow: 0 16px 36px rgba(0,0,0,0.32);
    transition: transform 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

#muteButton {
    background: rgba(255,255,255,0.10);
}

#muteButton:hover {
    background: rgba(255,255,255,0.14);
}

#muteButton::before {
    content: "";
    display: block;
    width: 34px;
    height: 34px;
    margin: 0 auto 8px;
    background: url("icons/mic.svg") center / contain no-repeat;
}

#endCallButton {
    background: linear-gradient(160deg, #ff6b5f 0%, var(--red) 100%);
}

#endCallButton:hover {
    filter: brightness(1.08);
}

#endCallButton::before {
    content: "";
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 6px;
    background: url("icons/endcall.svg") center / contain no-repeat;
}

/* Online counter */
.online-counter {
    margin-top: 26px;
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(101,223,114,0.10);
    border: 1px solid rgba(101,223,114,0.24);
    color: rgba(255,255,255,0.92);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.45px;
    z-index: 2;
    box-shadow: 0 0 28px rgba(101,223,114,0.08);
}

/* Splash */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background:
        radial-gradient(circle at 50% 35%, rgba(122,80,255,0.32), transparent 30%),
        #050713;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    width: 132px;
    height: 132px;
    border-radius: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.4rem;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, var(--violet), var(--purple) 48%, var(--cyan));
    box-shadow:
        0 0 44px rgba(122,80,255,0.58),
        0 0 95px rgba(34,211,254,0.22);
    animation: splashPop 0.8s ease both;
}

.splash-title {
    margin-top: 34px;
    font-size: clamp(2.8rem, 12vw, 3.4rem);
    font-weight: 900;
    letter-spacing: clamp(10px, 4vw, 16px);
    padding-left: clamp(10px, 4vw, 16px);
    color: white;
    animation: splashFade 0.9s ease 0.18s both;
}

.splash-subtitle {
    margin-top: 16px;
    font-size: 0.85rem;
    letter-spacing: clamp(4px, 2vw, 7px);
    color: rgba(255,255,255,0.70);
    animation: splashFade 0.9s ease 0.32s both;
}

/* UX states */
.welcome-container button:active,
.search-container button:active,
.call-container button:active {
    transform: scale(0.96);
}

button:focus-visible {
    outline: 3px solid rgba(34,211,254,0.55);
    outline-offset: 5px;
}

audio {
    display: none;
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes splashPop {
    from {
        opacity: 0;
        transform: scale(0.86);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes splashFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile polish */
@media (max-width: 420px) {
    .welcome-container::before {
        width: 104px;
        height: 104px;
        border-radius: 30px;
        font-size: 58px;
        margin-bottom: 42px;
    }

    .welcome-container button {
        width: 100px;
        height: 100px;
        margin-top: 78px;
    }

    .welcome-container button::after {
        top: 145px;
    }

    .call-avatar {
        width: 140px;
        height: 140px;
        margin-bottom: 36px;
    }

    .call-actions {
        gap: 10px;
    }

    .call-container button {
        min-height: 88px;
        border-radius: 22px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}