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

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #4a9eff;
    --accent-hover: #5baaff;
    --border: #404040;
    --success: #4caf50;
    --error: #f44336;
    --message-bg: #2d2d2d;
    --message-own: #1e3a5f;
    /* Fallback zanim JS zmierzy pasek - bez tego panel wysyłania może zasłonić radio */
    --radio-bar-height: 150px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Strona logowania */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 16px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 0;
}

.login-box {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 2em;
}

.brand-title-anim {
    display: inline;
    font-weight: inherit;
    animation: brand-color-pulse 22s ease-in-out infinite;
}

@keyframes brand-color-pulse {
    0% { color: #39ff14; }
    20% { color: #ffff00; }
    40% { color: #00f0ff; }
    60% { color: #ff5f1a; }
    80% { color: #ff10f0; }
    100% { color: #39ff14; }
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1em;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.error-message {
    background: var(--error);
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.registration-instructions {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.registration-instructions h3 {
    color: var(--error);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.registration-instructions ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: var(--text-primary);
    line-height: 1.8;
}

.registration-instructions li {
    margin-bottom: 8px;
}

.registration-instructions li strong {
    color: var(--accent);
}

.user-icons-legend {
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    margin-top: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.user-icons-legend h3 {
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.user-icons-intro {
    color: var(--text-secondary);
    font-size: 0.92em;
    margin-bottom: 16px;
    line-height: 1.5;
}

.user-icons-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.user-icons-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.user-icons-list .nick-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.user-icons-list .nick-icon-dj {
    font-size: 1.05rem;
    font-weight: 700;
    color: #39ff14;
}

.user-icons-list .nick-icon-sluchacz {
    color: #b388ff;
}

.user-icons-list .nick-icon svg {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
}

.user-icons-list strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-icons-list li > div > span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.88em;
    line-height: 1.45;
}

.instruction-note {
    background: rgba(74, 158, 255, 0.1);
    border-left: 3px solid var(--accent);
    padding: 12px;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
    margin-top: 15px;
}

.instruction-note strong {
    color: var(--accent);
}

.info-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-top: 20px;
}

/* Na PC: szerszy panel, formularz i instrukcja obok siebie */
@media (min-width: 900px) {
    .login-container {
        max-width: 920px;
    }
    
    .login-box {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 48px;
        row-gap: 8px;
        padding: 48px 56px;
        align-items: start;
    }
    
    .login-box > h1,
    .login-box > .subtitle,
    .login-box > .error-message {
        grid-column: 1 / -1;
    }
    
    .login-box > h1 {
        font-size: 2.35em;
    }
    
    .login-box > form {
        grid-column: 1;
    }
    
    .login-box > .info-text {
        grid-column: 1;
        text-align: left;
        margin-top: 8px;
    }
    
    .login-box > .user-icons-legend {
        grid-column: 1;
        margin-top: 16px;
    }
    
    .login-box > .registration-instructions {
        grid-column: 2;
        grid-row: 3 / span 3;
        margin-bottom: 0;
        height: 100%;
    }
}

@media (max-width: 899px) {
    .login-container {
        padding: 0 4px;
    }
    
    .login-box {
        padding: 28px 22px;
    }
}

/* Strona czatu.
   Na telefonie pasek adresu przeglądarki zasłania dół ekranu, a 100vh o tym
   nie wie - dlatego dół czatu (pasek radia) chował się poza widokiem.
   Jednostka dvh liczy realnie widoczną wysokość; 100vh zostaje dla starszych
   przeglądarek, które dvh nie znają i tę linijkę pominą. */
.chat-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.chat-header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.btn-mobile-menu {
    display: none;
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid #39ff14;
    border-radius: 6px;
    padding: 5px 8px 5px 7px;
    color: #39ff14;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-mobile-menu:hover,
.btn-mobile-menu:active {
    background: rgba(57, 255, 20, 0.18);
}

/* Lekkie „puknięcie” w bok - bez świecenia, żeby było widać że da się kliknąć */
.btn-mobile-menu.needs-hint {
    animation: online-nudge 1.6s ease-in-out 3;
}

@keyframes online-nudge {
    0%, 100% { transform: translateX(0); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(0); }
}

.online-icon {
    width: 18px;
    height: 18px;
    fill: #39ff14;
    display: block;
    flex-shrink: 0;
}

.online-label {
    color: #39ff14;
    letter-spacing: 0.02em;
    line-height: 1;
}

.online-count {
    font-size: 1em;
    font-weight: 700;
    color: #39ff14;
    line-height: 1;
    min-width: 0.8em;
}

.online-chevron {
    color: #39ff14;
    font-size: 1.2em;
    font-weight: 700;
    line-height: 1;
    margin-left: 1px;
}

.chat-title {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Player MixRadio na dole (iframe embed).
   Wysoki z-index: panel wiadomości / picker emotek nie może przejąć kliknięć. */
.radio-bar {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: block;
    padding: 0;
    flex-shrink: 0;
    line-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 1200;
    pointer-events: auto;
}

.radio-bar iframe {
    display: block;
    width: 100%;
    min-height: 150px;
    height: 150px;
    border: 0;
    pointer-events: auto;
    /* WebKit: po scrollu rodzica iframe czasem przestaje przyjmować tapnięcia */
    transform: translateZ(0);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username-display {
    color: var(--text-secondary);
}

.btn-logout {
    padding: 8px 16px;
    background: var(--error);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #d32f2f;
}


.chat-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Lista użytkowników */
.users-sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.users-sidebar h2 {
    padding: 15px;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

/* Link do panelu - pod nagłówkiem listy, nie w ciasnym headerze */
.btn-admin-panel {
    display: block;
    margin: 10px 12px;
    padding: 10px 12px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

.btn-admin-panel:hover {
    background: var(--accent-hover);
}

.users-list {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    /* Bez tego flex nie skraca listy i przewijanie nie rusza */
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.user-item {
    padding: 10px;
    margin-bottom: 5px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.user-item .status-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.user-item .user-nick-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.nick-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.nick-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* DJ – kolory sterowane w JS */
.nick-icon-dj {
    display: inline-flex;
    align-items: center;
    color: #39ff14;
    font-weight: 700;
    font-size: 1em;
    font-family: inherit;
    line-height: 1;
    letter-spacing: 0.02em;
}

.nick-icon-dj .dj-text {
    display: inline-block;
}

.nick-icon-sluchacz {
    color: #b388ff;
}

.nick-icon-sluchacz svg {
    width: 1.15em;
    height: 1.15em;
}

.nick-icon-admin {
    color: #e53935;
}

/* Przycisk banowania użytkownika (dla admina) */
.btn-ban-user {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    margin-left: auto;
}

.btn-ban-user:hover {
    background: var(--error);
    color: white;
}

/* Obszar czatu */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
}

.message {
    margin-bottom: 15px;
    padding-bottom: 5px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s;
    overflow: visible;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    position: relative;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.message-username {
    font-weight: 600;
    color: var(--accent);
    margin-right: auto;
}

.message-username.admin-username {
    color: var(--error);
    font-weight: 700;
}

.message-time {
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-left: 0;
    flex-shrink: 0;
}

/* Przycisk usuwania wiadomości (dla admina) – po prawej */
.btn-delete-message {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 0.8em;
    margin: 0;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s, background 0.3s, color 0.3s;
}

.message:hover .btn-delete-message {
    opacity: 1;
}

.btn-delete-message:hover {
    background: var(--error);
    color: white;
}

.message-content {
    background: var(--message-bg);
    padding: 12px 15px;
    border-radius: 8px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.5;
    overflow: visible;
    min-height: auto;
}

.message-text {
    margin-top: 5px;
}

/* Wiadomości systemowe */
.message.system {
    align-items: center;
    margin: 20px 0;
}

.message.system .message-content.system-message {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: var(--error);
    text-align: center;
    padding: 10px 20px;
    border-radius: 8px;
    max-width: 90%;
    font-weight: 500;
    font-size: 0.95em;
}

/* Wiadomości systemowe o odbanowaniu (zielone) */
.message.system .message-content.system-message:has-text("✅") {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--success);
}

/* Alternatywny sposób dla wiadomości o odbanowaniu */
.message.system .message-content.system-message.unban-message {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: var(--success);
}

.message.own .message-content {
    background: var(--message-own);
    margin-left: auto;
}

.image-wrapper {
    margin-top: 5px;
}

.message-image-thumb {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    object-fit: cover;
    transition: transform 0.2s;
}

.message-image-thumb:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.voice-wrapper {
    margin-top: 5px;
}

.voice-wrapper {
    margin-top: 5px;
    margin-bottom: 5px;
    width: 100%;
    max-width: 400px;
    display: block;
    position: relative;
    overflow: visible;
}

.voice-label {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin-bottom: 8px;
    font-weight: 500;
}

.voice-label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.btn-delete-voice {
    background: var(--error);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    flex-shrink: 0;
}

.btn-delete-voice:hover {
    background: #d32f2f;
}

/* Niestandardowy player audio */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    padding: 12px 15px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}

.custom-audio-player audio {
    display: none;
}

.audio-play-btn {
    background: var(--accent);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.3s;
}

.audio-play-btn:hover {
    background: var(--accent-hover);
}

.audio-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.audio-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.audio-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s;
}

.audio-time {
    color: var(--text-secondary);
    font-size: 0.85em;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.audio-volume-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.audio-volume-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.audio-volume-btn:hover {
    color: var(--text-primary);
}

.audio-volume-slider {
    width: 60px;
    height: 4px;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.audio-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.audio-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.voice-error {
    color: var(--error);
    padding: 10px;
    text-align: center;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 6px;
    border: 1px solid var(--error);
}

/* Style dla mobile */
@media (max-width: 768px) {
    .messages-container {
        padding-bottom: 80px !important;
    }
    
    .message {
        margin-bottom: 20px !important;
        padding-bottom: 10px !important;
        overflow: visible !important;
    }
    
    .message-content {
        max-width: 90% !important;
        overflow: visible !important;
        padding-bottom: 15px !important;
    }
    
    .message.own .message-content {
        max-width: 90% !important;
    }
    
    .voice-wrapper {
        max-width: 100% !important;
        width: 100% !important;
        margin: 5px 0 10px 0 !important;
        overflow: visible !important;
    }
    
    .voice-label {
        font-size: 0.8em !important;
        margin-bottom: 6px !important;
    }
    
    .custom-audio-player {
        max-width: 100% !important;
        width: 100% !important;
        padding: 10px 12px !important;
        gap: 8px !important;
        overflow: visible !important;
    }
    
    .audio-play-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
        flex-shrink: 0 !important;
    }
    
    .audio-progress-container {
        flex: 1 !important;
        min-width: 0 !important;
        overflow: visible !important;
    }
    
    .audio-progress-bar {
        height: 6px !important;
        overflow: visible !important;
    }
    
    .audio-time {
        font-size: 0.8em !important;
        min-width: 65px !important;
        flex-shrink: 0 !important;
    }
    
    .audio-volume-container {
        gap: 4px !important;
        flex-shrink: 0 !important;
    }
    
    .audio-volume-btn {
        font-size: 16px !important;
        padding: 3px !important;
    }
    
    .audio-volume-slider {
        width: 50px !important;
        height: 4px !important;
    }
    
    .audio-volume-slider::-webkit-slider-thumb {
        width: 12px !important;
        height: 12px !important;
    }
    
    .audio-volume-slider::-moz-range-thumb {
        width: 12px !important;
        height: 12px !important;
    }
}

/* Nagrywanie głosu */
.voice-recorder {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    border: 2px solid var(--error);
}

.recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background: var(--error);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

#recording-time {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--error);
    font-family: 'Courier New', monospace;
}

.recording-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-start {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
    font-weight: 600;
}

.btn-start:hover {
    background: var(--accent-hover);
}

.btn-stop {
    background: var(--error);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-stop:hover {
    background: #d32f2f;
}

.btn-cancel {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

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

.youtube-wrapper {
    margin-top: 5px;
    width: 100%;
    max-width: 560px;
}

.youtube-embed {
    width: 100%;
    height: 315px;
    max-width: 560px;
    border-radius: 8px;
    border: none;
}

.youtube-link {
    color: var(--accent);
    text-decoration: none;
    display: inline-block;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    transition: background 0.3s;
}

.youtube-link:hover {
    background: var(--bg-primary);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .youtube-embed {
        height: 200px;
    }
}

/* Panel wysyłania */
.message-input-container {
    background: var(--bg-secondary);
    padding: 15px;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.input-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.btn-icon {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.3s;
}

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

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 44px;
}

#message-input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-send {
    padding: 12px 24px;
    background: #39ff14; /* Neon zielony */
    color: #000000; /* Czarny tekst */
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.btn-send:hover {
    background: #32e60f; /* Nieco ciemniejszy neon zielony przy hover */
}

.preview-container {
    margin-top: 10px;
}

.preview-image {
    position: relative;
    display: inline-block;
    max-width: 200px;
    margin-right: 10px;
}

.preview-image img {
    max-width: 100%;
    border-radius: 6px;
}

.preview-image .remove-preview {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
}

/* Picker emotek z katalogu smiles/ */
.smiles-picker {
    position: fixed;
    /* --radio-bar-height ustawia script.js, żeby picker nie zasłaniał radia */
    bottom: calc(80px + var(--radio-bar-height, 150px));
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 1150;
    max-width: 90%;
    width: 420px;
}

.smiles-picker.active {
    display: block;
}

.smiles-search {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95em;
    margin-bottom: 12px;
}

.smiles-search:focus {
    outline: none;
    border-color: var(--accent);
}

.smiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}

.smiles-info {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.smile-item {
    height: 56px;
    padding: 4px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.smile-item:hover {
    background: var(--bg-tertiary);
}

.smile-item img {
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}

/* Emotka wewnątrz wiadomości */
.chat-smile {
    max-width: 150px;
    max-height: 150px;
    vertical-align: middle;
}

/* Ikona graficzna na przycisku w pasku narzędzi */
.btn-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}

/* Responsywność */
@media (max-width: 768px) {
    .btn-mobile-menu {
        display: inline-flex;
    }
    
    .users-sidebar {
        position: fixed;
        right: -250px;
        top: 60px;
        /* Na całą wysokość pod headerem - lista ma być nad polem wiadomości i radiem */
        height: calc(100vh - 60px);
        height: calc(100dvh - 60px);
        max-height: calc(100dvh - 60px);
        z-index: 3000;
        transition: right 0.3s;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .users-sidebar.active {
        right: 0;
    }
    
    .users-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chat-title {
        font-size: 1.1em;
        margin: 0 8px;
        flex: 1;
        min-width: 0;
    }
    
    .user-info {
        gap: 8px;
        flex-shrink: 0;
    }
    
    .username-display {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.9em;
    }
    
    .btn-logout {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .smiles-picker {
        width: 90%;
        left: 5%;
        transform: none;
        bottom: calc(100px + var(--radio-bar-height, 150px));
    }
    
    .chat-smile {
        max-width: 110px;
        max-height: 110px;
    }
    
    .input-toolbar {
        flex-wrap: wrap;
    }
    
    .btn-icon {
        font-size: 1em;
        padding: 6px 10px;
    }
    
    /* Radio zawsze na dole viewportu - nad panelem wysyłania przy kolizji */
    .radio-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1200;
    }

    .chat-container {
        padding-bottom: var(--radio-bar-height, 150px);
    }

    /* Panel wysyłania na telefonie - musi stać nad paskiem radia */
    .message-input-container {
        position: fixed;
        bottom: var(--radio-bar-height, 150px);
        left: 0;
        right: 0;
        width: 100%;
        padding: 10px;
        z-index: 1100;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .chat-area {
        padding-bottom: 160px;
    }
    
    .messages-container {
        padding-bottom: 50px;
    }
    
    #message-input {
        font-size: 16px; /* Zapobiega zoomowaniu na iOS */
        min-height: 44px;
    }
    
    .btn-send {
        padding: 10px 16px;
        font-size: 0.9em;
        white-space: nowrap;
    }
    
    .input-wrapper {
        gap: 8px;
    }
}

/* Modal do powiększania zdjęć */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10002;
}

.modal-close:hover {
    background: var(--error);
}

/* Modal wyboru czasu bana */
.ban-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ban-modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

.ban-modal-content h2 {
    margin-bottom: 15px;
    color: var(--error);
    font-size: 1.5em;
}

.ban-modal-username {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    text-align: center;
}

.ban-modal-subtitle {
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

.ban-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.color-option-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.color-option-btn:hover {
    transform: scale(1.15);
    border-color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.ban-option-btn {
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
    font-weight: 500;
}

.ban-option-btn:hover {
    background: var(--error);
    border-color: var(--error);
    color: white;
    transform: translateY(-2px);
}

.ban-cancel-btn {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

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

@media (max-width: 768px) {
    .ban-options {
        grid-template-columns: 1fr;
    }
    
    .ban-modal-content {
        padding: 20px;
        width: 95%;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

/* Scrollbar dla listy użytkowników */
.users-list::-webkit-scrollbar {
    width: 6px;
}

.users-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.users-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.users-list::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* PWA - baner instalacji na telefonie */
.pwa-install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #222;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.pwa-install-banner[hidden] {
    display: none !important;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pwa-install-text strong {
    color: #39ff14;
    font-size: 0.95em;
}

.pwa-install-text span {
    color: var(--text-secondary);
    font-size: 0.8em;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pwa-install-btn {
    background: #39ff14;
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 700;
    cursor: pointer;
}

.pwa-install-dismiss {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

@media (display-mode: standalone) {
    .pwa-install-banner {
        display: none !important;
    }

    .chat-page,
    .chat-container {
        padding-top: env(safe-area-inset-top, 0px);
    }
}


