/* ==========================================================================
   Design Tokens & Variables
   ========================================================================== */
:root {
    --bg-primary: #0a0b10;
    --bg-surface: rgba(18, 20, 30, 0.65);
    --bg-surface-solid: #151824;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-glow: rgba(0, 180, 216, 0.3);
    
    --text-primary: #f0f2f5;
    --text-secondary: #949ba4;
    --text-muted: #626973;
    
    --color-accent: #00b4d8;
    --color-accent-rgb: 0, 180, 216;
    --color-success: #2ec4b6;
    --color-danger: #e63946;
    --color-admin: #3a86c8;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    
    --glass-blur: blur(16px);
    --glass-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Base & Layout Reset
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

/* App Background with dynamic blur state */
#app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('partybg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    transition: var(--transition-smooth);
}

#app-background.bg-blurred::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 16, 0.85); /* Dark solid fallback instead of filter */
    z-index: -1;
}

/* Screens container */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Common Premium UI Components
   ========================================================================== */
.glass-card {
    background: rgba(20, 22, 32, 0.95); /* Solid dark card fallback instead of filter */
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 40px;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-color-glow);
    box-shadow: 0 10px 45px 0 rgba(0, 180, 216, 0.15);
}

/* Badge style */
.badge {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 20px;
    margin-bottom: 20px;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.3);
}

.neon-text {
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.4);
}

.glow-text {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 3rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 30%, #00b4d8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

/* Inputs */
.input-group {
    margin-bottom: 24px;
    position: relative;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: var(--transition-smooth);
    outline: none;
}

input[type="text"]:focus, input[type="password"]:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.error-msg {
    display: block;
    color: var(--color-danger);
    font-size: 0.8rem;
    margin-top: 6px;
    min-height: 1.2em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: var(--font-sans);
    text-decoration: none;
}

.btn-primary {
    background: var(--color-accent);
    color: #050508;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: #00d2f3;
    box-shadow: 0 4px 20px rgba(0, 180, 216, 0.5);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--text-secondary);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 4px 15px rgba(230, 57, 70, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: #ff4d5a;
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.5);
    transform: translateY(-2px);
}

.btn-accent {
    background: #ff0055;
    color: white;
    box-shadow: 0 4px 15px rgba(255, 0, 85, 0.3);
    border: 1px solid #ff0055;
}

.btn-accent:hover:not(:disabled) {
    background: #ff2a70;
    box-shadow: 0 4px 20px rgba(255, 0, 85, 0.5);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   1. Countdown Screen Styles
   ========================================================================== */
#countdown-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-card {
    max-width: 550px;
    text-align: center;
}

.countdown-card .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Countdown numbers */
.countdown-timer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.timer-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
}

.timer-box span:first-child {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 3.5rem;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-shadow: 0 0 15px rgba(255,255,255,0.1);
}

.timer-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-top: 6px;
}

.timer-divider {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 3.5rem;
    color: var(--text-muted);
    line-height: 1.1;
    align-self: flex-start;
    transform: translateY(-5px);
}

/* Hidden admin trigger key - 5% opacity, keyboard & mouse accessible */
#admin-trigger {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    outline: none;
    z-index: 10;
    opacity: 0.05; /* 5% opacity */
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-smooth);
    color: #fff;
}

#admin-trigger:hover {
    opacity: 0.2;
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   Modals (Password, Announcement Setup)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 8, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: var(--transition-smooth);
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-card {
    width: 90%;
    max-width: 460px;
    padding: 30px;
}

.modal-card h2 {
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.modal-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================================================
   2. Username Selection Stage
   ========================================================================== */
#username-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.username-card {
    width: 90%;
    max-width: 420px;
    text-align: center;
}

.username-card h2 {
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1.75rem;
}

.username-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Avatar selections */
.avatar-selector {
    margin-bottom: 24px;
    text-align: left;
}

.avatar-selector label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.avatar-options {
    display: flex;
    gap: 15px;
}

.avatar-opt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.avatar-opt:hover {
    border-color: rgba(0, 180, 216, 0.4);
    color: var(--text-secondary);
}

.avatar-opt.active {
    border-color: var(--color-accent);
    background: rgba(0, 180, 216, 0.08);
    color: var(--color-accent);
    box-shadow: 0 0 10px rgba(0, 180, 216, 0.15);
}

/* ==========================================================================
   3. Livestream Screen (Discord Screenshare Style)
   ========================================================================== */
#stream-screen {
    width: 100vw;
    height: 100vh;
}

.stream-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    width: 100%;
    height: 100%;
    background: #111214; /* Discord solid dark background */
}

/* --- Main stream area --- */
.stream-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    overflow: hidden;
}

.stream-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    background: #1e1f22;
    border-radius: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.stream-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
}

.admin-avatar-glow {
    border-color: var(--color-admin);
    box-shadow: 0 0 8px rgba(58, 134, 200, 0.5);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
}

.stream-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.stream-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.02em;
}

.stream-badge.live {
    background: var(--color-danger);
    color: #fff;
}

.stream-badge.viewers {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.viewers-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-success);
    display: inline-block;
}

.stream-actions {
    color: var(--text-secondary);
}

.stream-quality {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

/* --- Stream player container --- */
.stream-video-container {
    flex: 1;
    position: relative;
    background: #050608;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

#stream-video, #youtube-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 1;
}

#youtube-player {
    position: absolute;
    top: 0;
    left: 0;
    border: none;
}

/* Default view (Roblox stage scene representation) */
#stream-default-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050608; /* Solid black view */
    overflow: hidden;
    z-index: 0;
}

/* Dynamic glow overlay for video audio visual simulation */
#video-overlay-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    box-shadow: inset 0 0 100px rgba(0, 180, 216, 0);
    transition: box-shadow 0.2s ease;
}

/* Starry Sky Animation */
.sky-stars {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 4s infinite ease-in-out;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.1; transform: scale(0.8); }
    50% { opacity: 0.9; transform: scale(1.2); }
}

/* Grass Ground */
.ground-grass {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to bottom, #081207 0%, #040903 100%);
    border-top: 2px solid rgba(8, 20, 7, 0.4);
}

/* Roblox Werewolf Avatar Positioning */
.werewolf-character {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 400px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.1s ease;
}

.werewolf-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.8));
    animation: breathe 3.5s infinite ease-in-out;
    transform-origin: bottom center;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02) translateY(-2px); }
}

/* --- Roblox Style Chat Speech Bubbles Over Stream --- */
#speech-bubbles-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.speech-bubble {
    position: absolute;
    background: rgba(246, 246, 246, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 8px 16px;
    max-width: 250px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a1a1a;
    font-family: var(--font-sans);
    line-height: 1.3;
    pointer-events: none;
    text-align: center;
    transform-origin: bottom center;
    animation: bubble-entrance 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, 
               bubble-drift 3.5s linear forwards;
}

/* Speech bubble bottom pointer */
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: rgba(246, 246, 246, 0.92) transparent;
    display: block;
    width: 0;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 9px 9px 0;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.15) transparent;
    display: block;
    width: 0;
    z-index: -1;
}

@keyframes bubble-entrance {
    0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

@keyframes bubble-drift {
    0% { margin-bottom: 0px; }
    70% { opacity: 1; }
    90% { opacity: 0; }
    100% { margin-bottom: 120px; opacity: 0; }
}

/* --- Admin Control Panel (Under video) --- */
#admin-controls-panel {
    background: #1e1f22;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.admin-panel-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-accent);
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.admin-panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-upload-btn input[type="file"] {
    display: none;
}

#admin-video-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 8px;
}

/* --- Discord Style Chat Sidebar --- */
.stream-sidebar {
    background: #2b2d31; /* Discord sidebar color */
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-sidebar-header {
    padding: 16px;
    background: #2b2d31;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    z-index: 2;
}

.chat-sidebar-header h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

.chat-messages-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse; /* Scroll to bottom by default */
}

#chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message styles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: message-fade-in 0.2s ease-out;
}

@keyframes message-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #3f4248;
}

.msg-avatar svg, .msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.msg-content-wrapper {
    flex: 1;
    min-width: 0;
}

.msg-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 3px;
}

.msg-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

.msg-author:hover {
    text-decoration: underline;
}

.msg-author.author-admin {
    color: #43b581; /* Discord Green */
}

.msg-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1;
}

.msg-badge.badge-admin {
    background: rgba(67, 181, 129, 0.15);
    color: #43b581;
    border: 1px solid rgba(67, 181, 129, 0.3);
}

.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.msg-body {
    font-size: 0.85rem;
    color: #dbdee1; /* Discord message body color */
    line-height: 1.4;
    word-break: break-word;
}

.msg-body.system-msg {
    color: var(--color-accent);
    font-style: italic;
    font-size: 0.8rem;
}

/* Chat Input Bar */
.chat-input-area {
    padding: 16px;
    background: #2b2d31;
    z-index: 2;
}

#chat-form {
    display: flex;
    background: #383a40; /* Discord input bg */
    border-radius: 8px;
    padding: 8px 12px;
    align-items: center;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
}

#chat-form:focus-within {
    border-color: var(--color-accent);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    padding: 6px 0;
}

#btn-send-chat {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

#chat-input:not(:placeholder-shown) + #btn-send-chat,
#btn-send-chat:hover {
    color: var(--color-accent);
}

/* ==========================================================================
   4. Announcement Banner (Roblox Styled - EXACT MATCH)
   ========================================================================== */
.announcement-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-150px);
    z-index: 10000;
    width: 90%;
    max-width: 480px;
    height: 100px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    background-image: linear-gradient(90deg, rgba(0,0,0,0) 25%, #000000 45%), url('ETannounce.png');
    background-size: cover;
    background-position: left center;
    background-repeat: no-repeat;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.announcement-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.announcement-banner.hidden {
    transform: translateX(-50%) translateY(-150px);
    opacity: 0;
    pointer-events: none;
    display: flex !important;
}

.announcement-content-side {
    margin-left: 45%; /* Position text on the black gradient area */
    padding: 12px 20px 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    min-width: 0;
    width: 55%;
    height: 100%;
}

.announcement-sender-name {
    font-size: 0.75rem;
    color: #cccccc;
    font-weight: 400; /* Not bold */
    line-height: 1.1;
    margin-bottom: 1px;
}

.announcement-original-text {
    font-size: 0.82rem; /* Small */
    font-weight: 500; /* Not very bold */
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.15;
    word-break: break-word;
    max-height: 38px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    opacity: 0.75;
}

.announcement-translated-text {
    font-size: 1.12rem; /* Big guest translation */
    font-weight: 800; /* Bold */
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-top: 1px;
    word-break: break-word;
    max-height: 35px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Troll overlay styles */
#troll-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Dark scary backdrop overlay */
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.2s ease;
    opacity: 0;
}

#troll-overlay.active {
    opacity: 1;
}

.troll-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.5);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#troll-overlay.active .troll-card {
    transform: scale(1.15); /* Zooms the card */
}

#troll-overlay img {
    max-width: 80vw;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.5);
    border: 3px solid #ff0055;
    background: #000;
}

#troll-overlay.active img {
    animation: troll-shake 0.05s infinite; /* Shakes the image inside the card */
}

@keyframes troll-shake {
    0% { transform: translate(2px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(0px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(2px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}



/* ==========================================================================
   Custom Alert Notification Toast
   ========================================================================== */
#alert-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-toast {
    background: rgba(18, 20, 30, 0.9);
    backdrop-filter: blur(8px);
    border-left: 4px solid var(--color-accent);
    border-radius: 4px;
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: toast-in 0.3s ease forwards, toast-out 0.3s ease 3s forwards;
    max-width: 320px;
}

.alert-toast.toast-error {
    border-left-color: var(--color-danger);
}

.alert-toast.toast-success {
    border-left-color: var(--color-success);
}

@keyframes toast-in {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
    .stream-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 300px;
    }
    
    .stream-sidebar {
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.2);
    }
    
    .countdown-timer {
        gap: 8px;
    }
    
    .timer-box {
        width: 75px;
    }
    
    .timer-box span:first-child {
        font-size: 2.5rem;
    }
    
    .timer-divider {
        font-size: 2.5rem;
    }
}
