* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    background-color: #0e0e10;
    color: #efeff1;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    flex-direction: row;
}

/* --- Video Container --- */
.video-container {
    flex: 1;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

/* --- Video.js Styling Overrides --- */
.video-container .video-js {
    width: 100% !important;
    height: 100% !important;
    background-color: #000;
}

.video-js .vjs-tech {
    object-fit: contain !important;
}

.video-js .vjs-big-play-button {
    background-color: rgba(145, 70, 255, 0.8) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 2em !important;
    height: 2em !important;
    line-height: 2em !important;
    margin-left: -1em !important;
    margin-top: -1em !important;
}

/* --- Chat Container --- */
.chat-container {
    width: 340px;
    background-color: #18181b;
    border-left: 1px solid #2f2f35;
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.chat-header {
    padding: 14px 16px;
    border-bottom: 1px solid #2f2f35;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #18181b;
}

.chat-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

.clear-btn {
    background: transparent;
    border: 1px solid #3a3a44;
    color: #adadb8;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

.clear-btn:hover {
    background: #2f2f35;
    color: #fff;
}

/* --- Username Modal --- */
.modal {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: auto 0;
}

.modal input {
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #3a3a44;
    background: #0e0e10;
    color: #fff;
    font-size: 1rem;
    outline: none;
}

.modal button {
    padding: 12px;
    border-radius: 6px;
    border: none;
    background: #9146ff;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

/* --- Chat Messages --- */
.chat-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.message {
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.message .time {
    color: #adadb8;
    font-size: 0.75rem;
    margin-right: 6px;
}

.message .username {
    font-weight: bold;
    color: #a970ff;
    margin-right: 6px;
}

/* Chat Inline GIF Styling */
.chat-gif {
    display: block;
    max-width: 220px;
    max-height: 160px;
    border-radius: 8px;
    margin-top: 6px;
    object-fit: cover;
}

/* --- Chat Input & Pickers --- */
.chat-input-area {
    position: relative;
    padding: 10px;
    border-top: 1px solid #2f2f35;
    background-color: #18181b;
    width: 100%;
}

.chat-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.icon-btn {
    background: #2f2f35;
    border: 1px solid #3a3a44;
    color: #efeff1;
    padding: 8px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: #3a3a44;
}

.chat-bar input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #3a3a44;
    background: #0e0e10;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.chat-bar button[type="submit"] {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    background: #9146ff;
    color: #fff;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    flex-shrink: 0;
}

/* Popup Panels for Emojis and GIFs */
.picker-panel {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    height: 240px;
    background: #1f1f23;
    border: 1px solid #3a3a44;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    z-index: 50;
    overflow: hidden;
}

.picker-header {
    padding: 8px 10px;
    background: #18181b;
    border-bottom: 1px solid #2f2f35;
    font-size: 0.85rem;
    font-weight: bold;
}

.picker-header input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #3a3a44;
    background: #0e0e10;
    color: #fff;
    font-size: 0.85rem;
}

/* Emoji Grid */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 10px;
    overflow-y: auto;
    font-size: 1.4rem;
    text-align: center;
}

.emoji-item {
    cursor: pointer;
    border-radius: 4px;
    padding: 4px 0;
    user-select: none;
}

.emoji-item:hover {
    background: #2f2f35;
}

/* GIF Grid */
.gif-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

.gif-grid img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
}

.gif-grid img:hover {
    opacity: 0.8;
}

.hidden {
    display: none !important;
}

/* --- MOBILE LAYOUT --- */
@media screen and (max-width: 768px) {
    .container {
        flex-direction: column !important;
    }

    .video-container {
        width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        max-height: 40vh !important;
        flex: none !important;
        overflow: hidden !important;
    }

    .chat-container {
        width: 100vw !important;
        max-width: 100vw !important;
        flex: 1 !important;
        min-height: 0 !important;
        border-left: none;
        border-top: 1px solid #2f2f35;
    }

    .chat-header, .chat-messages, .chat-input-area {
        padding: 8px 10px;
    }
}
