*,::after,::before {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1877f2;
    --primary-dark: #1464d8;
    --primary-light: #42a0ff;
    --primary-glow: rgba(24, 119, 242, 0.58);
    --bg-dark: #0a1628;
    --bg-base: #0a1628;
    --bg-medium: #0f1f3d;
    --bg-panel: #0f1f3d;
    --bg-light: #1a2f54;
    --bg-card: #122040;
    --bg-input: #071120;
    --bg-glass: rgba(10, 22, 40, 0.92);
    --text-primary: #e8f0fe;
    --text-secondary: #93aed6;
    --text-muted: #4a6fa0;
    --text-dim: #2e4870;
    --text-listeners: #06d6a0;
    --border: #1e3a6e;
    --border-primary: rgba(24, 119, 242, 0.35);
    --danger: #f44336;
    --danger-dark: #b93228;
    --success: #0bdc1b;
    --warning: #ffd966;
    --header-h: 64px;
    --player-h: 96px;
    --footer-h: 35px;
    --sidebar-width: 300px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --trans: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    --font-display: "Nunito", sans-serif;
    --font-body: "Outfit", sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

html.theme-light-pre body {
    --bg-dark: #f0f4fa;
    --bg-base: #f0f4fa;
    --bg-medium: #e2eaf5;
    background: #f0f4fa;
}

body.theme-light {
    --bg-dark: #f0f4fa;
    --bg-base: #f0f4fa;
    --bg-medium: #e2eaf5;
    --bg-panel: #e8eef8;
    --bg-light: #d4deef;
    --bg-card: #dde6f4;
    --bg-input: #ffffff;
    --bg-glass: rgba(240, 244, 250, 0.95);
    --primary-light: #1464d8;
    --text-primary: #42a0ff;
    --text-secondary: #2c4a7c;
    --text-muted: #6b85aa;
    --text-dim: #9ab0cc;
    --text-listeners: #00b140;
    --border: #b8cce0;
    --border-primary: rgba(24, 119, 242, 0.4);
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    --chat-overlay: rgba(200, 215, 235, 0.55);
}

body.theme-light .bg-slide {
    filter: brightness(.55) saturate(.8);
}

#theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: 0 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: background var(--trans),color var(--trans),border-color var(--trans);
}

#theme-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-light);
    border-color: var(--border);
}

body.theme-light #theme-toggle-btn {
    border-color: #8aabcc;
    color: #2c4a7c;
    background: rgb(255 255 255 / .5);
}

body.theme-light #theme-toggle-btn:hover {
    background: rgb(255 255 255 / .85);
    border-color: var(--primary);
    color: var(--primary);
}

html {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

button {
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: #fff0;
}

input,select,textarea {
    -webkit-tap-highlight-color: #fff0;
}

.cap {
    text-transform: capitalize;
}

#app-shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
    background: var(--bg-dark);
}

#app-shell.auth-visible {
    background: 0 0;
}

@media (max-width:900px) {
    #app-shell {
        background: 0 0!important;
    }
}

#main-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 14px;
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    z-index: 100;
    margin: 6px 8px 0;
}

.logo-zone {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    text-decoration: none;
}

.logo-img {
    height: 46px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 0 8px var(--primary-glow));
    transition: filter 0.35s ease;
}

.logo-zone:hover .logo-img {
    filter: drop-shadow(0 0 14px var(--primary)) drop-shadow(0 0 28px var(--primary-glow)) drop-shadow(0 0 6px #fff4);
}

.lbox-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lbox-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.lbox-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transform: scale(.92);
    transition: transform 0.25s ease;
}

.lbox-overlay.open .lbox-inner {
    transform: scale(1);
}

.lbox-img {
    width: min(72vw, 260px);
    height: min(72vw, 260px);
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 3px solid var(--border-primary);
    box-shadow: 0 0 40px var(--primary-glow);
    image-rendering: auto;
}

.lbox-name {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.lbox-role {
    color: var(--text-secondary);
    font-size: .85rem;
}

.lbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: color 0.2s,border-color 0.2s;
}

.lbox-close:hover {
    color: var(--text-primary);
    border-color: var(--border-primary);
}

.team-card {
    cursor: pointer;
}

.team-avatar img {
    transition: transform 0.25s ease;
}

.team-card:hover .team-avatar img {
    transform: scale(1.07);
}

#main-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    background: 0 0;
    border: 1px solid #fff0;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: .84rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--trans),background var(--trans),border-color var(--trans);
}

.nav-btn.active,.nav-btn:hover {
    color: var(--text-primary);
    background: var(--bg-light);
    border-color: var(--border);
}

.nav-btn.primary {
    background: #1464d8;
    border-color: #1464d8;
    color: #fff;
}

.nav-btn.primary:hover {
    background: #1255b8;
    border-color: #1255b8;
    box-shadow: 0 0 14px var(--primary-glow);
}

body.theme-light .nav-btn.primary {
    background: #1464d8;
    border-color: #1464d8;
    box-shadow: 0 2px 10px rgb(24 119 242 / .4);
}

body.theme-light .nav-btn.primary:hover {
    background: #1255b8;
    border-color: #1255b8;
    box-shadow: 0 4px 16px rgb(24 119 242 / .55);
}

body.theme-light .nav-btn:not(.primary) {
    color: var(--text-secondary);
    border-color: var(--border);
}

body.theme-light .nav-btn:not(.primary):hover {
    background: var(--bg-light);
    color: var(--text-primary);
    border-color: var(--primary);
}

#pwa-install-btn {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    background: rgb(24 119 242 / .12);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-family: var(--font-body);
    font-size: .84rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--trans),box-shadow var(--trans),color var(--trans);
}

#pwa-install-btn.visible {
    display: flex;
}

#pwa-install-btn:hover {
    background: rgb(24 119 242 / .22);
    box-shadow: 0 0 14px var(--primary-glow);
}

body.theme-light #pwa-install-btn {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

body.theme-light #pwa-install-btn:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

body.theme-light .message {
    background: rgb(255 255 255 / .15);
    border-color: rgb(255 255 255 / .12);
}

body.theme-light .message:hover {
    background: rgb(255 255 255 / .25);
}

body.theme-light .system-message {
    background: rgb(255 255 255 / .12);
    border-color: rgb(255 255 255 / .08);
}

#hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: 0 0;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--trans);
}

#hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s,opacity 0.3s;
    transform-origin: center;
}

#hamburger.open span:first-child {
    transform: translateY(7px) rotate(45deg);
}

#hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

#hamburger:hover {
    background: var(--bg-light);
}

#main-footer {
    height: var(--footer-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 100;
    margin-top: auto;
    margin-bottom: 2px;
    background: 0 0;
    pointer-events: none;
}

#main-footer p {
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgb(255 255 255 / .06);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: .65rem;
    color: var(--text-secondary);
    margin: 0;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgb(0 0 0 / .3);
}

#main-footer p span {
    cursor: pointer;
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
}

.privacidade-section {
    margin-bottom: 24px;
    text-align: left;
    color: var(--text-secondary);
}

.privacidade-section h2 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#player-bar {
    height: var(--player-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    background: var(--bg-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 6px 8px;
    position: relative;
    z-index: 99;
}

#player-bar a,#player-bar span {
    color: var(--text-primary);
}

#auth-screen {
    color: var(--text-primary)!important;
}

#auth-screen input::placeholder {
    color: var(--text-muted)!important;
}

.auth-field-group .password-wrapper~label,.auth-field-group>label {
    color: #8ab0e0!important;
}

body.theme-light #auth-screen,body.theme-light .auth-field-group input {
    color: #1a2a4a!important;
}

body.theme-light .auth-field-group .password-wrapper~label,
body.theme-light .auth-field-group>label
{
    color: #2e3d52!important;
}

.player-artwork {
    width: 66px;
    height: 66px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-light);
    border: 1px solid var(--border);
    box-shadow: 0 4px 18px rgb(0 0 0 / .5);
}

#sonic_art {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sonic_art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

#sonic_art:empty::after {
    content: "🎵";
    font-size: 1.8rem;
}

#dj_profile {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg,var(--primary-dark),var(--bg-light));
    border-radius: inherit;
    overflow: hidden;
}

#dj_profile[hidden],#sonic_art[hidden] {
    display: none!important;
}

.dj-profile-badge {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.25rem;
    color: #fff;
    text-shadow: 0 2px 10px rgb(0 0 0 / .45);
    letter-spacing: .04em;
}

.dj-profile-label {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 4px;
    padding: 2px 4px;
    border-radius: 6px;
    background: rgb(0 0 0 / .45);
    color: #fff;
    font-size: .52rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-track {
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

#sonic_title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.player-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.player-listeners {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    color: var(--text-muted);
}

.player-listeners svg {
    flex-shrink: 0;
}

#sonic_listeners {
    font-size: .75rem;
    color: var(--text-listeners)!important;
    font-weight: 600;
}

#sonic_dj {
    font-size: .75rem;
    color: var(--primary-light)!important;
    font-weight: 600;
}

.listeners-label {
    font-size: .73rem;
    color: var(--text-listeners)!important;
    font-weight: 600;
}

.equalizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--trans);
}

.equalizer.playing {
    opacity: 1;
}

.eq-bar {
    width: 3px;
    border-radius: 2px;
    background: var(--primary-light);
    transform-origin: bottom;
    animation: eq-bounce 0.9s ease-in-out infinite;
}

.eq-bar:first-child {
    animation-delay: 0s;
    animation-duration: 0.85s;
}

.eq-bar:nth-child(2) {
    animation-delay: 0.18s;
    animation-duration: 0.65s;
}

.eq-bar:nth-child(3) {
    animation-delay: 0.35s;
    animation-duration: 1s;
}

.eq-bar:nth-child(4) {
    animation-delay: 0.52s;
    animation-duration: 0.75s;
}

@keyframes eq-bounce {
    0%,100% {
        height: 4px;
    }
    50% {
        height: 16px;
    }
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.play-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 18px var(--primary-glow);
    transition: transform var(--trans),box-shadow var(--trans),background var(--trans);
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 28px var(--primary-glow);
}

.play-btn:active {
    transform: scale(.94);
}

.volume-zone {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.vol-icon {
    color: var(--text-muted);
}

.vol-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right,var(--primary) 0,var(--primary) var(--vol-pct,70%),var(--bg-light) var(--vol-pct,70%),var(--bg-light) 100%);
    border-radius: 2px;
    cursor: pointer;
    outline: 0;
    border: none;
}

.vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    transition: transform var(--trans),background var(--trans);
}

.vol-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-light);
}

.vol-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    border: none;
    cursor: pointer;
}

#content-area {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 10px 0;
}

#bg-slideshow {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg-slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.bg-slide.active {
    opacity: 1;
}

#bg-slideshow::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgb(5 10 20 / .55);
}

#bg-slideshow::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background-image: repeating-linear-gradient(-45deg,transparent,transparent 5px,rgb(24 119 242 / .13) 5px,rgb(24 119 242 / .13) 6px);
}

#chat-wrapper {
    position: relative;
    z-index: 10;
    width: 90%;
    max-width: 1200px;
    height: 90%;
    max-height: min(680px, calc(100dvh - var(--header-h) - var(--player-h) - 20px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#chat-app {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#chat-header {
    height: calc(58px + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--bg-medium);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    gap: 10px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    font-size: 1.25rem;
}

#chat-header h2 {
    font-size: 1rem;
    font-weight: 800;
}

.online-badge {
    background: rgb(6 214 160 / .1);
    color: var(--text-listeners);
    border-radius: 20px;
    padding: 2px 9px;
    font-size: .72rem;
    font-weight: 700;
    border: 1px solid rgb(6 214 160 / .22);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 24px;
    cursor: pointer;
    user-select: none;
    border: 1px solid #fff0;
    transition: background 0.15s,border-color 0.15s;
    position: relative;
    max-width: 180px;
}

.profile-btn:hover {
    background: var(--bg-light);
    border-color: var(--border);
}

#header-avatar {
    flex-shrink: 0;
    line-height: 0;
}

#header-avatar div,#header-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: block;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
    overflow: hidden;
}

.profile-info .current-username {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 90px;
}

.current-username {
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.role-badge {
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgb(24 119 242 / .18);
    color: var(--primary-light);
    border: 1px solid rgb(24 119 242 / .28);
}

.profile-info .role-badge {
    font-size: .6rem;
    padding: 1px 6px;
}

.profile-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.profile-btn:has(+#profile-menu:not([style*="none"])) .profile-chevron {
    transform: rotate(180deg);
}

.profile-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 195px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgb(0 0 0 / .55),0 2px 8px rgb(0 0 0 / .3);
    z-index: 400;
    overflow: hidden;
    animation: menuIn 0.15s ease;
}

@keyframes menuIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: 0 0;
    border: none;
    color: var(--text-secondary);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: background 0.12s,color 0.12s;
    font-family: inherit;
}

.profile-menu-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.profile-menu-item.danger {
    color: var(--danger);
}

.profile-menu-item.danger:hover {
    background: rgb(247 37 133 / .1);
}

.profile-menu-item span {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    background: 0 0;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    min-width: 44px;
    min-height: 44px;
    transition: background var(--trans),color var(--trans);
}

.icon-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

#chat-main {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    background-color: var(--bg-dark);
    background-image: url(../php/chat/bgs/chatBGSANTOS.webp);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

#chat-main::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgb(6 14 28 / .82);
}

#chat-main::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 90% 80% at 50% 50%,transparent 50%,rgb(4 10 20 / .5) 100%);
}

#messages-container {
    position: relative;
    z-index: 1;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#messages-container::-webkit-scrollbar {
    width: 5px;
}

#messages-container::-webkit-scrollbar-track {
    background: 0 0;
}

#messages-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

#messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 10px;
    position: relative;
    background: rgb(10 22 40 / .55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.12s;
    border: 1px solid rgb(255 255 255 / .03);
}

.message:hover {
    background: rgb(18 32 64 / .8);
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .88rem;
    font-weight: 800;
    flex-shrink: 0;
    color: #fff;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.message-username {
    font-weight: 700;
    font-size: .9rem;
}

.role-icon {
    margin-right: 2px;
    font-size: .8em;
}

.message-time {
    font-size: .68rem;
    color: var(--text-muted);
}

.message-content {
    word-break: break-word;
    line-height: 1.55;
    color: var(--text-primary);
    font-size: .9rem;
}

.message-content img.gif {
    width: 300px;
    height: 169px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 4px;
    display: block;
}

.message-actions {
    display: none;
    align-items: center;
    gap: 2px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    box-shadow: 0 2px 8px rgb(0 0 0 / .3);
}

.message:hover .message-actions {
    display: flex;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: 0 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--text-secondary);
    transition: background 0.1s;
}

.msg-action-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.msg-action-btn.delete-btn:hover {
    color: var(--danger);
}

.msg-action-btn.ban-btn:hover {
    color: var(--warning);
}

.system-message {
    text-align: center;
    color: var(--text-muted);
    font-size: .75rem;
    padding: 6px 12px;
    font-style: italic;
    background: rgb(10 22 40 / .4);
    border-radius: 8px;
    margin: 2px 0;
    border: 1px solid rgb(255 255 255 / .04);
}

.banned-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    text-align: center;
}

.banned-screen .banned-icon {
    font-size: 4rem;
}

.banned-screen h1 {
    font-size: 1.8rem;
    color: var(--danger);
}

.banned-screen p {
    color: var(--text-secondary);
    max-width: 400px;
}

#chat-input-area {
    background: var(--bg-medium);
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 6px;
    transition: border-color var(--trans),box-shadow var(--trans);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(24 119 242 / .1);
}

#message-input {
    flex: 1;
    background: 0 0;
    border: none;
    outline: 0;
    color: var(--text-primary);
    font-size: 1em;
    padding: 2px 2px;
    resize: none;
    line-height: 1.2;
    max-height: 100px;
    font-family: inherit;
    -webkit-appearance: none;
}

#message-input::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.gif-trigger-btn {
    width: auto;
    padding: 0 8px;
    border-radius: 7px;
    border: 1px solid #fff0;
    min-height: 36px;
    transition: background var(--trans),border-color var(--trans);
}

.gif-trigger-btn:hover {
    background: rgb(24 119 242 / .14);
    border-color: rgb(24 119 242 / .3);
}

.gif-btn-label {
    font-size: .76rem;
    font-weight: 800;
    color: var(--primary-light);
    letter-spacing: .02em;
}

#send-btn {
    background: linear-gradient(135deg,var(--primary),#4cc9f0);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .85rem;
    font-weight: 700;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--trans),box-shadow var(--trans);
    box-shadow: 0 2px 10px rgb(24 119 242 / .35);
    min-height: 40px;
}

#send-btn:hover {
    opacity: .9;
    box-shadow: 0 3px 14px rgb(24 119 242 / .5);
}

#send-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#gif-modal {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    width: min(400px, calc(100vw - 20px));
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 -2px 40px rgb(0 0 0 / .65),0 0 0 1px rgb(255 255 255 / .04);
    z-index: 300;
    flex-direction: column;
    overflow: hidden;
    max-height: min(380px, calc(100dvh - 160px));
}

#gif-modal.visible {
    display: flex;
    animation: gifIn 0.2s cubic-bezier(.22,1,.36,1);
}

#gif-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

#gif-backdrop.visible {
    display: block;
}

@keyframes gifIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.gif-modal-header {
    padding: 10px 10px 6px;
    flex-shrink: 0;
}

.gif-search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 9px;
    padding: 2px 6px 2px 10px;
    transition: border-color var(--trans);
}

.gif-search-wrapper:focus-within {
    border-color: var(--primary);
}

.gif-search-icon {
    font-size: .85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.gif-search-input {
    flex: 1;
    background: 0 0;
    border: none;
    outline: 0;
    color: var(--text-primary);
    font-size: 16px;
    padding: 7px 0;
    font-family: inherit;
    -webkit-appearance: none;
}

.gif-search-input::placeholder {
    color: var(--text-muted);
}

.gif-search-clear {
    background: 0 0;
    border: none;
    color: var(--text-muted);
    font-size: .75rem;
    padding: 4px 6px;
    border-radius: 5px;
    line-height: 1;
    transition: color var(--trans),background var(--trans);
}

.gif-search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-light);
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 3px;
    padding: 0 8px 6px;
    max-height: min(320px, calc(100dvh - 220px));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.gif-grid::-webkit-scrollbar {
    width: 4px;
}

.gif-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.gif-section-label {
    font-size: .65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    padding: 4px 10px 5px;
    line-height: 1;
    flex-shrink: 0;
}

.gif-item {
    position: relative;
    overflow: hidden;
    border-radius: 7px;
    background: var(--bg-light);
    cursor: pointer;
    height: 100px;
}

.gif-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.25s,transform 0.2s;
}

.gif-item.loaded img {
    opacity: 1;
}

.gif-item:hover img {
    transform: scale(1.07);
}

.gif-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff0;
    transition: background 0.15s;
    border-radius: 7px;
}

.gif-item:hover::after {
    background: rgb(0 0 0 / .28);
}

.gif-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.gif-overlay-icon {
    color: #fff;
    font-size: 1.15rem;
    opacity: 0;
    transform: scale(.5);
    transition: opacity 0.15s,transform 0.15s;
    text-shadow: 0 2px 8px rgb(0 0 0 / .6);
}

.gif-item:hover .gif-overlay-icon {
    opacity: 1;
    transform: scale(1);
}

.gif-skeleton {
    border-radius: 7px;
    height: 100px;
    background: linear-gradient(90deg,var(--bg-light) 25%,var(--border) 50%,var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gif-empty {
    grid-column: 1/-1;
    text-align: center;
    padding: 28px 14px;
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.7;
}

.gif-empty-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    display: block;
}

.gif-footer {
    text-align: center;
    padding: 7px;
    font-size: .68rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

#auth-screen {
    position: fixed;
    inset: 0;
    top: calc(var(--header-h) + var(--player-h) + 18px);
    height: calc(100dvh - var(--header-h) - var(--player-h) - 18px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px max(20px, var(--safe-bottom));
    background: 0 0;
    overflow: auto;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 36px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    animation: authIn 0.4s cubic-bezier(.22,1,.36,1);
}

@keyframes authIn {
    from {
        opacity: 0;
        transform: translateY(28px) scale(.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-logo-bubble {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg,var(--primary),#4cc9f0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    box-shadow: 0 4px 20px rgb(24 119 242 / .5);
}

.auth-logo-text {
    line-height: 1.1;
}

.auth-logo-name {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.02em;
    background: linear-gradient(135deg,var(--text-primary) 30%,var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: #fff0;
    background-clip: text;
}

.auth-logo-tagline {
    display: block;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 28px;
    gap: 2px;
}

.auth-tab {
    padding: 10px 0;
    border: none;
    background: 0 0;
    color: var(--text-secondary);
    border-radius: 7px;
    font-size: .88rem;
    font-weight: 600;
    transition: background var(--trans),color var(--trans),box-shadow var(--trans);
}

.auth-tab.active {
    background: linear-gradient(135deg,var(--primary),#4cc9f0);
    color: #fff;
    box-shadow: 0 2px 12px rgb(24 119 242 / .45);
}

.auth-tab:not(.active):hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 16px;
}

.auth-field-group {
    position: relative;
}

.auth-field-group label {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: .95rem;
    font-weight: 400;
    pointer-events: none;
    transition: transform 150ms cubic-bezier(.4,0,.2,1),font-size 150ms cubic-bezier(.4,0,.2,1),color 150ms cubic-bezier(.4,0,.2,1);
    background: 0 0;
    padding: 0;
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 0;
    white-space: nowrap;
}

.auth-field-group input {
    width: 100%;
    padding: 16px 15px 8px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    outline: 0;
    transition: border-color var(--trans),box-shadow var(--trans);
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.auth-field-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(24 119 242 / .15);
}

.auth-field-group input::placeholder {
    color: #fff0;
}

.auth-field-group input:focus~label,
.auth-field-group input:not(:placeholder-shown)~label
{
    transform: translateY(-130%) scale(.78);
    color: var(--primary-light);
    background: var(--bg-input);
    padding: 0 4px;
    left: 12px;
}

.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 46px;
    width: 100%;
}

.auth-field-group .password-wrapper~label {
    top: 50%;
    transform: translateY(-50%);
}

.auth-field-group .password-wrapper~label.floated,
.auth-field-group:focus-within .password-wrapper~label
{
    transform: translateY(-130%) scale(.78);
    color: var(--primary-light);
    background: var(--bg-input);
    padding: 0 4px;
    left: 12px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: 0 0;
    border: none;
    color: var(--text-muted);
    font-size: .95rem;
    padding: 6px;
    border-radius: 5px;
    transition: color var(--trans);
    line-height: 1;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--text-primary);
}

.auth-error {
    color: var(--danger);
    font-size: .82rem;
    min-height: 18px;
    margin-bottom: 10px;
    padding: 0 2px;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg,var(--primary),#4cc9f0);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    transition: opacity var(--trans),transform 0.1s,box-shadow var(--trans);
    box-shadow: 0 4px 20px rgb(24 119 242 / .45);
    letter-spacing: .01em;
    -webkit-appearance: none;
}

.btn-primary:hover {
    opacity: .9;
    box-shadow: 0 6px 24px rgb(24 119 242 / .55);
}

.btn-primary:active {
    transform: scale(.98);
}

.btn-primary:disabled {
    opacity: .45;
    cursor: not-allowed;
}

#sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: var(--sidebar-width);
    background: var(--bg-medium);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform var(--trans);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 24px rgb(0 0 0 / .45);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

#sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

#online-users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

#online-users-list::-webkit-scrollbar {
    width: 4px;
}

#online-users-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 8px;
    border-radius: 8px;
    transition: background 0.1s;
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.online-user-item:hover {
    background: var(--bg-light);
}

.sidebar-avatar {
    width: 22px!important;
    height: 22px!important;
    min-width: 22px!important;
    max-width: 22px!important;
    border-radius: 50%;
    flex: 0 0 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .65rem;
    font-weight: 800;
    color: #fff;
    overflow: hidden;
}

.sidebar-avatar img {
    width: 22px!important;
    height: 22px!important;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.online-user-item span {
    font-size: .86rem;
    font-weight: 500;
}

.self-label {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
}

.online-empty {
    color: var(--text-muted);
    font-size: .83rem;
    padding: 12px 10px;
    font-style: italic;
}

.user-mod-btns {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.online-user-item:hover .user-mod-btns {
    opacity: 1;
}

.sidebar-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.13s,color 0.13s,transform 0.1s;
    min-width: 32px;
    min-height: 32px;
}

.sidebar-action-btn.kick-btn:hover {
    background: rgb(249 115 22 / .15);
    color: #f97316;
    transform: scale(1.1);
}

.sidebar-action-btn.ban-btn-sidebar:hover {
    background: rgb(237 66 69 / .15);
    color: var(--danger);
    transform: scale(1.1);
}

.sidebar-action-btn:active {
    transform: scale(.9);
}

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .5);
    z-index: 199;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#sidebar-overlay.visible {
    display: block;
}

#mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .55);
    backdrop-filter: blur(4px);
    z-index: 150;
}

#mobile-nav-overlay.visible {
    display: block;
}

#mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(290px, 85vw);
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(.25,.8,.25,1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    box-shadow: 8px 0 32px rgb(0 0 0 / .6);
}

#mobile-nav.open {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mobile-nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-nav-logo .logo-img {
    height: 38px;
}

.mobile-nav-close {
    width: 34px;
    height: 34px;
    background: 0 0;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--trans),color var(--trans);
}

.mobile-nav-close:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.mobile-nav-items {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    border-radius: var(--radius-sm);
    background: 0 0;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: background var(--trans),color var(--trans);
    width: 100%;
}

.mobile-nav-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.mobile-nav-item.primary {
    color: var(--primary-light);
    border: 1px solid var(--border-primary);
    margin-top: 4px;
}

.mobile-nav-item.primary:hover {
    background: rgb(24 119 242 / .1);
}

.mobile-nav-footer {
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

#pwa-install-btn-mobile {
    display: none;
    width: 100%;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 11px;
    background: rgb(24 119 242 / .1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--primary-light);
    font-family: var(--font-body);
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--trans);
}

#pwa-install-btn-mobile.visible {
    display: flex;
}

#pwa-install-btn-mobile:hover {
    background: rgb(24 119 242 / .18);
}

#theme-toggle-btn-mobile {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}

#theme-toggle-btn-mobile:hover {
    background: rgb(24 119 242 / .18);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .7);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal-overlay.open .modal-box {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.modal-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    transform: translateY(18px) scale(.97);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(.22,1,.36,1),opacity 0.28s ease;
    box-shadow: 0 20px 70px rgb(0 0 0 / .7),0 0 0 1px rgb(255 255 255 / .04);
}

.modal-box.wide {
    max-width: 680px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 1;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 9px;
}

.modal-title-accent {
    color: var(--primary-light);
}

.modal-close {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    transition: background var(--trans),color var(--trans);
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 22px;
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input,.form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .9rem;
    padding: 10px 13px;
    outline: 0;
    transition: border-color var(--trans),box-shadow var(--trans);
    -webkit-appearance: none;
}

.form-input:focus,.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(24 119 242 / .18);
}

.form-textarea {
    resize: vertical;
    min-height: 88px;
}

.form-input::placeholder,.form-textarea::placeholder {
    color: var(--text-dim,#3e4060);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 6px;
    transition: background var(--trans),box-shadow var(--trans),transform var(--trans);
}

.btn-submit:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 18px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.form-success {
    text-align: center;
    padding: 22px;
    color: var(--success);
    font-size: .9rem;
    font-weight: 500;
}

.form-success .success-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: block;
}

.form-error-msg {
    color: var(--danger);
    font-size: .8rem;
    margin-top: 7px;
    padding: 9px 13px;
    background: rgb(247 37 133 / .1);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--danger);
}

.about-text {
    font-size: .88rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 24px;
    text-align: center;
}

.history {
    font-size: .9rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-left: 16px;
}

.history-youtube-link {
    color: inherit;
    text-decoration: none;
}

.history-youtube-link:hover,
.history-youtube-link:focus-visible {
    color: #4da3ff;
    text-decoration: underline;
}

.section-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.section-divider h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    flex-shrink: 0;
}

.section-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.team-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.team-card {
    width: 150px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    transition: border-color var(--trans),transform var(--trans);
    cursor: pointer;
}

.team-card:hover {
    border-color: var(--border-primary);
    transform: translateY(-3px);
}

.team-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--bg-light);
    margin: 0 auto 11px;
    overflow: hidden;
    border: 2px solid var(--border-primary);
}

.team-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.team-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-light);
}

.team-name {
    font-size: .86rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.team-role {
    font-size: .73rem;
    color: var(--text-muted);
    white-space: pre-line;
}

#ban-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / .6);
    z-index: 400;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#ban-modal-overlay.visible {
    display: flex;
}

#ban-modal {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px;
    width: 100%;
    max-width: 390px;
    box-shadow: var(--shadow);
    animation: authIn 0.22s cubic-bezier(.22,1,.36,1);
}

#ban-modal h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.ban-subtitle {
    color: var(--text-secondary);
    font-size: .83rem;
    margin-bottom: 16px;
}

.ban-form-group {
    margin-bottom: 13px;
}

.ban-form-group label {
    display: block;
    font-size: .72rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.ban-form-group input,.ban-form-group select,.ban-form-group textarea {
    width: 100%;
    padding: 11px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    outline: 0;
    transition: border-color var(--trans);
    font-family: inherit;
    -webkit-appearance: none;
}

.ban-form-group input:focus,
.ban-form-group select:focus,
.ban-form-group textarea:focus
{
    border-color: var(--primary);
}

.ban-form-group input[readonly] {
    opacity: .6;
}

.ban-form-group select option {
    background: var(--bg-medium);
}

.ban-form-row {
    display: flex;
    gap: 10px;
}

.ban-form-row .ban-form-group {
    flex: 1;
}

.ban-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-cancel {
    flex: 1;
    padding: 12px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: .86rem;
    transition: background var(--trans);
    min-height: 44px;
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-ban {
    flex: 1;
    padding: 12px;
    background: var(--danger);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: .86rem;
    font-weight: 700;
    transition: background var(--trans);
    min-height: 44px;
}

.btn-ban:hover {
    background: var(--danger-dark);
}

#toast-container {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 7px;
    pointer-events: none;
    align-items: center;
    width: calc(100% - 32px);
    max-width: 360px;
}

.toast {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 16px;
    font-size: .86rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 6px 28px rgb(0 0 0 / .5);
    animation: toastIn 0.32s cubic-bezier(.22,1,.36,1);
    text-align: center;
    pointer-events: all;
    max-width: 290px;
}

.toast.success {
    border-color: rgb(6 214 160 / .35);
    color: var(--success);
    background: rgb(6 214 160 / .1);
}

.toast.error {
    border-color: rgb(247 37 133 / .35);
    color: var(--danger);
    background: rgb(247 37 133 / .1);
}

.toast.info {
    border-color: rgb(24 119 242 / .28);
    color: var(--primary-light);
    background: rgb(24 119 242 / .1);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-6px) scale(.97);
    }
}

#iframe-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgb(0 0 0 / .75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#iframe-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

#iframe-modal {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1100px;
    max-height: calc(100dvh - 32px);
    background: var(--bg-dark);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgb(24 119 242 / .25);
    box-shadow: 0 24px 80px rgb(0 0 0 / .8),0 0 0 1px rgb(255 255 255 / .04);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.22s cubic-bezier(.22,1,.36,1);
}

#iframe-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgb(255 255 255 / .12);
    background: rgb(0 0 0 / .6);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

#iframe-close:hover {
    background: rgb(237 66 69 / .25);
    border-color: rgb(237 66 69 / .4);
    color: #f72585;
    transform: scale(1.08);
}

#iframe-content {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: var(--bg-dark);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.system-radio-inner {
    padding: 10px 14px 0;
    font-size: .88rem;
    color: var(--text-primary);
    font-weight: 500;
}

.system-radio-timer {
    height: 3px;
    background: rgb(255 255 255 / .07);
    margin-top: 8px;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}

.system-radio-bar {
    display: block;
    height: 100%;
    width: var(--start-width,100%);
    background: linear-gradient(90deg,var(--primary),#57f287);
    border-radius: inherit;
    transform-origin: left;
}

@keyframes radioTimerBar {
    from {
        width: var(--start-width,100%);
    }
    to {
        width: 0%;
    }
}

.admin-page {
    overflow: auto;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-dark);
}

.admin-container {
    max-width: 960px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 1.45rem;
    font-weight: 800;
}

.admin-card {
    background: var(--bg-medium);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 18px;
}

.admin-card h2 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}

.admin-table th {
    text-align: left;
    padding: 9px 12px;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 9px 12px;
    border-bottom: 1px solid rgb(30 58 110 / .5);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgb(255 255 255 / .02);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}

.badge-danger {
    background: rgb(237 66 69 / .16);
    color: var(--danger);
}

.badge-warning {
    background: rgb(255 209 102 / .16);
    color: var(--warning);
}

.badge-muted {
    background: rgb(255 255 255 / .06);
    color: var(--text-secondary);
}

.btn-sm {
    padding: 5px 12px;
    border: none;
    border-radius: 6px;
    font-size: .78rem;
    font-weight: 700;
    transition: opacity 0.15s;
}

.btn-sm:hover {
    opacity: .82;
}

.btn-sm-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm-success {
    background: var(--success);
    color: #111;
}

.btn-sm-primary {
    background: var(--primary);
    color: #fff;
}

code {
    font-family: monospace;
    font-size: .8rem;
    background: rgb(24 119 242 / .1);
    padding: 2px 6px;
    border-radius: 4px;
}

#admin-login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.admin-login-card {
    background: rgb(24 25 41 / .9);
    border: 1px solid rgb(24 119 242 / .2);
    border-radius: 20px;
    padding: 38px 32px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.admin-login-card h1 {
    font-size: 1.35rem;
    margin-bottom: 6px;
}

.admin-login-card p {
    color: var(--text-secondary);
    font-size: .83rem;
    margin-bottom: 22px;
}

.admin-login-card input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    outline: 0;
    transition: border-color var(--trans);
    margin-bottom: 12px;
    -webkit-appearance: none;
}

.admin-login-card input:focus {
    border-color: var(--primary);
}

#visits-widget {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-panel);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 14px 0 0 14px;
    border-right: none;
    padding: 14px 12px 14px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: border-color 0.2s,box-shadow 0.2s,padding 0.2s;
    min-width: 62px;
}

#visits-widget:hover {
    border-color: var(--primary);
    box-shadow: -4px 0 20px rgb(24 119 242 / .3);
    padding-right: 18px;
}

.visits-icon {
    font-size: 1.3rem;
}

.visits-num {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.visits-label {
    font-size: .62rem;
    color: #8ab0e0;
    text-transform: uppercase;
    letter-spacing: .06em;
}

body.theme-light #visits-widget {
    color: #1255b8;
}

body.theme-light .visits-num {
    color: #1255b8;
}

body.theme-light .visits-label {
    color: #4a6080;
}

.share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-light);
    color: var(--text-primary);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s,border-color 0.15s,transform 0.1s;
    font-family: inherit;
}

.share-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn.whatsapp {
    color: #25d366;
    border-color: rgb(37 211 102 / .25);
}

.share-btn.whatsapp:hover {
    background: rgb(37 211 102 / .1);
    border-color: rgb(37 211 102 / .5);
}

.share-btn.facebook {
    color: #1877f2;
    border-color: rgb(24 119 242 / .25);
}

.share-btn.facebook:hover {
    background: rgb(24 119 242 / .1);
    border-color: rgb(24 119 242 / .5);
}

.share-btn.twitter {
    color: #e8e9f3;
    border-color: rgb(255 255 255 / .15);
}

.share-btn.twitter:hover {
    background: rgb(255 255 255 / .08);
}

.share-btn.telegram {
    color: #29b6f6;
    border-color: rgb(41 182 246 / .25);
}

.share-btn.telegram:hover {
    background: rgb(41 182 246 / .1);
    border-color: rgb(41 182 246 / .5);
}

.share-btn.email {
    color: #ffa726;
    border-color: rgb(255 167 38 / .25);
}

.share-btn.email:hover {
    background: rgb(255 167 38 / .1);
    border-color: rgb(255 167 38 / .5);
}

.share-btn.copy {
    color: #b39ddb;
    border-color: rgb(179 157 219 / .25);
}

.share-btn.copy:hover {
    background: rgb(179 157 219 / .1);
    border-color: rgb(179 157 219 / .5);
}

.stats-card {
    background: rgb(24 119 242 / .08);
    border: 1px solid rgb(24 119 242 / .2);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}

.stats-num {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-light);
    line-height: 1;
    margin-bottom: 4px;
}

.stats-lbl {
    font-size: .68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.stats-country-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--bg-light);
}

.stats-country-bar-wrap {
    flex: 1;
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.stats-country-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.swal2-popup {
    background: var(--bg-panel)!important;
    border: 1px solid var(--border)!important;
    border-radius: 16px!important;
    box-shadow: 0 24px 60px rgb(0 0 0 / .7)!important;
    font-family: var(--font-body)!important;
}

.swal2-title {
    color: var(--text-primary)!important;
    font-size: 1.1rem!important;
    font-weight: 700!important;
}

.swal2-content,.swal2-html-container {
    color: var(--text-secondary)!important;
    font-size: 0.88rem!important;
}

.swal2-confirm {
    border-radius: 8px!important;
    font-weight: 700!important;
    padding: 10px 24px!important;
    font-size: 0.88rem!important;
    box-shadow: none!important;
}

.swal2-cancel {
    border-radius: 8px!important;
    font-weight: 600!important;
    padding: 10px 24px!important;
    font-size: 0.88rem!important;
    background: var(--bg-medium)!important;
    color: var(--text-secondary)!important;
    box-shadow: none!important;
}

.swal2-cancel:hover {
    background: var(--bg-light)!important;
    color: var(--text-primary)!important;
}

.swal2-icon {
    border-color: transparent!important;
}

.swal2-icon.swal2-warning {
    border-color: rgb(250 166 26 / .3)!important;
}

.swal2-icon.swal2-question {
    border-color: rgb(24 119 242 / .3)!important;
}

.swal2-icon.swal2-error {
    border-color: rgb(237 66 69 / .3)!important;
}

.swal2-backdrop-show {
    background: rgb(0 0 0 / .65)!important;
    backdrop-filter: blur(4px)!important;
}

.swal-kick-popup {
    width: min(340px, calc(100vw - 32px))!important;
    padding: 20px!important;
}

.swal-kick-popup .swal2-html-container {
    margin: 4px 0 0!important;
    padding: 0!important;
    overflow: visible!important;
}

.swal-kick-popup .swal2-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
}

.swal-kick-popup .swal2-title {
    font-size: 1rem!important;
    padding: 0 0 4px!important;
}

.swal-kick-popup .swal2-actions {
    margin-top: 14px!important;
}

#loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transition: opacity 0.5s ease,visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-logo img {
    height: 72px;
    width: auto;
    filter: drop-shadow(0 0 16px var(--primary-glow));
}

.loading-bar-track {
    width: 130px;
    height: 3px;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 0;
    background: var(--text-primary);
    border-radius: 2px;
    animation: load-fill 1.5s ease forwards;
    box-shadow: 0 0 8px var(--primary-glow);
}

@keyframes load-fill {
    0% {
        width: 0;
    }
    60% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

.loading-text {
    font-size: .75rem;
    color: var(--text-primary);
    letter-spacing: .1em;
    text-transform: uppercase;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: 0 0;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 3px;
}

.hidden {
    display: none!important;
}

@media (max-width:900px) {
    #chat-wrapper {
        max-width: 100%;
        max-height: 84vh;
        height: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    #content-area {
        align-items: stretch;
        padding: 0;
    }
    #bg-slideshow {
        display: none;
    }
    body {
        background-image: url(images/bg1.webp)!important;
        background-size: cover!important;
        background-position: center!important;
        background-attachment: scroll!important;
        background-repeat: no-repeat!important;
    }
    body.theme-light {
        background-image: url(images/bg1.webp)!important;
    }
    body.theme-light #app-shell::before {
        background: rgb(200 215 235 / .42);
    }
    #app-shell::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgb(5 5 15 / .52);
        pointer-events: none;
        z-index: 0;
    }
    #app-shell {
        background: 0 0;
    }
    #chat-wrapper.auth-visible, {
        background: 0 0!important;
        backdrop-filter: none!important;
        border: none!important;
        box-shadow: none!important;
    }
    {
        background: 0 0!important;
    }
    #main-header {
        position: relative;
        z-index: 100;
    }
    #player-bar {
        position: relative;
        z-index: 99;
    }
    #content-area {
        position: relative;
        z-index: 10;
        background: 0 0;
    }
    #visits-widget {
        display: none;
    }
}

@media (max-width:768px) {
    :root {
        --header-h: 56px;
        --player-h: 76px;
    }
    #main-nav {
        display: none;
    }
    #pwa-install-btn {
        display: none!important;
    }
    #hamburger {
        display: flex;
        margin-left: auto;
    }
    #main-header {
        padding: 0 12px;
        gap: 10px;
    }
    #player-bar {
        padding: 0 12px;
        gap: 10px;
    }
    #theme-toggle-btn {
        display: none;
    }
    .player-artwork {
        width: 52px;
        height: 52px;
    }
    .vol-slider {
        width: 60px;
    }
    .equalizer {
        display: none;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width:600px) {
    #main-footer {
        display: none;
    }
    :root {
        --sidebar-width: 100vw;
    }
    #auth-screen {
        align-items: flex-start;
        padding: 20px 20px max(20px, var(--safe-bottom));
    }
    .auth-screen {
        height: calc(100vh - var(--header-h) - var(--player-h));
    }
    .auth-card {
        padding: 28px 18px;
        border-radius: var(--radius);
    }
    #chat-header {
        padding-left: 10px;
        padding-right: 10px;
    }
    .profile-chevron,.profile-info {
        display: none;
    }
    .profile-btn {
        padding: 3px;
        border-radius: 50%;
    }
    #messages-container {
        padding: 8px;
    }
    #message-input {
        font-size: 16px;
    }
    #chat-input-area {
        padding: 8px 10px;
        padding-bottom: max(10px, calc(8px + var(--safe-bottom)));
    }
    #gif-modal {
        position: fixed;
        bottom: max(80px, calc(80px + var(--safe-bottom)));
        left: 50%;
        transform: translateX(-50%);
        width: 85dvw;
        max-width: 500px;
        border-radius: 20px;
        max-height: 60dvh;
        z-index: 1000;
    }
    .gif-grid {
        grid-template-columns: repeat(3,1fr);
        grid-auto-rows: 100px;
        max-height: calc(75dvh - 80px);
        gap: 6px;
    }
    .message-content img.gif {
        width: 200px;
        height: 130px;
    }
    .ban-modal-btns {
        flex-direction: column;
    }
    .admin-table td:nth-child(n+4),.admin-table th:nth-child(n+4) {
        display: none;
    }
    .message {
        padding: 5px 7px;
        gap: 8px;
    }
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: .8rem;
    }
}

@media (max-width:480px) {
    :root {
        --player-h: 68px;
    }
    .vol-icon,.vol-slider {
        display: none;
    }
    .player-artwork {
        width: 46px;
        height: 46px;
    }
    .play-btn {
        width: 44px;
        height: 44px;
    }
    .modal-box {
        border-radius: var(--radius);
    }
    .modal-body {
        padding: 16px;
    }
    .team-grid {
        grid-template-columns: repeat(2,1fr);
    }
}

@media (max-width:380px) {
    .gif-grid {
        grid-template-columns: repeat(2,1fr);
        max-height: calc(65dvh - 90px);
        gap: 6px;
    }
    .auth-card {
        padding: 22px 14px;
    }
    .auth-screen {
        height: calc(100vh - var(--header-h) - var(--player-h));
    }
    .message-content img.gif {
        width: 160px;
        height: 105px;
    }
}

@supports (padding-bottom:env(safe-area-inset-bottom)) {
    #chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    #toast-container {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
    #sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    #chat-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}

@supports (-webkit-touch-callout:none) {
    #chat-app {
        height: 100svh;
    }
    #chat-input-area {
        position: sticky;
        bottom: env(safe-area-inset-bottom);
    }
}

#dj_profile .dj-profile-img {
    width: 100%!important;
    height: 100%!important;
    display: block!important;
    object-fit: cover!important;
    object-position: center top!important;
    border-radius: inherit!important;
}

#dj_profile .dj-profile-badge,#dj_profile .dj-profile-label {
    display: none!important;
}

#dj_profile .dj-profile-fallback {
    width: 100%!important;
    height: 100%!important;
    display: flex!important;
    align-items: center!important;
    justify-content: center!important;
    font-size: 1.8rem!important;
}

.player-artwork>#sonic_art,.player-artwork>#dj_profile {
    width: 100%!important;
    height: 100%!important;
    max-width: 100%!important;
    max-height: 100%!important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit!important;
    overflow: hidden!important;
}

.player-artwork>#dj_profile {
    background: var(--bg-light)!important;
    border: 0!important;
    box-shadow: none!important;
    padding: 0!important;
    margin: 0!important;
}

.player-artwork>#dj_profile[hidden],.player-artwork>#sonic_art[hidden] {
    display: none!important;
}

.player-artwork>#dj_profile img,
.player-artwork>#dj_profile .dj-profile-img,
.player-artwork>#sonic_art img
{
    width: 100%!important;
    height: 100%!important;
    max-width: 100%!important;
    max-height: 100%!important;
    display: block!important;
    object-fit: cover!important;
    object-position: center top!important;
    border-radius: inherit!important;
}

.message-username.role-moderator .cap,
.message-username .role-moderator.cap,
.role-moderator.cap
{
    color: var(--success)!important;
}

.message-username.role-admin .cap,
.message-username .role-admin.cap,
.role-admin.cap
{
    color: var(--danger)!important;
}

.online-users-list .role-moderator .cap,
.online-users-list .role-moderator-cap,
.online-users-list .role-loc
{
    color: var(--success)!important;
}

.online-users-list .role-admin .cap,
.online-users-list .role-admin-cap,
.online-users-list .role-admin
{
    color: var(--danger)!important;
}

.swal2-popup .swal2-icon.swal2-info,.swal2-popup .swal-bv-icon {
    border-color: #3fc3ee!important;
    color: #3fc3ee!important;
}

.swal2-popup .swal2-icon.swal2-info .swal2-icon-content,
.swal2-popup .swal-bv-icon .swal2-icon-content
{
    display: flex!important;
    align-items: center!important;
    justify-content: center!important;
    width: 100%!important;
    height: 100%!important;
    font-size: 3.75em!important;
    font-weight: 400!important;
    line-height: 1!important;
    color: #3fc3ee!important;
    opacity: 1!important;
    visibility: visible!important;
    transform: none!important;
}
.player-seo-line {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    margin-top: 10px;
    max-width: 100%;
    overflow: hidden;
}

.player-seo-line h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    font-family: var(--font-body);
    font-size: 0.70rem;
    line-height: 1.15;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
}

.player-seo-icon {
    flex-shrink: 0;
    color: var(--primary-light);
}

.seo-radio-name {
    color: var(--primary-light);
    flex-shrink: 0;
}

.seo-radio-desc {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-seo-line p {
    margin: 0;
    font-size: 0.65rem;
    line-height: 1.15;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

body.theme-light .player-seo-icon,
body.theme-light .seo-radio-name {
    color: var(--primary);
}

body.theme-light .seo-radio-desc {
    color: var(--text-primary);
}

body.theme-light .player-seo-line p {
    color: var(--text-secondary);
}

@media (max-width: 700px) {
    .player-seo-line h1 {
        font-size: 0.62rem;
    }

    .player-seo-line p {
        font-size: 0.53rem;
    }
    .player-seo-line {
        display: none;
    }
}

@media (max-width: 480px) {
    .player-seo-line {
        display: none;
    }
}

/* === PATCH iOS/mobile - desbloquear loading, login e player === */

#loading-screen.hidden,
#loading-screen.force-hide {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#bg-slideshow,
#bg-slideshow::before,
#bg-slideshow::after,
#app-shell::before,
#chat-main::before,
#chat-main::after {
    pointer-events: none !important;
}

/* Evita overlays invisíveis a bloquear toques */
#sidebar-overlay:not(.visible),
#mobile-nav-overlay:not(.visible),
#ban-modal-overlay:not(.visible),
#gif-backdrop:not(.visible),
.modal-overlay:not(.open),
.lbox-overlay:not(.open),
#iframe-overlay:not(.open),
#landscape-overlay:not(.visible) {
    display: none !important;
    pointer-events: none !important;
}

/* O auth-screen deve ficar dentro da zona do chat, não por cima da página toda */
#auth-screen {
    position: absolute !important;
    inset: 0 !important;
    top: auto !important;
    height: auto !important;
    z-index: 30 !important;
    pointer-events: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Garante que o player fica sempre clicável */
#main-header {
    position: relative !important;
    z-index: 120 !important;
    pointer-events: auto !important;
}

#player-bar {
    position: relative !important;
    z-index: 121 !important;
    pointer-events: auto !important;
}

#player-bar *,
#main-header *,
#auth-screen *,
.auth-card * {
    pointer-events: auto !important;
}

/* Corrige o bug iOS do chat ocupar 100svh dentro do layout */
@supports (-webkit-touch-callout: none) {
    #chat-app {
        height: 100% !important;
        min-height: 0 !important;
    }

    #chat-input-area {
        position: relative !important;
        bottom: auto !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }
}

/* === PATCH iOS stream/touch lock === */
#offline-overlay {
    display: none !important;
    pointer-events: none !important;
}

@supports (-webkit-touch-callout: none) {
    body, #app-shell, #content-area, #chat-app {
        -webkit-overflow-scrolling: touch;
    }

    #player-bar, #player-bar *, #main-header, #main-header * {
        touch-action: manipulation;
    }
}

/* === PATCH auth login/registar centrado e sem cortes === */
#chat-wrapper:has(#auth-screen:not([style*="display: none"])),
#chat-wrapper.auth-visible {
    height: 100% !important;
    max-height: none !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

#auth-screen {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(12px, 3dvh, 28px) 18px max(clamp(12px, 3dvh, 28px), var(--safe-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.auth-card {
    margin: auto !important;
    width: min(420px, calc(100vw - 36px)) !important;
    max-height: calc(100dvh - var(--header-h) - var(--player-h) - var(--safe-top) - var(--safe-bottom) - 34px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

@media (max-width: 600px) {
    #content-area {
        align-items: stretch !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    #auth-screen {
        align-items: center !important;
        justify-content: center !important;
        padding: 12px 18px max(12px, var(--safe-bottom)) !important;
    }

    .auth-card {
        width: min(100%, 420px) !important;
        max-height: calc(100dvh - var(--header-h) - var(--player-h) - var(--safe-top) - var(--safe-bottom) - 24px) !important;
        padding: 24px 18px !important;
    }
}

@media (max-width: 380px), (max-height: 720px) {
    .auth-card {
        padding: 20px 14px !important;
    }

    .auth-logo {
        margin-bottom: 16px !important;
    }

    .auth-tabs,
    .auth-fields {
        margin-bottom: 16px !important;
    }

    .auth-field-group {
        margin-bottom: 14px !important;
    }

    .auth-field-group input {
        height: 46px !important;
    }
}


/* === PATCH auth: esconder painel depois do login === */
#auth-screen[hidden],
#auth-screen[style*="display: none"],
#app-shell:not(.auth-visible) #auth-screen,
#chat-wrapper:not(.auth-visible) #auth-screen {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#app-shell.auth-visible #auth-screen,
#chat-wrapper.auth-visible #auth-screen {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* === PATCH iOS PWA standalone - layout mais compacto e preenchido === */
@supports (-webkit-touch-callout: none) {
    @media (display-mode: standalone) and (max-width: 600px) {
        :root {
            --header-h: 56px;
            --player-h: 74px;
        }

        html,
        body {
            height: 100%;
            min-height: 100svh;
            overflow: hidden;
            background: var(--bg-dark);
        }

        #app-shell {
            min-height: 100svh;
            height: 100svh;
            padding-top: max(env(safe-area-inset-top), 10px);
            padding-right: max(env(safe-area-inset-right), 10px);
            padding-bottom: max(env(safe-area-inset-bottom), 10px);
            padding-left: max(env(safe-area-inset-left), 10px);
            gap: 6px;
        }

        #main-header {
            height: var(--header-h) !important;
            min-height: var(--header-h) !important;
            margin: 0 !important;
            border-radius: 14px !important;
            padding: 0 13px !important;
        }

        .logo-img {
            height: 42px !important;
        }

        #hamburger {
            width: 42px !important;
            height: 42px !important;
        }

        #player-bar {
            height: var(--player-h) !important;
            min-height: var(--player-h) !important;
            margin: 0 !important;
            border-radius: 14px !important;
            padding: 0 12px !important;
            gap: 10px !important;
        }

        .player-artwork {
            width: 50px !important;
            height: 50px !important;
        }

        .player-track {
            font-size: 1rem !important;
            line-height: 1.15 !important;
            max-width: 100% !important;
        }

        .player-meta {
            font-size: .78rem !important;
        }

        .player-seo-line {
            display: none !important;
        }

        .play-btn {
            width: 58px !important;
            height: 58px !important;
            flex: 0 0 58px !important;
        }

        #content-area {
            flex: 1 1 auto !important;
            min-height: 0 !important;
            height: auto !important;
            align-items: stretch !important;
            justify-content: center !important;
            padding: 0 !important;
            overflow: hidden !important;
        }

        #chat-wrapper:not(.auth-visible) {
            width: 100% !important;
            max-width: none !important;
            height: 100% !important;
            max-height: none !important;
            min-height: 0 !important;
            margin: 0 !important;
            border-radius: 16px !important;
        }

        #chat-app {
            height: 100% !important;
            min-height: 0 !important;
            border-radius: 16px !important;
        }

        #chat-header {
            height: 68px !important;
            min-height: 68px !important;
            padding-top: 0 !important;
            padding-left: 12px !important;
            padding-right: 12px !important;
        }

        #chat-header h2 {
            font-size: 1.12rem !important;
            white-space: nowrap !important;
        }

        .online-badge {
            font-size: .78rem !important;
            padding: 3px 10px !important;
        }

        #messages-container {
            flex: 1 1 auto !important;
            min-height: 0 !important;
            padding: 8px 10px !important;
            overflow-y: auto !important;
            -webkit-overflow-scrolling: touch !important;
        }

        .message {
            padding: 6px 8px !important;
            gap: 8px !important;
        }

        .message-content img.gif,
        .message-content img.chat-image {
            max-width: min(100%, 330px) !important;
            width: auto !important;
            height: auto !important;
            max-height: 230px !important;
            object-fit: contain !important;
        }

        #chat-input-area {
            flex-shrink: 0 !important;
            padding: 9px 10px max(9px, env(safe-area-inset-bottom)) !important;
            position: relative !important;
            bottom: auto !important;
        }

        #message-form,
        .message-form {
            min-height: 56px !important;
        }

        #message-input {
            min-height: 48px !important;
            max-height: 88px !important;
            font-size: 16px !important;
        }

        #gif-btn,
        #send-btn {
            min-height: 52px !important;
        }
    }
}


/* === PATCH iOS Safari/PWA: evitar zoom e preencher melhor a tela === */
html.ios,
html.ios body {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    -webkit-text-size-adjust: 100% !important;
    touch-action: manipulation;
}

/* iOS faz zoom automático ao focar inputs com fonte <16px. Mantém sempre 16px. */
html.ios input,
html.ios textarea,
html.ios select,
html.ios button {
    font-size: 16px !important;
}

html.ios input,
html.ios textarea,
html.ios select {
    transform: translateZ(0);
    -webkit-user-select: text;
}

/* Classe criada por JS porque o Safari/iOS nem sempre respeita @media(display-mode: standalone). */
html.ios-standalone #app-shell {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    padding-top: 8px !important;
    padding-right: max(10px, env(safe-area-inset-right)) !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    padding-left: max(10px, env(safe-area-inset-left)) !important;
    gap: 7px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

html.ios-standalone #main-header {
    height: 56px !important;
    min-height: 56px !important;
    flex: 0 0 56px !important;
    margin: 0 !important;
    border-radius: 14px !important;
    padding: 0 13px !important;
}

html.ios-standalone .logo-img {
    height: 42px !important;
    width: auto !important;
}

html.ios-standalone #hamburger {
    width: 42px !important;
    height: 42px !important;
}

html.ios-standalone #player-bar {
    height: 72px !important;
    min-height: 72px !important;
    flex: 0 0 72px !important;
    margin: 0 !important;
    border-radius: 14px !important;
    padding: 0 12px !important;
    gap: 10px !important;
}

html.ios-standalone .player-artwork {
    width: 50px !important;
    height: 50px !important;
    flex: 0 0 50px !important;
}

html.ios-standalone .player-track {
    font-size: 1rem !important;
    line-height: 1.12 !important;
}

html.ios-standalone .player-meta {
    font-size: .8rem !important;
}

html.ios-standalone .player-seo-line,
html.ios-standalone .volume-zone,
html.ios-standalone .equalizer {
    display: none !important;
}

html.ios-standalone .play-btn {
    width: 58px !important;
    height: 58px !important;
    flex: 0 0 58px !important;
}

html.ios-standalone #content-area {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    align-items: stretch !important;
    justify-content: center !important;
}

html.ios-standalone #chat-wrapper:not(.auth-visible) {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

html.ios-standalone #chat-app {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

html.ios-standalone #chat-header {
    height: 64px !important;
    min-height: 64px !important;
    flex: 0 0 64px !important;
    padding: 0 12px !important;
}

html.ios-standalone #chat-header h2 {
    font-size: 1.08rem !important;
    white-space: nowrap !important;
}

html.ios-standalone .online-badge {
    font-size: .78rem !important;
    padding: 3px 10px !important;
}

html.ios-standalone #messages-container {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 10px !important;
}

html.ios-standalone .message {
    padding: 6px 8px !important;
    gap: 8px !important;
}

html.ios-standalone .message-content img.gif,
html.ios-standalone .message-content img.chat-image {
    max-width: min(100%, 330px) !important;
    max-height: 220px !important;
    object-fit: contain !important;
}

html.ios-standalone #chat-input-area {
    flex: 0 0 auto !important;
    position: relative !important;
    bottom: auto !important;
    padding: 9px 10px max(9px, env(safe-area-inset-bottom)) !important;
}

html.ios-standalone #message-form,
html.ios-standalone .message-form {
    min-height: 56px !important;
}

html.ios-standalone #message-input {
    min-height: 48px !important;
    max-height: 84px !important;
    font-size: 16px !important;
}

html.ios-standalone #gif-btn,
html.ios-standalone #send-btn {
    min-height: 52px !important;
}

/* Quando está no login/registo, mantém centrado sem provocar zoom nem corte. */
html.ios #chat-wrapper.auth-visible {
    height: 100% !important;
    max-height: none !important;
    overflow: hidden !important;
}

html.ios #auth-screen {
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

html.ios .auth-card {
    max-height: calc(100dvh - 160px) !important;
}

html.ios-standalone .auth-card {
    max-height: calc(100dvh - 150px) !important;
}

@media (max-width: 390px) {
    html.ios-standalone #main-header {
        height: 54px !important;
        min-height: 54px !important;
        flex-basis: 54px !important;
    }

    html.ios-standalone #player-bar {
        height: 70px !important;
        min-height: 70px !important;
        flex-basis: 70px !important;
    }

    html.ios-standalone #chat-header {
        height: 60px !important;
        min-height: 60px !important;
        flex-basis: 60px !important;
    }

    html.ios-standalone #chat-header h2 {
        font-size: 1rem !important;
    }
}


/* ==========================================================================
   PATCH iOS PWA: scroll do chat + SweetAlert2 acima do layout fixo
   ========================================================================== */
html.ios-standalone,
html.ios-standalone body {
    width: 100% !important;
    height: 100% !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: manipulation !important;
}

html.ios-standalone #chat-app,
html.ios-standalone #chat-main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

html.ios-standalone #messages-container {
    flex: 1 1 0 !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    transform: translateZ(0) !important;
    will-change: scroll-position !important;
    contain: size layout paint !important;
}

html.ios-standalone #messages-container,
html.ios-standalone #messages-container * {
    pointer-events: auto !important;
}

html.ios-standalone #chat-input-area {
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 20 !important;
}

/* SweetAlert2 dentro de PWA iOS precisa ficar acima de app-shell/fixed layers. */
.swal2-container,
html.ios .swal2-container,
html.ios-standalone .swal2-container {
    z-index: 2147483647 !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    min-height: 100dvh !important;
    height: 100dvh !important;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

html.ios .swal2-popup,
html.ios-standalone .swal2-popup {
    max-width: min(92vw, 420px) !important;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 18px !important;
}

html.ios .swal2-title,
html.ios .swal2-html-container,
html.ios .swal2-confirm,
html.ios .swal2-cancel,
html.ios-standalone .swal2-title,
html.ios-standalone .swal2-html-container,
html.ios-standalone .swal2-confirm,
html.ios-standalone .swal2-cancel {
    font-size: 16px !important;
}

/* ==========================================================================
   PATCH iOS PWA: esconder totalmente o chat enquanto está no login/registo
   ========================================================================== */
html.ios-standalone #chat-wrapper.auth-visible #chat-app,
html.ios-standalone #app-shell.auth-visible #chat-app,
html.ios #chat-wrapper.auth-visible #chat-app,
html.ios #app-shell.auth-visible #chat-app {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

html.ios-standalone #chat-wrapper.auth-visible,
html.ios #chat-wrapper.auth-visible {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
}

html.ios-standalone #chat-wrapper.auth-visible #auth-screen,
html.ios #chat-wrapper.auth-visible #auth-screen {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 80 !important;
}


/* iOS/PWA safety: evita que locks de modal/iframe fiquem presos após bfcache/pageshow. */
html.page-scroll-locked,
body.page-scroll-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* Likes/dislikes nas últimas músicas tocadas */
.history-list {
    display: grid;
    gap: 8px;
    padding-left: 1.35rem;
}

.history-item {
    padding: 6px 0;
}

.history-item::marker {
    color: var(--primary, #1877f2);
    font-weight: 700;
}

.history-item .history-youtube-link {
    display: inline;
    line-height: 1.45;
}

.song-votes {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.song-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid rgb(255 255 255 / .14);
    border-radius: 999px;
    background: rgb(255 255 255 / .07);
    color: inherit;
    font: inherit;
    font-size: .78rem;
    line-height: 1;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, opacity .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.song-vote-btn:hover,
.song-vote-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgb(77 163 255 / .65);
    background: rgb(77 163 255 / .15);
    outline: none;
}

.song-vote-btn.is-active {
    border-color: rgb(77 163 255 / .85);
    background: rgb(77 163 255 / .22);
    color: #dceeff;
}

.song-vote-btn:disabled {
    cursor: wait;
    opacity: .6;
    transform: none;
}

.song-vote-count {
    min-width: 1ch;
    font-weight: 700;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 520px) {
    .song-votes {
        display: flex;
        width: fit-content;
        margin: 6px 0 0;
    }

    .song-vote-btn {
        min-height: 32px;
        padding: 5px 10px;
        font-size: .84rem;
    }
}



/* Últimas músicas tocadas com o mesmo visual do Top Músicas */
.history-list.song-top-list {
    padding-left: 0;
    margin-left: 0;
}

.history-item.song-top-item {
    padding: 10px 12px;
}

.history-item .song-top-meta {
    font-size: .78rem;
}

.song-top-votes .song-vote-btn {
    min-height: 30px;
    padding: 5px 9px;
    background: rgb(255 255 255 / .07);
    border-color: rgb(255 255 255 / .1);
    color: #eaf5ff;
    font-size: .86rem;
    font-weight: 700;
}

.song-top-votes .song-vote-btn.is-active {
    border-color: rgb(77 163 255 / .9);
    background: linear-gradient(135deg, rgb(24 119 242 / .32), rgb(77 163 255 / .2));
}

@media (min-width: 640px) {
    .history-item.song-top-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }
}

/* Top de músicas votadas */
.song-top-panel {
    display: grid;
    gap: 14px;
}

.song-top-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.song-top-filter {
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid rgb(255 255 255 / .14);
    border-radius: 999px;
    background: rgb(255 255 255 / .07);
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease, opacity .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.song-top-filter:hover,
.song-top-filter:focus-visible {
    transform: translateY(-1px);
    border-color: rgb(77 163 255 / .65);
    background: rgb(77 163 255 / .15);
    outline: none;
}

.song-top-filter.is-active {
    border-color: rgb(77 163 255 / .9);
    background: linear-gradient(135deg, rgb(24 119 242 / .32), rgb(77 163 255 / .2));
    color: #eaf5ff;
}

.song-top-filter:disabled {
    cursor: wait;
    opacity: .62;
    transform: none;
}

.song-top-status {
    padding: 10px 12px;
    border: 1px solid rgb(77 163 255 / .22);
    border-radius: 14px;
    background: rgb(77 163 255 / .08);
    color: var(--text-soft, #cfe4ff);
    font-size: .92rem;
}

.song-top-status.is-error {
    border-color: rgb(255 111 111 / .35);
    background: rgb(255 111 111 / .1);
    color: #ffd4d4;
}

.song-top-results.is-loading {
    opacity: .72;
}

.song-top-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.song-top-item {
    padding: 10px 12px;
    border: 1px solid rgb(255 255 255 / .1);
    border-radius: 16px;
    background: rgb(255 255 255 / .055);
}

.song-top-item::marker {
    content: "";
}

.song-top-info {
    display: grid;
    gap: 4px;
}

.song-top-title {
    color: inherit;
    text-decoration: none;
    font-weight: 800;
    line-height: 1.35;
}

.song-top-title:hover,
.song-top-title:focus-visible {
    color: #8cc5ff;
    text-decoration: underline;
    outline: none;
}

.song-top-meta {
    color: var(--text-muted, #98abc2);
    font-size: .82rem;
}

.song-top-votes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    color: #eaf5ff;
    font-size: .86rem;
}

.song-top-votes span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgb(255 255 255 / .07);
    border: 1px solid rgb(255 255 255 / .1);
}

.song-top-empty {
    padding: 16px;
    border: 1px dashed rgb(255 255 255 / .16);
    border-radius: 16px;
    color: var(--text-muted, #98abc2);
    text-align: center;
}

@media (min-width: 640px) {
    .song-top-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .song-top-votes {
        flex: 0 0 auto;
        margin-top: 0;
    }
}


/* Ajuste final: Últimas tocadas em cartões, sem numeração automática e menos afastadas da esquerda */
#sonic_history .history-card-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 0 !important;
    list-style: none !important;
}

#sonic_history .history-card-item {
    margin-left: 0 !important;
    list-style: none !important;
}

#sonic_history .history-card-item::marker {
    content: "";
    display: none;
}

#sonic_history .history-card-item.song-top-item {
    padding: 10px 12px;
}

@media (max-width: 520px) {
    #sonic_history .history-card-list {
        gap: 8px;
    }

    #sonic_history .history-card-item.song-top-item {
        padding: 9px 10px;
    }
}


/* Alinhamento final: Últimas Músicas Tocadas igual ao Top Músicas */
#sonic_history.history,
#sonic_history {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#sonic_history .history-list,
#sonic_history .history-card-list,
#sonic_history .song-top-list {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

#sonic_history .history-item,
#sonic_history .history-card-item,
#sonic_history .song-top-item {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 640px) {
    #sonic_history.history,
    #sonic_history {
        margin-inline: 0 !important;
        padding-inline: 0 !important;
    }

    #sonic_history .history-list,
    #sonic_history .history-card-list,
    #sonic_history .song-top-list {
        margin-inline: 0 !important;
        padding-inline: 0 !important;
    }
}
