@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

:root {
  --burnt-orange: #e67e50;
  --terracotta: #d87850;
  --sage-concrete: #7a8b8b;
  --charcoal-ink: #2d2d2d;
  --sandstone: #f3e8d1;
  --ink-veil: #fdf9f4;

  --background: #f6f2eb;
  --foreground: var(--charcoal-ink);
  --card: var(--sage-concrete);
  --card-foreground: var(--charcoal-ink);
  --popover: #fdfaf6;
  --popover-foreground: var(--charcoal-ink);
  --primary: var(--burnt-orange);
  --primary-foreground: #1b110a;
  --secondary: var(--terracotta);
  --secondary-foreground: #2a140c;
  --muted: #cbd2d2;
  --muted-foreground: #394646;
  --accent: var(--sandstone);
  --accent-foreground: var(--charcoal-ink);
  --destructive: #b3473b;
  --destructive-foreground: #fff5f2;
  --border: #5f6c6b;
  --input: #7b8c8c;
  --ring: var(--terracotta);
  --chart-1: var(--burnt-orange);
  --chart-2: var(--terracotta);
  --chart-3: #f1c6a2;
  --chart-4: #8c9898;
  --chart-5: var(--charcoal-ink);
  --radius: 0.75rem;
  --sidebar: #f8f3ec;
  --sidebar-foreground: var(--charcoal-ink);
  --sidebar-primary: var(--burnt-orange);
  --sidebar-primary-foreground: #1f140c;
  --sidebar-accent: #d8c7b1;
  --sidebar-accent-foreground: var(--charcoal-ink);
  --sidebar-border: #d4dad8;
  --sidebar-ring: var(--terracotta);
  --panel-tint: transparent;
  --swatch-color: transparent;
}

.dark {
  --background: #111111;
  --foreground: #f6ede0;
  --card: #202425;
  --card-foreground: #f6ede0;
  --popover: #161919;
  --popover-foreground: #f6ede0;
  --primary: var(--burnt-orange);
  --primary-foreground: #140b06;
  --secondary: color-mix(in srgb, var(--terracotta) 85%, #1a130f);
  --secondary-foreground: #f6ede0;
  --muted: #1f2626;
  --muted-foreground: #c4cdcd;
  --accent: #2c3233;
  --accent-foreground: #f6ede0;
  --destructive: #ff8f7f;
  --destructive-foreground: #2d0400;
  --border: #3d4444;
  --input: #394040;
  --ring: var(--burnt-orange);
  --chart-1: #ffb285;
  --chart-2: #f18d62;
  --chart-3: #fbd4b6;
  --chart-4: #4a5354;
  --chart-5: #f6ede0;
  --sidebar: #141717;
  --sidebar-foreground: #f6ede0;
  --sidebar-primary: #ff9a6c;
  --sidebar-primary-foreground: #1d0903;
  --sidebar-accent: #2c3233;
  --sidebar-accent-foreground: #f6ede0;
  --sidebar-border: #272c2c;
  --sidebar-ring: var(--terracotta);
}

@theme inline {
  /* optional: --font-sans, --font-serif, --font-mono if they are applied in the layout.tsx */
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
    scrollbar-width: thin;
  }

  body {
    @apply text-foreground;
    font-family: var(--font-body), "Space Grotesk", system-ui, sans-serif;
    background-color: var(--background);
    background-image:
      radial-gradient(circle at 20% 20%, rgba(230, 126, 80, 0.25), transparent 55%),
      radial-gradient(circle at 80% 0%, rgba(216, 120, 80, 0.18), transparent 45%),
      linear-gradient(135deg, rgba(243, 232, 209, 0.8), transparent 60%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(122, 139, 139, 0.28) 65%, rgba(122, 139, 139, 0.45));
    min-height: 100vh;
    letter-spacing: 0.01em;
  }

  h1,
  h2,
  h3,
  h4,
  .font-heading {
    font-family: var(--font-heading), "Playfair Display", "Times New Roman", serif;
    font-feature-settings: "liga", "clig";
    letter-spacing: -0.01em;
    color: var(--charcoal-ink);
  }

  small,
  .eyebrow {
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--charcoal-ink) 70%, #fff 30%);
  }

  /* Light mode scrollbar - hidden by default, show on hover */
  * {
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
  }

  *:hover {
    scrollbar-color: var(--burnt-orange) #dcdede;
  }

  *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }

  *::-webkit-scrollbar-track {
    background: transparent;
    transition: background 0.3s ease;
  }

  *:hover::-webkit-scrollbar-track {
    background: #dcdede;
  }

  *::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.3s ease;
  }

  *:hover::-webkit-scrollbar-thumb {
    background: var(--burnt-orange);
    border-radius: 4px;
  }

  *::-webkit-scrollbar-thumb:hover {
    background: #f29b6f;
  }

  /* Dark mode scrollbar - hidden by default, show on hover */
  .dark * {
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s ease;
  }

  .dark *:hover {
    scrollbar-color: var(--burnt-orange) #000000;
  }

  .dark *::-webkit-scrollbar-track {
    background: transparent;
    transition: background 0.3s ease;
  }

  .dark *:hover::-webkit-scrollbar-track {
    background: #000000;
  }

  .dark *::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.3s ease;
  }

  .dark *:hover::-webkit-scrollbar-thumb {
    background: var(--burnt-orange);
    border-radius: 4px;
  }

  /* Hidden scrollbar for chat input textarea */
  .hide-scrollbar {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .hide-scrollbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@layer components {
  .gallery-shell {
    position: relative;
    min-height: 100vh;
    background: none;
    isolation: isolate;
  }

  .mobile-shell {
    transition: background 300ms ease;
  }

  @media (max-width: 639px) {
    body {
      overflow: hidden;
      overscroll-behavior: none;
    }

    .gallery-shell {
      min-height: 100dvh;
      height: 100dvh;
      padding-top: env(safe-area-inset-top, 0px);
      padding-bottom: env(safe-area-inset-bottom, 0px);
      padding-inline: clamp(0.75rem, 4vw, 1.5rem);
      overflow: hidden;
    }

    @supports (height: 100svh) {
      .gallery-shell {
        min-height: 100svh;
        height: 100svh;
      }
    }

    @supports (height: 100dvh) {
      .gallery-shell {
        min-height: 100dvh;
        height: 100dvh;
      }
    }

    .gallery-shell::after {
      opacity: 0.6;
    }

    .mobile-shell {
      background: none;
    }

    .chat-panel {
      border-radius: 1.75rem;
      background: linear-gradient(180deg, #f6ede0, #f3e8d1 100%);
      border: 1px solid rgba(243, 232, 209, 0.6);
      box-shadow: 0 25px 55px rgba(45, 45, 45, 0.15);
      padding: clamp(1.25rem, 4vw, 1.75rem) clamp(1rem, 4vw, 1.5rem);
      backdrop-filter: blur(18px);
      overflow: hidden !important;
    }

    .mobile-feed {
      border-radius: 1.4rem;
      background: transparent;
      padding-inline: 0;
      height: 100%;
      overflow-y: auto;
    }

    .message-frame {
      gap: 0.75rem;
    }

    .message-bubble {
      border-radius: 1.25rem;
      font-size: 0.95rem;
      line-height: 1.5;
    }

    .message-bubble.user {
      background: rgba(200, 200, 200, 0.75);
      border: 1px solid rgba(180, 180, 180, 0.4);
      color: rgba(45, 45, 45, 0.95);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .message-bubble.assistant {
      background: transparent;
      border: none;
      color: rgba(45, 45, 45, 0.9);
      box-shadow: none;
    }

    .mobile-hero-card {
      display: flex;
      align-items: center;
      gap: 1rem;
      border-radius: 1.25rem;
      padding: 1rem 1.25rem;
      background: transparent;
      border: none;
      box-shadow: none;
    }

    .mobile-hero-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.75rem;
      height: 2.75rem;
      border-radius: 999px;
      border: 1px solid rgba(45, 45, 45, 0.12);
      background: rgba(255, 255, 255, 0.4);
    }

    .mobile-hero-icon span {
      display: block;
      width: 1.5rem;
      height: 1.5rem;
      border-radius: 999px;
      background: var(--burnt-orange);
      box-shadow: 0 0 28px rgba(230, 126, 80, 0.4);
    }

    .mobile-hero-heading {
      margin-top: 0.35rem;
      font-family: var(--font-heading), "Playfair Display", serif;
      font-size: 1.5rem;
      color: rgba(45, 45, 45, 0.85);
      letter-spacing: -0.01em;
    }

    .mobile-hero-label {
      font-size: 0.62rem;
      letter-spacing: 0.4em;
      text-transform: uppercase;
      color: rgba(45, 45, 45, 0.6);
    }

    .mobile-agent-stack {
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      width: 100%;
    }

    .mobile-agent-chip {
      width: 100%;
      border-radius: 1.1rem;
      padding: 0.95rem 1.25rem;
      border: 1px solid rgba(45, 45, 45, 0.1);
      background: rgba(255, 255, 255, 0.5);
      text-align: left;
      font-size: 0.72rem;
      letter-spacing: 0.28em;
      text-transform: uppercase;
      color: rgba(45, 45, 45, 0.8);
      transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
    }

    .mobile-agent-chip.is-active {
      border-color: rgba(45, 45, 45, 0.2);
      background: rgba(255, 255, 255, 0.75);
      color: rgba(45, 45, 45, 0.95);
      box-shadow: 0 8px 20px rgba(45, 45, 45, 0.12);
      transform: translateY(-2px);
    }

    .chat-panel button[title="Start a fresh conversation"] {
      border-radius: 0.75rem;
      border: 1px solid rgba(180, 180, 180, 0.4);
      background: rgba(200, 200, 200, 0.75);
      color: rgba(45, 45, 45, 0.9);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }

    .chat-panel button[title="Start a fresh conversation"]:hover {
      background: rgba(210, 210, 210, 0.85);
      border-color: rgba(190, 190, 190, 0.5);
    }

    .chat-panel .text-white\/60,
    .chat-panel .text-white\/80,
    .chat-panel .text-white\/70 {
      color: rgba(45, 45, 45, 0.6) !important;
    }

    .chat-panel .scroll-reveal {
      background: rgba(255, 255, 255, 0.6) !important;
      border-color: rgba(45, 45, 45, 0.15) !important;
      color: rgba(45, 45, 45, 0.9) !important;
    }

    .chat-panel .scroll-reveal:hover {
      background: rgba(255, 255, 255, 0.75) !important;
      border-color: rgba(45, 45, 45, 0.25) !important;
    }

    .chat-panel .text-charcoal {
      color: rgba(45, 45, 45, 0.9) !important;
    }

    .chat-panel .text-muted-foreground {
      color: rgba(45, 45, 45, 0.7) !important;
    }

    .chat-panel .border-white\/10 {
      border-color: rgba(45, 45, 45, 0.15) !important;
    }

    .chat-panel .bg-white\/10 {
      background: rgba(255, 255, 255, 0.4) !important;
    }

    .chat-panel .bg-white\/40 {
      background: rgba(255, 255, 255, 0.5) !important;
    }

    .chat-panel .text-white\/70 {
      color: rgba(45, 45, 45, 0.7) !important;
    }

    .chat-panel .text-destructive {
      color: rgba(200, 50, 50, 0.9) !important;
    }

    .composer-affix {
      position: relative;
      width: 100%;
      padding-bottom: max(env(safe-area-inset-bottom), 0.65rem);
      background: transparent;
    }

    .composer-panel {
      border-radius: 0;
      background: transparent;
      border: none;
      box-shadow: none;
    }

    .dark .composer-panel {
      background: transparent;
      border: none;
    }

    .mobile-composer {
      border-radius: 1.5rem;
      border: none;
      background: rgba(60, 60, 60, 0.95);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    }

    .mobile-composer .text-foreground,
    .mobile-composer .text-muted-foreground,
    .mobile-composer input,
    .mobile-composer textarea,
    .mobile-composer button {
      color: rgba(255, 255, 255, 0.95) !important;
    }

    .mobile-composer textarea::placeholder {
      color: rgba(255, 255, 255, 0.6) !important;
    }

    .mobile-composer .text-white,
    .mobile-composer .text-white\/70,
    .mobile-composer .text-white\/80 {
      color: rgba(255, 255, 255, 0.95) !important;
    }

    .mobile-composer .composer-send-button {
      background: var(--burnt-orange) !important;
      border-color: rgba(230, 126, 80, 0.8) !important;
      color: rgba(255, 255, 255, 0.95) !important;
      box-shadow: 0 4px 12px rgba(230, 126, 80, 0.4) !important;
    }

    .mobile-composer .composer-send-button:hover:not(:disabled) {
      background: color-mix(in srgb, var(--burnt-orange) 90%, white) !important;
      border-color: var(--burnt-orange) !important;
    }

    .mobile-composer .composer-action-button {
      background: rgba(180, 180, 180, 0.4) !important;
      border-color: rgba(160, 160, 160, 0.5) !important;
      color: rgba(255, 255, 255, 0.95) !important;
    }

    .mobile-composer .composer-action-button:hover {
      background: rgba(200, 200, 200, 0.5) !important;
      border-color: rgba(180, 180, 180, 0.6) !important;
    }

    .mobile-composer .text-white\/90 {
      color: rgba(255, 255, 255, 0.95) !important;
    }

    .mobile-composer [role="menuitem"]:hover {
      background: rgba(255, 255, 255, 0.15) !important;
    }

    .mobile-composer [role="menuitem"]:hover * {
      color: rgba(255, 255, 255, 1) !important;
    }

    .dark .mobile-composer {
      border-color: rgba(80, 80, 80, 0.5);
      background: rgba(60, 60, 60, 0.95);
      box-shadow: 0 20px 35px rgba(0, 0, 0, 0.4);
    }

    .composer-form {
      display: flex;
      justify-content: center;
      width: 100%;
    }

    .composer-form .composer-panel {
      width: min(100%, 640px);
      padding: 1.25rem 1.35rem 1.4rem;
    }

    .composer-images {
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
      margin-bottom: 0.75rem;
    }

    .composer-image-thumb {
      position: relative;
      width: 3.4rem;
      height: 3.4rem;
      border-radius: 0.9rem;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.15);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    }

    .composer-image-thumb img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .composer-image-remove {
      position: absolute;
      top: -0.4rem;
      right: -0.4rem;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 1.25rem;
      height: 1.25rem;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.75);
      color: #fff;
      border: 1px solid rgba(255, 255, 255, 0.2);
      transition: opacity 160ms ease;
    }

    .composer-image-remove:hover {
      opacity: 0.8;
    }

    .composer-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .composer-dropdown-trigger {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      border-radius: 999px;
      border: 1px solid rgba(45, 45, 45, 0.15);
      background: rgba(255, 255, 255, 0.85);
      padding: 0.65rem 1rem;
      font-size: 0.55rem;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      backdrop-filter: blur(6px);
      transition: background 180ms ease, border-color 180ms ease;
      color: var(--charcoal-ink);
    }

    .composer-dropdown-trigger:hover {
      border-color: rgba(255, 255, 255, 0.35);
      background: rgba(255, 255, 255, 0.15);
    }

    .composer-actions {
      display: flex;
      align-items: center;
      gap: 0.6rem;
    }

    .composer-action-button {
      width: 2.75rem !important;
      height: 2.75rem !important;
      border-radius: 0.95rem;
      border: 1px solid rgba(45, 45, 45, 0.12);
      background: rgba(255, 255, 255, 0.85);
      color: var(--charcoal-ink);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
      transition: background 180ms ease, transform 180ms ease;
    }

    .composer-action-button:hover {
      background: rgba(255, 255, 255, 0.18);
      transform: translateY(-1px);
    }

    .composer-send-button {
      width: 3rem !important;
      height: 3rem !important;
      border-radius: 1rem;
      border: none;
      background: linear-gradient(135deg, var(--burnt-orange), color-mix(in srgb, var(--burnt-orange) 70%, #ffffff));
      color: #1f0d06;
      box-shadow: 0 12px 25px rgba(230, 126, 80, 0.28);
      transition: transform 160ms ease, box-shadow 160ms ease;
    }

    .composer-send-button:disabled {
      opacity: 0.6;
      box-shadow: none;
    }

    .composer-send-button:not(:disabled):hover {
      transform: translateY(-1px);
      box-shadow: 0 16px 25px rgba(230, 126, 80, 0.45);
    }
  }

  .gallery-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 5%, rgba(230, 126, 80, 0.18), transparent 45%),
      radial-gradient(circle at 85% 20%, rgba(216, 120, 80, 0.17), transparent 50%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0));
    opacity: 0.85;
    pointer-events: none;
    z-index: -1;
  }

  .palette-shell {
    position: relative;
    padding: 2.5rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.32)),
      var(--card);
    border: 1px solid color-mix(in srgb, var(--charcoal-ink) 20%, transparent);
    box-shadow: 0 25px 45px rgba(45, 45, 45, 0.25);
    overflow: hidden;
  }

  .palette-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 0%, var(--panel-tint, transparent), transparent 55%);
    opacity: 0.85;
    transition: background 300ms ease, opacity 300ms ease;
    pointer-events: none;
  }

  .swatch-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    border: 1px solid color-mix(in srgb, var(--charcoal-ink) 15%, transparent);
    background: color-mix(in srgb, var(--sandstone) 40%, white 60%);
    backdrop-filter: blur(12px);
    transition: border-color 220ms ease, transform 220ms ease;
    isolation: isolate;
  }

  .swatch-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), transparent 70%);
    opacity: 0.4;
    transition: opacity 220ms ease;
  }

  .swatch-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--swatch-color, var(--burnt-orange)) 18%, transparent);
    opacity: 0;
    transition: opacity 220ms ease;
  }

  .swatch-card:hover,
  .swatch-card:focus-visible {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--swatch-color, var(--burnt-orange)) 45%, transparent);
  }

  .swatch-card:hover::after,
  .swatch-card:focus-visible::after {
    opacity: 1;
  }

  .palette-row {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
  }

  .palette-chip {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 200ms ease, box-shadow 200ms ease;
  }

  .palette-chip:hover,
  .palette-chip:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.25);
  }

  .message-frame {
    animation: fade-slide 260ms ease-out both;
  }

  .message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  .message-avatar.assistant {
    background: linear-gradient(135deg, rgba(230, 126, 80, 0.9), rgba(45, 45, 45, 0.9));
    color: #fff;
  }

  .message-avatar.user {
    background: linear-gradient(135deg, rgba(216, 120, 80, 0.9), rgba(255, 205, 166, 0.85));
    color: var(--charcoal-ink);
  }

  .message-bubble {
    border-radius: 1.5rem;
    padding: 1.1rem 1.4rem;
    border: 1px solid color-mix(in srgb, var(--charcoal-ink) 12%, transparent);
    background: rgba(255, 255, 255, 0.56);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    color: var(--charcoal-ink);
  }

  .message-bubble.user {
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 6px rgba(45, 45, 45, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.25), inset 0 8px 14px rgba(255, 255, 255, 0.2);
    color: var(--charcoal-ink);
  }

  .message-bubble.assistant {
    background: color-mix(in srgb, var(--sage-concrete) 28%, #ffffff);
    color: var(--charcoal-ink);
  }

  .dark .message-bubble {
    background: rgba(12, 12, 12, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--foreground);
  }

  .dark .message-bubble.user {
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.04), inset 0 8px 14px rgba(255, 255, 255, 0.035);
    color: rgba(255, 255, 255, 0.92);
  }

  .dark .message-bubble.assistant {
    background: color-mix(in srgb, var(--sage-concrete) 45%, rgba(8, 8, 8, 0.7));
    color: var(--foreground);
  }

  @keyframes agent-picker-breathe {
    0% {
      background-position: 0% 50%;
      box-shadow: 0 8px 18px rgba(230, 126, 80, 0.18);
      opacity: 0.85;
    }
    50% {
      background-position: 100% 50%;
      box-shadow: 0 16px 28px rgba(216, 120, 80, 0.35);
      opacity: 1;
    }
    100% {
      background-position: 0% 50%;
      box-shadow: 0 8px 18px rgba(230, 126, 80, 0.18);
      opacity: 0.85;
    }
  }

  .agent-picker-prompt {
    border-color: rgba(255, 255, 255, 0.65) !important;
    color: #fff !important;
    background-image: linear-gradient(130deg, rgba(230, 126, 80, 0.85), rgba(122, 139, 139, 0.75));
    background-size: 180% 180%;
    animation: agent-picker-breathe 3.8s ease-in-out infinite;
  }

  .manuscript-panel {
    border-radius: 1.75rem;
    border: 1px solid color-mix(in srgb, var(--charcoal-ink) 15%, transparent);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 30px 70px rgba(45, 45, 45, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.35), inset 0 12px 25px rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(18px);
  }

  .dark .manuscript-panel {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(9, 9, 9, 0.4);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.06), inset 0 10px 20px rgba(255, 255, 255, 0.04);
    color: var(--foreground);
  }
}

@layer utilities {
  .text-charcoal {
    color: var(--charcoal-ink);
  }

  .bg-burnt {
    background-color: var(--burnt-orange);
  }

  .text-burnt {
    color: var(--burnt-orange);
  }

  .bg-terracotta {
    background-color: var(--terracotta);
  }

  .bg-sage {
    background-color: var(--sage-concrete);
  }

  .border-burnt {
    border-color: var(--burnt-orange);
  }

  .scroll-reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: transform 260ms ease-out, opacity 260ms ease-out;
  }

  .scroll-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .pt-safe {
    padding-top: env(safe-area-inset-top);
  }

  .pb-safe {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-safe {
    bottom: env(safe-area-inset-bottom);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-reveal,
  .message-frame {
    animation: none;
    transition: none;
  }
}
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}
.markdown-glass pre {
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--charcoal-ink);
}

.dark .markdown-glass pre {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--foreground);
}

.markdown-glass .hljs {
  background: transparent !important;
  color: inherit;
}
