/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: transparent !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background-color 0.3s ease;
}

/* Demo Mode Styles */
body.demo-mode {
    background: #2a2a2a !important;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

.demo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.demo-container {
    width: 800px;
    height: 600px;
    position: relative;
    background-image: url('example.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
}

.demo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 50%,
        rgba(0, 0, 0, 0.3) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-radius: 10px;
    overflow: hidden;
}

.demo-title {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    text-align: center;
}

body.demo-mode #chat-container {
    height: 100%;
    width: 100%;
    padding: 0;
    background: transparent;
    box-sizing: border-box;
}

body.demo-mode #chat-messages {
    padding: 5px 5px 5px 5px !important;
}

/* Ensure 10px padding for URL parameter mode and consistent embedding */
body:not(.demo-mode) #chat-messages {
    padding: 5px 5px 5px 5px;
}

/* Ensure settings panel and modals appear above demo container */
body.demo-mode #settings-panel {
    z-index: 10001;
}

body.demo-mode #settings-btn {
    z-index: 10000;
}

body.demo-mode #help-btn {
    z-index: 10000;
}

body.demo-mode #font-selector-modal {
    z-index: 10002;
}

body.demo-mode #obs-help-modal {
    z-index: 10002;
}

body.demo-mode #loading-screen {
    z-index: 10003;
}

/* Chat container */
#chat-container {
    height: 100vh;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    /* Fade effect at viewport top */
    -webkit-mask-image: linear-gradient(to bottom, 
        transparent 0px,
        rgba(0,0,0,0.3) 30px,
        rgba(0,0,0,0.7) 60px,
        black 100px
    );
    mask-image: linear-gradient(to bottom, 
        transparent 0px,
        rgba(0,0,0,0.3) 30px,
        rgba(0,0,0,0.7) 60px,
        black 100px
    );
    mask: linear-gradient(to bottom, 
        transparent 0px,
        rgba(0,0,0,0.3) 30px,
        rgba(0,0,0,0.7) 60px,
        black 100px
    );
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    padding: 5px 5px 5px 5px;
    margin: 0;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
    align-self: flex-end;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-end;
    /* Always anchor messages to the bottom */
    height: 100%;
    max-height: 100%;
}

#chat-messages::-webkit-scrollbar {
    display: none;
}

/* Dark mode scrollbar styles for modals */
.font-grid-container::-webkit-scrollbar,
.obs-instructions::-webkit-scrollbar,
.font-tabs::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.font-grid-container::-webkit-scrollbar-track,
.obs-instructions::-webkit-scrollbar-track,
.font-tabs::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.font-grid-container::-webkit-scrollbar-thumb,
.obs-instructions::-webkit-scrollbar-thumb,
.font-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.font-grid-container::-webkit-scrollbar-thumb:hover,
.obs-instructions::-webkit-scrollbar-thumb:hover,
.font-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.font-grid-container::-webkit-scrollbar-thumb:active,
.obs-instructions::-webkit-scrollbar-thumb:active,
.font-tabs::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.4);
}

/* Firefox scrollbar styles for modals */
.font-grid-container,
.obs-instructions,
.font-tabs {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

#chat-messages::after {
    content: "";
    display: block;
    flex-shrink: 0;
}

/* Chat message styles */
.chat-message {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 16px;
    line-height: 1.2;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    flex-shrink: 0;
    max-width: 100%;
    transform-origin: left center;
    z-index: 1;
    /* Remove backdrop-filter to prevent glow interference */
    isolation: isolate;
}

/* Platform-specific styling */
.chat-message.twitch {
    border-left: 3px solid #9146ff;
}

.chat-message.kick {
    border-left: 3px solid #53fc18;
}

/* Platform tags */
.platform-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 6px;
    text-transform: uppercase;
    vertical-align: middle;
    line-height: 1;
}

.platform-tag.twitch {
    background: #9146ff;
    color: white;
}

.platform-tag.kick {
    background: #53fc18;
    color: black;
}

.chat-message.subscriber {
    border-color: rgba(147, 51, 234, 0.5);
    background: rgba(147, 51, 234, 0.1);
}

.chat-message.moderator {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.1);
}

.chat-message.vip {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 215, 0, 0.1);
}

.chat-message.broadcaster {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
}

/* Username styles */
.username {
    font-weight: bold;
    margin-right: 8px;
    vertical-align: middle;
    line-height: 1;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Message text */
.message-text {
    color: #ffffff;
    display: inline;
    vertical-align: middle;
    line-height: 1;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Badges - Official Twitch Images Only */
.badges {
    display: inline-flex;
    gap: 3px;
    margin-right: 6px;
    vertical-align: middle;
    align-items: center;
    flex-wrap: wrap;
}

.badge-container {
    display: inline-block;
    vertical-align: middle;
    position: relative;
}

/* Official Twitch badge images */
.badge {
    height: 18px;
    width: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
    border-radius: 2px;
    object-fit: contain;
    background: transparent;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transition: transform 0.2s ease;
}

.badge:hover {
    transform: scale(1.1);
}

/* Badge animations for new messages */
@keyframes badgeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.chat-message.entering .badge {
    animation: badgeSlideIn 0.4s ease-out forwards;
}

/* Responsive badge sizing */
@media (max-width: 600px) {
    .badge {
        height: 16px;
        width: 16px;
    }
}

/* Twitch Event Message Styling */
.event-message {
    background: linear-gradient(135deg, rgba(145, 70, 255, 0.15), rgba(147, 51, 234, 0.1)) !important;
    border-left: 4px solid #9146ff !important;
    border-color: rgba(145, 70, 255, 0.3) !important;
    box-shadow: 0 0 15px rgba(145, 70, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    position: relative;
    overflow: hidden;
    /* Remove backdrop interference for text glow effects */
    isolation: isolate;
}

.event-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #9146ff, #b794f6, #9146ff);
    animation: eventGlow 2s ease-in-out infinite;
}

@keyframes eventGlow {
    0%, 100% { opacity: 0.6; transform: scaleX(1); }
    50% { opacity: 1; transform: scaleX(1.05); }
}

.event-icon {
    font-size: 16px;
    margin-right: 6px;
    vertical-align: middle;
    filter: drop-shadow(0 0 4px rgba(145, 70, 255, 0.5));
    animation: eventIconPulse 10s ease-in-out forwards;
}

@keyframes eventIconPulse {
    0%, 90% { transform: scale(1); }
    45% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.event-badge {
    font-size: 9px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.event-badge.subscription,
.event-badge.resub {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #ffffff;
    text-shadow: none;
}

.event-badge.subgift,
.event-badge.mysterygift {
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: #fff;
}

.event-badge.cheer {
    background: linear-gradient(135deg, #9146ff, #b794f6);
    color: #fff;
}

.event-badge.raid {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #ffffff;
    text-shadow: none;
}

.event-badge.host {
    background: linear-gradient(135deg, #06b6d4, #38bdf8);
    color: #fff;
}

.event-username {
    font-weight: bold;
    margin-right: 8px;
    text-shadow: 0 0 8px rgba(145, 70, 255, 0.4);
    position: relative;
    z-index: 3;
}

.event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 3;
}

.event-submessage {
    margin-top: 4px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
    border-left: 2px solid rgba(145, 70, 255, 0.5);
    font-size: 0.9em;
    line-height: 1.3;
}

/* Specific event type styling */
.subscription-event {
    border-left-color: #ffd700 !important;
}

.subscription-event .event-icon,
.resub-event .event-icon {
    filter: none;
    text-shadow: none;
}

.subscription-event .event-badge,
.resub-event .event-badge {
    box-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700, 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: goldPulse 10s ease-in-out forwards;
}

.subscription-event .event-username,
.resub-event .event-username {
    font-weight: bold;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.subscription-event .event-text,
.resub-event .event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.resub-event {
    border-left-color: #ffd700 !important;
}

.subgift-event,
.mysterygift-event {
    border-left-color: #ff6b6b !important;
}

.subgift-event .event-icon,
.mysterygift-event .event-icon {
    filter: none;
    text-shadow: none;
}

.subgift-event .event-badge,
.mysterygift-event .event-badge {
    box-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700, 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: goldPulse 10s ease-in-out forwards;
}

.subgift-event .event-username,
.mysterygift-event .event-username {
    font-weight: bold;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.subgift-event .event-text,
.mysterygift-event .event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.cheer-event {
    border-left-color: #9146ff !important;
}

.cheer-event .event-icon {
    filter: none;
    text-shadow: none;
}

.cheer-event .event-badge {
    box-shadow: 0 0 8px #4f9eff, 0 0 16px #4f9eff, 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: bluePulse 10s ease-in-out forwards;
}

.cheer-event .event-username {
    font-weight: bold;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.cheer-event .event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.raid-event {
    border-left-color: #f59e0b !important;
}

.raid-event .event-icon {
    filter: none;
    text-shadow: none;
}

.raid-event .event-badge {
    box-shadow: 0 0 8px #ff7b7b, 0 0 16px #ff7b7b, 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: redPulse 10s ease-in-out forwards;
}

.raid-event .event-username {
    font-weight: bold;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.raid-event .event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.host-event {
    border-left-color: #06b6d4 !important;
}

.host-event .event-icon {
    filter: none;
    text-shadow: none;
}

.host-event .event-badge {
    box-shadow: 0 0 8px #38bdf8, 0 0 16px #38bdf8, 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: cyanPulse 10s ease-in-out forwards;
}

.host-event .event-username {
    font-weight: bold;
    margin-right: 8px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.host-event .event-text {
    font-weight: 600;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Badge color styles for text badge fallbacks */
.badge-text.broadcaster {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    border-color: #ff8a80;
}

.badge-text.moderator {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #4ade80;
}

.badge-text.vip {
    background: linear-gradient(135deg, #ffd700, #f59e0b);
    color: #000000;
    border-color: #fbbf24;
}

.badge-text.subscriber {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    border-color: #a855f7;
}

.badge-text.founder {
    background: linear-gradient(135deg, #d946ef, #c026d3);
    border-color: #e879f9;
}

.badge-text.premium {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-color: #38bdf8;
}

.badge-text.staff {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #f87171;
}

.badge-text.admin {
    background: linear-gradient(135deg, #991b1b, #7f1d1d);
    border-color: #dc2626;
}

.badge-text.global_mod {
    background: linear-gradient(135deg, #059669, #047857);
    border-color: #10b981;
}

.badge-text.partner {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: #a78bfa;
}

.badge-text.turbo {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border-color: #22d3ee;
}

.badge-text.bits {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000000;
    border-color: #fbbf24;
}

.badge-text.artist {
    background: linear-gradient(135deg, #ec4899, #db2777);
    border-color: #f472b6;
}

.badge-text.developer {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-color: #818cf8;
}

.badge-text.hype_train {
    background: linear-gradient(135deg, #f97316, #ea580c);
    border-color: #fb923c;
}

.badge-text.no_audio, .badge-text.no_video {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border-color: #9ca3af;
}

/* Default badge styles for unknown types */
.badge-text:not(.broadcaster):not(.moderator):not(.vip):not(.subscriber):not(.founder):not(.premium):not(.staff):not(.admin):not(.global_mod):not(.partner):not(.turbo):not(.bits):not(.artist):not(.developer):not(.hype_train):not(.no_audio):not(.no_video) {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border-color: #9ca3af;
}

.badge-text {
    font-size: 12px;
    font-weight: bold;
    color: #ffff00;
    background: rgba(0, 0, 0, 0.7);
    padding: 1px 3px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    min-width: 12px;
    text-align: center;
    line-height: 1;
}

/* Badge loading state */
.badge:not([src]) {
    display: none;
}

/* Emotes */
.emote {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin: 0 2px;
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Settings panel */
#settings-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 20px;
    color: white;
    min-width: 520px;
    max-width: 580px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

#settings-panel.hidden {
    transform: scale(0.9) translateY(-10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#settings-panel h3 {
    margin-bottom: 15px;
    color: #9333ea;
}

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 3px;
}

.settings-tab {
    flex: 1;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.1;
    text-align: center;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.settings-tab.active {
    background: #9333ea;
    color: white;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 15px;
    margin-top: 20px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

.setting-group input[type="text"],
.setting-group input[type="number"],
.setting-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    margin-bottom: 5px;
}

.setting-group select {
    cursor: pointer;
    font-size: 16px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 32px;
    line-height: 1.5;
}

.setting-group select option {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 12px;
    font-size: 16px;
    border: none;
    line-height: 1.4;
}

.setting-group select optgroup {
    background: rgba(20, 20, 20, 0.95);
    color: #9333ea;
    font-weight: bold;
    font-size: 14px;
    padding: 8px 0;
    margin: 4px 0;
}

.setting-group select optgroup option {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-weight: normal;
    padding-left: 20px;
    margin: 2px 0;
}

/* Specific font selector styling */
#username-font,
#message-font {
    min-height: 42px;
    font-size: 18px;
    padding: 10px 32px 10px 12px;
}

#username-font option,
#message-font option {
    padding: 10px 12px;
    line-height: 1.6;
    font-size: 16px;
    min-height: 36px;
    font-display: swap; /* Better font loading for Firefox */
}

/* Firefox-specific font rendering improvements */
@-moz-document url-prefix() {
    #username-font option,
    #message-font option {
        font-size: 15px;
        padding: 8px 10px;
        line-height: 1.4;
        font-synthesis: none; /* Prevent Firefox from synthesizing fonts */
        font-variant-ligatures: none; /* Disable ligatures for better compatibility */
    }
    
    /* Force font loading for Firefox */
    #username-font,
    #message-font {
        font-feature-settings: normal;
        font-variant: normal;
    }
    
    /* Better font fallback chain for Firefox */
    #username-font option[data-font-loaded="true"],
    #message-font option[data-font-loaded="true"] {
        font-weight: normal;
        font-style: normal;
    }
}

#username-font optgroup,
#message-font optgroup {
    font-size: 15px;
    padding: 6px 8px;
    margin: 2px 0;
}

#username-font optgroup option,
#message-font optgroup option {
    padding-left: 24px;
    margin: 1px 0;
}

.setting-group input[type="range"] {
    width: 70%;
    margin-right: 10px;
}

/* Slider container */
.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.slider-container input[type="range"] {
    flex: 1;
    min-width: 100px;
}

.slider-container span {
    min-width: 35px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Color picker styles */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

/* Font size container */
.font-size-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 5px;
}

.font-size-container input[type="range"] {
    flex: 1;
    min-width: 100px;
}

.font-size-container input[type="number"] {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    text-align: center;
}

.font-size-container span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    min-width: 20px;
}

/* Sound selector styles */
.sound-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-selector-container select {
    flex: 1;
}

.sound-preview-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sound-preview-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.sound-preview-btn:active {
    transform: scale(0.95);
}

.color-picker-container input[type="color"] {
    width: 40px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 0;
}

.color-picker-container input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 3px;
}

.color-picker-container input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.opacity-slider {
    flex: 1;
    min-width: 80px;
}

.color-picker-container span {
    min-width: 35px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.setting-group button {
    background: #9333ea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.setting-group button:hover {
    background: #7c3aed;
}

/* Utility buttons */
.utility-btn {
    background: #6b7280 !important;
    margin: 2px !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
}

.utility-btn:hover {
    background: #4b5563 !important;
}

.utility-btn.danger {
    background: #dc2626 !important;
}

.utility-btn.danger:hover {
    background: #b91c1c !important;
}

/* Generated URL textarea */
#generated-url, #load-settings-url {
    width: 100%;
    height: 60px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 12px;
    resize: vertical;
    margin-bottom: 5px;
    font-family: monospace;
}

#load-settings-url {
    margin-bottom: 8px;
    font-family: 'Segoe UI', sans-serif;
}

#load-settings-url::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Load settings actions container */
.load-settings-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.load-settings-actions .utility-btn {
    flex: 1;
}

/* Settings toggle button */
.settings-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 16px;
    z-index: 999;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.settings-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Help toggle button */
.help-toggle {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    z-index: 999;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Hidden state for OBS mode */
.settings-toggle[style*="display: none"],
.help-toggle[style*="display: none"] {
    display: none !important;
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 20px;
}

.loading-content h2 {
    margin: 20px 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.loading-content p {
    margin: 10px 0;
    font-size: 16px;
    opacity: 0.8;
}

/* Spinner Animation */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress Bar */
.loading-progress {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    min-width: 40px;
    font-size: 14px;
    font-weight: 600;
}

/* Responsive design for demo mode */
@media (max-width: 840px) or (max-height: 640px) {
    .demo-wrapper {
        gap: 15px;
    }
    
    .demo-container {
        width: calc(100vw - 40px);
        height: calc((100vw - 40px) * 0.75);
        max-height: calc(100vh - 120px);
    }
    
    .demo-title {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    body.demo-mode #chat-container {
        padding: 0;
    }
}

@media (max-width: 600px) {
    /* Standard responsive design */
    body:not(.demo-mode) #chat-container {
        padding: 5px;
    }
    
    body:not(.demo-mode) #chat-messages {
        padding: 5px 5px 5px 5px;
    }
    
    body:not(.demo-mode) .chat-message {
        padding: 6px 10px;
        font-size: 14px;
    }
    
    body:not(.demo-mode) #settings-panel {
        right: 10px;
        top: 10px;
        min-width: 400px;
        max-width: 95vw;
    }
    
    body:not(.demo-mode) .settings-tabs {
        flex-direction: column;
        gap: 1px;
    }
    
    body:not(.demo-mode) .settings-tab {
        padding: 10px 8px;
        font-size: 11px;
        letter-spacing: 0.2px;
    }
    
    /* Demo mode responsive design */
    body.demo-mode {
        padding: 10px;
    }
    
    .demo-wrapper {
        gap: 10px;
    }
    
    .demo-container {
        width: calc(100vw - 20px);
        height: calc((100vw - 20px) * 0.75);
        max-height: calc(100vh - 80px);
        border-radius: 8px;
    }
    
    .demo-title {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    body.demo-mode #chat-container {
        padding: 0;
    }
    
    body.demo-mode #chat-messages {
        padding: 5px 5px 5px 5px !important;
    }
    
    body.demo-mode #settings-panel {
        right: 5px;
        top: 5px;
        min-width: 360px;
        max-width: calc(100vw - 10px);
    }
    
    body.demo-mode .settings-tab {
        padding: 6px 4px;
        font-size: 9px;
        letter-spacing: 0.1px;
    }
}

/* Font selector button styling */
.font-selector-btn {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    text-align: left;
}

.font-selector-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.font-selector-arrow {
    opacity: 0.7;
    font-size: 12px;
    transition: transform 0.2s ease;
}

.font-selector-btn:hover .font-selector-arrow {
    transform: translateY(1px);
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    width: 90vw;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #9333ea;
    margin: 0;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Font tabs */
.font-tabs {
    display: flex;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.font-tab {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.font-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.font-tab.active {
    color: #9333ea;
    border-bottom-color: #9333ea;
}

/* Font grid */
.font-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.font-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.font-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.font-option.selected {
    background: rgba(147, 51, 234, 0.2);
    border-color: #9333ea;
}

.font-option-name {
    color: white;
    font-size: 20px;
    font-weight: 500;
    margin: 0;
    line-height: 1.2;
    text-align: center;
    word-break: break-word;
}

/* Responsive design for modal */
@media (max-width: 600px) {
    .modal-content {
        width: 95vw;
        height: 85vh;
    }
    
    .font-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    
    .font-option {
        padding: 16px 12px;
        min-height: 70px;
    }
    
    .font-option-name {
        font-size: 16px;
    }
}
@-moz-document url-prefix() {
    /* Firefox-specific select dropdown styling */
    select#username-font,
    select#message-font {
        font-weight: normal !important;
        font-style: normal !important;
        appearance: menulist !important;
        -moz-appearance: menulist !important;
        text-rendering: optimizeLegibility !important;
    }
    
    /* Force font rendering for Firefox options */
    select#username-font option,
    select#message-font option {
        font-weight: normal !important;
        font-style: normal !important;
        font-size: 14px !important;
        padding: 4px 8px !important;
        background: white !important;
        color: black !important;
        text-rendering: optimizeLegibility !important;
        font-feature-settings: "kern" 1 !important;
        -moz-font-feature-settings: "kern" 1 !important;
    }
    
    /* Ensure proper font loading for all Google Fonts */
    /* Clean & Modern Fonts */
    select option[data-font="Roboto"] { font-family: "Roboto", sans-serif !important; }
    select option[data-font="Open Sans"] { font-family: "Open Sans", sans-serif !important; }
    select option[data-font="Inter"] { font-family: "Inter", sans-serif !important; }
    select option[data-font="Lato"] { font-family: "Lato", sans-serif !important; }
    select option[data-font="Source Sans Pro"] { font-family: "Source Sans Pro", sans-serif !important; }
    select option[data-font="Nunito"] { font-family: "Nunito", sans-serif !important; }
    select option[data-font="Poppins"] { font-family: "Poppins", sans-serif !important; }
    select option[data-font="Work Sans"] { font-family: "Work Sans", sans-serif !important; }
    select option[data-font="Rubik"] { font-family: "Rubik", sans-serif !important; }
    select option[data-font="DM Sans"] { font-family: "DM Sans", sans-serif !important; }
    select option[data-font="Manrope"] { font-family: "Manrope", sans-serif !important; }
    select option[data-font="Outfit"] { font-family: "Outfit", sans-serif !important; }
    select option[data-font="Plus Jakarta Sans"] { font-family: "Plus Jakarta Sans", sans-serif !important; }
    select option[data-font="Figtree"] { font-family: "Figtree", sans-serif !important; }
    select option[data-font="Lexend"] { font-family: "Lexend", sans-serif !important; }
    select option[data-font="Space Grotesk"] { font-family: "Space Grotesk", sans-serif !important; }
    select option[data-font="Public Sans"] { font-family: "Public Sans", sans-serif !important; }
    select option[data-font="Karla"] { font-family: "Karla", sans-serif !important; }
    select option[data-font="Noto Sans"] { font-family: "Noto Sans", sans-serif !important; }
    select option[data-font="Mulish"] { font-family: "Mulish", sans-serif !important; }
    select option[data-font="Hind"] { font-family: "Hind", sans-serif !important; }
    select option[data-font="IBM Plex Sans"] { font-family: "IBM Plex Sans", sans-serif !important; }
    select option[data-font="Red Hat Display"] { font-family: "Red Hat Display", sans-serif !important; }
    select option[data-font="Overpass"] { font-family: "Overpass", sans-serif !important; }
    select option[data-font="Oxygen"] { font-family: "Oxygen", sans-serif !important; }
    select option[data-font="Ubuntu"] { font-family: "Ubuntu", sans-serif !important; }
    select option[data-font="PT Sans"] { font-family: "PT Sans", sans-serif !important; }
    select option[data-font="Titillium Web"] { font-family: "Titillium Web", sans-serif !important; }
    select option[data-font="Assistant"] { font-family: "Assistant", sans-serif !important; }
    select option[data-font="Exo 2"] { font-family: "Exo 2", sans-serif !important; }
    
    /* Bold & Stylish Fonts */
    select option[data-font="Montserrat"] { font-family: "Montserrat", sans-serif !important; }
    select option[data-font="Oswald"] { font-family: "Oswald", sans-serif !important; }
    select option[data-font="Raleway"] { font-family: "Raleway", sans-serif !important; }
    select option[data-font="Roboto Condensed"] { font-family: "Roboto Condensed", sans-serif !important; }
    select option[data-font="Bebas Neue"] { font-family: "Bebas Neue", cursive !important; }
    select option[data-font="Anton"] { font-family: "Anton", sans-serif !important; }
    select option[data-font="Fjalla One"] { font-family: "Fjalla One", sans-serif !important; }
    select option[data-font="Russo One"] { font-family: "Russo One", sans-serif !important; }
    select option[data-font="Barlow Condensed"] { font-family: "Barlow Condensed", sans-serif !important; }
    select option[data-font="Yanone Kaffeesatz"] { font-family: "Yanone Kaffeesatz", sans-serif !important; }
    select option[data-font="Archivo Black"] { font-family: "Archivo Black", sans-serif !important; }
    select option[data-font="Teko"] { font-family: "Teko", sans-serif !important; }
    select option[data-font="Squada One"] { font-family: "Squada One", cursive !important; }
    select option[data-font="Alfa Slab One"] { font-family: "Alfa Slab One", cursive !important; }
    select option[data-font="Black Ops One"] { font-family: "Black Ops One", cursive !important; }
    select option[data-font="Orbitron"] { font-family: "Orbitron", sans-serif !important; }
    select option[data-font="Exo"] { font-family: "Exo", sans-serif !important; }
    select option[data-font="Righteous"] { font-family: "Righteous", cursive !important; }
    select option[data-font="Pathway Gothic One"] { font-family: "Pathway Gothic One", sans-serif !important; }
    select option[data-font="Saira Condensed"] { font-family: "Saira Condensed", sans-serif !important; }
    select option[data-font="Kanit"] { font-family: "Kanit", sans-serif !important; }
    select option[data-font="Prompt"] { font-family: "Prompt", sans-serif !important; }
    select option[data-font="Fredoka One"] { font-family: "Fredoka One", cursive !important; }
    select option[data-font="Signika"] { font-family: "Signika", sans-serif !important; }
    select option[data-font="Asap Condensed"] { font-family: "Asap Condensed", sans-serif !important; }
    select option[data-font="Cabin"] { font-family: "Cabin", sans-serif !important; }
    select option[data-font="Mukti"] { font-family: "Mukti", sans-serif !important; }
    select option[data-font="Sarabun"] { font-family: "Sarabun", sans-serif !important; }
    select option[data-font="Varela"] { font-family: "Varela", sans-serif !important; }
    
    /* Playful & Fun Fonts */
    select option[data-font="Pacifico"] { font-family: "Pacifico", cursive !important; }
    select option[data-font="Comfortaa"] { font-family: "Comfortaa", cursive !important; }
    select option[data-font="Quicksand"] { font-family: "Quicksand", sans-serif !important; }
    select option[data-font="Varela Round"] { font-family: "Varela Round", sans-serif !important; }
    select option[data-font="Caveat"] { font-family: "Caveat", cursive !important; }
    select option[data-font="Dancing Script"] { font-family: "Dancing Script", cursive !important; }
    select option[data-font="Shadows Into Light"] { font-family: "Shadows Into Light", cursive !important; }
    select option[data-font="Amatic SC"] { font-family: "Amatic SC", cursive !important; }
    select option[data-font="Indie Flower"] { font-family: "Indie Flower", cursive !important; }
    select option[data-font="Kalam"] { font-family: "Kalam", cursive !important; }
    select option[data-font="Patrick Hand"] { font-family: "Patrick Hand", cursive !important; }
    select option[data-font="Architects Daughter"] { font-family: "Architects Daughter", cursive !important; }
    select option[data-font="Gloria Hallelujah"] { font-family: "Gloria Hallelujah", cursive !important; }
    select option[data-font="Coming Soon"] { font-family: "Coming Soon", cursive !important; }
    select option[data-font="Handlee"] { font-family: "Handlee", cursive !important; }
    select option[data-font="Satisfy"] { font-family: "Satisfy", cursive !important; }
    select option[data-font="Courgette"] { font-family: "Courgette", cursive !important; }
    select option[data-font="Kaushan Script"] { font-family: "Kaushan Script", cursive !important; }
    select option[data-font="Great Vibes"] { font-family: "Great Vibes", cursive !important; }
    select option[data-font="Allura"] { font-family: "Allura", cursive !important; }
    select option[data-font="Sacramento"] { font-family: "Sacramento", cursive !important; }
    select option[data-font="Alex Brush"] { font-family: "Alex Brush", cursive !important; }
    select option[data-font="Cookie"] { font-family: "Cookie", cursive !important; }
    select option[data-font="Tangerine"] { font-family: "Tangerine", cursive !important; }
    select option[data-font="Lobster"] { font-family: "Lobster", cursive !important; }
    select option[data-font="Lobster Two"] { font-family: "Lobster Two", cursive !important; }
    select option[data-font="Fredoka"] { font-family: "Fredoka", sans-serif !important; }
    select option[data-font="Chewy"] { font-family: "Chewy", cursive !important; }
    select option[data-font="Bubblegum Sans"] { font-family: "Bubblegum Sans", cursive !important; }
    
    /* Elegant & Serif Fonts */
    select option[data-font="Merriweather"] { font-family: "Merriweather", serif !important; }
    select option[data-font="Playfair Display"] { font-family: "Playfair Display", serif !important; }
    select option[data-font="Lora"] { font-family: "Lora", serif !important; }
    select option[data-font="Crimson Text"] { font-family: "Crimson Text", serif !important; }
    select option[data-font="Libre Baskerville"] { font-family: "Libre Baskerville", serif !important; }
    select option[data-font="Old Standard TT"] { font-family: "Old Standard TT", serif !important; }
    select option[data-font="Cormorant Garamond"] { font-family: "Cormorant Garamond", serif !important; }
    select option[data-font="EB Garamond"] { font-family: "EB Garamond", serif !important; }
    select option[data-font="Gentium Plus"] { font-family: "Gentium Plus", serif !important; }
    select option[data-font="Neuton"] { font-family: "Neuton", serif !important; }
    select option[data-font="Vollkorn"] { font-family: "Vollkorn", serif !important; }
    select option[data-font="Alegreya"] { font-family: "Alegreya", serif !important; }
    select option[data-font="Domine"] { font-family: "Domine", serif !important; }
    select option[data-font="Arvo"] { font-family: "Arvo", serif !important; }
    select option[data-font="Bitter"] { font-family: "Bitter", serif !important; }
    select option[data-font="Rokkitt"] { font-family: "Rokkitt", serif !important; }
    select option[data-font="Slabo 27px"] { font-family: "Slabo 27px", serif !important; }
    select option[data-font="Cardo"] { font-family: "Cardo", serif !important; }
    select option[data-font="Spectral"] { font-family: "Spectral", serif !important; }
    select option[data-font="Source Serif Pro"] { font-family: "Source Serif Pro", serif !important; }
    select option[data-font="PT Serif"] { font-family: "PT Serif", serif !important; }
    select option[data-font="Noticia Text"] { font-family: "Noticia Text", serif !important; }
    select option[data-font="Gelasio"] { font-family: "Gelasio", serif !important; }
    select option[data-font="Frank Ruhl Libre"] { font-family: "Frank Ruhl Libre", serif !important; }
    select option[data-font="IBM Plex Serif"] { font-family: "IBM Plex Serif", serif !important; }
    select option[data-font="Zilla Slab"] { font-family: "Zilla Slab", serif !important; }
    select option[data-font="Abril Fatface"] { font-family: "Abril Fatface", cursive !important; }
    select option[data-font="Cinzel"] { font-family: "Cinzel", serif !important; }
    select option[data-font="Yeseva One"] { font-family: "Yeseva One", cursive !important; }
    select option[data-font="Ultra"] { font-family: "Ultra", serif !important; }
    
    /* Monospace & Code Fonts */
    select option[data-font="JetBrains Mono"] { font-family: "JetBrains Mono", monospace !important; }
    select option[data-font="Fira Code"] { font-family: "Fira Code", monospace !important; }
    select option[data-font="Source Code Pro"] { font-family: "Source Code Pro", monospace !important; }
    select option[data-font="Roboto Mono"] { font-family: "Roboto Mono", monospace !important; }
    select option[data-font="IBM Plex Mono"] { font-family: "IBM Plex Mono", monospace !important; }
    select option[data-font="Inconsolata"] { font-family: "Inconsolata", monospace !important; }
    select option[data-font="Ubuntu Mono"] { font-family: "Ubuntu Mono", monospace !important; }
    select option[data-font="Space Mono"] { font-family: "Space Mono", monospace !important; }
    select option[data-font="Courier Prime"] { font-family: "Courier Prime", monospace !important; }
    select option[data-font="Anonymous Pro"] { font-family: "Anonymous Pro", monospace !important; }
    select option[data-font="Overpass Mono"] { font-family: "Overpass Mono", monospace !important; }
    select option[data-font="B612 Mono"] { font-family: "B612 Mono", monospace !important; }
    select option[data-font="PT Mono"] { font-family: "PT Mono", monospace !important; }
    select option[data-font="Noto Sans Mono"] { font-family: "Noto Sans Mono", monospace !important; }
    select option[data-font="Share Tech Mono"] { font-family: "Share Tech Mono", monospace !important; }
    select option[data-font="VT323"] { font-family: "VT323", monospace !important; }
    select option[data-font="Cutive Mono"] { font-family: "Cutive Mono", monospace !important; }
    select option[data-font="Nova Mono"] { font-family: "Nova Mono", monospace !important; }
    select option[data-font="Major Mono Display"] { font-family: "Major Mono Display", monospace !important; }
    select option[data-font="Azeret Mono"] { font-family: "Azeret Mono", monospace !important; }
}

/* Enhanced cross-browser font support */
@supports (-webkit-appearance: none) {
    /* Webkit/Chrome optimizations */
    select#username-font option,
    select#message-font option {
        font-display: swap;
        text-rendering: optimizeLegibility;
    }
}

/* OBS Instructions Modal Styles */
.obs-instructions {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.instruction-step {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.instruction-step h4 {
    color: #9333ea;
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.instruction-step p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0 0 8px 0;
    line-height: 1.6;
    font-size: 14px;
}

.instruction-step ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.instruction-step li {
    margin-bottom: 4px;
    line-height: 1.5;
    font-size: 14px;
}

.tip-box {
    background: rgba(147, 51, 234, 0.1);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.6;
}

.tip-box strong {
    color: #9333ea;
}

/* Pulsing Animation Keyframes for Event Glows */
@keyframes goldPulse {
    0%, 90% { 
        text-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700, 0 0 24px #ffd700, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    45% { 
        text-shadow: 0 0 12px #ffd700, 0 0 24px #ffd700, 0 0 36px #ffd700, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 12px #ffd700, 0 0 24px #ffd700, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    100% {
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

@keyframes bluePulse {
    0%, 100% { 
        text-shadow: 0 0 8px #4f9eff, 0 0 16px #4f9eff, 0 0 24px #4f9eff, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 8px #4f9eff, 0 0 16px #4f9eff, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% { 
        text-shadow: 0 0 12px #4f9eff, 0 0 24px #4f9eff, 0 0 36px #4f9eff, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 12px #4f9eff, 0 0 24px #4f9eff, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

@keyframes redPulse {
    0%, 90% { 
        text-shadow: 0 0 8px #ff7b7b, 0 0 16px #ff7b7b, 0 0 24px #ff7b7b, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 8px #ff7b7b, 0 0 16px #ff7b7b, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    45% { 
        text-shadow: 0 0 12px #ff7b7b, 0 0 24px #ff7b7b, 0 0 36px #ff7b7b, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 12px #ff7b7b, 0 0 24px #ff7b7b, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    100% {
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

@keyframes cyanPulse {
    0%, 90% { 
        text-shadow: 0 0 8px #38bdf8, 0 0 16px #38bdf8, 0 0 24px #38bdf8, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 8px #38bdf8, 0 0 16px #38bdf8, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    45% { 
        text-shadow: 0 0 12px #38bdf8, 0 0 24px #38bdf8, 0 0 36px #38bdf8, 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 0 12px #38bdf8, 0 0 24px #38bdf8, 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    100% {
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 1px #000, 0 0 2px #000;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}
