/* ── CSS változók ── */
:root {
    --bg-gradient: linear-gradient(45deg, #83a4d4, #b6fbff);
    --container-bg: #ffffffcc;
    --container-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    --text-color: #333;
    --h2-color: #444;
    --button-bg: #007BFF;
    --button-hover: #0056b3;
    --active-bg: #28a745;
    --active-hover: #1e7e34;
    --now-playing-color: #28a745;
    --wave-color: #28a745;
    --toggle-bg: rgba(255, 255, 255, 0.35);
    --toggle-hover: rgba(255, 255, 255, 0.55);
    --toggle-color: #445577;
    --reconnect-color: #e67e00;
    --connecting-bg: #e67e00;
    --connecting-hover: #c96b00;

    /* Liquid glass stílus */
    --glass-container-bg: rgba(255, 255, 255, 0.16);
    --glass-container-border: rgba(255, 255, 255, 0.35);
    --glass-container-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 8px 24px rgba(0, 0, 0, 0.12);
    --glass-button-bg: rgba(255, 255, 255, 0.22);
    --glass-button-border: rgba(255, 255, 255, 0.32);
    --glass-button-hover: rgba(255, 255, 255, 0.32);
    --glass-active-bg: rgba(40, 167, 105, 0.55);
    --glass-active-border: rgba(120, 255, 180, 0.55);
    --glass-connecting-bg: rgba(230, 126, 0, 0.55);
    --glass-connecting-border: rgba(255, 200, 120, 0.55);
    --glass-blob-1: rgba(255, 120, 180, 0.35);
    --glass-blob-2: rgba(120, 180, 255, 0.35);
}

/* ── Sötét mód változók ── */
[data-theme="dark"] {
    --bg-gradient: linear-gradient(45deg, #0a1628, #0e2d50);
    --container-bg: #0f1f35e8;
    --container-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    --text-color: #e2eaf4;
    --h2-color: #a8bfd4;
    --button-bg: #1d4ed8;
    --button-hover: #1e40af;
    --active-bg: #16a34a;
    --active-hover: #15803d;
    --now-playing-color: #4ade80;
    --wave-color: #4ade80;
    --toggle-bg: rgba(255, 255, 255, 0.1);
    --toggle-hover: rgba(255, 255, 255, 0.2);
    --toggle-color: #a8c8f0;
    --reconnect-color: #f59e0b;
    --connecting-bg: #f59e0b;
    --connecting-hover: #d97706;

    /* Liquid glass stílus – sötét */
    --glass-container-bg: rgba(255, 255, 255, 0.06);
    --glass-container-border: rgba(255, 255, 255, 0.14);
    --glass-container-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.4);
    --glass-button-bg: rgba(255, 255, 255, 0.08);
    --glass-button-border: rgba(255, 255, 255, 0.16);
    --glass-button-hover: rgba(255, 255, 255, 0.14);
    --glass-active-bg: rgba(22, 163, 74, 0.45);
    --glass-active-border: rgba(120, 255, 180, 0.35);
    --glass-connecting-bg: rgba(245, 158, 11, 0.45);
    --glass-connecting-border: rgba(255, 200, 120, 0.35);
    --glass-blob-1: rgba(80, 140, 255, 0.3);
    --glass-blob-2: rgba(90, 220, 180, 0.22);
}

/* ── Rendszer sötét mód (ha nincs manuálisan beállítva) ── */
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg-gradient: linear-gradient(45deg, #0a1628, #0e2d50);
        --container-bg: #0f1f35e8;
        --container-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
        --text-color: #e2eaf4;
        --h2-color: #a8bfd4;
        --button-bg: #1d4ed8;
        --button-hover: #1e40af;
        --active-bg: #16a34a;
        --active-hover: #15803d;
        --now-playing-color: #4ade80;
        --wave-color: #4ade80;
        --toggle-bg: rgba(255, 255, 255, 0.1);
        --toggle-hover: rgba(255, 255, 255, 0.2);
        --toggle-color: #a8c8f0;
        --reconnect-color: #f59e0b;
        --connecting-bg: #f59e0b;
        --connecting-hover: #d97706;

        --glass-container-bg: rgba(255, 255, 255, 0.06);
        --glass-container-border: rgba(255, 255, 255, 0.14);
        --glass-container-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.4);
        --glass-button-bg: rgba(255, 255, 255, 0.08);
        --glass-button-border: rgba(255, 255, 255, 0.16);
        --glass-button-hover: rgba(255, 255, 255, 0.14);
        --glass-active-bg: rgba(22, 163, 74, 0.45);
        --glass-active-border: rgba(120, 255, 180, 0.35);
        --glass-connecting-bg: rgba(245, 158, 11, 0.45);
        --glass-connecting-border: rgba(255, 200, 120, 0.35);
        --glass-blob-1: rgba(80, 140, 255, 0.3);
        --glass-blob-2: rgba(90, 220, 180, 0.22);
    }
}

/* ── Alap ── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background: var(--bg-gradient);
    transition: background 0.5s ease;
    position: relative;
    overflow-x: hidden;
}

/* ── Liquid glass háttér-foltok (csak üveg módban látszanak) ── */
html[data-glass="on"] body::before,
html[data-glass="on"] body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
    transition: background 0.5s ease;
}

html[data-glass="on"] body::before {
    top: -60px;
    left: -60px;
    background: var(--glass-blob-1);
}

html[data-glass="on"] body::after {
    bottom: -60px;
    right: -60px;
    background: var(--glass-blob-2);
}

/* ── Container ── */
.container {
    position: relative;
    z-index: 1;
    text-align: center;
    background-color: var(--container-bg);
    padding: 30px 30px 30px 30px;
    border-radius: 12px;
    box-shadow: var(--container-shadow);
    width: 90%;
    max-width: 800px;
    margin: 30px 20px;
    transition: background-color 0.5s ease, box-shadow 0.5s ease, backdrop-filter 0.5s ease, border 0.5s ease;
}

/* Üveg mód: átlátszó, elmosott hátterű container */
html[data-glass="on"] .container {
    background-color: var(--glass-container-bg);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--glass-container-border);
    box-shadow: var(--glass-container-shadow);
}

/* ── Kapcsológomb csoport (téma + üveg stílus) ── */
.toggle-group {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.toggle-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--toggle-bg);
    color: var(--toggle-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    backdrop-filter: blur(4px);
    padding: 0;
}

.toggle-btn:hover {
    background: var(--toggle-hover);
    transform: scale(1.1);
}

.toggle-btn.spinning {
    animation: spinToggle 0.5s ease;
}

@keyframes spinToggle {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(0.8); }
    100% { transform: rotate(360deg) scale(1); }
}

.toggle-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toggle-icon svg {
    width: 20px;
    height: 20px;
}

/* Világos módban: hold látszik (mert arra lehet váltani) */
.toggle-icon.sun  { opacity: 0; transform: rotate(90deg) scale(0.5); }
.toggle-icon.moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* Sötét módban: nap látszik */
[data-theme="dark"] .toggle-icon.sun  { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .toggle-icon.moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]):not([data-theme="dark"]) .toggle-icon.sun  { opacity: 1; transform: rotate(0deg) scale(1); }
    html:not([data-theme="light"]):not([data-theme="dark"]) .toggle-icon.moon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
}

/* Normál módban: az üveg csepp ikon látszik (mert arra lehet váltani) */
.toggle-icon.glass-off { opacity: 1; transform: rotate(0deg) scale(1); }
.toggle-icon.glass-on  { opacity: 0; transform: rotate(90deg) scale(0.5); }

/* Üveg módban: a sima négyzet ikon látszik (mert arra lehet visszaváltani) */
html[data-glass="on"] .toggle-icon.glass-off { opacity: 0; transform: rotate(-90deg) scale(0.5); }
html[data-glass="on"] .toggle-icon.glass-on  { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── Címek ── */
h1 {
    margin: 0 0 24px 0;
    color: var(--text-color);
    font-size: clamp(1.4rem, 5vw, 2rem);
    transition: color 0.5s ease;
    padding-top: 8px;
}

h2 {
    margin-bottom: 16px;
    margin-top: 8px;
    color: var(--h2-color);
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    transition: color 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

h2 .fi {
    font-size: 1.1em;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Audio lejátszó ── */
audio {
    width: 100%;
    max-width: 500px;
    outline: none;
    border-radius: 10px;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ── Gombok ── */
.radio-buttons {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0 4px;
}

.radio-button {
    background-color: var(--button-bg);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    outline: none;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.radio-button:hover {
    background-color: var(--button-hover);
}

.radio-button.active {
    background-color: var(--active-bg);
    transform: scale(1.08);
}

.radio-button.active:hover {
    background-color: var(--active-hover);
}

/* Üveg mód: félig átlátszó, elmosott hátterű gombok */
html[data-glass="on"] .radio-button {
    background-color: var(--glass-button-bg);
    border: 1px solid var(--glass-button-border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

html[data-glass="on"] .radio-button:hover {
    background-color: var(--glass-button-hover);
}

html[data-glass="on"] .radio-button.active,
html[data-glass="on"] .radio-button.active:hover {
    background-color: var(--glass-active-bg);
    border: 1px solid var(--glass-active-border);
}

/* Kapcsolódik állapot: sárga/amber, a lejátszás (zöld) előtti köztes fázis */
.radio-button.active.connecting,
.radio-button.active.connecting:hover {
    background-color: var(--connecting-bg);
}

html[data-glass="on"] .radio-button.active.connecting,
html[data-glass="on"] .radio-button.active.connecting:hover {
    background-color: var(--glass-connecting-bg);
    border: 1px solid var(--glass-connecting-border);
}

/* ── Kapcsolódás pötty animáció ── */
.connecting-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: connectingPulse 1s ease-in-out infinite;
}

@keyframes connectingPulse {
    0%, 100% { transform: scale(0.55); opacity: 0.45; }
    50%      { transform: scale(1); opacity: 1; }
}

/* ── Hanghullám animáció ── */
.sound-wave {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 16px;
}

.sound-wave span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: white;
    animation: soundBounce 0.5s ease-in-out infinite alternate;
}

.sound-wave span:nth-child(1) { height: 4px;  animation-duration: 0.40s; animation-delay: 0.00s; }
.sound-wave span:nth-child(2) { height: 10px; animation-duration: 0.50s; animation-delay: 0.10s; }
.sound-wave span:nth-child(3) { height: 14px; animation-duration: 0.35s; animation-delay: 0.05s; }
.sound-wave span:nth-child(4) { height: 8px;  animation-duration: 0.45s; animation-delay: 0.15s; }
.sound-wave span:nth-child(5) { height: 5px;  animation-duration: 0.40s; animation-delay: 0.08s; }

@keyframes soundBounce {
    from { transform: scaleY(0.3); }
    to   { transform: scaleY(1); }
}

/* ── Most játszik felirat ── */
.now-playing-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--now-playing-color);
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 16px 0;
    transition: color 0.5s ease;
}

.now-playing-label.connecting {
    color: var(--connecting-bg);
}

.now-playing-label.connecting .connecting-dot {
    background: var(--connecting-bg);
}

.now-playing-wave {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 14px;
}

.now-playing-wave span {
    display: block;
    width: 2px;
    border-radius: 2px;
    background: var(--wave-color);
    animation: soundBounce 0.5s ease-in-out infinite alternate;
    transition: background 0.5s ease;
}

.now-playing-wave span:nth-child(1) { height: 4px;  animation-duration: 0.40s; animation-delay: 0.00s; }
.now-playing-wave span:nth-child(2) { height: 10px; animation-duration: 0.50s; animation-delay: 0.10s; }
.now-playing-wave span:nth-child(3) { height: 12px; animation-duration: 0.35s; animation-delay: 0.05s; }
.now-playing-wave span:nth-child(4) { height: 7px;  animation-duration: 0.45s; animation-delay: 0.15s; }

/* ── Újracsatlakozás jelzés ── */
.reconnect-label {
    color: var(--reconnect-color);
    font-size: 13px;
    margin: 0 0 14px 0;
    animation: pulse 1s ease-in-out infinite alternate;
    transition: color 0.5s ease;
}

@keyframes pulse {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

/* ── Hiba üzenet ── */
.error-message {
    color: #e53e3e;
    font-size: 14px;
    margin: 0 0 14px 0;
}

/* ── Frissítési értesítő sáv ── */
#updateBanner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1d4ed8;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideUp 0.4s ease;
}

#updateBanner button {
    background: white;
    color: #1d4ed8;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

#updateBanner button:hover {
    background: #e0eaff;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Reszponzív – tablet ── */
@media (max-width: 600px) {
    .container {
        width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 20px 14px 30px 14px;
        min-height: 100vh;
    }

    h1 {
        font-size: 1.5rem;
        padding-top: 10px;
    }

    h2 {
        font-size: 1rem;
    }

    .radio-button {
        font-size: 13px;
        padding: 10px 15px;
    }

    audio {
        max-width: 100%;
    }

    .toggle-group {
        top: 12px;
        right: 12px;
        gap: 6px;
    }

    .toggle-btn {
        width: 34px;
        height: 34px;
    }

    .toggle-icon {
        width: 18px;
        height: 18px;
    }

    .toggle-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Reszponzív – kis mobil ── */
@media (max-width: 380px) {
    .radio-buttons {
        gap: 6px;
    }

    .radio-button {
        font-size: 12px;
        padding: 9px 13px;
    }
}
