:root {
    --background-color: #0a0a09;
    --card-background: #14130f;
    --card-hover: #241f14;
    --text-color: #fff3e0;
    --accent-color: #e0c01f;
    --text-secondary: #fff1dc; 
    --success-color: #ffe44d; 
    --warning-color: #ff9800;
    --danger-color: #ff5722;
    --border-color: #3d3424;
}

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
    background-color: var(--background-color);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: 
        radial-gradient(circle at 0% 0%, rgba(255, 242, 0, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(255, 140, 0, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(255, 238, 0, 0.284) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(255, 140, 0, 0.15) 0%, transparent 50%),
        linear-gradient(180deg, #1a1810 0%, #241f14 100%);
    background-attachment: fixed;
    background-size: 100% 100%;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body::before,
body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 213, 0, 0.136) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatParticle 15s infinite linear;
}

body::before {
    top: -150px;
    left: -150px;
}

body::after {
    bottom: -150px;
    right: -150px;
    animation-delay: -7.5s;
}

@keyframes floatParticle {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(50px, 50px) scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }
}

@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 3rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
}

.container.loaded {
    opacity: 1;
}

header {
    text-align: center;
    margin-bottom: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.brand-link, .minecraft-link {
    text-decoration: none;
    display: block;
    width: fit-content;
    cursor: pointer;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #fff200 0%, #ff8c00 100%);
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(255, 160, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.brand-icon {
    font-size: 2rem;
    color: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.brand-text {
    font-size: 1.8rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.minecraft-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    margin-top: 1rem;
    cursor: pointer;
}

.minecraft-container i {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.minecraft-container span {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.minecraft-container:hover {
    border-color: var(--text-secondary);
    background: var(--card-hover);
}

.minecraft-container:hover i,
.minecraft-container:hover span {
    color: var(--text-color);
}
.stats-container {
    margin-top: 2rem;
    width: 100%;
    max-width: 400px;
}

.total-online {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
}

.stats-icon {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.total-online-label {
    color: var(--text-secondary);
}

.total-online-count {
    color: var(--accent-color);
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

#playerSearch {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.2s ease;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
    padding-right: 3.5rem;
}

#playerSearch:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--card-hover);
}

#playerSearch::placeholder {
    color: var(--text-secondary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
}

.highlight-number::placeholder {
    color: var(--text-secondary) !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

.highlight-number::placeholder span {
    color: var(--accent-color) !important;
    font-weight: 600;
}

.player-count {
    color: var(--accent-color);
    font-weight: 600;
}

.server-groups {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    margin: 0 auto;
    padding-right: 0;
}

.server-group {
    position: relative;
    background: var(--card-background);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    padding-top: calc(1.25rem + 8px);
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 12px;
}

.group-header:hover {
    background: var(--card-hover);
}

.group-header h2 {
    flex: 1;
    font-size: 1.25rem;
    color: var(--accent-color);
}

.group-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.group-total {
    white-space: nowrap;
    margin-right: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.group-total .current {
    color: var(--text-color);
    opacity: 0.9;
}

.group-total .max,
.group-total .separator {
    color: var(--text-secondary);
    opacity: 0.8;
}

.group-total .separator {
    margin: 0 0.2rem;
}

.group-header i {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.group-header.expanded {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.group-header.expanded i {
    transform: rotate(180deg);
    color: var(--accent-color);
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.25rem;
    padding: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    visibility: hidden;
    width: 100%;
    margin: 0;
    padding: 0 1.25rem;
    box-sizing: border-box;
}

.servers-grid.expanded {
    max-height: none;
    opacity: 1;
    padding: 1.25rem;
    visibility: visible;
    width: 100%;
}

.servers-grid .server-card {
    margin: 0;
}

.server-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.server-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
}

.server-header {
    margin-bottom: 1rem;
}

.server-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent-color);
}

.server-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.server-stats {
    display: flex;
    justify-content: space-between;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat i {
    color: var(--accent-color);
}

.players-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 8px;
    background: var(--card-background);
    border-radius: 6px;
}

.player {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.player:last-child {
    border-bottom: none;
}

.player-name {
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

.player-time {
    color: var(--accent-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
}

::-webkit-scrollbar {
    width: 6px;
}

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

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

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

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        padding-top: 2rem;
    }

    .brand-container {
        padding: 0.75rem 1.5rem;
    }

    .brand-icon {
        font-size: 1.5rem;
    }

    .brand-text {
        font-size: 1.4rem;
    }

    .minecraft-container {
        padding: 0.6rem 1.2rem;
        margin-top: 0.75rem;
    }

    .servers-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 1rem;
    }

    .servers-grid.expanded {
        padding: 1rem;
    }

    .server-card {
        margin: 0;
        width: 100%;
        padding: 1rem;
    }

    .server-group {
        padding: 0;
    }

    .group-header {
        padding: 1rem;
        padding-top: calc(1rem + 8px);
    }

    .group-header h2 {
        font-size: 1.1rem;
        white-space: nowrap;
    }

    .group-total {
        font-size: 0.9rem;
    }

    .group-header i {
        margin-left: 0.5rem;
        flex-shrink: 0;
        font-size: 1.2rem;
        color: var(--accent-color);
    }

    .online-progress {
        width: 100px;
        height: 4px;
        margin: 0;
        flex-shrink: 0;
    }

    .online-progress-tooltip {
        font-size: 0.75rem;
        padding: 2px 6px;
        top: -20px;
    }

    .stats-container {
        margin-top: 1.5rem;
    }

    .total-online {
        width: 100%;
        justify-content: center;
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }

    .search-container {
        gap: 0.75rem;
    }

    #playerSearch {
        padding: 0.6rem 1rem 0.6rem 2.5rem;
        font-size: 0.9rem;
    }

    header {
        margin-bottom: 3rem;
    }

    .refresh-button {
        padding: 0.6rem;
        min-width: 38px;
        height: 38px;
    }

    #playerSearch::placeholder {
        content: attr(data-mobile-placeholder);
    }

    .toast {
        padding: 0.75rem 1.25rem;
    }

    .toast i {
        font-size: 0.9rem;
    }

    .toast-message {
        font-size: 0.85rem;
    }

    .player-name {
        font-size: 0.9rem;
    }

    .player-time {
        font-size: 0.85rem;
    }

    .player-name:active {
        color: var(--accent-color);
    }

    
    .player-name {
        -webkit-tap-highlight-color: transparent;
        color: var(--text-color);
    }

    .player-name:hover {
        color: var(--text-color);
    }

    .player-name:active {
        color: var(--accent-color);
    }

    body {
        min-height: 100vh;
        /* Фиксируем фон при скролле на мобильных */
        background-attachment: fixed;
    }

    /* Улучшаем скролл на iOS */
    .players-list {
        -webkit-overflow-scrolling: touch;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 15px rgba(255, 160, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 160, 0, 0.4);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 160, 0, 0.2);
    }
}

.brand-container {
    animation: pulse 3s infinite;
}

.brand-container:hover {
    animation: none;
}

.error-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.error-content {
    background: var(--card-background);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
}

.error-icon {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 1.5rem;
}

.error-content h1 {
    font-size: 3.5rem;
    color: var(--danger-color);
    margin: 0;
    line-height: 1;
}

.error-content h2 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin: 1rem 0;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.error-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.error-link:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

.error-link i {
    font-size: 1.2rem;
}

.online-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--background-color);
    overflow: hidden;
}

.online-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        #ffa000 0%, 
        #ffb74d 50%, 
        #ffd700 100%
    );
    box-shadow: 0 0 10px rgba(255, 160, 0, 0.3);
    transition: width 0.3s ease;
}

.online-progress-tooltip {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-hover);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.online-progress:hover .online-progress-tooltip {
    opacity: 1;
}

.server-total {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.server-total .current {
    color: var(--text-color);
    opacity: 0.9;
}

.server-total .max,
.server-total .separator {
    color: var(--text-secondary);
    opacity: 0.8;
}

.server-total .separator {
    margin: 0 0.2rem;
}

.refresh-button {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.75rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.refresh-button:hover {
    background: var(--card-hover);
    color: var(--text-color);
    border-color: var(--accent-color);
}

.refresh-button.loading {
    pointer-events: none;
    opacity: 0.7;
    background: var(--card-hover);
}

.refresh-button.loading i {
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .refresh-button {
        height: 38px;
        padding: 0.6rem 1rem;
    }

    .refresh-button:active {
        background: var(--card-hover);
        color: var(--text-color);
        border-color: var(--accent-color);
        transform: scale(0.98);
    }

    .refresh-button:hover {
        background: var(--card-background);
        color: var(--text-secondary);
        border-color: var(--border-color);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    color: var(--accent-color);
    font-size: 2rem;
}

.loader i {
    animation: spin 1s linear infinite;
}

.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast i {
    color: var(--success-color);
}

.toast-message {
    color: var(--text-color);
    font-size: 0.95rem;
}

.player-name:hover {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .player-name:active {
        color: var(--accent-color);
        transform: scale(0.98);
    }
}

.pull-indicator {
    position: fixed;
    top: -60px;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.pull-indicator.pulling {
    transform: translateY(60px);
}

.pull-indicator i {
    margin-right: 0.5rem;
    animation: spin 1s linear infinite;
}

.server-card {
    animation: fadeIn 0.3s ease;
}

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

.refresh-button.disabled {
    background: var(--card-background);
    border-color: var(--danger-color);
    color: var(--danger-color);
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.refresh-button.disabled i {
    animation: none;
}

.refresh-button.disabled {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(255, 87, 34, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 87, 34, 0);
    }
}

.chat-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--accent-color);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 20px rgba(255, 160, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 98;
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.chat-toggle.hidden {
    opacity: 0;
    transform: scale(0.8) rotate(-90deg);
    pointer-events: none;
}

.chat-toggle:hover {
    background: #ff8c00;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 160, 0, 0.4);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: none;
    box-shadow: 0 2px 8px rgba(255, 87, 34, 0.3);
    animation: badge-pulse 2s infinite;
}

.chat-badge.show {
    display: block;
}

.chat-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 350px;
    height: 500px;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    transform: translateX(120%) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.chat-panel.open {
    transform: translateX(0) scale(1);
}

.chat-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.chat-header {
    position: sticky;
    top: 0;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-background);
    z-index: 2;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header h3 {
    color: var(--text-color);
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-online-count {
    background: var(--card-background);
    color: var(--accent-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: calc(1rem + 60px);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-message {
    word-break: break-word;
    max-width: 85%;
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    animation: message-appear 0.3s ease;
}

.chat-message.incoming {
    background: var(--card-hover);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.outgoing {
    background: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    gap: 1rem;
}

.message-author {
    font-weight: 600;
}

.message-time {
    opacity: 0.8;
}

.chat-input-container {
    position: sticky;
    bottom: 0;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.8rem;
    background: var(--card-background);
    z-index: 2;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--card-hover);
}

.chat-input::placeholder {
    color: var(--text-secondary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
}

.chat-input-icon {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chat-send {
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    color: white;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.chat-send:hover {
    background: #ff8c00;
    transform: scale(1.05);
}

.chat-send:active {
    transform: scale(0.95);
}

.chat-login {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--card-background);
}

.login-input-container {
    position: relative;
    width: 100%;
}

.login-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.chat-name-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.2s ease;
}

.chat-name-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--card-hover);
}

.chat-name-input::placeholder {
    color: var(--text-secondary);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
}

.chat-join-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-color);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-join-btn i {
    font-size: 0.9rem;
}

.chat-join-btn:hover {
    background: #ff8c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 160, 0, 0.3);
}

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

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

@keyframes badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    .chat-panel {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 20px 20px 0 0;
        transform: translateY(120%);
    }
    
    .chat-panel.open {
        transform: translateY(0);
    }
    
    .chat-content {
        height: calc(100% - 60px);
        overflow: hidden;
    }
    
    .chat-messages {
        height: calc(100% - 60px);
        padding: 1rem;
        padding-bottom: calc(env(safe-area-inset-bottom) + 90px);
        margin-bottom: 0;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        position: relative;
        z-index: 1;
    }
    
    .chat-header {
        position: sticky;
        top: 0;
        padding: 1rem;
        background: var(--card-background);
        z-index: 2;
        border-bottom: 1px solid var(--border-color);
    }
    
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 1rem;
        background: var(--card-background);
        border-top: 1px solid var(--border-color);
        z-index: 2;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    @supports (-webkit-touch-callout: none) {
        .chat-panel {
            height: -webkit-fill-available;
        }
        
        .chat-content {
            height: -webkit-fill-available;
        }
    }
}

@media (pointer: coarse) {
    .chat-messages {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .chat-message {
        touch-action: pan-y;
        user-select: text;
        -webkit-user-select: text;
    }
}

.vk-login-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.vk-login-info i {
    font-size: 3rem;
    color: #ffa000;
}

.vk-login-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: #ffa000;
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vk-login-btn i {
    font-size: 1.2rem;
}

.vk-login-btn:hover {
    background: #ff8c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 160, 0, 0.3);
}

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

.message-author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-message.outgoing .message-author-info {
    flex-direction: row-reverse;
}

.typing-indicator {
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    background: var(--card-hover);
    margin: 0.5rem 0;
    display: none;
    align-items: center;
    gap: 0.75rem;
    width: fit-content;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.typing-indicator.show .typing-dot {
    animation: typingAnimation 1.4s infinite;
    animation-fill-mode: both;
}

.typing-indicator.show .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator.show .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-3px);
        opacity: 1;
    }
} 
