@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&display=swap');

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

#glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px; /* Only top 200px */
    pointer-events: none;
    z-index: 10; /* Lift above the black top border (z-index:1) but below header (z-index:20) */
    overflow: hidden;
}

.glow-bubble {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px); /* Slightly less blur for smaller bubbles */
    opacity: 0.45; /* Increased saturation */
    transition: all 1s ease-in-out;
    will-change: transform, background;
}

:root {
    /* These will be controlled by JS for light/dark themes */
    --bg-color: #0d0d0d;
    --text-color: #ffffff;
    --container-bg: #171717;
    --placeholder-color: #999;
    --icon-color: #999;
    --icon-hover-color: #fff;
    --sidebar-bg: #000;
    --sidebar-label-color: #ccc;
    --input-bg: #2d2d2d;
    --input-border: #4a4a4a;
    --dropdown-bg: #171717;
    --dropdown-hover-bg: #333;
    --message-agent-bg: #171717;
    --message-user-bg: #171717;
    --popup-bg: #0d0d0d;
    /* New: top bar color above background image (inverts in light mode) */
    --top-bar-color: #000000;
}

/* New: Light theme variable overrides to invert dark-on-black → light-on-white */
body.light-theme {
    --bg-color: #ffffff;
    --text-color: #000000;
    --container-bg: #f5f5f5;
    --placeholder-color: #666666;
    --icon-color: #666666;
    --icon-hover-color: #000000;
    --sidebar-bg: #ffffff;
    --sidebar-label-color: #333333;
    --input-bg: #eeeeee;
    --input-border: #d0d0d0;
    --dropdown-bg: #f9f9f9;
    --dropdown-hover-bg: #eeeeee;
    --message-agent-bg: #f5f5f5;
    --message-user-bg: #f5f5f5;
    --popup-bg: #ffffff;
    --top-bar-color: #ffffff;
}

/* Invert only the photographic background layers in light mode */
body.light-theme #photos {
    filter: invert(1) hue-rotate(180deg);
}

/* Keep the prism above the (possibly inverted) background, not inverted itself */
#prism {
    z-index: -10; /* already above #photos (-11) */
}

/* Black top overlap/bar becomes variable-based so it flips in light mode */
#photos::before {
    background: var(--top-bar-color);
}

/* Tweak borders/accents for light mode so they don't look too dark/heavy */
body.light-theme .animated-container::after {
    background: var(--container-bg);
}
body.light-theme #sidebar::before,
body.light-theme .info-popup-container::before,
body.light-theme .message-content::before {
    /* keep rainbow border but it will sit on light canvas now */
}

/* Inputs and buttons fine-tuning for light */
body.light-theme .auth-button,
body.light-theme .auth-link-button {
    background-color: #e9e9e9;
    color: var(--text-color);
}
body.light-theme .auth-button:hover,
body.light-theme .auth-link-button:hover {
    background-color: #dddddd;
}

/* Code blocks in light mode */
body.light-theme .bot-message pre {
    background-color: rgba(0,0,0,0.06);
    border: 1px solid #e0e0e0;
}
body.light-theme .bot-message pre code {
    color: #111;
}

/* Glass mode on light: slightly adjust backdrop for contrast */
body.light-theme.glass-enabled #sidebar,
body.light-theme.glass-enabled .message-content,
body.light-theme.glass-enabled #image-preview-container {
    background: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    border-color: rgba(0, 0, 0, 0.08);
}

/* APOD/NASA credit stays UI-colored text (not inverted) over the inverted photo */
#apod-credit-container {
    color: var(--text-color);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
}
body.light-theme #apod-credit-container {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.25);
}

/* Make sure icons adapt in light */
body.light-theme .animated-icon-button {
    color: var(--icon-color);
}
body.light-theme .animated-icon-button:hover {
    color: var(--icon-hover-color);
}

/* Inputs in light mode */
body.light-theme .api-key-input,
body.light-theme .auth-input {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-color);
}

/* Chat container scrollbars remain subtle */
body.light-theme .popup-content-scrollable::-webkit-scrollbar-track {
    background: var(--input-bg);
}
body.light-theme .popup-content-scrollable::-webkit-scrollbar-thumb {
    background-color: #bdbdbd;
    border: 2px solid var(--input-bg);
}

/* Firebase Login Styles */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
}

#login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background-color: var(--container-bg);
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    position: relative;
}

#login-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 2px; /* This is the border width */
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    border-radius: inherit; /* Use the same border-radius as the sidebar */
    z-index: -1;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    pointer-events: none;
}

.auth-error-message {
    /* @tweakable The color for authentication error messages */
    color: #ff4d4d;
    background-color: rgba(255, 77, 77, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.auth-input {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    font-size: 1rem;
    width: 100%;
}

.auth-input:focus {
    outline: none;
    border-color: var(--input-focus-border, red);
}

.auth-button {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
    z-index: 10;
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    transition: background-color 0.2s;
}

.auth-button:hover {
    background-color: #444;
}

.auth-separator {
    display: flex;
    align-items: center;
    text-align: center;
    width: 100%;
    color: var(--placeholder-color);
}

.auth-separator::before,
.auth-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--input-border);
}

.auth-separator:not(:empty)::before {
    margin-right: .5em;
}

.auth-separator:not(:empty)::after {
    margin-left: .5em;
}

.google-signin-btn {
    width: 100%;
}

.auth-toggle-text {
    color: var(--placeholder-color);
    font-size: 0.9rem;
    margin: 0;
}

.auth-toggle-text a {
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.auth-toggle-text a:hover {
    text-decoration: underline;
}

.auth-text-button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* Space between text and button */
    width: 100%;
}

.auth-link-button {
    display: inline-block;
    height: 40px;
    line-height: 40px; /* Vertically center text for single line */
    padding: 0 20px;
    font-size: 14px;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    background-color: #333;
    border-radius: 9999px;
    transition: background-color 0.2s;
    text-align: center;
    margin-top: 0.5rem; /* Space between text and button */
}

.auth-link-button:hover {
    background-color: #444;
    text-decoration: none;
}

#app-container {
    display: contents; /* Use contents to avoid breaking flex layout of body */
}

#sign-out-btn {
    width: 100%;
    margin-top: auto; /* Pushes to the bottom */
    padding-top: 1rem;
    text-align: center;
    background-color: transparent;
    border: 1px solid #555;
    color: var(--sidebar-label-color);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
}

#sign-out-btn:hover {
    background-color: #555;
    color: white;
}

body {
    font-family: 'Google Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    height: 100vh;
    margin: 0;
    padding: 10px; /* leave room for glow */
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    box-sizing: border-box;
}

/* replaced Google logo with ORION gradient text */
.orion-logo {
    font-size: 48px;
    font-weight: 500;
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Adjust ORION logo size for mobile */
@media (max-width: 640px) {
    .orion-logo {
        font-size: 32px;
    }
}

.search-input {
    background-color: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    flex-grow: 1;
    height: 100%;
    font-size: 16px;
    position: relative;
    z-index: 10;
    caret-color: red;
    animation: rainbow-caret 7s linear infinite;
}
.search-input:focus {
    caret-color: red;
    animation: rainbow-caret 7s linear infinite;
}

.search-input::placeholder {
    color: var(--placeholder-color);
}

/* Shared styles for animated containers */
.animated-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--container-bg);
    z-index: 0;
    overflow: visible;
    transition: all 0.3s ease-in-out;
    box-sizing: border-box;
}

.animated-container::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: var(--container-bg);
    z-index: 1;
}

.animated-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2px;
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    background-size: 400% 400%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
    animation: rainbow-move 10s linear infinite;
    animation-play-state: paused;
}

.animated-container:hover::before,
.search-box:focus-within::before,
.animated-container:hover .glow-overlay,
.search-box:focus-within .glow-overlay,
.animated-container.active::before,
.animated-container.active .glow-overlay {
    animation-play-state: running;
}

.animated-container .glow-overlay {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    background-size: 400% 400%;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    animation: rainbow-move 10s linear infinite;
    animation-play-state: paused;
    z-index: -2;
    pointer-events: none;
}

.animated-container:hover .glow-overlay,
.search-box:focus-within .glow-overlay,
.animated-container.active .glow-overlay {
    opacity: 1;
    animation-play-state: running;
}

.search-box {
    flex: 1 1 auto;
    height: 60px;
    border-radius: 9999px;
    padding: 0 20px;
    box-sizing: border-box;
}

.search-box::after,
.search-box::before,
.search-box .glow-overlay {
    border-radius: 9999px;
}

.animated-text-button {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
    z-index: 10;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.animated-text-button:hover {
    color: var(--text-color);
}

.animated-text-button::after,
.animated-text-button::before,
.animated-text-button .glow-overlay {
    border-radius: 9999px;
}

.animated-text-button span {
    position: relative;
    z-index: 2;
    font-size: 8px; /* Half the size */
}

.animated-icon-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    color: var(--icon-color);
    font-size: 16px;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.animated-icon-button i {
    position: relative;
    z-index: 11; /* Increased z-index */
}

.animated-icon-button:hover {
    color: var(--icon-hover-color);
}

.animated-icon-button::after,
.animated-icon-button::before,
.animated-icon-button .glow-overlay {
    border-radius: 50%;
}

@keyframes rainbow-move {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

@keyframes color-rotate {
    to {
        --angle: 360deg;
    }
}

@keyframes rainbow-caret {
    0% { caret-color: red; }
    14.28% { caret-color: orange; }
    28.56% { caret-color: yellow; }
    42.84% { caret-color: green; }
    57.12% { caret-color: blue; }
    71.4% { caret-color: indigo; }
    85.68% { caret-color: violet; }
    100% { caret-color: red; }
}

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.popup-overlay {
    /* @tweakable Controls the overlay background color and opacity for popups */
    --overlay-bg-color: rgba(0, 0, 0, 0.7);
    /* @tweakable Controls the z-index for popups to ensure they are on top */
    --popup-z-index: 50;

    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: var(--overlay-bg-color);
    z-index: var(--popup-z-index);
    padding: 1rem;
}

#sidebar {
    position: fixed;
    top: 10px; /* Match body padding */
    bottom: 10px; /* Match body padding */
    right: 10px; /* Match body padding */
    width: 18rem; /* w-72 from tailwind */
    height: calc(100vh - 20px); /* Full height minus top/bottom padding */
    transform: translateX(calc(100% + 20px)); /* Hide it off-screen, accounting for padding */
    transition: transform 0.3s ease-in-out;
    z-index: 30;
    padding: 0.5rem 1.5rem 1.5rem 1.5rem; /* Reduced top padding */
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 20px); /* Match the height we set */
}

#sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 2px; /* This is the border width */
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    border-radius: inherit; /* Use the same border-radius as the sidebar */
    z-index: -1;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    pointer-events: none;
}

.setting-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sidebar.open {
    transform: translateX(0);
}

#close-sidebar {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
}
#close-sidebar i {
    color: red;
    font-size: 1.5rem;
    text-shadow: 0 0 8px red;
    line-height: 1;
}

#sidebar h2, .sidebar-setting-group h3 {
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

#sidebar h2 {
    margin-top: 0.5rem; /* Adjust top margin */
    margin-bottom: 0.5rem; /* Adjust bottom margin */
}

.sidebar-setting-group h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.space-y-4 {
    margin-top: 0.25rem; /* Further reduced margin */
    overflow-y: auto;
    flex: 1;
    /* Ensure no horizontal scrollbar */
    max-width: 100%;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.space-y-4::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.sidebar-setting {
    height: 40px;
    border-radius: 0.5rem;
    padding: 0 1rem;
    color: var(--text-color);
    font-size: 16px;
    position: relative;
    z-index: 10;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.sidebar-setting span {
    position: relative;
    z-index: 2; /* Ensure text is above glow-overlay */
    max-width: calc(100% - 40px); /* Account for delete button */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-convo-btn {
    position: relative; /* Changed from absolute */
    z-index: 3; /* Ensure button is above glow-overlay */
    /* Other styles remain as they were in v010 */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: red; /* Always red */
    font-size: 1.2em; /* Adjust size as needed */
    text-shadow: 0 0 5px red; /* Red glow */
    transition: transform 0.2s ease-in-out;
}

.delete-convo-btn:hover {
    transform: scale(1.1); /* Zoom on hover */
}

#clear-all-conversations-btn {
    width: 100%;
    margin-top: 1rem;
    text-align: center;
    background-color: transparent;
    border: 1px solid #555;
    color: var(--sidebar-label-color); /* Ensure text color is visible */
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    -webkit-background-clip: initial; /* Override inherited background-clip */
    -webkit-text-fill-color: initial; /* Override inherited text-fill-color */
    background-clip: initial;
}
#clear-all-conversations-btn:hover {
    background-color: #c83131;
    color: white;
    border-color: #c83131;
}

.relative {
    position: relative;
}

/* Keys row: masked key + Edit button */
#api-key-display {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

#api-key-display .api-key-masked {
    font-family: monospace;
    letter-spacing: 2px;
    color: var(--sidebar-label-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

/* Make the Edit API button clearly visible and clickable */
.edit-api-btn {
    height: 36px;
    padding: 0 14px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-api-btn:hover {
    filter: brightness(1.05);
}

/* Ensure the text stays above animated borders/overlays */
.edit-api-btn span {
    position: relative;
    z-index: 2;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Keep the input hidden only when we explicitly toggle it in JS */
#keys-content-container .api-key-input {
    margin-top: 8px;
}

.api-key-input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-color);
    font-family: monospace;
    margin-top: 0.25rem;
}
.api-key-input:focus {
    outline: none;
    border-color: var(--input-focus-border);
}

/* New rule for Edit API button text */
.edit-api-btn span {
    position: relative;
    z-index: 2; /* Ensure text is above glow-overlay */
    color: var(--text-color); /* Adapt to theme's text color */
}

/* Preset buttons under Parameters */
.parameter-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 0.5rem;
}

.preset-btn {
    height: 36px;
    padding: 0 12px;
    border-radius: 9999px;
    color: var(--text-color);
    background: transparent;
    border: none;
    cursor: pointer;
}

.preset-btn span {
    position: relative;
    z-index: 2;
    font-size: 0.9rem;
    font-weight: 500;
}

.custom-dropdown-button {
    justify-content: space-between !important;
    text-align: left;
}

.custom-dropdown-menu {
    position: absolute;
    background: var(--dropdown-bg);
    border: 2px solid;
    border-image-slice: 1;
    border-image-source: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    border-radius: 0.5rem;
    width: 100%;
    z-index: 40;
    max-height: 200px;
    overflow-y: auto;
    /* Prevent horizontal overflow */
    max-width: 100%;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.custom-dropdown-menu::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.custom-dropdown-menu a, .custom-dropdown-menu div {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    transition: background-color 0.2s;
    cursor: pointer;
}

.custom-dropdown-menu a:hover, .custom-dropdown-menu div:hover {
    background-color: var(--dropdown-hover-bg);
}

/* Model Tier Toggle Styles */
.model-tier-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
    color: var(--sidebar-label-color);
}
.switch-label {
    font-size: 0.9em;
}
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 22px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background: var(--theme-gradient);
}
input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
    transform: translateX(18px);
}

.theme-toggle-button {
    width: 40px;
    height: 40px;
}

.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 80px 0 20px;
    padding: 0 10px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
}

.chat-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari and Opera */
}

.message { /* Re-map from chat-message */
    display: flex;
    margin: 8px 0;
    max-width: 85%;
}

.bot-message { /* Re-map from .agent */
    align-self: flex-start;
}

.user-message { /* Re-map from .user */
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-content {
    position: relative;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-color);
    border: 2px solid transparent;
    background-clip: padding-box;
    word-break: break-word;
    line-height: 1.6;
    background: rgba(23, 23, 23, 0.15) !important;
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
}

.bot-message .message-content {
    margin-right: 12px;
}

.user-message .message-content {
    margin-left: 12px;
}

/* Light theme adjustments for glass text backgrounds */
body.light-theme .message-content {
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
}

.message-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 2px;
    border-radius: 12px;
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    z-index: -1;
}

.bot-message pre {
    background-color: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    border: 1px solid #444;
}

.bot-message pre code {
    font-family: 'Courier New', Courier, monospace;
}

.popup-content-scrollable {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 15px; /* space for scrollbar */
    margin-right: -15px; /* pull back to align content */
    color: var(--sidebar-label-color); 
    text-align: left; 
    max-width: 100%; 
    overflow-wrap: break-word;
}

.popup-content-scrollable::-webkit-scrollbar {
    width: 8px;
}

.popup-content-scrollable::-webkit-scrollbar-track {
    background: var(--input-bg);
    border-radius: 4px;
}

.popup-content-scrollable::-webkit-scrollbar-thumb {
    background-color: var(--placeholder-color);
    border-radius: 4px;
    border: 2px solid var(--input-bg);
}

#model-info-list .model-info-header {
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--input-border);
    padding-bottom: 0.25rem;
}

#model-info-list .model-info-total {
    font-size: 1em;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
}

#model-info-list ul {
    list-style-type: disc;
    list-style-position: inside;
    padding-left: 5px;
}

#model-info-list li {
    margin-bottom: 0.25rem;
}

.info-popup-container {
    position: relative;
    background: var(--popup-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
    color: var(--text-color);
    border: 2px solid transparent;
    background-clip: padding-box;
    max-width: 90%;
    width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.info-popup-container::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet);
}

.info-popup-container h3 {
    background: linear-gradient(270deg, red, orange, yellow, green, blue, indigo, violet, black, red, orange, yellow, green, blue, indigo, violet, black);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.close-popup-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: red;
    font-size: 1.5rem;
    text-shadow: 0 0 8px red;
    line-height: 1;
}

.hidden {
    display: none !important;
}

header {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: transparent;
    z-index: 20;
    transition: right 0.3s ease-in-out, transform 0.3s ease-in-out;
}

header.shifted {
     right: calc(10px + 18rem);
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#settings-btn.hidden-when-sidebar-open {
    display: none;
}

@media (max-width: 480px) {
    .bottom-area {
        gap: 10px;
        padding: 0 0.5rem;
    }
    .main-container {
        gap: 0.5rem;
    }
    .search-box {
        height: 50px;
    }
    .search-input {
        font-size: 14px;
    }
    .animated-text-button {
        height: 40px;
        padding: 0 16px;
        font-size: 14px;
    }
    .suggestion-buttons {
        display: none; /* Hide on small screens to save space */
    }

    /* Adjust header buttons for smaller screens */
    .header-buttons {
        gap: 0.5rem; /* Reduce gap between buttons */
    }
    .header-buttons .animated-icon-button {
        width: 18px; /* 2x smaller than current 36px */
        height: 18px;
        font-size: 7px; /* 2x smaller than current 14px */
    }
    .header-buttons .animated-icon-button svg {
        width: 10px; /* 2x smaller than current 20px */
        height: 10px;
    }
    .header-buttons .animated-icon-button svg text {
        font-size: 6px; /* 2x smaller than current 12px */
    }
}

#main-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    height: 100%;
    flex: 1;
    transition: width 0.3s ease-in-out, margin-right 0.3s ease-in-out;
    gap: 0;
    padding-bottom: 20px;
}

#main-content.shifted {
    width: calc(100% - 18rem); /* 16rem width + 2rem gap */
    margin-right: 18rem;
}

@media (max-width: 768px) {
    #main-content.shifted {
         width: calc(100% - 16rem);
         margin-right: 16rem;
    }
    #sidebar {
        width: 16rem;
    }
    header.shifted {
        right: calc(10px + 16rem);
    }
}

@media (max-width: 640px) {
    #main-content {
        transition: transform 0.3s ease-in-out;
    }
    #main-content.shifted {
        transform: translateX(-100%);
        width: 100%;
        margin-right: 0;
    }
    #sidebar {
        width: 100%;
    }
    header.shifted {
        transform: translateX(-100%);
        right: 10px;
    }
    #settings-btn.hidden-when-sidebar-open {
        display: none; /* Ensure it's hidden on small screens too when sidebar is open */
    }
}

.bottom-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0;
}
.bottom-area .main-container,
.bottom-area .suggestion-buttons {
    width: 100%;
    padding: 0 10px;
}
.main-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#image-preview-container {
    position: absolute;
    bottom: 100%;
    left: 20px;
    margin-bottom: 10px;
    background-color: var(--container-bg);
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 2px solid var(--input-border);
    z-index: 15;
}

#image-preview-container img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 8px;
}

#remove-image-btn {
    background: none;
    border: none;
    color: red;
    cursor: pointer;
    font-size: 1.2rem;
    text-shadow: 0 0 5px red; /* Red glow */
}

.suggestion-buttons {
     display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

#photos {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: transparent;
    z-index: -11;
    pointer-events: none;
}

/* New: Black top overlap/bar above any background image layer */
#photos::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px; /* overlap height */
    background: #000; /* solid black */
    z-index: 1; /* above .photo backgrounds, still below #prism (-10) */
    pointer-events: none;
}

#photos .photo {
    position: absolute;
    width: 100%;
    height: 100%;
    inset: 0;
    opacity: 0;
    background-size: cover;
    background-position: center center;
    will-change: opacity;
    transition: opacity 1.5s ease-in-out;
}
#photos .photo.active {
    opacity: 1;
}

#photos .photo:nth-child(1) { background-image: url("https://images.unsplash.com/photo-1534796636912-3b95b3ab5986?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&q=80&w=2048"); }
#photos .photo:nth-child(2) { background-image: url("https://images.unsplash.com/photo-1534796636912-3b95b3ab5986?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&q=80&w=2048"); }
#photos .photo:nth-child(3) { background-image: url("https://images.unsplash.com/photo-1506443432602-ac2fcd6f54e0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&q=80&w=2048"); }
#photos .photo:nth-child(4) { background-image: url("https://images.unsplash.com/photo-1462331940025-496dfbfc7564?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&q=80&w=2048"); }
#photos .photo:nth-child(5) { background-image: url("https://images.unsplash.com/photo-1444703686981-a3abbc4d4fe3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&q=80&w=2048"); }

#apod-credit-container {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 25;
    background-color: transparent;
    color: var(--text-color);
    padding: 0;
    border-radius: 0;
    font-size: 12px;
    max-width: 80%;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
}
#apod-credit-container a {
    color: #8ab4f8;
    text-decoration: none;
}
#apod-credit-container a:hover {
    text-decoration: underline;
}
#apod-credit-container strong {
    color: #fff;
    font-weight: 500;
}

/* Prism Theme Overrides */
body.gemini-theme #prism > div {
    background-image: linear-gradient(to bottom, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
}
body.anthropic-dawn-theme #prism > div {
    background-image: linear-gradient(to bottom, #FF6F61, #FFB6A6, #DDA0DD, #000000);
}
body.copilot-neon-theme #prism > div {
    background-image: linear-gradient(to bottom, #0078D4, #6F42C1, #00CC6D, #000000);
}
body.cyber-forge-theme #prism > div {
    background-image: linear-gradient(to bottom, #EF4444, #7C3AED, #F59E0B, #000000);
}
body.quantum-flux-theme #prism > div {
    background-image: linear-gradient(to bottom, #A1A1AA, #3B82F6, #60A5FA, #000000);
}
body.google-ai-mode-theme #prism > div {
    background-image: linear-gradient(to bottom, #4285F4, #DB4437, #F4B400, #0F9D58);
}

/* Glass mode: subtle translucent backgrounds with blur for sidebar and chat bubbles */
body.glass-enabled #sidebar {
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
}

body.glass-enabled .message-content {
    background: rgba(23, 23, 23, 0.35) !important;
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
}

/* Keep borders and text crisp in glass mode */
body.glass-enabled .message-content::before {
    opacity: 0.9;
}
body.glass-enabled .message-content,
body.glass-enabled #sidebar {
    color: var(--text-color);
}

/* Optional tweak: make input preview container match glass style when enabled */
body.glass-enabled #image-preview-container {
    background: rgba(23, 23, 23, 0.35);
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Gemini Theme */
body.gemini-theme .animated-container::before,
body.gemini-theme .info-popup-container::before,
body.gemini-theme .animated-container .glow-overlay {
    background: linear-gradient(to right, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
    background-size: 400% 400%;
}

body.gemini-theme .orion-logo {
    background: linear-gradient(to right, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.gemini-theme #sidebar h2,
body.gemini-theme .sidebar-setting-group h3,
body.gemini-theme .info-popup-container h3 {
    background: linear-gradient(to right, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.gemini-theme .custom-dropdown-menu {
    border-image-source: linear-gradient(to right, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
}

body.gemini-theme #sidebar::before,
body.gemini-theme .message-content::before {
    background: linear-gradient(to right, #8A2BE2, #0000FF, #FF00FF, #FF0000, #000000);
}

/* Anthropic-Dawn Theme */
body.anthropic-dawn-theme .animated-container::before,
body.anthropic-dawn-theme .info-popup-container::before,
body.anthropic-dawn-theme .animated-container .glow-overlay {
    background: linear-gradient(135deg, #FF6F61, #FFB6A6, #DDA0DD, #000000);
    background-size: 400% 400%;
}

body.anthropic-dawn-theme .orion-logo,
body.anthropic-dawn-theme #sidebar h2,
body.anthropic-dawn-theme .sidebar-setting-group h3,
body.anthropic-dawn-theme .info-popup-container h3 {
    background: linear-gradient(135deg, #FF6F61, #FFB6A6, #DDA0DD, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.anthropic-dawn-theme .custom-dropdown-menu {
    border-image-source: linear-gradient(135deg, #FF6F61, #FFB6A6, #DDA0DD, #000000);
}

body.anthropic-dawn-theme #sidebar::before,
body.anthropic-dawn-theme .message-content::before {
    background: linear-gradient(135deg, #FF6F61, #FFB6A6, #DDA0DD, #000000);
}

/* Copilot-Neon Theme */
body.copilot-neon-theme .animated-container::before,
body.copilot-neon-theme .info-popup-container::before,
body.copilot-neon-theme .animated-container .glow-overlay {
    background: linear-gradient(135deg, #0078D4, #6F42C1, #00CC6D, #000000);
    background-size: 400% 400%;
}

body.copilot-neon-theme .orion-logo,
body.copilot-neon-theme #sidebar h2,
body.copilot-neon-theme .sidebar-setting-group h3,
body.copilot-neon-theme .info-popup-container h3 {
    background: linear-gradient(135deg, #0078D4, #6F42C1, #00CC6D, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.copilot-neon-theme .custom-dropdown-menu {
    border-image-source: linear-gradient(135deg, #0078D4, #6F42C1, #00CC6D, #000000);
}

body.copilot-neon-theme #sidebar::before,
body.copilot-neon-theme .message-content::before {
    background: linear-gradient(135deg, #0078D4, #6F42C1, #00CC6D, #000000);
}

/* Cyber-Forge Theme */
body.cyber-forge-theme .animated-container::before,
body.cyber-forge-theme .info-popup-container::before,
body.cyber-forge-theme .animated-container .glow-overlay {
    background: linear-gradient(135deg, #EF4444, #7C3AED, #F59E0B, #000000);
    background-size: 400% 400%;
}

body.cyber-forge-theme .orion-logo,
body.cyber-forge-theme #sidebar h2,
body.cyber-forge-theme .sidebar-setting-group h3,
body.cyber-forge-theme .info-popup-container h3 {
    background: linear-gradient(135deg, #EF4444, #7C3AED, #F59E0B, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.cyber-forge-theme .custom-dropdown-menu {
    border-image-source: linear-gradient(135deg, #EF4444, #7C3AED, #F59E0B, #000000);
}

body.cyber-forge-theme #sidebar::before,
body.cyber-forge-theme .message-content::before {
    background: linear-gradient(135deg, #EF4444, #7C3AED, #F59E0B, #000000);
}

/* Quantum-Flux Theme */
body.quantum-flux-theme .animated-container::before,
body.quantum-flux-theme .info-popup-container::before,
body.quantum-flux-theme .animated-container .glow-overlay {
    background: linear-gradient(135deg, #A1A1AA, #3B82F6, #60A5FA, #000000);
    background-size: 400% 400%;
}

body.quantum-flux-theme .orion-logo,
body.quantum-flux-theme #sidebar h2,
body.quantum-flux-theme .sidebar-setting-group h3,
body.quantum-flux-theme .info-popup-container h3 {
    background: linear-gradient(135deg, #A1A1AA, #3B82F6, #60A5FA, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.quantum-flux-theme .custom-dropdown-menu {
    border-image-source: linear-gradient(135deg, #A1A1AA, #3B82F6, #60A5FA, #000000);
}

body.quantum-flux-theme #sidebar::before,
body.quantum-flux-theme .message-content::before {
    background: linear-gradient(130deg, #A1A1AA, #3B82F6, #60A5FA, #000000);
}

/* Google-AI-Mode Theme */
body.google-ai-mode-theme .animated-container::before,
body.google-ai-mode-theme .info-popup-container::before,
body.google-ai-mode-theme .animated-container .glow-overlay {
    background: conic-gradient(from var(--angle), #4285F4 0% 12.5%, #DB4437 12.5% 25%, #F4B400 25% 37.5%, #0F9D58 37.5% 50%, #000000 50% 100%);
    animation: color-rotate 4s linear infinite;
    animation-play-state: paused;
}

body.google-ai-mode-theme .orion-logo,
body.google-ai-mode-theme #sidebar h2,
body.google-ai-mode-theme .sidebar-setting-group h3 {
    background: linear-gradient(to right, #4285F4, #DB4437, #F4B400, #0F9D58);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.google-ai-mode-theme .info-popup-container h3 {
    background: linear-gradient(to right, #4285F4, #DB4437, #F4B400, #0F9D58);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: none; /* No animation for this text */
}

body.google-ai-mode-theme .custom-dropdown-menu {
    border-image-source: conic-gradient(from 0deg, #4285F4 0% 12.5%, #DB4437 12.5% 25%, #F4B400 25% 37.5%, #0F9D58 37.5% 50%, #000000 50% 100%);
}

body.google-ai-mode-theme .animated-container:hover .glow-overlay,
body.google-ai-mode-theme .search-box:focus-within .glow-overlay,
body.google-ai-mode-theme .animated-container.active .glow-overlay {
    opacity: 1; /* Ensure full opacity on interaction */
}

body.google-ai-mode-theme .animated-container:hover::before,
body.google-ai-mode-theme .search-box:focus-within::before,
body.google-ai-mode-theme .animated-container:hover .glow-overlay,
body.google-ai-mode-theme .search-box:focus-within .glow-overlay,
body.google-ai-mode-theme .animated-container.active::before,
body.google-ai-mode-theme .animated-container.active .glow-overlay {
    animation-play-state: running;
}

body.google-ai-mode-theme #sidebar::before,
body.google-ai-mode-theme .message-content::before {
    background: conic-gradient(from 0deg, #4285F4 0% 12.5%, #DB4437 12.5% 25%, #F4B400 25% 37.5%, #0F9D58 37.5% 50%, #000000 50% 100%);
}

/* --- Animated Background Styles --- */
@property --pos-x {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}
@property --pos-y {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}
@property --angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 0deg;
}

#prism {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  --size: 0.025;
  --opacity: 1;
  /* start value */
  --pos-x-s: 0vw;
  --pos-y-s: 0vh;
  --angle-s: 0deg;
  /* end value */
  --pos-x-e: 0vw;
  --pos-y-e: 0vh;
  --angle-e: 0deg;
  --scale: 1;
  --duration: 2s;
  --delay: 0s;
  pointer-events: none;
  z-index: -10;
}
#prism.on-black {
}
#prism > div {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(((100vmin + 100vmax) / 2) * var(--size));
  height: calc(((100vmin + 100vmax) / 2) * var(--size));
  background-image: linear-gradient(to bottom in oklch decreasing hue, oklch(0.8 0.3 300deg) 24%, oklch(0.8 0.2 300deg), oklch(0.8 0.2 300deg), oklch(0.95 0.2 270deg), oklch(0.95 0.2 270deg), oklch(0.95 0.2 240deg), oklch(0.95 0.2 240deg), oklch(0.95 0.1 210deg), oklch(0.95 0.1 210deg), oklch(0.95 0.1 180deg), oklch(0.95 0.1 180deg), oklch(0.95 0.1 150deg), oklch(0.95 0.1 150deg), oklch(0.95 0.2 90deg) 78%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  mask-image: radial-gradient(closest-side circle at center, white 30%, transparent);
  transform: skew(calc(var(--angle) / 2), var(--angle)) rotate(calc(var(--angle) * -2)) translate3d(var(--pos-x), var(--pos-y), 0) scale3d(calc(var(--scale) / 1.8), var(--scale), 1);
  transform-origin: center top;
  will-change: transform;
  animation-name: anim-bg;
  animation-duration: var(--duration);
  animation-delay: var(--delay);
  animation-timing-function: ease-in-out;
  animation-direction: alternate;
  animation-iteration-count: infinite;
}
#prism > div:nth-child(even) {
  animation-direction: alternate-reverse;
}
#prism > div:nth-child(1) { --pos-x-s: 50.1vw; --pos-y-s: 85.1vh; --angle-s: 5.1deg; --pos-x-e: 58.8vw; --pos-y-e: 91.6vh; --angle-e: 25.3deg; --scale: 2.1; --duration: 14.2s; --delay: -21s; --opacity: 0.21; }
#prism > div:nth-child(2) { --pos-x-s: 56.8vw; --pos-y-s: 17.8vh; --angle-s: -5.1deg; --pos-x-e: 65.1vw; --pos-y-e: 24.6vh; --angle-e: -26.7deg; --scale: 2.33; --duration: 14.7s; --delay: -5.7s; --opacity: 0.65; }
#prism > div:nth-child(3) { --pos-x-s: 73.9vw; --pos-y-s: 87.4vh; --angle-s: 5.1deg; --pos-x-e: 86.4vw; --pos-y-e: 95.7vh; --angle-e: 27.2deg; --scale: 1.18; --duration: 10.7s; --delay: -16.8s; --opacity: 0.33; }
#prism > div:nth-child(4) { --pos-x-s: 95.5vw; --pos-y-s: 2.7vh; --angle-s: -5.1deg; --pos-x-e: 104.2vw; --pos-y-e: 7.3vh; --angle-e: -25.1deg; --scale: 1.86; --duration: 5.6s; --delay: -16.8s; --opacity: 0.27; }
#prism > div:nth-child(5) { --pos-x-s: 46.4vw; --pos-y-s: 5.3vh; --angle-s: 5.3deg; --pos-x-e: 58.8vw; --pos-y-e: 10.3vh; --angle-e: 27.2deg; --scale: 1.75; --duration: 14.1s; --delay: -10.2s; --opacity: 0.67; }
#prism > div:nth-child(6) { --pos-x-s: 12.3vw; --pos-y-s: 24.6vh; --angle-s: -5.1deg; --pos-x-e: 19.7vw; --pos-y-e: 32.6vh; --angle-e: -22.9deg; --scale: 1.8; --duration: 12.2s; --delay: -14.4s; --opacity: 0.39; }
#prism > div:nth-child(7) { --pos-x-s: 59.7vw; --pos-y-s: 12.8vh; --angle-s: 5.2deg; --pos-x-e: 72.6vw; --pos-y-e: 20.3vh; --angle-e: 23.4deg; --scale: 1.25; --duration: 12.8s; --delay: -12.6s; --opacity: 0.58; }
#prism > div:nth-child(8) { --pos-x-s: 35.6vw; --pos-y-s: 6.2vh; --angle-s: -5.1deg; --pos-x-e: 47.7vw; --pos-y-e: 14.1vh; --angle-e: -25.4deg; --scale: 1.43; --duration: 11.5s; --delay: -6.3s; --opacity: 0.29; }
#prism > div:nth-child(9) { --pos-x-s: 86.6vw; --pos-y-s: 38.6vh; --angle-s: 5.5deg; --pos-x-e: 92.3vw; --pos-y-e: 46.9vh; --angle-e: 26.3deg; --scale: 1.52; --duration: 11.6s; --delay: -11.7s; --opacity: 0.59; }
#prism > div:nth-child(10) { --pos-x-s: 99.6vw; --pos-y-s: 46.3vh; --angle-s: -5.4deg; --pos-x-e: 109.8vw; --pos-y-e: 51.2vh; --angle-e: -21.2deg; --scale: 1.23; --duration: 8.6s; --delay: -18.3s; --opacity: 0.68; }
#prism > div:nth-child(11) { --pos-x-s: 3.6vw; --pos-y-s: 60.7vh; --angle-s: 5.1deg; --pos-x-e: 10.4vw; --pos-y-e: 67.7vh; --angle-e: 20.2deg; --scale: 2.1; --duration: 6.9s; --delay: -10.8s; --opacity: 0.28; }
#prism > div:nth-child(12) { --pos-x-s: 84.2vw; --pos-y-s: 77.4vh; --angle-s: -5.2deg; --pos-x-e: 91.6vw; --pos-y-e: 83.4vh; --angle-e: -21.5deg; --scale: 1.86; --duration: 7.2s; --delay: -6s; --opacity: 0.23; }
#prism > div:nth-child(13) { --pos-x-s: 51.8vw; --pos-y-s: 27.2vh; --angle-s: 5.2deg; --pos-x-e: 60.6vw; --pos-y-e: 32.4vh; --angle-e: 21.4deg; --scale: 2.83; --duration: 9.9s; --delay: -11.4s; --opacity: 0.36; }
#prism > div:nth-child(14) { --pos-x-s: 85.8vw; --pos-y-s: 32.3vh; --angle-s: -5.2deg; --pos-x-e: 93.4vw; --pos-y-e: 38.8vh; --angle-e: -26.2deg; --scale: 2.7; --duration: 12.8s; --delay: -19.2s; --opacity: 0.62; }
#prism > div:nth-child(15) { --pos-x-s: 92.4vw; --pos-y-s: 13.8vh; --angle-s: 5.4deg; --pos-x-e: 98.3vw; --pos-y-e: 19.9vh; --angle-e: 25.1deg; --scale: 1.82; --duration: 13.6s; --delay: -18.9s; --opacity: 0.46; }
#prism > div:nth-child(16) { --pos-x-s: 51.1vw; --pos-y-s: 83.7vh; --angle-s: -5.4deg; --pos-x-e: 57.3vw; --pos-y-e: 90.4vh; --angle-e: -24.3deg; --scale: 2.61; --duration: 14.8s; --delay: -0.9s; --opacity: 0.58; }
#prism > div:nth-child(17) { --pos-x-s: 22.4vw; --pos-y-s: 1.2vh; --angle-s: 5.2deg; --pos-x-e: 30.5vw; --pos-y-e: 8.9vh; --angle-e: 21.5deg; --scale: 1.27; --duration: 9.7s; --delay: -17.7s; --opacity: 0.45; }
#prism > div:nth-child(18) { --pos-x-s: 38.2vw; --pos-y-s: 53.9vh; --angle-s: -5.3deg; --pos-x-e: 44.7vw; --pos-y-e: 60.9vh; --angle-e: -23.5deg; --scale: 1.56; --duration: 9.4s; --delay: -12.3s; --opacity: 0.69; }
#prism > div:nth-child(19) { --pos-x-s: 23.7vw; --pos-y-s: 99vh; --angle-s: 5.5deg; --pos-x-e: 31.2vw; --pos-y-e: 106.1vh; --angle-e: 26.8deg; --scale: 1.56; --duration: 10.2s; --delay: -18.6s; --opacity: 0.66; }
#prism > div:nth-child(20) { --pos-x-s: 57vw; --pos-y-s: 50.4vh; --angle-s: -5.1deg; --pos-x-e: 65.6vw; --pos-y-e: 56.2vh; --angle-e: -22.5deg; --scale: 1.34; --duration: 13s; --delay: -15s; --opacity: 0.54; }
#prism > div:nth-child(21) { --pos-x-s: 25.3vw; --pos-y-s: 2.3vh; --angle-s: 5.2deg; --pos-x-e: 31.4vw; --pos-y-e: 9.9vh; --angle-e: 22.9deg; --scale: 2.09; --duration: 12.5s; --delay: -0.3s; --opacity: 0.65; }
#prism > div:nth-child(22) { --pos-x-s: 20.4vw; --pos-y-s: 87.4vh; --angle-s: -5.4deg; --pos-x-e: 25.4vw; --pos-y-e: 93vh; --angle-e: -25.8deg; --scale: 1.92; --duration: 6.1s; --delay: -1.2s; --opacity: 0.51; }
#prism > div:nth-child(23) { --pos-x-s: 7.4vw; --pos-y-s: 30.1vh; --angle-s: 5.5deg; --pos-x-e: 16.2vw; --pos-y-e: 38.7vh; --angle-e: 20.1deg; --scale: 1.55; --duration: 14s; --delay: -3s; --opacity: 0.54; }
#prism > div:nth-child(24) { --pos-x-s: 40.5vw; --pos-y-s: 83.2vh; --angle-s: -5.5deg; --pos-x-e: 49.8vw; --pos-y-e: 88.4vh; --angle-e: -27.3deg; --scale: 2.95; --duration: 9.4s; --delay: -12.9s; --opacity: 0.56; }
#prism > div:nth-child(25) { --pos-x-s: 30.3vw; --pos-y-s: 10.5vh; --angle-s: 5.3deg; --pos-x-e: 35.6vw; --pos-y-e: 15.8vh; --angle-e: 25.5deg; --scale: 1.79; --duration: 13.9s; --delay: -8.1s; --opacity: 0.49; }
#prism > div:nth-child(26) { --pos-x-s: 75.9vw; --pos-y-s: 79.8vh; --angle-s: -5.2deg; --pos-x-e: 84.5vw; --pos-y-e: 87.2vh; --angle-e: -26.9deg; --scale: 1.86; --duration: 13.8s; --delay: -20.1s; --opacity: 0.27; }
#prism > div:nth-child(27) { --pos-x-s: 53.8vw; --pos-y-s: 34.8vh; --angle-s: 5.4deg; --pos-x-e: 61.6vw; --pos-y-e: 43.3vh; --angle-e: 23.9deg; --scale: 1.34; --duration: 8s; --delay: -9.6s; --opacity: 0.4; }
#prism > div:nth-child(28) { --pos-x-s: 27.6vw; --pos-y-s: 92.7vh; --angle-s: -5.2deg; --pos-x-e: 35.3vw; --pos-y-e: 100.3vh; --angle-e: -23.1deg; --scale: 1.35; --duration: 8.3s; --delay: -0.9s; --opacity: 0.49; }
#prism > div:nth-child(29) { --pos-x-s: 22.3vw; --pos-y-s: 65.3vh; --angle-s: 5.1deg; --pos-x-e: 27.4vw; --pos-y-e: 71.1vh; --angle-e: 27.1deg; --scale: 2.27; --duration: 10.1s; --delay: -19.5s; --opacity: 0.35; }
#prism > div:nth-child(30) { --pos-x-s: 10.7vw; --pos-y-s: 4.3vh; --angle-s: -5.4deg; --pos-x-e: 15.7vw; --pos-y-e: 10.3vh; --angle-e: -27.2deg; --scale: 1.29; --duration: 11.7s; --delay: -11.1s; --opacity: 0.58; }

@keyframes anim-bg {
  0% {
    --pos-x: var(--pos-x-s);
    --pos-y: var(--pos-y-s);
    --angle: var(--angle-s);
  }
  100% {
    --pos-x: var(--pos-x-e);
    --pos-y: var(--pos-y-e);
    --angle: var(--angle-e);
  }
}

/* --- Parameter Sliders --- */
.parameter-slider-group {
    color: var(--sidebar-label-color);
    font-size: 0.9em;
}

.parameter-slider-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.slider-container {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
}

.parameter-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--input-bg);
    outline: none;
    border-radius: 2px;
    cursor: pointer;
    background-image: linear-gradient(var(--slider-gradient, var(--theme-gradient, red)), var(--slider-gradient, var(--theme-gradient, red)));
    background-size: var(--slider-filled-percentage, 50%) 100%;
    background-repeat: no-repeat;
    transition: opacity .2s;
}

.parameter-slider:hover {
    opacity: 0.9;
}

/* Thumb for Webkit browsers (Chrome, Safari, Opera) */
.parameter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid #222;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    transition: transform .2s;
    margin-top: -6px; /* Center thumb on track */
}

.parameter-slider:hover::-webkit-slider-thumb {
    transform: scale(1.1);
}

/* Thumb for Firefox */
.parameter-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid #222;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    transition: transform .2s;
}

.parameter-slider:hover::-moz-range-thumb {
     transform: scale(1.1);
}

/* Track for Firefox */
.parameter-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--input-bg);
    border-radius: 2px;
}

/* Progress for Firefox - needs to be styled separately as it doesn't inherit well */
.parameter-slider::-moz-range-progress {
    height: 4px;
    background: var(--slider-gradient, var(--theme-gradient, red));
    border-radius: 2px;
}
