:root {
    --primary: #ff3b30;
    --primary-glow: rgba(255, 59, 48, 0.4);
    --bg-dark: #0a0a0a;
    --card-bg: rgba(28, 28, 30, 0.8);
    --text-main: #f2f2f7;
    --text-dim: #8e8e93;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

body {
    background: var(--bg-dark);
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 59, 48, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 59, 48, 0.05) 0%, transparent 40%);
    color: var(--text-main);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    /* Enforce centering */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(255, 59, 48, 0.1);
}

/* Visual Armor Effect refined */
.card::before {
    content: "SECURE SIGNAL";
    position: absolute;
    top: 20px;
    right: -40px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 4px 60px;
    transform: rotate(45deg);
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(255, 59, 48, 0.3);
    z-index: 10;
}

.logo {
    width: 140px;
    height: 140px;
    border-radius: 30px;
    /* Modern squircle-ish */
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 25px;
    background-color: #fff;
    box-shadow: 0 0 30px var(--primary-glow);
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.playing .logo {
    transform: scale(1.05);
    box-shadow: 0 0 40px var(--primary);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin-bottom: 30px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

audio {
    width: 100%;
    margin-top: 10px;
    filter: invert(1);
    height: 40px;
    border-radius: 12px;
    opacity: 0.8;
}

.status {
    font-size: 0.85rem;
    margin-top: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Ensure contents are centered */
    gap: 8px;
    padding: 8px 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 100px;
    color: var(--text-dim);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
    font-weight: 500;
}

.status:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
    color: var(--text-main);
}

.playing .status {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.2);
    color: var(--text-main);
}

/* Loading State */
.status {
    position: relative;
    overflow: hidden;
}

.status.loading::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 100%;
    animation: loading-scan 1.5s infinite linear;
    transform: translateX(-100%);
    box-shadow: 0 0 10px var(--primary);
}

@keyframes loading-scan {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.dot {
    font-size: 1.2rem;
    color: #444;
}

.playing .dot {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.9);
    }
}

/* Modal Styles */
#modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: #1c1c1e;
    border: 1px solid var(--glass-border);
    margin: 15vh auto;
    padding: 32px;
    width: 90%;
    max-width: 380px;
    border-radius: 24px;
    text-align: left;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideUp {
    to {
        transform: scale(1);
    }
}

.modal-content h2 {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
}

.stat-row {
    margin: 20px 0;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-bar-bg {
    background: rgba(255, 255, 255, 0.05);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.stat-bar-fill {
    background: var(--primary);
    height: 100%;
    box-shadow: 0 0 10px var(--primary-glow);
}

.stat-bar-fill.default-fill {
    width: 15%;
}

.close-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px;
    width: 100%;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 20px;
    font-weight: 700;
    font-size: 1rem;
    transition: opacity 0.2s ease;
}

.close-btn:hover {
    opacity: 0.9;
}

.footer {
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--text-dim);
    opacity: 0.6;
    line-height: 1.6;
    text-align: center;
}

.controls-stack {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
    max-width: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

#trackInfo {
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 15px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    opacity: 0.8;
}

.modal-signal {
    font-size: 0.75rem;
    color: #32d74b;
    margin-bottom: 20px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: rgba(50, 215, 75, 0.1);
    padding: 12px;
    border-radius: 8px;
    line-height: 1.4;
}

/* Live Stream Button */
.btn-live {
    background: linear-gradient(135deg, var(--primary) 0%, #ff6b5b 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
    animation: pulse-live 2s infinite;
}

.btn-live:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.6);
}

@keyframes pulse-live {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(255, 59, 48, 0.7);
    }
}

/* Removed duplicated btn-container */

/* Loading stream state for next button */
.btn-nav.loading-stream {
    background: rgba(255, 59, 48, 0.1);
    border-color: rgba(255, 59, 48, 0.3);
}

/* Pulse animation when stream fails */
.btn-nav.pulse-button {
    background: rgba(255, 59, 48, 0.2);
    border-color: var(--primary);
    animation: pulse-next 1s infinite;
}

@keyframes pulse-next {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(255, 59, 48, 0.6);
    }
}

/* i18n Selector */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.lang-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}