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

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

/* Homepage Hero Section */
#homepage {
    display: none;
    height: 100vh;
    overflow-y: auto;
}

.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1a1a1d 0%, #0e0e10 100%);
}

.hero-content {
    max-width: 900px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px);
}

.hero-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #9147ff 0%, #bf94ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title i {
    -webkit-text-fill-color: #9147ff;
}

.hero-subtitle {
    font-size: 20px;
    color: #adadb8;
    margin-bottom: 40px;
}

.stream-input-container {
    background: #18181b;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 60px;
    border: 1px solid #2d2d2d;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.input-icon {
    color: #9147ff;
    font-size: 20px;
}

#homepage-stream-input {
    flex: 1;
    padding: 12px 16px;
    background: #0e0e10;
    border: 2px solid #2d2d2d;
    border-radius: 4px;
    color: #efeff1;
    font-size: 16px;
    transition: border-color 0.2s;
}

#homepage-stream-input:focus {
    outline: none;
    border-color: #9147ff;
}

.add-stream-btn {
    padding: 12px 24px;
    background: #9147ff;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.add-stream-btn:hover {
    background: #772ce8;
}

#homepage-streams-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 40px;
}

.homepage-stream-tag {
    background: #2d2d2d;
    padding: 8px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.homepage-stream-tag button {
    background: none;
    border: none;
    color: #adadb8;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}

.homepage-stream-tag button:hover {
    color: #ff4444;
}

#start-watching-btn {
    padding: 14px 32px;
    background: #00c853;
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#start-watching-btn:hover {
    background: #00a043;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    text-align: center;
}

.feature {
    padding: 20px;
}

.feature i {
    font-size: 36px;
    color: #9147ff;
    margin-bottom: 12px;
}

.feature h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #efeff1;
}

.feature p {
    font-size: 14px;
    color: #adadb8;
}

/* Main Content Layout */
#main-content {
    display: none;
    height: 100vh;
    position: relative;
}

#add-stream-input-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #18181b;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #2d2d2d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 1000;
}

#new-stream-input {
    width: 300px;
    padding: 12px 16px;
    background: #0e0e10;
    border: 2px solid #2d2d2d;
    border-radius: 4px;
    color: #efeff1;
    font-size: 16px;
}

#new-stream-input:focus {
    outline: none;
    border-color: #9147ff;
}

#add-stream-input-container button {
    padding: 12px 16px;
    background: #9147ff;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

#add-stream-input-container button:hover {
    background: #772ce8;
}

#add-stream-input-container button:last-child {
    background: #2d2d2d;
}

#add-stream-input-container button:last-child:hover {
    background: #ff4444;
}

/* Content Wrapper */
#content-wrapper {
    display: flex;
    height: 100vh;
    position: relative;
}

#streams-container {
    flex: 1;
    background: #0e0e10;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: center;
    padding: 10px;
    gap: 10px;
    overflow-y: auto;
}

.stream-frame {
    border: none;
    border-radius: 4px;
}

/* Stream context menu for removal */
.stream-frame:hover {
    outline: 2px solid #9147ff;
}

/* Chat Toggle Button */
#chat-toggle-btn {
    position: fixed;
    right: 340px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 80px;
    background: #18181b;
    border: 1px solid #2d2d2d;
    border-right: none;
    border-radius: 4px 0 0 4px;
    color: #adadb8;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 99;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-toggle-btn:hover {
    background: #9147ff;
    color: white;
}

#chat-toggle-btn.hidden {
    right: 0;
}

#chat-toggle-btn.hidden i {
    transform: rotate(180deg);
}

/* Chat Container */
#chat-container {
    width: 340px;
    background: #18181b;
    border-left: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    transition: margin-right 0.3s ease;
    position: relative;
}

#chat-container.hidden {
    margin-right: -340px;
}

.chat-header {
    background: #1a1a1d;
    border-bottom: 1px solid #2d2d2d;
}

.chat-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #2d2d2d #1a1a1d;
}

.chat-tabs::-webkit-scrollbar {
    height: 4px;
}

.chat-tabs::-webkit-scrollbar-track {
    background: #1a1a1d;
}

.chat-tabs::-webkit-scrollbar-thumb {
    background: #2d2d2d;
    border-radius: 2px;
}

.chat-tab {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    color: #adadb8;
    transition: all 0.2s;
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-tab.add-tab {
    color: #9147ff;
    font-size: 16px;
    padding: 12px 12px;
}

.chat-tab.add-tab:hover {
    background: #2d2d2d;
    color: #bf94ff;
}

.tab-close-btn {
    background: none;
    border: none;
    color: #adadb8;
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    margin-left: 4px;
    transition: color 0.2s;
}

.tab-close-btn:hover {
    color: #ff4444;
}

.chat-tab:hover {
    color: #efeff1;
    background: #18181b;
}

.chat-tab.active {
    color: #9147ff;
    border-bottom-color: #9147ff;
    font-weight: 600;
}

.chat-content {
    flex: 1;
    position: relative;
}

.chat-panel {
    display: none;
    height: 100%;
}

.chat-panel.active {
    display: block;
}

.chat-frame {
    width: 100%;
    height: 100%;
    border: none;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    #chat-container {
        width: 300px;
    }
    
    #chat-toggle-btn {
        right: 300px;
    }
    
    #chat-toggle-btn.hidden {
        right: 0;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}

/* Emote Info Banners */
.emote-info-banner {
    background: linear-gradient(135deg, #9147ff 0%, #772ce8 100%);
    padding: 20px 30px;
    border-radius: 8px;
    margin-top: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(145, 71, 255, 0.3);
}

.emote-info-banner i {
    font-size: 24px;
    color: #ffffff;
    flex-shrink: 0;
}

.emote-info-banner p {
    color: #ffffff;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.emote-info-banner a {
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.emote-info-banner a:hover {
    opacity: 0.8;
}

.version-footer {
    text-align: center;
    color: #4a4a52;
    font-size: 0.75rem;
    padding: 30px 0 20px 0;
    font-weight: 300;
    margin-top: auto;
}

.emote-userscript-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #9147ff 0%, #772ce8 100%);
    padding: 16px 24px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    max-width: 90%;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.emote-userscript-banner.visible {
    display: flex;
}

.emote-userscript-banner i.fa-sparkles {
    font-size: 20px;
    color: #ffffff;
    flex-shrink: 0;
}

.emote-userscript-banner p {
    color: #ffffff;
    font-size: 13px;
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.emote-userscript-banner a {
    color: #ffffff;
    font-weight: 600;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.emote-userscript-banner a:hover {
    opacity: 0.8;
}

.close-banner-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.close-banner-btn:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .emote-info-banner,
    .emote-userscript-banner {
        padding: 14px 18px;
        gap: 10px;
    }
    
    .emote-info-banner p,
    .emote-userscript-banner p {
        font-size: 12px;
    }
    
    .emote-userscript-banner {
        bottom: 10px;
        max-width: 95%;
    }
}