/* 🎨 FONT LOADING — MontrealSerial with light and regular cuts */
@font-face {
  font-family: 'MontrealSerial';
  src: url('/static/fonts/Montreal-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MontrealSerial';
  src: url('/static/fonts/MontrealSerial.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MontrealSerial';
  src: url('/static/fonts/MontrealSerialBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #9c88b1;
  --accent-soft: rgba(156, 136, 177, 0.18);
  --accent-softer: rgba(156, 136, 177, 0.12);
  --accent-strong: #cab8de;
  --accent-warm: #f5c84c;
  --surface-0: #0f0f10;
  --surface-1: #141418;
  --surface-2: #191922;
  --surface-3: #1f1f2a;
  --text-strong: #f5f5f7;
  --text-primary: rgba(245, 245, 247, 0.88);
  --text-muted: rgba(180, 180, 190, 0.72);
  --text-soft: rgba(150, 150, 160, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
  --midnight-bg-color: #050508;
  --midnight-bg-layers:
    radial-gradient(180% 150% at 50% -25%, rgba(64, 60, 74, 0.12) 0%, rgba(46, 43, 56, 0.06) 38%, transparent 70%),
    radial-gradient(220% 110% at 50% 10%, rgba(76, 68, 92, 0.08) 0%, rgba(44, 40, 55, 0.04) 36%, transparent 58%),
    linear-gradient(180deg, rgba(16, 15, 20, 0.96) 0%, rgba(10, 9, 14, 0.97) 52%, rgba(6, 6, 10, 0.99) 74%, #030305 100%);
}

/* 🌑 GLOBAL BODY STYLING — black background, white text, modern feel */
body {
  background-color: var(--surface-0);
  color: var(--text-primary);
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

/* 🔐 AUTH MODAL — In-place authentication recovery */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.auth-modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-modal-content p {
  margin: 0 0 20px 0;
  font-size: 16px;
  color: #e0e0e0;
  line-height: 1.4;
}

.auth-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #333;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-login-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.auth-login-btn:hover {
  background: rgba(156, 136, 177, 0.85);
}

/* 📦 MAIN CONTAINER — wraps the whole UI layout */
#container {
  padding: 100px 75px 0 75px; /* top and side padding only */
  box-sizing: border-box;
}

/* 📝 Prompt input area wrapper */
#prompt-box {
  position: relative;
  width: 100%;
  overflow: visible; /* Ensure contents aren't clipped */
}

/* 👻 Placeholder text ("Describe your Story...") — shown behind textarea until user types */
#placeholder {
  font-size: 45px;
  color: white;
  opacity: 0.4; /* Increased opacity */
  line-height: 1.2;
  pointer-events: none; /* Let clicks pass through to input */
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important; /* Force regular weight */
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased; /* Better rendering */
}

/* 🧠 MAIN PROMPT INPUT — large text area for typing queries */
#prompt-input {
  background: transparent;
  border: none;
  color: white;
  font-size: 45px;
  line-height: 1.2;
  width: 100%;
  height: 550px; /* Fits ~10 lines before shrinking */
  resize: none;
  outline: none;
  overflow-y: auto;
  caret-color: white;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
}

/* 🎚️ Scrollbar styling for textarea */
#prompt-input::-webkit-scrollbar {
  width: 6px;
}
#prompt-input::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

/* ⚖️ Footer container — holds "Terms" and "Privacy" links */
#footer {
  position: absolute;
  bottom: 30px;
  right: 40px;
  margin-right: 80px;
  display: flex;
  opacity: 0.7;
}

/* 🔗 Individual footer links */
.footer-link {
  font-size: 16px;
  color: white;       /* Changed to white */
  opacity: 1;
  margin-left: 20px;
  text-decoration: none;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
}

/* ⚠️ Legal note under grid (visible on results screen) */
#legal-note {
  color: white;
  font-size: 16px;
  margin-top: 30px;
  max-width: 100%;
  opacity: 0.5;
  font-weight: normal;
  font-family: 'MontrealSerial', sans-serif;
  word-wrap: break-word;
  white-space: normal;
}

/* 📊 Match counter styling */
#match-counter {
  color: white !important;
  font-size: .9rem !important;
  margin-top: 30px !important;
  opacity: 0.8;
  font-weight: normal;
  font-family: 'MontrealSerial', sans-serif;
}

/* 🔓 Unlock button styling */
#match-counter a,
.unlock-btn {
  color: white !important;
  text-decoration: none !important;
  font-weight: normal;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(246, 126, 75, 0.1);
  border: 1px solid rgba(246, 126, 75, 0.2);
  transition: all 0.2s ease;
  display: inline-block;
  margin-top: 15px;
  margin-left: 8px;
}

#match-counter a:hover,
.unlock-btn:hover {
  background: rgba(246, 126, 75, 0.15);
  border-color: rgba(246, 126, 75, 0.3);
  color: white !important;
}

/* 🔒 Unlock box in video grid */
.unlock-box {
  background: transparent !important;
  background-color: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 8px !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
}

/* Safari-specific fix for unlock box */
.video-box.unlock-box {
  background: transparent !important;
  background-color: transparent !important;
}

.unlock-box a {
  color: white !important;
  text-decoration: none !important;
  font-weight: normal !important;
  padding: 6px 12px !important;
  border-radius: 4px !important;
  background: rgba(246, 126, 75, 0.1) !important;
  border: 1px solid rgba(246, 126, 75, 0.2) !important;
  transition: all 0.2s ease !important;
  display: inline-block !important;
  margin-top: 15px !important;
}

.unlock-box a:hover {
  background: rgba(246, 126, 75, 0.15) !important;
  border-color: rgba(246, 126, 75, 0.3) !important;
  color: white !important;
}

/* ✂️ Shrinked state for prompt (after CMD+Enter) */
#prompt-input.shrinked {
  height: 112px; /* Two lines only */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
  resize: none;
  cursor: pointer;
}

/* 🎞️ VIDEO RESULTS GRID — responsive layout of video previews */
.video-grid, #video-grid {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0;
  margin-bottom: 0;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 0 24px 32px;
}

/* 🖼️ Each video container box */
.video-box {
  position: relative;
  width: 710px !important;
  min-width: 710px;
  max-width: 710px;
  height: 400px;
  background: rgba(20, 20, 26, 0.85);
  border: none;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  flex-grow: 0;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.35);
}

/* 📹 The video itself inside each box */
.video-box video {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Maintain aspect ratio */
  background: black;
  border-radius: 18px;
}

/* ✨ MUSE dust indicator for cross-pattern matches */
.muse-dust {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  z-index: 15;
  cursor: help;
  animation: sparkle 2s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}

@keyframes sparkle {
  0%, 100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1) rotate(5deg);
  }
}

/* MUSE fairy dust positioned on left side */
.video-left-overlay .muse-fairy-dust {
  position: relative;
  font-size: 20px;
  z-index: 6;
  cursor: help;
  animation: sparkle 2s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(147, 197, 253, 0.8));
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
  line-height: 1;
}

/* Tooltip for fairy dust */
.muse-fairy-dust:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  font-family: 'MontrealSerial', sans-serif;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 250px;
  pointer-events: none;
  z-index: 20;
}

.video-action-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-action-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 12, 18, 0.72);
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}
.video-action-btn:hover {
  transform: translateY(-1px);
  background: rgba(156, 136, 177, 0.2);
  border-color: rgba(156, 136, 177, 0.45);
  opacity: 1;
}

.video-action-btn img {
  width: 18px;
  height: 18px;
  display: block;
  filter: brightness(1.1);
  pointer-events: none;
}

.duplicate-btn {
  border-color: rgba(255, 255, 255, 0.12);
}

.duplicate-btn.is-marked {
  border-color: rgba(255, 95, 109, 0.8);
  background: rgba(255, 95, 109, 0.15);
}

.video-box.video-box--duplicate {
  box-shadow: 0 0 0 2px rgba(255, 95, 109, 0.6);
}

/* Tooltip on hover */
.muse-dust:hover::after {
  content: attr(title);
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 12px;
  font-family: 'MontrealSerial', sans-serif;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 250px;
  pointer-events: none;
  z-index: 20;
}

/* 🤷‍♂️ Message shown when no matches found */
#no-match {
  position: absolute;
  top: -1.2em;
  left: 0;
  width: 100%;
  font-size: 45px;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important; /* Force regular weight */
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased; /* Better rendering */
  line-height: 1.2;
  color: white;
  opacity: 0.4;
  pointer-events: none;
  white-space: pre-wrap;
  padding: 0;
  margin: 0;
}

/* 📊 Animated progress bar at top (during prompt processing) */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background-color: white;
  transition: width 1.2s ease-out, opacity 0.3s ease-in-out;
  opacity: 0;
  z-index: 9999;
}

/* 💎 FADE IN animation (used for video tile appearance) */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 🌀 Loading shimmer animation (not currently used but prepped) */
@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 🎬 Title overlay inside each video tile (updated) */
.video-title {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-family: 'MontrealSerial';
  font-weight: normal;
  font-size: 18px;
  color: white;
  opacity: 0.5;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 5; /* Ensure title appears above sprite preview */
}

/* 🎛 Overlay container for model badges and actions */
.video-left-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  z-index: 10;
}

.video-left-overlay .left-top-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 🏷️ Model emojis overlay (staging only) */
.video-left-overlay .model-emojis {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(12, 12, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 6px 12px;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  line-height: 1;
}

.model-badge {
  width: 18px;
  height: 18px;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  position: relative;
  cursor: help;
}

.model-badge--map { color: #a895d1; mask-image: url('/static/icons/model-map.svg'); -webkit-mask-image: url('/static/icons/model-map.svg'); }
.model-badge--compass { color: #7fb8ff; mask-image: url('/static/icons/model-compass.svg'); -webkit-mask-image: url('/static/icons/model-compass.svg'); }
.model-badge--glitch { color: #ff94c0; mask-image: url('/static/icons/model-glitch.svg'); -webkit-mask-image: url('/static/icons/model-glitch.svg'); }
.model-badge--cipher { color: #6fe3c1; mask-image: url('/static/icons/model-cipher.svg'); -webkit-mask-image: url('/static/icons/model-cipher.svg'); }
.model-badge--wave { color: #6aa9ff; mask-image: url('/static/icons/model-wave.svg'); -webkit-mask-image: url('/static/icons/model-wave.svg'); }
.model-badge--ripple { color: #7dd3fc; mask-image: url('/static/icons/model-ripple.svg'); -webkit-mask-image: url('/static/icons/model-ripple.svg'); }
.model-badge--gem { color: #7fb8ff; mask-image: url('/static/icons/model-gem.svg'); -webkit-mask-image: url('/static/icons/model-gem.svg'); }
.model-badge--pearl { color: #f6d978; mask-image: url('/static/icons/model-pearl.svg'); -webkit-mask-image: url('/static/icons/model-pearl.svg'); }
.model-badge--mira { color: #f58fb5; mask-image: url('/static/icons/model-mira.svg'); -webkit-mask-image: url('/static/icons/model-mira.svg'); }
.model-badge--mira-27 { color: #f05d5e; mask-image: url('/static/icons/model-mira.svg'); -webkit-mask-image: url('/static/icons/model-mira.svg'); }
.model-badge--mira-30 { color: #f6d36a; mask-image: url('/static/icons/model-mira.svg'); -webkit-mask-image: url('/static/icons/model-mira.svg'); }
.model-badge--echo { color: #7ea7ff; mask-image: url('/static/icons/model-echo.svg'); -webkit-mask-image: url('/static/icons/model-echo.svg'); }
.model-badge--bro { color: #f2b48c; mask-image: url('/static/icons/model-bro.svg'); -webkit-mask-image: url('/static/icons/model-bro.svg'); }
.model-badge--cousin { color: #8dd9a5; mask-image: url('/static/icons/model-cousin.svg'); -webkit-mask-image: url('/static/icons/model-cousin.svg'); }
.model-badge--neuro { color: #8aa0ff; mask-image: url('/static/icons/model-neuro.svg'); -webkit-mask-image: url('/static/icons/model-neuro.svg'); }

.model-badge--pearl.model-badge--mini {
  color: #f5f5f7;
}

.model-badge--mini {
  position: relative;
  color: inherit;
}

.model-badge::after {
  content: attr(data-label);
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  background: rgba(12, 12, 18, 0.92);
  color: #f5f5f7;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-family: 'MontrealSerial', sans-serif;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  z-index: 30;
}

.model-badge:hover::after {
  opacity: 1;
  transform: translate(-50%, 4px);
}

.model-badge--mini::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(156, 136, 177, 0.6);
}

.model-counts {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  color: var(--text-muted);
}

.model-count-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.model-count-group .model-badge {
  width: 16px;
  height: 16px;
}

.model-count-number {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-count-separator {
  opacity: 0.4;
  font-size: 12px;
}

/* Media controls */
.video-control {
  position: absolute;
  top: 20px;
  z-index: 12;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 12, 18, 0.75);
  color: rgba(245, 245, 247, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.video-control.is-visible {
  display: flex;
}

.video-control::before {
  content: '';
  width: 18px;
  height: 18px;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.video-control:hover {
  transform: translateY(-1px);
  background: rgba(156, 136, 177, 0.22);
  border-color: rgba(156, 136, 177, 0.5);
  color: #ffffff;
}

.video-control:active {
  transform: translateY(0);
}

.video-control--download {
  right: 20px;
  display: flex;
}

.video-control--download::before {
  mask-image: url('/static/icons/video-download.svg');
  -webkit-mask-image: url('/static/icons/video-download.svg');
}

.video-control--play {
  right: 72px;
}

.video-control--play::before {
  mask-image: url('/static/icons/video-play.svg');
  -webkit-mask-image: url('/static/icons/video-play.svg');
}

.video-control--play.is-paused::before {
  mask-image: url('/static/icons/video-pause.svg');
  -webkit-mask-image: url('/static/icons/video-pause.svg');
}

.video-control--sound {
  right: 124px;
}

.video-control--sound-on::before {
  mask-image: url('/static/icons/video-volume.svg');
  -webkit-mask-image: url('/static/icons/video-volume.svg');
}

.video-control--sound-off::before {
  mask-image: url('/static/icons/video-volume-off.svg');
  -webkit-mask-image: url('/static/icons/video-volume-off.svg');
}

/* Show play control in relevant states */
.turtle-mode .video-control--play,
.video-box .video-control--play {
  display: flex;
}

.video-box[data-individual-video-mode="true"] .video-control--play {
  display: flex !important;
}

/* 📊 Progress bar wrapper */
.video-progress {
  position: absolute;
  bottom: 0px;
  left: 0px;
  width: 100%;
  height: 4px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

/* 📊 Actual fill bar */
.progress-fill {
  height: 100%;
  width: 0%;
  background-color: white;
  opacity: 0.5;
  transition: width 0.1s linear;
}

.video-box.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  z-index: 2;
  pointer-events: none;
}

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

.drag-drop-text {
  font-size: 1.7rem;
  line-height: 1.3;
  color: white;
  opacity: 0.85; /* Increased opacity */
  text-align: center;
  margin-top: 70px;
  width: 100%;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important; /* Force regular weight */
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased; /* Better rendering */
}

/* 🕹️ Only show scrub hover when video is ready */
video:not(.scrub-ready) {
  cursor: default !important;
}

video.scrub-ready:hover {
  cursor: ew-resize;
}

#policy-links {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 1.3rem;
  opacity: 0.8;
  display: flex;
  gap: 20px;
  z-index: 10;
}

#policy-links a {
  color: white;
  text-decoration: none;
  cursor: pointer;
}

#policy-window {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(19, 19, 19, 0.8); /* #131313 with 80% opacity */
  color: white;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
  font-size: 1.3rem;
  padding: 60px;
  overflow-y: auto;
  z-index: 10000;

  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
}

#policy-window::-webkit-scrollbar {
  width: 6px;
}

#policy-window::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#back-button {
  position: fixed;
  top: 28px;
  right: 28px;
  margin-left: auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  padding: 0;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  backdrop-filter: blur(8px);
  cursor: pointer;
  margin-bottom: 0;
  opacity: 1;
  z-index: 2;
  transition: all 0.2s ease;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
}

#back-button:hover {
  opacity: 1;
  color: #fff;
  border-color: rgba(245, 200, 76, 0.6);
  box-shadow: 0 0 20px rgba(245, 200, 76, 0.28);
}

#policy-window.policy-window--support {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
}

#policy-window.policy-window--support #policy-content {
  width: 100%;
  max-width: 820px;
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: normal;
  word-wrap: normal;
}

.support-card {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(20, 20, 28, 0.72);
}

.support-title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
}

.support-subtitle {
  margin: 10px 0 24px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
}

.support-form {
  display: grid;
  gap: 14px;
}

.support-form-group {
  display: grid;
  gap: 8px;
}

.support-form-group label {
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.86);
}

.support-form-group input,
.support-form-group textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(9, 9, 14, 0.75);
  color: #fff;
  font: inherit;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.support-form-group input:focus,
.support-form-group textarea:focus {
  border-color: rgba(245, 200, 76, 0.78);
  box-shadow: 0 0 0 2px rgba(245, 200, 76, 0.16);
}

.support-form-group textarea {
  resize: vertical;
  min-height: 140px;
}

.support-form-group--hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.support-status {
  min-height: 20px;
  font-size: 0.9rem;
}

.support-status--error {
  color: #ff9f9f;
}

.support-status--success {
  color: #b4ffbf;
}

.support-submit-btn {
  justify-self: stretch;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 22px;
  background: rgba(245, 200, 76, 0.12);
  color: rgba(245, 200, 76, 0.92);
  border: 1px solid rgba(245, 200, 76, 0.42);
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  box-shadow: none;
}

.support-submit-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 200, 76, 0.6);
  background: rgba(245, 200, 76, 0.2);
}

.support-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Logo in the top left */
#site-logo {
  position: absolute;
  top: 25px;
  left: 25px;
  height: 20px;
  width: auto;
  z-index: 1000;
  opacity: 0.8;
}

/* Logo is orange by default (no filter needed) */

/* 🔧 Shift dynamic auth button slightly left */
#auth-link {
  transform: translateX(-17px);
}

::selection {
  background: rgba(255, 255, 255, 0.2); /* White with low opacity for elegance */
  color: white;
}

/* 🎨 Enhance/Remix buttons */
#prompt-buttons {
  display: none; /* Hidden by default */
  position: absolute;
  left: 0;
  top: 0; /* Will be dynamically positioned via JS */
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  z-index: 10;
  pointer-events: none; /* Let clicks pass through to textarea */
}

#prompt-buttons button,
#prompt-buttons div {
  pointer-events: auto; /* But make buttons clickable */
}

.button-row {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: center;
  margin-left: -7px;
}

.prompt-btn {
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
  font-size: 18px;
  color: white;
  background: transparent;
  border: 1px solid white;
  border-radius: 8px;
  cursor: pointer;
  padding: 3px 12px;
  transition: all 0.2s ease;
  opacity: 0.9;
  position: relative;
}

/* Green styling for Juice button */
#enhance-btn {
  border-color: #0DE9C4;
}

#enhance-btn:hover:not(:disabled) {
  background: rgba(13, 233, 196, 0.05);
  border-color: #0DE9C4;
}

#enhance-btn:active:not(:disabled) {
  background: rgba(13, 233, 196, 0.1);
}

#enhance-btn.processing {
  border-color: #0DE9C4;
  box-shadow: 0 0 8px rgba(13, 233, 196, 0.3);
  animation: glow-green 2s ease-in-out infinite;
}

.prompt-btn:hover:not(:disabled) {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
  border-color: white;
}

.prompt-btn:active:not(:disabled) {
  opacity: 0.8;
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.1);
}

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

.prompt-btn.processing {
  opacity: 0.7;
  animation: glow 2s ease-in-out infinite;
}

/* Upgrade button specific styling */
.prompt-btn.upgrade-btn {
  border-color: #6dc0fc !important;
  background: rgba(109, 192, 252, 0.08) !important;
  color: #e8f6ff !important;
  box-shadow: 0 0 18px rgba(109, 192, 252, 0.28) !important;
}

.prompt-btn.upgrade-btn:hover {
  opacity: 1 !important;
  background: rgba(109, 192, 252, 0.14) !important;
  border-color: #6dc0fc !important;
  box-shadow: 0 0 26px rgba(109, 192, 252, 0.38) !important;
}

@keyframes glow {
  0%, 100% { 
    border-color: white;
    box-shadow: none;
  }
  50% { 
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
  }
}

@keyframes glow-green {
  0%, 100% { 
    border-color: #0DE9C4;
    box-shadow: 0 0 4px rgba(13, 233, 196, 0.2);
  }
  50% { 
    border-color: #0DE9C4;
    box-shadow: 0 0 12px rgba(13, 233, 196, 0.4);
  }
}

/* Playful circular wiggle animation for juice button */
@keyframes wiggle {
  0% { 
    transform: rotate(0deg) scale(1);
    box-shadow: 0 0 4px rgba(13, 233, 196, 0.3);
  }
  10% { 
    transform: rotate(-8deg) scale(1.02);
    box-shadow: 0 0 8px rgba(13, 233, 196, 0.5);
  }
  20% { 
    transform: rotate(6deg) scale(0.98);
    box-shadow: 0 0 6px rgba(13, 233, 196, 0.4);
  }
  30% { 
    transform: rotate(-5deg) scale(1.01);
    box-shadow: 0 0 10px rgba(13, 233, 196, 0.6);
  }
  40% { 
    transform: rotate(4deg) scale(0.99);
    box-shadow: 0 0 8px rgba(13, 233, 196, 0.5);
  }
  50% { 
    transform: rotate(-3deg) scale(1.005);
    box-shadow: 0 0 12px rgba(13, 233, 196, 0.7);
  }
  60% { 
    transform: rotate(2deg) scale(0.995);
    box-shadow: 0 0 8px rgba(13, 233, 196, 0.5);
  }
  70% { 
    transform: rotate(-1deg) scale(1);
    box-shadow: 0 0 6px rgba(13, 233, 196, 0.4);
  }
  80% { 
    transform: rotate(1deg) scale(1);
    box-shadow: 0 0 5px rgba(13, 233, 196, 0.3);
  }
  90% { 
    transform: rotate(-0.5deg) scale(1);
    box-shadow: 0 0 4px rgba(13, 233, 196, 0.2);
  }
  100% { 
    transform: rotate(0deg) scale(1);
    box-shadow: 0 0 2px rgba(13, 233, 196, 0.1);
  }
}

.wiggling {
  animation: wiggle 0.6s ease-in-out;
}

/* Low matches message */
#low-matches-message {
  color: white;
  font-size: 0.9rem;
  margin-top: 15px;
  opacity: 0.8;
}

/* Juice button in video results */
.juice-btn {
  font-family: 'MontrealSerial', sans-serif;
  font-weight: normal;
  font-size: 14px;
  color: white;
  background: transparent;
  border: 1px solid #0DE9C4;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 8px;
  transition: all 0.2s ease;
  opacity: 0.9;
  text-decoration: none;
  display: inline-block;
  margin-left: 4px;
}

.juice-btn:hover {
  background: rgba(13, 233, 196, 0.05);
  border-color: #0DE9C4;
  opacity: 1;
  text-decoration: none;
  color: white;
}

.juice-btn:active {
  background: rgba(13, 233, 196, 0.1);
}

#prompt-warning {
  font-size: 14px;
  color: white;
  margin-top: 20px;
  display: none; /* Hidden by default */
  opacity: 1;
  transition: opacity 0.3s ease;
}

#prompt-help {
  margin-top: 15px; /* Space below buttons */
  font-size: 14px;
  color: white;
  line-height: 1.4;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
}

/* Reduce opacity when both buttons are disabled */
#prompt-buttons:has(.button-row .prompt-btn:disabled:nth-child(1)):has(.button-row .prompt-btn:disabled:nth-child(2)) #prompt-help {
  opacity: 0.3;
}

/* 🎯 Drag and Drop Overlay */
#drop-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.45) !important; /* Soft black overlay with medium opacity */
  z-index: 999999999 !important; /* Very high z-index value */
  display: none !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: all !important; /* Ensure it captures all events */
  transform: none !important; /* Prevent any transform stacking context issues */
  will-change: auto !important;
  filter: none !important;
  backdrop-filter: none !important;
  contain: none !important;
}

#drop-overlay::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 30px;
  right: 30px;
  bottom: 30px;
  border: 3px dashed rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  pointer-events: none;
}

#drop-message {
  font-family: 'MontrealSerial', sans-serif;
  font-size: 32px;
  color: white;
  text-align: center;
  line-height: 1.3;
  opacity: 0.92;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

#drop-message.pulsing {
  animation: pronouncedPulse 1.5s ease-in-out infinite;
}

@keyframes pronouncedPulse {
  0%, 100% { 
    opacity: 0.9;
  }
  50% { 
    opacity: 0.4;
  }
}

#drop-message.error {
  font-size: 22px;
  line-height: 1.5;
  color: #ff6b6b;
  opacity: 0.9;
  font-weight: 400;
}

/* Minimal loading spinner */
.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(156, 136, 177, 0.85) 0deg, rgba(156, 136, 177, 0.25) 140deg, transparent 220deg);
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  animation: spinnerOrbit 1.1s linear infinite;
  position: relative;
}

.loading-spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-strong);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(156, 136, 177, 0.6);
}

@keyframes spinnerOrbit {
  to {
    transform: rotate(360deg);
  }
}

/* 🖼️ BACKGROUND IMAGE SYSTEM - Transform-based Crossfade */
.bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1);
  opacity: 0;
  transition: opacity 2.5s ease-out, transform 2.5s ease-out;
  will-change: opacity, transform;
}

.bg-layer.active {
  opacity: 0.6;
  transform: scale(1);
  transition: opacity 2.5s ease-in, transform 2.5s ease-in;
}

/* Background container */
#background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -3;
  pointer-events: none;
  transition: filter 0.8s ease-out;
}

/* Apply blur to background when blur is active */
body.blur-active #background-container {
  filter: blur(6px);
}

/* Hide the separate blur overlay - not needed with this approach */
#global-blur-overlay {
  display: none;
}

/* Keep backgrounds visible with search results - removed hiding rule */


/* 🐢 TURTLE MODE - Sprite Sheet Preview */
.turtle-mode .video-box {
  cursor: crosshair;
}

.turtle-mode .video-box video {
  display: none; /* Hide actual video in turtle mode */
}

.sprite-preview {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: black; /* Letterboxing background */
  transition: none; /* CRUCIAL: No transitions for discrete frame effect */
  z-index: 1; /* Below video title and other overlays */
  display: block;
  overflow: hidden;
}

.sprite-window {
  position: absolute;
  top: 0;
  left: 0;
  background-repeat: no-repeat;
  background-position: 0 0;
  transition: none; /* CRUCIAL: No transitions for discrete frame effect */
  display: block;
}

/* Sprite scrubbing cursor */
.sprite-preview:hover {
  cursor: ew-resize;
}

/* Bottom-left toggle button removed - now using inline mode buttons */

/* Mode message styling */
.mode-message {
  color: white;
  font-size: 0.9rem;
  margin-top: 38px;
  opacity: 0.8;
  font-weight: normal;
  font-family: 'MontrealSerial', sans-serif;
}

/* Mode toggle buttons */
.mode-toggle-btn {
  font-family: 'MontrealSerial', sans-serif;
  font-weight: normal;
  font-size: 14px;
  color: white;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 2px 8px;
  transition: all 0.2s ease;
  opacity: 0.9;
  text-decoration: none;
  display: inline-block;
  margin-left: 4px;
}

/* Lite Mode button (green color #90836e) */
.lite-mode-btn {
  border: 1px solid #90836e;
  background: rgba(144, 131, 110, 0.1);
}

.lite-mode-btn:hover {
  background: rgba(144, 131, 110, 0.15);
  border-color: #90836e;
  opacity: 1;
}

/* Video Mode button (white border) */
.video-mode-btn {
  border: 1px solid white;
  background: rgba(255, 255, 255, 0.1);
}

.video-mode-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: white;
  opacity: 1;
}

/* Bottom-left toggle button CSS removed */

/* ========================================
   🤖 CHAT INTERFACE STYLES
   ======================================== */

/* Navigation links - positioned to the right of MIA logo */
#nav-links {
  position: fixed;
  top: 24px; /* Pushed down 4px */
  left: 150px; /* Right of MIA logo */
  display: flex;
  gap: 40px; /* 40px spacing between all links */
  z-index: 1000;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-size: 16px;
  font-family: 'MontrealSerial', sans-serif !important;
  font-weight: 400 !important;
  font-weight: normal !important;
  -webkit-font-smoothing: antialiased;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  opacity: 1;
}


/* Chat container */
#chat-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0; /* Allow full height */
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scroll */
  padding: 0;
  padding-bottom: 120px; /* Space for prompt editor */
  z-index: 100;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  background-color: var(--midnight-bg-color, #050508);
  background-image: var(--midnight-bg-layers,
    radial-gradient(180% 150% at 50% -25%, rgba(64, 60, 74, 0.12) 0%, rgba(46, 43, 56, 0.06) 38%, transparent 70%),
    radial-gradient(220% 110% at 50% 10%, rgba(76, 68, 92, 0.08) 0%, rgba(44, 40, 55, 0.04) 36%, transparent 58%),
    linear-gradient(180deg, rgba(16, 15, 20, 0.96) 0%, rgba(10, 9, 14, 0.97) 52%, rgba(6, 6, 10, 0.99) 74%, #030305 100%)
  );
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
}

/* Subtle opacity fade for scrolling - top fade pushed way up, matching bottom pattern */
#chat-container {
  mask: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0) 0px,
    rgba(255, 255, 255, 0.1) 24px,
    rgba(255, 255, 255, 0.3) 48px,
    rgba(255, 255, 255, 0.6) 72px,
    rgba(255, 255, 255, 0.9) 96px,
    rgba(255, 255, 255, 1) 120px, 
    rgba(255, 255, 255, 1) calc(100% - 40px),
    rgba(255, 255, 255, 0.8) calc(100% - 30px),
    rgba(255, 255, 255, 0.5) calc(100% - 20px),
    rgba(255, 255, 255, 0.2) calc(100% - 10px),
    rgba(255, 255, 255, 0) 100%);
  -webkit-mask: linear-gradient(to bottom, 
    rgba(255, 255, 255, 0) 0px,
    rgba(255, 255, 255, 0.1) 24px,
    rgba(255, 255, 255, 0.3) 48px,
    rgba(255, 255, 255, 0.6) 72px,
    rgba(255, 255, 255, 0.9) 96px,
    rgba(255, 255, 255, 1) 120px,
    rgba(255, 255, 255, 1) calc(100% - 40px),
    rgba(255, 255, 255, 0.8) calc(100% - 30px),
    rgba(255, 255, 255, 0.5) calc(100% - 20px),
    rgba(255, 255, 255, 0.2) calc(100% - 10px),
    rgba(255, 255, 255, 0) 100%);
}

#chat-container::-webkit-scrollbar {
  width: 5px;
}

#chat-container::-webkit-scrollbar-track {
  background: transparent;
}

#chat-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 3px;
}

/* Hide any potential horizontal scrollbars */
#chat-container::-webkit-scrollbar:horizontal {
  display: none;
}

html, body {
  overflow-x: hidden; /* Prevent horizontal scroll */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Chat messages area */
#chat-messages {
  width: 100%; /* Use full width */
  padding: 10px 50px 10px 0; /* Remove left padding, right padding for scrollbar (5px) + 45px breathing room */
  min-height: calc(100vh - 200px); /* Ensure minimum height for scrolling */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Start from bottom */
}

/* Message bubbles */
.message {
  margin-bottom: 26px;
  display: flex;
  width: 100%;
  flex-shrink: 0; /* Prevent shrinking */
  opacity: 0;
  transform: translateY(10px);
  animation: messageSlideIn 0.8s ease-out forwards;
}

/* Initial welcome message - gentler animation */
.message:first-child.assistant-message {
  margin-bottom: 60px; /* 60px space above prompt editor */
  animation: welcomeMessageSlideIn 1.2s ease-out forwards;
  animation-delay: 0.3s; /* Small delay for elegance */
}

@keyframes messageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes welcomeMessageSlideIn {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Duplicate rule removed - handled above */

.user-message {
  justify-content: flex-end;
}

/* User messages with attachments need column layout */
.user-message.has-attachment {
  flex-direction: column;
  align-items: flex-end;
}

/* Ensure attachment thumbnails in user messages align properly */
.user-message.has-attachment .message-attachment-thumbnail {
  align-self: flex-end; /* Explicitly align to the right in flex container */
}

.assistant-message {
  justify-content: flex-start;
  align-items: flex-start;
}

.message-bubble {
  max-width: min(72ch, 85%);
  padding: 0;
  border-radius: 0;
  font-size: 22px;
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 300;
  line-height: 1.35;
  color: var(--text-primary);
  word-wrap: break-word;
  opacity: 1;
  position: relative;
}

/* Force normal font weight with maximum CSS specificity */
body .message-bubble,
body .message-bubble p,
body .message-bubble span,
body .message-bubble div,
body .assistant-message .message-bubble,
body .user-message .message-bubble,
body .assistant-message .message-bubble *,
body .user-message .message-bubble * {
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

body .message-bubble strong,
body .message-bubble b {
  font-weight: 500;
}

.user-message .message-bubble {
  background: linear-gradient(145deg, rgba(115, 93, 144, 0.585), rgba(52, 40, 70, 0.675));
  border-radius: 18px;
  padding: 16px 20px;
  margin-left: auto;
  margin-right: 28px;
  max-width: min(68ch, 78%);
  border: 1px solid rgba(156, 136, 177, 0.32);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32);
}

.assistant-message .message-bubble {
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-left: 42px;
  margin-right: auto;
  max-width: min(72ch, 84%);
  line-height: 1.4;
  color: var(--text-primary);
}

.muse-message {
  justify-content: center;
  margin: 38px 0 52px;
}

.muse-message[data-waiting="true"] {
  margin-top: 28px;
}

.muse-inline {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  width: min(860px, calc(100% - 40px));
  padding: 20px 34px;
  background: rgba(20, 20, 26, 0.72);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  box-shadow: none;
  color: var(--text-primary);
}

.muse-inline__icon {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  color: var(--accent-warm);
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.muse-inline__content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.muse-inline__title {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.muse-inline__body {
  font-size: 18px;
  line-height: 1.45;
}

.muse-inline__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.muse-inline__open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(245, 200, 76, 0.42);
  background: rgba(245, 200, 76, 0.12);
  color: rgba(245, 200, 76, 0.92);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.muse-inline__open:hover {
  border-color: rgba(245, 200, 76, 0.6);
  background: rgba(245, 200, 76, 0.18);
  color: #fff3c2;
}

.muse-inline__open-icon {
  width: 14px;
  height: 14px;
  background-color: currentColor;
  mask: url('/static/icons/spark.svg') center/contain no-repeat;
  -webkit-mask: url('/static/icons/spark.svg') center/contain no-repeat;
  opacity: 0.9;
}

.muse-inline__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.muse-inline__meta .feedback-buttons {
  margin-top: 0;
}

.muse-inline__meta .feedback-confirmation {
  margin-left: 6px;
}

.muse-inline[data-type="reference"] .muse-inline__icon {
  mask-image: url('/static/icons/scene.svg');
  -webkit-mask-image: url('/static/icons/scene.svg');
}

.muse-inline[data-type="scene"] .muse-inline__icon {
  mask-image: url('/static/icons/scene.svg');
  -webkit-mask-image: url('/static/icons/scene.svg');
}

.muse-inline[data-type="pattern"] .muse-inline__icon {
  mask-image: url('/static/icons/pattern.svg');
  -webkit-mask-image: url('/static/icons/pattern.svg');
}

.muse-inline[data-type="creative"] .muse-inline__icon {
  mask-image: url('/static/icons/phase.svg');
  -webkit-mask-image: url('/static/icons/phase.svg');
}

.muse-inline[data-type="suggestion"] .muse-inline__icon,
.muse-inline[data-type="waiting"] .muse-inline__icon {
  mask-image: url('/static/icons/spark.svg');
  -webkit-mask-image: url('/static/icons/spark.svg');
}
.rerun-search-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid rgba(156, 136, 177, 0.4);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.rerun-search-link:hover {
  color: var(--accent-strong);
  border-color: rgba(156, 136, 177, 0.6);
}

/* Typing indicator animation */
.typing-bubble {
  padding: 0;
  margin-left: 28px;
  min-width: auto;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.typing-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.55);
  animation: typing-wave 1.6s ease-in-out infinite;
  transform-origin: center;
}

.typing-dots .dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dots .dot:nth-child(2) {
  animation-delay: 0.18s;
}

.typing-dots .dot:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes typing-wave {
  0%, 80%, 100% {
    opacity: 0.15;
    transform: translateY(0);
  }
  40% {
    opacity: 0.85;
    transform: translateY(-4px);
  }
}

/* Long message expansion */
.message-long {
  max-height: 120px; /* ~5 lines */
  overflow: hidden;
  position: relative;
}

.message-expand-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.message-expand-btn:hover {
  opacity: 1;
}

/* Search buttons */
.search-button {
  background: rgba(156, 136, 177, 0.18);
  border: 1px solid rgba(156, 136, 177, 0.35);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 16px;
  cursor: pointer;
  margin-top: 16px;
  font-size: 18px;
  font-family: 'MontrealSerial', sans-serif;
  transition: all 0.2s ease;
}

.search-button:hover {
  background: rgba(156, 136, 177, 0.28);
  border-color: rgba(156, 136, 177, 0.5);
}

/* Prompt editor container */
#prompt-editor-container {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, calc(100% - 80px));
  z-index: 1000;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  pointer-events: none;
}

/* Prompt editor */
#prompt-editor {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 6px 0 8px 0;
  color: var(--text-primary);
  font-size: 22px;
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  resize: none;
  outline: none;
  min-height: 52px;
  max-height: 240px;
  overflow-y: hidden;
  line-height: 1.3;
  opacity: 1;
  box-sizing: border-box;
  text-align: left;
  transition: color 0.3s ease;
  pointer-events: auto;
}

/* Removed fade animations - keeping prompt editor simple */

#prompt-editor::placeholder {
  color: rgba(245, 245, 247, 0.35);
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* Removed thinking animation - now using typing indicator in chat */

#prompt-editor::-webkit-scrollbar {
  width: 5px;
}

#prompt-editor::-webkit-scrollbar-track {
  background: transparent;
}

#prompt-editor::-webkit-scrollbar-thumb {
  background: rgba(156, 136, 177, 0.4);
  border-radius: 3px;
}

/* Provider toggle button */
/* Removed provider toggle styles - moved to admin settings */

/* Remove send button styles since we removed the button */

/* Message attachment thumbnails - simple below message positioning */
.message-attachment-thumbnail {
  width: 60px !important;
  height: 60px !important;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
  transform: rotate(-2deg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: inline-block !important; /* Changed from block to inline-block for proper alignment */
  margin-top: 10px !important;
  margin-left: auto !important; /* Push to the right */
  margin-right: 20px !important; /* Match the message bubble's right margin */
  position: relative;
}

.message-attachment-thumbnail:hover {
  transform: rotate(0deg) scale(1.05);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.message-attachment-thumbnail .pdf-icon {
  color: #4285f4;
  font-size: 16px;
  font-weight: bold;
  font-family: 'MontrealSerial', sans-serif;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  padding: 2px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(66, 133, 244, 0.3);
}

/* Image preview */
.image-preview {
  position: absolute;
  bottom: 10px;
  right: -100px;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  overflow: visible; /* Changed from hidden to show remove button */
  transform: rotate(5deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px; /* Match parent border radius */
}

.remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: normal;
  z-index: 20;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* File preview styles for non-images */
.file-icon {
  font-size: 36px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 60%;
}

.file-name {
  font-size: 10px;
  color: white;
  text-align: center;
  padding: 2px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 0 0 12px 12px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Video grid in chat */
.video-grid-container {
  margin: 20px 0;
  width: 100%;
}

.video-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  box-sizing: border-box;
  justify-content: center;
}

/* Non-admin users get video grid closer to legal disclaimer */
.video-grid:not(.admin-mode) {
  margin-top: 40px;
}

.video-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: transform 0.2s ease;
}

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

.video-filename {
  font-size: 14px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.video-models {
  font-size: 16px;
  margin: 8px 0;
}

.video-score {
  font-size: 18px;
  font-weight: normal;
  color: var(--accent);
}

/* Load more button */
.load-more-button {
  background: rgba(245, 200, 76, 0.08);
  border: 1px solid rgba(245, 200, 76, 0.38);
  color: rgba(245, 200, 76, 0.9);
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  margin: 11px auto 47px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: 'MontrealSerial', sans-serif;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.load-more-button:hover {
  background: rgba(245, 200, 76, 0.16);
  border-color: rgba(245, 200, 76, 0.55);
  color: #fff3c2;
}

.load-more-button.loading {
  cursor: default;
  pointer-events: none;
  background: rgba(245, 200, 76, 0.12);
  border-color: rgba(245, 200, 76, 0.32);
  color: rgba(245, 200, 76, 0.6);
}

.load-more-button.loading:hover {
  background: rgba(245, 200, 76, 0.12);
  border-color: rgba(245, 200, 76, 0.32);
}

.load-more-label {
  display: inline-block;
}

.load-more-button.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.12) 45%, transparent 90%);
  transform: translateX(-100%);
  animation: loadMoreSheen 1.4s ease-in-out infinite;
}

@keyframes loadMoreSheen {
  to {
    transform: translateX(100%);
  }
}

/* Legal note and mode indicator - only shown with search results */
.legal-note, .mode-indicator {
  text-align: center;
  font-size: 14px;
  font-family: 'MontrealSerial', sans-serif;
  font-weight: normal;
  opacity: 0.6;
  margin: 20px 0;
  line-height: 1.4;
  color: white;
}

.legal-note {
  margin: 120px 0;
  margin-top: 40px;
}

/* Mode toggle button styling */
.mode-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(156, 136, 177, 0.35);
  background: rgba(156, 136, 177, 0.16);
  color: var(--text-primary);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'MontrealSerial', sans-serif;
  font-weight: 400;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  margin: 0 6px;
}

.mode-toggle-btn:hover {
  transform: translateY(-1px);
  background: rgba(156, 136, 177, 0.28);
  border-color: rgba(156, 136, 177, 0.55);
  color: #ffffff;
}

.mode-toggle-btn:active {
  transform: translateY(0);
}

.mode-toggle-btn .mode-toggle-icon {
  width: 16px;
  height: 16px;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  opacity: 0.9;
}

.mode-toggle-btn.video-mode-btn .mode-toggle-icon {
  mask-image: url('/static/icons/video-play.svg');
  -webkit-mask-image: url('/static/icons/video-play.svg');
}

.mode-toggle-btn.lite-mode-btn .mode-toggle-icon {
  mask-image: url('/static/icons/chip.svg');
  -webkit-mask-image: url('/static/icons/chip.svg');
}

/* Drag and drop states */
.drag-over {
  background: rgba(246, 126, 75, 0.1) !important;
  border-color: rgba(246, 126, 75, 0.5) !important;
}

/* Loading states */
.loading .message-bubble {
  opacity: 0.1;
}

.loading #send-button {
  animation: pulse 1.5s infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
  #nav-links {
    right: 20px;
    gap: 15px;
  }
  
  .nav-link {
    font-size: 14px;
  }
  
  #chat-container {
    padding: 0 20px;
    top: 60px;
    bottom: 180px;
  }
  
  #prompt-editor-container {
    width: calc(100% - 40px);
    left: 20px;
    right: 20px;
    transform: none;
  }
  
  .message-bubble {
    font-size: 18px;
    max-width: 85%;
  }
  
  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }
}


/* 💎 Upgrade button styling */
.upgrade-button {
  background: #6dc0fc;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
  display: block;
  width: fit-content;
}

.upgrade-button:hover {
  background: #5ba8e0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 192, 252, 0.3);
}

/* 💎 Outline upgrade button styling (for search limit messages) */
.upgrade-button-outline {
  background: transparent;
  color: #6dc0fc;
  border: 1px solid #6dc0fc;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
  display: block;
  width: fit-content;
  box-shadow: 0 0 0 rgba(109, 192, 252, 0);
}

.upgrade-button-outline:hover {
  background: rgba(109, 192, 252, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(109, 192, 252, 0.5);
}

/* 🧠 Context Preferences Modal */
.context-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: 'MontrealSerial', sans-serif;
}

.context-modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Stylish scrollbar for context modal */
.context-modal-content::-webkit-scrollbar {
  width: 6px;
}

.context-modal-content::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.context-modal-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.context-modal-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* For Firefox */
.context-modal-content {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.context-modal-header {
  padding: 24px 24px 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid #333;
  padding-bottom: 16px;
}

.context-modal-header h3 {
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: normal;
  margin: 0;
}

.context-close-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.context-close-btn:hover {
  color: #ffffff;
}

.context-modal-body {
  padding: 0 24px;
}

.context-section {
  margin-bottom: 24px;
}

.context-label {
  display: block;
  color: #ffffff;
  font-size: 1rem;
  margin-bottom: 8px;
  font-weight: normal;
}

.context-input,
.context-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.context-input:focus,
.context-select:focus {
  outline: none;
  border-color: var(--accent);
}

.context-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.context-select option {
  background: #1a1a1a;
  color: #ffffff;
}

.context-checkbox-label {
  display: flex;
  align-items: center;
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 0;
}

.context-checkbox {
  margin-right: 12px;
  margin-left: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.context-help {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
  line-height: 1.4;
}

.context-warning {
  color: rgba(255, 191, 36, 0.8);
}

.context-clear-btn {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid rgba(156, 136, 177, 0.4);
  border-radius: 8px;
  padding: 12px 20px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.context-clear-btn:hover {
  background: rgba(156, 136, 177, 0.12);
  transform: translateY(-1px);
  border-color: rgba(156, 136, 177, 0.6);
  color: #ffffff;
}

.context-modal-footer {
  padding: 0 24px 24px 24px;
  border-top: 1px solid #333;
  padding-top: 16px;
  margin-top: 8px;
}

.context-save-btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-family: 'MontrealSerial', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  font-weight: normal;
}

.context-save-btn:hover {
  background: rgba(156, 136, 177, 0.9);
  transform: translateY(-1px);
}

.context-save-btn:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.8;
}

.context-clear-btn:disabled {
  cursor: not-allowed;
  transform: none;
}

/* Responsive design for context modal */
@media (max-width: 768px) {
  .context-modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .context-modal-header {
    padding: 20px 20px 0 20px;
  }
  
  .context-modal-body {
    padding: 0 20px;
  }
  
  .context-modal-footer {
    padding: 0 20px 20px 20px;
  }
}
