@font-face {
    font-family: 'Segoe UI Historic';
    src: url('/segoeuithis.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-bg: #f0f2f5;
    --secondary-bg: #ffffff;
    --text-color: #050505;
    --subtle-text: #65676b;
    --border-color: #ced0d4;
    --accent-red: #ff3b30;
    --accent-blue: #007aff;
    --accent-purple: #af52de;
    --accent-green: #34c759;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-hover: rgba(0, 0, 0, 0.1);
    --font-heading: 'Segoe UI Historic', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    font-family: var(--font-body);
    margin: 0;
    background-color: var(--primary-bg);
    color: var(--text-color);
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.light {
    --primary-bg: #f0f2f5;
    --secondary-bg: #ffffff;
    --text-color: #050505;
    --subtle-text: #65676b;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --shadow-color-hover: rgba(0, 0, 0, 0.1);
}

body.dark {
    --primary-bg: #121212;
    --secondary-bg: #1e1e1e;
    --text-color: #e8e8e8;
    --subtle-text: #888888;
    --border-color: #2a2a2a;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-hover: rgba(0, 0, 0, 0.15);
}

body.synthwave {
    --primary-bg: #1A1033;
    --secondary-bg: #2A1B4D;
    --text-color: #E6E0FF;
    --subtle-text: #A99CDE;
    --border-color: #4D3D80;
    --accent-red: #FF4D9D;
    --accent-blue: #00E5FF;
    --accent-purple: #D05AFF;
    --accent-green: #2EFF7B;
    --shadow-color: rgba(0, 229, 255, 0.1);
    --shadow-color-hover: rgba(0, 229, 255, 0.15);
}

body.forest {
    --primary-bg: #2E3C30;
    --secondary-bg: #435847;
    --text-color: #E8F5E9;
    --subtle-text: #A5D6A7;
    --border-color: #5C7761;
    --accent-red: #E57373;
    --accent-blue: #64B5F6;
    --accent-purple: #BA68C8;
    --accent-green: #FFB74D;
    --shadow-color: rgba(0, 0, 0, 0.15);
    --shadow-color-hover: rgba(0, 0, 0, 0.2);
}

body.rose {
    --primary-bg: #FFF0F5;
    --secondary-bg: #FFFFFF;
    --text-color: #5C3A47;
    --subtle-text: #B28390;
    --border-color: #FADADD;
    --accent-red: #E53935;
    --accent-blue: #82A9D1;
    --accent-purple: #C0799E;
    --accent-green: #7CB342;
    --shadow-color: rgba(184, 131, 144, 0.1);
    --shadow-color-hover: rgba(184, 131, 144, 0.15);
}

body.amoled {
    --primary-bg: #000000;
    --secondary-bg: #111111;
    --text-color: #F5F5F5;
    --subtle-text: #9E9E9E;
    --border-color: #212121;
    --accent-red: #EF5350;
    --accent-blue: #42A5F5;
    --accent-purple: #AB47BC;
    --accent-green: #66BB6A;
    --shadow-color: rgba(255, 255, 255, 0.05);
    --shadow-color-hover: rgba(255, 255, 255, 0.1);
}

/* System prefers-color-scheme */
@media (prefers-color-scheme: dark) {
    body:not(.light):not(.synthwave):not(.forest):not(.rose):not(.amoled) {
        --primary-bg: #121212;
        --secondary-bg: #1e1e1e;
        --text-color: #e8e8e8;
        --subtle-text: #888888;
        --border-color: #2a2a2a;
        --shadow-color: rgba(0, 0, 0, 0.1);
        --shadow-color-hover: rgba(0, 0, 0, 0.15);
    }
}

/* --- Title Screen --- */
#title-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('./title-background.png');
    background-size: cover;
    background-position: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 2000;
    padding: 2rem;
    box-sizing: border-box;
    transition: opacity 0.5s ease-out;
    opacity: 1;
    overflow: hidden;
}
#title-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 0;
}
#title-screen.hidden {
    opacity: 0;
    pointer-events: none;
}
.title-logo {
    width: 100%;
    max-width: 150px;
    height: auto;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}
#title-screen h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    margin: 0 0 0.5rem 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}
.tagline {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    margin: 0 0 2rem 0;
    max-width: 400px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}
#title-bg-icons {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
}
.bg-icon {
    position: absolute;
    bottom: -100px; /* Start off-screen */
    color: rgba(255, 255, 255, 0.15);
    animation: float-up 20s infinite linear;
    opacity: 0;
}
@keyframes float-up {
    0% { transform: translateY(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-120vh); opacity: 0; }
}
.version-info {
    position: absolute;
    top: 1.5rem; right: 1.5rem;
    background-color: rgba(0,0,0,0.4);
    color: rgba(255,255,255,0.8);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
    z-index: 1;
}
#start-game-btn {
    width: auto;
    min-width: 200px;
    position: relative;
    z-index: 1;
}

/* --- Main Game Layout --- */
#game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1rem 120px 1rem;
}
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
header {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    margin-bottom: 2rem;
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo img {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}
.channel-info h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    font-family: var(--font-heading);
}
#channel-description-header {
    margin: 2px 0 0 0;
    font-size: 0.85rem;
    color: var(--subtle-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
    line-height: 1.3;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.icon-btn {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--subtle-text);
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.icon-btn:hover {
    background-color: var(--primary-bg);
}
#stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--secondary-bg);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
}
.stat-item i {
    font-size: 1.5rem;
    color: var(--subtle-text);
}
.stat-item i.fa-dollar-sign { color: var(--accent-green); }
.stat-item div { line-height: 1.3; }
.stat-item span {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}
.stat-item p {
    margin: 0;
    color: var(--subtle-text);
    font-size: 0.8rem;
}

/* --- Views & Content --- */
.view-header {
    margin-bottom: 1.5rem;
}
.view-header h2 {
    font-size: 1.8rem;
    margin: 0 0 0.25rem 0;
    font-weight: 700;
    font-family: var(--font-heading);
}
.view-header p {
    color: var(--subtle-text);
    margin: 0;
    font-size: 1rem;
}

#post-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 600px) {
    #post-options { grid-template-columns: 1fr 1fr; }
}
.post-btn {
    padding: 1.25rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}
.post-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.post-btn:active { transform: scale(0.98) translateY(-1px); }
.post-btn i { font-size: 1.75rem; margin-bottom: 0.75rem; }
.post-btn h3 { margin: 0 0 0.25rem 0; font-size: 1.2rem; font-weight: 600; font-family: var(--font-heading); }
.post-btn p { margin: 0; font-size: 0.85rem; opacity: 0.8; }
.post-btn.video { background: linear-gradient(45deg, #ff3b30, #d42a2a); }
.post-btn.short { background: linear-gradient(45deg, #007aff, #005fcc); }
.post-btn.shoutout { background: linear-gradient(45deg, #af52de, #8e44ad); }
.post-btn.live { background: linear-gradient(45deg, #34c759, #27ae60); }
.post-btn.podcast { background: linear-gradient(45deg, #fd7e14, #e85a19); }
.post-btn.community { background: linear-gradient(45deg, #6c757d, #495057); }

/* --- Bottom Nav --- */
#bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 1rem 1rem;
    z-index: 1000;
    pointer-events: none;
}
.nav-content {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    padding: 0.75rem;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
body.dark .nav-content, body.synthwave .nav-content, body.forest .nav-content, body.amoled .nav-content {
    background-color: rgba(28, 28, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.nav-btn {
    background: none; border: none;
    color: var(--subtle-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-family: var(--font-body);
    cursor: pointer;
    padding: 0.5rem 0.25rem;
    border-radius: 16px;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
}
body.dark .nav-btn, body.synthwave .nav-btn, body.forest .nav-btn, body.amoled .nav-btn {
    color: var(--subtle-text);
}
.nav-btn i { font-size: 1.25rem; margin-bottom: 2px; }
.nav-btn.active {
    background-color: var(--accent-blue);
    color: #fff;
}
.nav-btn:not(.active):hover {
    color: var(--text-color);
}
body.dark .nav-btn:not(.active):hover, body.synthwave .nav-btn:not(.active):hover, body.forest .nav-btn:not(.active):hover, body.amoled .nav-btn:not(.active):hover {
    color: var(--text-color);
}


/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
    padding: 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.modal-content {
    background-color: var(--secondary-bg);
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 550px;
    text-align: center;
    position: relative;
    animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}
@keyframes slide-up {
    from { transform: translateY(30px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-content h2 {
    margin-top: 0; margin-bottom: 1.5rem; font-size: 1.5rem;
    font-weight: 600; font-family: var(--font-heading);
}
.modal-content .close-btn {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none; border: none; font-size: 1.5rem; cursor: pointer;
    color: var(--subtle-text);
    background-color: var(--primary-bg);
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; line-height: 1;
    transition: background-color 0.2s;
}
.modal-content .close-btn:hover { background-color: var(--border-color); }
body.dark .modal-content .close-btn, body.synthwave .modal-content .close-btn, body.forest .modal-content .close-btn, body.amoled .modal-content .close-btn {
    color: var(--subtle-text);
    background-color: var(--primary-bg);
}
body.dark .modal-content .close-btn:hover, body.synthwave .modal-content .close-btn:hover, body.forest .modal-content .close-btn:hover, body.amoled .modal-content .close-btn:hover {
    background-color: var(--border-color);
}


/* --- Forms & Buttons --- */
textarea, input[type="text"], select {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    font-size: 1rem;
    box-sizing: border-box;
    background-color: var(--primary-bg);
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; height: 120px; }
textarea:focus, input[type="text"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}
select {
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2365676b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}
body.dark select, body.synthwave select, body.forest select, body.amoled select {
     background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}
.form-group { text-align: left; margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--subtle-text); font-size: 0.9rem; }
.primary-btn {
    width: 100%; padding: 1rem; font-size: 1.1rem; font-weight: 600; border: none;
    border-radius: 16px; cursor: pointer; background-color: var(--accent-blue);
    color: white; transition: background-color 0.2s, transform 0.1s;
}
.primary-btn:hover { background-color: #006ae6; }
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { background-color: var(--border-color); color: var(--subtle-text); cursor: not-allowed; }
.end-stream-btn { background-color: var(--accent-red); margin-top: 1rem; }
.end-stream-btn:hover { background-color: #d13027; }

/* --- Loading & Results Modals --- */
.loader-container { position: relative; width: 76px; height: 76px; margin: 20px auto; }
#loading-progress { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 1rem; font-weight: 700; color: var(--subtle-text); }
.loader { border: 8px solid var(--border-color); border-top: 8px solid var(--accent-blue); border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; margin: 0; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.video-player-mockup {
    position: relative; background: #000; color: #fff; border-radius: 16px; margin-bottom: 1.5rem;
    cursor: pointer; border: 1px solid var(--border-color); overflow: hidden; aspect-ratio: 16 / 9;
    display: flex; align-items: center; justify-content: center;
}
.video-player-mockup img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.video-player-overlay { position: relative; z-index: 2; background-color: rgba(0,0,0,0.5); width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; box-sizing: border-box; }
.video-player-icon { font-size: 2.5rem; margin-bottom: 0.5rem; color: rgba(255, 255, 255, 0.8); transition: transform 0.2s, color 0.2s; }
.video-player-mockup:hover .video-player-icon { color: #fff; transform: scale(1.1); }
.video-stats { display: flex; justify-content: center; gap: 1.5rem; font-size: 1.1rem; margin-bottom: 1.5rem; background: var(--primary-bg); padding: 1rem; border-radius: 16px; border: 1px solid var(--border-color); flex-wrap: wrap; }
.video-stats span { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.new-subs { margin-bottom: 1.5rem; font-size: 1.2rem; font-weight: 500; }
.new-subs h3.gained { color: var(--accent-green); }
.new-subs h3.lost { color: var(--accent-red); }
#earnings-container { margin-bottom: 1.5rem; padding: 0.75rem; background-color: rgba(52, 199, 89, 0.15); border: 1px solid rgba(52, 199, 89, 0.3); border-radius: 12px; }
#earnings-text { color: #34c759; font-weight: 600; font-size: 1.1rem; margin: 0; font-family: var(--font-heading); }

/* Comments */
#result-comments h3, #past-video-details-comments-container h3 { margin: 0 0 0.75rem 0; font-weight: 600; font-family: var(--font-heading); text-align: left;}
#comments-list, #past-video-details-comments-list { max-height: 150px; overflow-y: auto; text-align: left; background: var(--primary-bg); padding: 0.5rem; border-radius: 12px; margin-bottom: 1.5rem; border: 1px solid var(--border-color); flex-shrink: 1; }
.comment, .pinned-comment { padding: 0.75rem; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 4px; }
.comment:last-child { border-bottom: none; }
.comment p { margin: 0; font-size: 0.95rem; color: var(--text-color); line-height: 1.5; }
.user-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment .user { font-weight: 600; margin-bottom: 0; font-size: 0.9rem; }
.comment-user-badge { font-size: 0.65rem; font-weight: 600; padding: 3px 8px; border-radius: 12px; line-height: 1; text-transform: uppercase; }
.comment-user-badge.new { background-color: var(--accent-blue); color: white; }
.comment-user-badge.recurring { background-color: var(--primary-bg); color: var(--subtle-text); border: 1px solid var(--border-color); }
.comment-body { display: flex; justify-content: space-between; align-items: flex-start; }
.comment-actions { display: flex; gap: 12px; flex-shrink: 0; margin-left: 10px; }
.comment-actions button { background: none; border: none; cursor: pointer; color: var(--subtle-text); font-size: 1rem; padding: 0; transition: color 0.2s; }
.comment-actions button:hover { color: var(--text-color); }
.comment-actions button.hearted i { color: var(--accent-red); }
#pinned-comment-container { margin-bottom: 1rem; text-align: left; }
.pinned-comment { background-color: rgba(0, 122, 255, 0.08); border: 1px solid rgba(0, 122, 255, 0.2); border-radius: 12px; }
.pinned-label { font-size: 0.8rem; font-weight: 600; color: var(--subtle-text); display: flex; align-items: center; gap: 5px; }

/* --- Analytics View --- */
#past-videos-list { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
#past-videos-list > p { color: var(--subtle-text); }
.past-video-item { background-color: var(--secondary-bg); border-radius: 16px; padding: 1rem; border: 1px solid var(--border-color); cursor: pointer; transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s; }
.past-video-item:hover { transform: translateY(-2px); background-color: var(--primary-bg); box-shadow: 0 4px 10px var(--shadow-color-hover); }
.past-video-content { display: flex; align-items: center; gap: 1rem; }
.past-video-thumbnail { width: 88px; height: 50px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background-color: var(--primary-bg); }
.past-video-info { flex-grow: 1; min-width: 0; }
.past-video-info h4 { margin: 0 0 0.5rem 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-family: var(--font-heading); }
.past-video-stats { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--subtle-text); flex-wrap: wrap; }
.past-video-stats span { display: flex; align-items: center; gap: 5px; }
.past-video-subs.gained { color: var(--accent-green); font-weight: 600; }
.past-video-subs.lost { color: var(--accent-red); font-weight: 600; }
.saga-tag { display: inline-block; background-color: rgba(0, 122, 255, 0.15); color: var(--accent-blue); padding: 3px 8px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; margin-right: 6px; vertical-align: middle; }

/* --- Channel View --- */
.settings-card { background-color: var(--secondary-bg); border-radius: 16px; padding: 1.5rem; border: 1px solid var(--border-color); }
.profile-picture-group { text-align: center; }
.profile-picture-container { position: relative; width: 120px; height: 120px; margin: 0.5rem auto 1rem auto; }
#channel-profile-picture { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--border-color); background-color: var(--primary-bg); }
.profile-picture-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }
.action-btn { background-color: var(--secondary-bg); border: 1px solid var(--border-color); color: var(--text-color); padding: 0.75rem 1.25rem; border-radius: 12px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; display: flex; align-items: center; gap: 8px; }
.action-btn:hover { background-color: var(--primary-bg); }
.action-btn i { color: var(--subtle-text); }
#profile-picture-prompt-input { height: 100px; }

/* --- AI Assistance View --- */
#ai-chat-container { display: flex; flex-direction: column; height: 65vh; max-height: 500px; background-color: var(--secondary-bg); border-radius: 16px; border: 1px solid var(--border-color); overflow: hidden; }
#ai-chat-messages { flex-grow: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.ai-chat-message { display: flex; gap: 10px; max-width: 85%; }
.ai-chat-user { align-self: flex-end; flex-direction: row-reverse; }
.ai-chat-avatar { width: 36px; height: 36px; border-radius: 50%; background-color: var(--primary-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--subtle-text); }
.ai-chat-user .ai-chat-avatar { background-color: var(--accent-blue); color: white; border: none; }
.ai-chat-bubble { padding: 0.75rem 1rem; border-radius: 18px; line-height: 1.5; font-size: 0.95rem; }
.ai-chat-assistant .ai-chat-bubble { background-color: var(--primary-bg); border-top-left-radius: 4px; }
.ai-chat-user .ai-chat-bubble { background-color: var(--accent-blue); color: white; border-top-right-radius: 4px; }
#ai-chat-input-area { display: flex; padding: 0.75rem; border-top: 1px solid var(--border-color); gap: 0.5rem; }
#ai-chat-input { flex-grow: 1; border: none; background: var(--primary-bg); padding: 0.75rem 1rem; border-radius: 18px; font-size: 0.9rem; color: var(--text-color); }
#ai-chat-send-btn { background: var(--accent-blue); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; flex-shrink: 0; cursor: pointer; transition: background-color 0.2s; }
#ai-chat-send-btn:hover { background-color: #006ae6; }
.typing-dots { display: flex; gap: 4px; align-items: center; height: 100%; padding: 4px 0; }
.typing-dots span { width: 8px; height: 8px; border-radius: 50%; background-color: var(--subtle-text); animation: typing-bounce 1.2s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: -1.0s; }
.typing-dots span:nth-child(3) { animation-delay: -0.8s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* --- Upgrades View --- */
#upgrades-list { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 600px) { #upgrades-list { grid-template-columns: 1fr 1fr; } }
.upgrade-card { background-color: var(--secondary-bg); border-radius: 16px; padding: 1.25rem; border: 1px solid var(--border-color); display: flex; flex-direction: column; text-align: left; gap: 0.5rem; }
.upgrade-header { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; }
.upgrade-header i { color: var(--accent-blue); font-size: 1.5rem; }
.upgrade-card h3 { margin: 0; font-size: 1.1rem; font-weight: 600; font-family: var(--font-heading); }
.upgrade-card p { margin: 0 0 0.75rem 0; color: var(--subtle-text); flex-grow: 1; font-size: 0.9rem; }
.upgrade-info { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.upgrade-cost { font-size: 1.1rem; font-weight: 700; color: var(--accent-green); }
.upgrade-owned { font-size: 0.9rem; font-weight: 700; color: var(--accent-blue); }
.upgrade-card .primary-btn { padding: 0.75rem 1rem; font-size: 0.9rem; width: auto; min-width: 120px; }

/* --- Leaderboard Modal --- */
.leaderboard-tabs { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 1.5rem; background-color: var(--primary-bg); padding: 0.5rem; border-radius: 12px; }
.leaderboard-tab-btn { background: transparent; border: none; padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; font-weight: 600; color: var(--subtle-text); cursor: pointer; transition: all 0.2s; }
.leaderboard-tab-btn.active { background-color: var(--accent-blue); color: #fff; }
#leaderboard-list { max-height: 55vh; overflow-y: auto; padding-right: 8px; }
.leaderboard-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border-radius: 12px; background-color: var(--primary-bg); margin-bottom: 0.5rem; border: 1px solid var(--border-color); }
.leaderboard-item.current-user { background-color: rgba(0, 122, 255, 0.1); border-color: rgba(0, 122, 255, 0.3); }
.leaderboard-rank { font-size: 1.2rem; font-weight: 700; color: var(--subtle-text); width: 30px; text-align: center; }
.leaderboard-rank .fa-trophy { font-size: 1.5rem; }
.leaderboard-rank .rank-1 { color: #FFD700; } .leaderboard-rank .rank-2 { color: #C0C0C0; } .leaderboard-rank .rank-3 { color: #CD7F32; }
.leaderboard-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background-color: var(--primary-bg); }
.leaderboard-info { flex-grow: 1; min-width: 0; }
.leaderboard-info p { margin: 0; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leaderboard-channel { font-weight: 600; font-size: 1rem; }
.leaderboard-user { font-size: 0.85rem; color: var(--subtle-text); }
.leaderboard-stat { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; background-color: var(--secondary-bg); padding: 0.5rem 1rem; border-radius: 12px; }

/* --- Live Stream Modal --- */
.live-modal-content { max-width: 90vw; width: 100%; max-width: 1000px; padding: 1.5rem; }
.live-stream-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px) { .live-stream-layout { grid-template-columns: 2fr 1fr; } }
.live-stream-info { display: flex; flex-direction: column; }
#live-stream-header { font-size: 1rem; font-weight: 700; color: var(--accent-red); margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.live-indicator { animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
#live-thumbnail { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; margin-bottom: 1rem; border: 1px solid var(--border-color); }
#live-title { margin: 0 0 1rem 0; font-size: 1.4rem; text-align: left; font-weight: 600; font-family: var(--font-heading); }
#live-stats-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.live-stat { background: var(--primary-bg); padding: 0.75rem; border-radius: 12px; font-size: 0.9rem; font-weight: 500; border: 1px solid var(--border-color); }
.live-stat i { color: var(--subtle-text); margin-right: 5px; }
.live-chat-container { display: flex; flex-direction: column; background: var(--primary-bg); border-radius: 16px; min-height: 400px; max-height: 70vh; border: 1px solid var(--border-color); }
.live-chat-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); text-align: left; }
.live-chat-header h3 { margin: 0; font-size: 1rem; font-family: var(--font-heading); }
#live-chat-messages { flex-grow: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.chat-message { text-align: left; max-width: 90%; }
.chat-message .chat-user { font-size: 0.8rem; font-weight: 600; color: var(--subtle-text); margin-bottom: 0.25rem; display: block; }
.chat-message .chat-text { background: var(--secondary-bg); padding: 0.5rem 0.85rem; border-radius: 16px; margin: 0; font-size: 0.9rem; word-wrap: break-word; line-height: 1.4; border: 1px solid var(--border-color); }
.chat-message.creator { align-self: flex-end; }
.chat-message.creator .chat-text { background-color: var(--accent-blue); color: white; border-color: transparent; }
.chat-message.creator .chat-user { color: var(--accent-blue); }
.live-chat-input-area { display: flex; padding: 0.75rem; border-top: 1px solid var(--border-color); gap: 0.5rem; background-color: var(--primary-bg); }
#live-chat-reply-input { flex-grow: 1; border: 1px solid var(--border-color); background: var(--secondary-bg); padding: 0.75rem 1rem; border-radius: 18px; font-size: 0.9rem; color: var(--text-color); }
#live-chat-send-btn { background: var(--accent-blue); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; flex-shrink: 0; cursor: pointer; }

/* Confetti */
#confetti-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 9999; }