/* Basic Reset & Font */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Typing Indicator Animation */
.typing-indicator {
    display: inline-block;
    color: var(--text-secondary);
    animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Disable all transitions during page load */
.no-transitions * {
    transition: none !important;
    animation: none !important;
}

/* Color scheme variables */
:root {
    --bg-color: #1C1C1E;
    --container-bg: transparent;
    --header-border: #272727;
    --chatbox-bg: transparent;
    --text-color: rgba(255, 255, 255, 0.8);
    --text-secondary: rgba(255, 255, 255, 0.5);
    --accent-color: #8E67FF;
    --accent-color-light: #af94ff;
    --accent-base: linear-gradient(135deg, #8E67FF 0%, #7F5CE0 50%, #6B4BC7 100%);
    --accent-hover: linear-gradient(135deg, #9F77FF 0%, #8E67FF 50%, #7F5CE0 100%);
    --assistant-msg-bg: transparent;
    --assistant-msg-border: transparent;
    --user-msg-bg: rgba(255, 255, 255, 0.08);
    --user-msg-border: transparent;
    --input-bg: rgba(10, 10, 10, 0.6);
    --input-border: #444444;
    --input-focus-bg: rgba(20, 20, 20, 0.8);
    --input-focus-border: rgba(127, 92, 224, 0.8);
    --button-bg: linear-gradient(135deg, #7F5CE0, #6237D9);
    --button-active-bg: linear-gradient(135deg, #8F6CF0, #7247E9);
    --button-disabled-bg: linear-gradient(135deg, rgba(127, 92, 224, 0.4), rgba(98, 55, 217, 0.4));
    --thinking-indicator-bg: #272727;
    --status-bg: #222;
    --code-bg: #333;
    --scrollbar-track: #272727;
    --scrollbar-thumb: #444444;
    --scrollbar-thumb-hover: #555555;
    --video-embed-bg: #1e1e1e;
    --video-title-bg: #272727;
    --blockquote-color: #aaa;
    --table-border: #444;
    --shadow-color: rgba(0,0,0,0.3);
}

.light-mode {
    --bg-color: #f5f5f7;
    --container-bg: transparent;
    --header-border: #e1e1e1;
    --chatbox-bg: transparent;
    --text-color: rgba(0, 0, 0, 0.85);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --accent-color: #6237D9;
    --accent-color-light: #7F5CE0;
    --accent-base: linear-gradient(135deg, #6237D9 0%, #5A2BC7 50%, #4A1FA3 100%);
    --accent-hover: linear-gradient(135deg, #7F5CE0 0%, #6237D9 50%, #5A2BC7 100%);
    --assistant-msg-bg: transparent;
    --assistant-msg-border: transparent;
    --user-msg-bg: rgba(0, 0, 0, 0.08);
    --user-msg-border: transparent;
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: #d1d1d1;
    --input-focus-bg: #ffffff;
    --input-focus-border: rgba(98, 55, 217, 0.4);
    --button-bg: linear-gradient(135deg, #7F5CE0, #6237D9);
    --button-active-bg: linear-gradient(135deg, #8F6CF0, #7247E9);
    --button-disabled-bg: linear-gradient(135deg, rgba(127, 92, 224, 0.4), rgba(98, 55, 217, 0.4));
    --thinking-indicator-bg: #f0f0f0;
    --status-bg: #ffffff;
    --code-bg: #f0f0f0;
    --scrollbar-track: #e0e0e0;
    --scrollbar-thumb: #bbbbbb;
    --scrollbar-thumb-hover: #999999;
    --video-embed-bg: #f5f5f5;
    --video-title-bg: #e9e9e9;
    --blockquote-color: #777;
    --table-border: #e0e0e0;
    --shadow-color: rgba(0,0,0,0.1);
}

.embed-mode.light-mode {
    --bg-color: #ffffff;
    --container-bg: #ffffff;
    --chatbox-bg: #ffffff;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
    margin: 0;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    padding: 20px 0;
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    font-size: 15px;
}

body.non-embedded {
    background-color: var(--bg-color);
}

.container {
    width: 100%;
    max-width: 900px;
    background: var(--container-bg);
    padding: 0;
    border-radius: 24px;
    box-shadow: 0 10px 40px var(--shadow-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    overflow: hidden;
    position: relative;
    margin: 0 auto;
    transition: all 0.2s ease;
}

.show-header .container {
    max-width: 1200px;
    width: 100%;
}

body.keyboard-active {
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.keyboard-active .container {
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Header */
.chat-header {
    padding: 14px 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--header-border);
    position: relative;
}

.show-header .chat-header {
    display: flex;
}

.keyboard-active .chat-header {
    padding: 8px 16px;
}

.chat-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    width: 100%;
    z-index: 1;
}

.back-button {
    position: relative;
    color: var(--accent-color);
    font-size: 1.8rem;
    text-decoration: none;
    line-height: 1;
    z-index: 2;
}

.reset-button {
    position: relative;
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background-color 0.2s;
}

.reset-button:hover {
    background-color: rgba(142, 103, 255, 0.1);
}

.reset-button svg {
    width: 20px;
    height: 20px;
}

/* Chatbox */
.chatbox {
    flex-grow: 1;
    overflow-y: auto;
    background: var(--chatbox-bg);
    padding: 75px 20px 140px 20px;
}

.chatbox::-webkit-scrollbar { width: 5px; }
.chatbox::-webkit-scrollbar-track { background: var(--scrollbar-track); border-radius: 12px; }
.chatbox::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 12px; }
.chatbox::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* Messages */
.message {
    margin-bottom: 0;
    padding: 0;
    border-radius: 32px;
    line-height: 1.4;
    max-width: 600px;
    word-wrap: break-word;
    position: relative;
    font-size: 14px;
    box-sizing: border-box;
    box-shadow: none;
    border: none;
}

.message-content {
    display: block;
    width: 100%;
    overflow-wrap: break-word;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
}

.message-content p {
    margin: 0 0 10px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Menu icons */
.menu-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    padding: 4px;
    margin: 0 3px;
    vertical-align: middle;
    background-color: rgba(0, 0, 0, 1.0);
    border-radius: 8px;
    opacity: 0;
    animation: iconFadeIn 0.25s ease-out forwards;
}

@keyframes iconFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.menu-icon:hover {
    background-color: rgba(0, 0, 0, 1.0);
    opacity: 0.85;
}

.user-message {
    background-color: var(--user-msg-bg);
    color: white;
    margin-left: auto;
    margin-right: 0;
    padding: 16px 20px;
    border-radius: 32px;
}

.assistant-message {
    background-color: transparent;
    color: var(--text-color);
    margin-right: auto;
    margin-left: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    opacity: 0.85;
}

.message-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 32px;
    padding: 0;
}

.message-container:first-child {
    margin-top: 0;
}

.message-container:last-child {
    margin-bottom: 0;
}

.user-container {
    align-items: flex-end;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
}

.consecutive-message {
    margin-top: 4px;
}

/* Input Area */
.form-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 15px) + 15px);
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.95) 100%);
    z-index: 1000;
    width: 100%;
}

.light-mode .form-container {
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(245,245,247,0.95) 100%);
}

.keyboard-active .form-container {
    position: sticky;
    bottom: 0;
    padding-bottom: 10px;
    width: 100%;
}

.ios-device .form-container {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 15px);
}

.keyboard-active.ios-device .form-container {
    position: sticky;
    bottom: 0;
    padding-bottom: 10px;
}

.keyboard-active .chatbox {
    padding-bottom: 100px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.form-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

#chat-form {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

textarea {
    flex: 1;
    padding: 12px 50px 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    resize: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.3;
    color: var(--text-color);
    outline: none;
    transition: all 0.2s ease;
    min-height: 44px;
    max-height: 120px;
    box-sizing: border-box;
    width: 100%;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

textarea:focus {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

textarea::placeholder {
    color: var(--text-secondary);
}

.light-mode textarea {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.light-mode textarea:focus {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

button[type="submit"] {
    background: var(--button-bg);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s, transform 0.2s, background 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button[type="submit"].active {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
    background: var(--button-active-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button[type="submit"]:disabled {
    background: var(--button-disabled-bg);
    cursor: not-allowed;
    opacity: 0.6;
    transform: translateY(-50%);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.arrow-up {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    width: 24px;
}

.arrow-up svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Thinking indicator */
.thinking-indicator {
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    margin-right: auto;
    margin-left: 0;
    margin-bottom: 24px;
    box-shadow: none;
    max-width: 100%;
}

.thinking-message {
    color: var(--text-color);
    font-size: 14px;
    opacity: 0.85;
}

.gradient-text {
    display: inline-block;
    position: relative;
    font-weight: 500;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.8) 20%, 
        rgba(142, 103, 255, 0.5) 40%,
        rgba(142, 103, 255, 0.5) 60%, 
        rgba(255, 255, 255, 0.8) 80%
    );
    background-size: 200% auto;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientMove 2s ease infinite;
}

.light-mode .gradient-text {
    background: linear-gradient(
        to right,
        #6237D9 20%, 
        #A98AFF 40%,
        #A98AFF 60%, 
        #6237D9 80%
    );
    background-size: 200% auto;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    text-shadow: 0 0 1px rgba(98, 55, 217, 0.05);
}

@keyframes gradientMove {
    0% { background-position: 0% center; }
    100% { background-position: -200% center; }
}

/* Status notification */
.status-notification {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--status-bg);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s ease-out;
    pointer-events: none;
    font-size: 0.8rem;
    max-width: 80%;
    text-align: center;
    border: 1px solid var(--input-border);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.status-notification.visible {
    opacity: 1;
    animation: toast-popup 0.3s ease-out;
}

@keyframes toast-popup {
    0% {
        transform: translateX(-50%) translateY(10px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes suggestions-fade-in {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Markdown content */
.markdown-content {
    line-height: 1.4;
    font-size: 14px;
}

.markdown-content > *:first-child {
    margin-top: 0 !important;
}

.markdown-content > *:last-child {
    margin-bottom: 0 !important;
}

.markdown-content p {
    margin: 0 0 12px 0;
    color: var(--text-color);
}

.markdown-content strong {
    font-weight: 600;
    color: var(--text-color);
    opacity: 1.0;
}

.markdown-content em {
    font-style: italic;
    color: var(--text-color);
}

.markdown-content ul,
.markdown-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.markdown-content li {
    line-height: 1.4;
    margin-bottom: 4px;
}

.markdown-content li:last-child {
    margin-bottom: 0;
}

.markdown-content li > ul,
.markdown-content li > ol {
    margin-top: 8px;
    margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    margin: 32px 0 12px 0;
    font-weight: 700;
    color: var(--text-color);
    opacity: 1.0;
    line-height: 1.3;
}

.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child,
.markdown-content h4:first-child {
    margin-top: 0;
}

.markdown-content h1 { font-size: 20px; }
.markdown-content h2 { font-size: 18px; }
.markdown-content h3 { font-size: 16px; }
.markdown-content h4 { font-size: 15px; font-weight: 600; }

.markdown-content code {
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-color);
}

.markdown-content pre {
    background-color: var(--code-bg);
    padding: 12px 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    line-height: 1.5;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.markdown-content a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.markdown-content a:hover {
    color: var(--accent-color-light);
    text-decoration: underline;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent-color);
    background: transparent;
    padding: 8px 0 8px 16px;
    margin: 16px 0;
    border-radius: 0;
    color: var(--text-color);
    font-style: normal;
    position: relative;
    opacity: 0.9;
}

.markdown-content blockquote p {
    margin: 0;
}

.markdown-content blockquote strong {
    color: var(--text-color);
    font-weight: 600;
}

.markdown-content blockquote em {
    color: var(--text-color);
    font-style: italic;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 14px;
}

.markdown-content th {
    background-color: var(--code-bg);
    border: 1px solid var(--table-border);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
}

.markdown-content td {
    border: 1px solid var(--table-border);
    padding: 10px 12px;
    text-align: left;
}

.markdown-content tr:hover {
    background-color: rgba(var(--code-bg), 0.3);
}

.markdown-content img:not(.menu-icon) {
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: 8px;
}

/* Video carousel */
.videos-carousel-wrapper {
    position: relative;
    margin: 20px -20px 4px -20px;
    overflow: visible;
    width: calc(100% + 40px);
}

.videos-carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 12px 20px 0 20px;
}

.videos-carousel::-webkit-scrollbar {
    display: none;
}

.video-embed-container {
    flex: 0 0 auto;
    width: 264px;
    height: 148px;
    display: block;
}

.message-container {
    font-size: inherit;
}

.message-content {
    line-height: 1.6;
}

.video-embed {
    position: relative;
    width: 264px;
    height: 148px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 25px;
    background-color: #000;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-embed.aspect-square,
.video-embed.aspect-vertical,
.video-embed.aspect-horizontal {
    width: 264px;
    height: 148px;
}

.video-title {
    font-size: 12px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    padding: 12px 0 0 0 !important;
    margin: 0 !important;
    min-height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: left;
    word-wrap: break-word;
    word-break: break-word;
}

.light-mode .video-title {
    color: rgba(0, 0, 0, 0.9);
}

.video-embed lite-youtube {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 25px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.video-embed lite-youtube .lty-title,
.video-embed lite-youtube [class*="title"] {
    display: none;
}

.video-embed lite-youtube *,
.video-embed lite-youtube::before,
.video-embed lite-youtube .lty-playbtn,
.video-embed lite-youtube .lty-thumbnail {
    border-radius: 24px;
}

.video-embed-container.aspect-square lite-youtube {
    aspect-ratio: 1/1;
}

.lite-youtube-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: none;
    border-radius: 24px;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lite-youtube-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 30%,
        rgba(0, 0, 0, 0) 100%
    );
    color: white;
    padding: 24px 24px 24px 12px;
    font-size: 1.1rem;
    font-weight: bold;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    border-radius: 0 0 24px 24px;
    z-index: 10;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.video-embed lite-youtube.lyt-activated .lite-youtube-title-overlay,
.video-embed lite-youtube[data-activated] .lite-youtube-title-overlay {
    opacity: 0;
    visibility: hidden;
}

lite-youtube:hover .lite-youtube-title-overlay {
    opacity: 1;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

.video-embed .lite-youtube-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    pointer-events: none;
}

@media (max-width: 768px) {
    .lite-youtube-title-overlay {
        font-size: 1rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Rating UI */
.rating-outer-container {
    display: flex;
    justify-content: flex-start;
    margin: 8px 0;
    padding: 0;
    width: 100%;
}

.rating-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-radius: 24px;
    background-color: rgba(0, 0, 0, 0.03);
    width: 250px;
    transition: all 0.3s ease;
}

.light-mode .rating-container {
    background-color: rgba(0, 0, 0, 0.03);
}

.rating-prompt {
    font-size: 12px;
    margin-bottom: 0;
    color: #888;
}

.rating-buttons {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.rating-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #fff;
    opacity: 0.3;
    box-shadow: none;
}

.light-mode .rating-button {
    background: transparent;
    color: #000;
    opacity: 0.3;
}

.rating-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

.light-mode .rating-button:hover {
    opacity: 0.7;
}

.rating-button.highlighted {
    opacity: 1;
}

.light-mode .rating-button.highlighted {
    opacity: 0.7;
}

.rating-button.selected {
    opacity: 1;
}

.light-mode .rating-button.selected {
    opacity: 0.7;
}

.rating-button.disabled {
    opacity: 0.5;
    cursor: default;
}

.rating-button.disabled:hover {
    color: #fff;
    transform: none;
}

.light-mode .rating-button.disabled:hover {
    color: #fff;
    transform: none;
}

/* Prevent hover effects after submission */
.rating-button.rating-submitted {
    pointer-events: none;
}

.rating-button.rating-submitted:hover {
    transform: none;
}

.rating-thank-you {
    text-align: center;
    padding: 8px;
    color: #666;
    font-size: 14px;
}

.rating-confirmation {
    text-align: center;
    padding: 12px 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    border-radius: 24px;
    background-color: rgba(100, 100, 100, 0.1);
    border: 1px solid rgba(100, 100, 100, 0.2);
}

/* Mobile responsive */
@media (max-width: 800px) {
    .container {
        padding: 0;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
    
    body {
        padding: 0;
        height: 100vh;
        width: 100vw;
        display: block;
    }
    
    .message {
        max-width: 100%;
    }
    .user-message {
        max-width: 80%;
    }
    
    .form-container {
        width: 100%;
        padding: 10px 0;
        padding-bottom: calc(env(safe-area-inset-bottom, 15px) + 10px);
    }
    
    .form-content-wrapper {
        padding: 0 15px;
    }
    
    .chatbox {
        padding: 65px 15px 120px 15px;
    }
    
    .show-header .chatbox {
        padding-top: 15px;
    }
    
    .embed-mode .chatbox {
        padding-top: 65px;
    }
    
    .status-notification {
        bottom: calc(env(safe-area-inset-bottom, 20px) + 120px);
    }
    
    .videos-carousel-wrapper {
        margin: 20px -15px 4px -15px;
        width: calc(100% + 30px);
    }
    
    .videos-carousel {
        gap: 14px;
        padding: 0 15px;
    }
    
    .video-embed-container {
        width: 264px;
        height: 200px;
    }
    
    .video-embed {
        width: 264px;
        height: 148px;
    }
    
    .keyboard-active.ios-device .container {
        height: 100%;
        position: fixed;
    }
}

/* Embed mode */
.embed-mode .chat-header {
    display: none;
}

.embed-mode .container {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    transition: none;
}

.embed-mode body, 
.embed-mode html {
    padding: 0;
    margin: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.show-header .chatbox {
    padding-top: 20px;
}

.embed-mode .chatbox {
    padding-top: 75px;
    overflow-y: auto;
}

.embed-mode .message-container:first-child {
    margin-top: 10px;
}

/* Load more button */
.load-more-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 0;
    width: 100%;
}

.load-more-button {
    background: rgba(142, 103, 255, 0.15);
    border: 1px solid rgba(142, 103, 255, 0.3);
    color: var(--accent-color);
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.light-mode .load-more-button {
    background: rgba(142, 103, 255, 0.05);
    border: 1px solid rgba(142, 103, 255, 0.2);
}

.header-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.theme-toggle {
    position: relative;
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: rgba(142, 103, 255, 0.1);
}

.light-icon, .dark-icon {
    transition: opacity 0.3s, transform 0.3s;
    position: absolute;
}

.light-icon {
    opacity: 0;
    transform: rotate(-30deg) scale(0.7);
}

.dark-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.light-mode .light-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.light-mode .dark-icon {
    opacity: 0;
    transform: rotate(30deg) scale(0.7);
}

.load-more-button:hover {
    background: rgba(142, 103, 255, 0.25);
}

/* Suggestions */
.suggestions-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 4px 0 0 0;
    margin-top: auto;
    margin-bottom: 0;
    box-sizing: border-box;
    background: transparent;
    opacity: 0;
    animation: suggestions-fade-in 0.4s ease-out forwards;
}

.suggestions-container * {
    pointer-events: auto;
}

.suggestions-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.suggestions-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0px;
    padding-left: 0;
    letter-spacing: -0.08px;
    opacity: 1;
}

.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.suggestion-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11.5px 14px;
    background: rgba(53, 53, 53, 0.6);
    border: none;
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.26px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.suggestion-button:hover {
    background: rgba(210, 210, 210, 1.0);
    color: rgba(0, 0, 0, 0.85);
}

.suggestion-button:active {
    transform: scale(0.98);
    opacity: 0.8;
}

.light-mode .suggestion-button {
    background: rgba(53, 53, 53, 0.6);
    color: rgba(0, 0, 0, 0.75);
}

.light-mode .suggestion-button:hover {
    background: rgba(210, 210, 210, 1.0);
    color: rgba(0, 0, 0, 0.85);
}

.suggestion-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.suggestion-icon.external {
    opacity: 0.7;
}

.suggestion-icon.topic {
    opacity: 0.8;
}

.suggestion-icon.topic svg path,
.suggestion-icon.external svg path {
    fill: currentColor;
}

.recent-videos-section {
    margin-bottom: 20px;
}

.suggestions-container > .recent-videos-section:first-child {
    margin-top: 0;
}

.recent-videos-carousel-container {
    position: relative;
    margin-top: 12px;
}

.recent-videos-carousel {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0 0 12px 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.recent-videos-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.recent-video-card {
    flex: 0 0 auto;
    width: 264px;
    height: 196px;
    background: none;
    border: none;
    padding: 0;
    border-radius: 25px;
    overflow: visible;
    transition: all 0.3s ease;
    position: relative;
}

.recent-video-card:hover {
    transform: translateY(-2px) scale(1.02);
}

.youtube-embed-container {
    position: relative;
    width: 264px !important;
    height: 148px !important;
    border-radius: 25px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.youtube-embed-container.aspect-square {
    width: 264px !important;
    height: 148px !important;
}

.youtube-embed-container.aspect-vertical {
    width: 264px !important;
    height: 148px !important;
}

.youtube-embed-container.aspect-horizontal {
    width: 264px !important;
    height: 148px !important;
}

.youtube-embed-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 24px;
}

.youtube-embed-container iframe::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}


.light-mode .youtube-embed-container {
    background: rgba(0, 0, 0, 0.05);
}

.video-thumbnail-container {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
}

.video-thumbnail-mobile {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.video-thumbnail-mobile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-overlay-mobile {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.recent-video-card:hover .play-overlay-mobile {
    opacity: 1;
}

.play-button-mobile {
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.play-button-mobile svg {
    width: 12px;
    height: 12px;
    margin-left: 1px;
}

@media (max-width: 768px) {
    .recent-video-card {
        width: calc(50% - 6px);
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .recent-video-card {
        width: calc(50% - 6px);
        min-width: 120px;
    }
}

/* Recent Videos Page */
.recent-videos-page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--chatbox-bg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--container-bg);
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-color);
    cursor: pointer;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
}

.back-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.05) 50%, 
        rgba(255, 255, 255, 0.02) 100%);
    border-radius: 50%;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.back-button::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 40%;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    border-radius: 50% 50% 80% 80%;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 3px 10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.back-button:hover::before {
    opacity: 1;
}

.back-button:hover::after {
    opacity: 0.8;
}

.back-button:active {
    transform: translateY(0) scale(0.98);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.back-button svg {
    width: 18px;
    height: 18px;
    z-index: 1;
    position: relative;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.light-mode .back-button {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-color);
}

.light-mode .back-button::before {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        rgba(255, 255, 255, 0.2) 100%);
}

.light-mode .back-button::after {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.9) 0%, 
        rgba(255, 255, 255, 0.3) 100%);
}

.light-mode .back-button:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.08),
        0 3px 10px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.light-mode .back-button:active {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

@supports (-webkit-backdrop-filter: blur(1px)) {
    .back-button {
        filter: url(#liquid-glass-back-button);
    }
    
    .back-button:hover {
        filter: url(#liquid-glass-back-button) brightness(1.05);
    }
    
    .back-button:active {
        filter: url(#liquid-glass-back-button) brightness(0.95);
    }
}

.page-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    flex: 1;
}

.video-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.video-item-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.3);
}

.video-item-player.aspect-vertical {
    aspect-ratio: 9/16;
    max-height: 400px;
}

.video-item-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-item-info {
    padding: 16px;
}

.video-item-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-item-date {
    font-size: 14px;
    color: var(--text-secondary);
    opacity: 0.7;
}

@media (max-width: 768px) {
    .videos-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .page-header {
        padding: 16px;
    }
    
    .page-header h2 {
        font-size: 20px;
    }
}

@keyframes subtle-glass-glow {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.6;
    }
}

@supports (-webkit-backdrop-filter: blur(1px)) {
    @media (hover: hover) and (pointer: fine) {
        .suggestion-button:hover::before {
            animation: subtle-glass-glow 3s ease-in-out infinite;
        }
        
        .light-mode .suggestion-button:hover::before {
            animation: subtle-glass-glow 3s ease-in-out infinite;
        }
    }
}

@media (max-width: 800px) {
    .suggestions-container {
        padding: 15px 0;
        margin-bottom: 15px;
    }
    
    .suggestions-grid {
        gap: 6px;
    }
    
    .suggestion-button {
        font-size: 0.8rem;
        padding: 7px 10px;
    }
    
    .recent-video-item {
        padding: 8px 10px;
    }
    
    .recent-video-thumbnail {
        width: 36px;
        height: 27px;
    }
}

/* Version Banner */
.version-banner {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

.version-banner-info {
    background: linear-gradient(135deg, rgba(142, 103, 255, 0.1), rgba(142, 103, 255, 0.05));
    border: 1px solid rgba(142, 103, 255, 0.3);
}

.version-banner-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.05));
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.version-banner-error {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.05));
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.version-banner-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
}

.version-banner-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.version-banner-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.4;
}

.version-banner-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.version-banner-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
