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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #0a0c10;
    color: #f3f4f6;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at 10% 20%, rgba(139,92,246,0.15), transparent 60%);
}

.card {
    background: #14171c;
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 2rem;
    width: 100%;
    max-width: 440px;
    border: 1px solid #2d313a;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s;
}

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

h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #fff, #8b5cf6);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 1.5rem;
}

.continue-card {
    background: #1e2128;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.continue-card h3 {
    margin-bottom: 0.5rem;
    color: #8b5cf6;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #9ca3af;
}

input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: #1e2128;
    border: 1px solid #2d313a;
    border-radius: 1rem;
    color: #f3f4f6;
    font-size: 1rem;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
}

.btn {
    width: 100%;
    padding: 0.9rem;
    background: #8b5cf6;
    border: none;
    border-radius: 1rem;
    font-weight: 600;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn:hover {
    background: #7c3aed;
    transform: scale(0.98);
}

.error {
    color: #f87171;
    margin-top: 1rem;
    text-align: center;
}

/* Room styles */
.room-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    background: #0a0c10;
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #14171c;
    padding: 8px 16px;
    border-radius: 20px;
    flex-shrink: 0;
}

.room-code {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    background: #1e2128;
    padding: 6px 12px;
    border-radius: 20px;
}

.copy-btn, .pip-btn, .search-btn {
    background: #8b5cf6;
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    margin-left: 8px;
}
.copy-btn:hover, .pip-btn:hover, .search-btn:hover {
    background: #7c3aed;
}

.main-content {
    display: flex;
    flex: 1;
    gap: 12px;
    min-height: 0;
}

.video-section {
    flex: 3;
    background: #14171c;
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

#player-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    width: 100%;
}

#video-placeholder {
    width: 100%;
    height: 100%;
}

#video-placeholder video,
#video-placeholder iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

#url-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#video-url {
    flex: 1;
    background: #1e2128;
    border: 1px solid #2d313a;
    padding: 8px 12px;
    border-radius: 12px;
    color: #f3f4f6;
}

#change-url-btn {
    background: #8b5cf6;
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
}

.chat-section {
    flex: 1;
    background: #14171c;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.participants {
    padding: 12px;
    border-bottom: 1px solid #2d313a;
    flex-shrink: 0;
}

.participants h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

#participants-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

#participants-list li {
    background: #1e2128;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}

.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #1e2128;
    border-bottom: 1px solid #2d313a;
    flex-shrink: 0;
}
.chat-tool-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: 0.2s;
}
.chat-tool-btn:hover {
    background: #2d313a;
    color: #f3f4f6;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    background: #1e2128;
    padding: 8px 12px;
    border-radius: 12px;
    max-width: 90%;
    word-break: break-word;
}

.message .nick {
    font-weight: 700;
    color: #8b5cf6;
    margin-right: 8px;
    font-size: 13px;
}

.message .time {
    font-size: 10px;
    color: #9ca3af;
    float: right;
}

.message .text {
    margin-top: 4px;
    font-size: 14px;
}

.chat-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #2d313a;
    flex-shrink: 0;
}

#chat-input {
    flex: 1;
    background: #1e2128;
    border: 1px solid #2d313a;
    padding: 8px 12px;
    border-radius: 24px;
    color: #f3f4f6;
}

#send-btn {
    background: #8b5cf6;
    border: none;
    width: 40px;
    border-radius: 24px;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}
.modal-content {
    background: #14171c;
    margin: 10% auto;
    padding: 20px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    border: 1px solid #2d313a;
    max-height: 80vh;
    overflow-y: auto;
}
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover {
    color: #fff;
}
#search-input {
    width: 100%;
    padding: 10px;
    margin: 15px 0;
    background: #1e2128;
    border: 1px solid #2d313a;
    border-radius: 12px;
    color: #f3f4f6;
}
.search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.search-item {
    background: #1e2128;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
}
.search-item:hover {
    background: #2d313a;
}
.search-item h4 {
    margin-bottom: 6px;
    color: #8b5cf6;
}
.search-item p {
    font-size: 12px;
    color: #9ca3af;
}
.search-item button {
    margin-top: 8px;
    background: #8b5cf6;
    border: none;
    padding: 4px 12px;
    border-radius: 16px;
    color: white;
    cursor: pointer;
}

/* Эмодзи и гифки */
.emoji-picker, .gif-picker {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: #1e2128;
    border: 1px solid #2d313a;
    border-radius: 12px;
    padding: 8px;
    width: 280px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1001;
}
.emoji-picker button {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}
.emoji-picker button:hover {
    background: #2d313a;
}
.gif-picker input {
    width: 100%;
    padding: 6px;
    margin-bottom: 8px;
    background: #2d313a;
    border: none;
    border-radius: 8px;
    color: white;
}
.gif-item {
    margin: 4px 0;
    cursor: pointer;
}
.gif-item img {
    width: 100%;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .room-container {
        padding: 8px;
        gap: 8px;
    }
    .main-content {
        flex-direction: column;
    }
    .video-section {
        flex: none;
    }
    .chat-section {
        flex: 1;
        min-height: 0;
    }
    .modal-content {
        margin: 20% auto;
        width: 95%;
    }
}
