/* ============================================
   ASKTHEFOUNDERS - Design System
   Consulting the Founders on the Questions of Today
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Colors — Civic Navy / Parchment / Aged Brass */
  --color-bg-dark: #0b0e14;
  --color-bg-gradient-1: #111826;
  --color-bg-gradient-2: #0d1018;
  --color-bg-warm: #1a2540;
  --color-golden-primary: #c9a94e;
  --color-golden-secondary: #a08a3e;
  --color-golden-glow: rgba(201, 169, 78, 0.25);
  --color-text-primary: #e8dcc8;
  --color-text-secondary: rgba(232, 220, 200, 0.8);
  --color-text-muted: rgba(232, 220, 200, 0.55);
  --color-surface: rgba(18, 24, 38, 0.92);
  --color-surface-elevated: rgba(26, 34, 52, 0.95);
  --color-border: rgba(201, 169, 78, 0.18);
  --color-error: #c9544d;
  --color-success: #5a9a6e;
  --color-accent-red: #8b3232;
  --color-accent-blue: #2a4a7f;

  /* Typography */
  --font-family: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-family-title: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-size-xs: 0.8rem;
  --font-size-sm: 0.95rem;
  --font-size-base: 1.15rem;
  --font-size-lg: 1.35rem;
  --font-size-xl: 1.6rem;
  --font-size-2xl: 2.2rem;
  --font-size-3xl: 2.8rem;
  --font-size-title: clamp(2.2rem, 5vw, 3.5rem);
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --line-height-tight: 1.3;
  --line-height-normal: 1.65;
  --line-height-relaxed: 1.8;
  --letter-spacing-normal: 0.01em;
  --letter-spacing-wide: 0.04em;

  /* Spacing - Tighter layout */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.875rem;
  --space-lg: 1.25rem;
  --space-xl: 1.75rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3.5rem;

  /* Sizing - Larger avatar, wider container */
  --avatar-size: clamp(180px, 25vw, 260px);
  --avatar-size-small: 70px;
  --input-height: 56px;
  --input-max-width: 560px;
  --container-max-width: 920px;

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-out: cubic-bezier(0, 0, 0.2, 1);

  /* Z-Index */
  --z-background: 0;
  --z-wave: 1;
  --z-content: 10;
  --z-avatar: 20;
  --z-input: 30;
  --z-zoom: 40;
  --z-toast: 100;

  /* Zoom Scale */
  --zoom-scale: 1;

  /* iOS keyboard offset (set by JS visualViewport handler) */
  --keyboard-offset: 0px;
}

/* ============================================
   Reset & Base
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-dark);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  /* Lock body scroll — fixed prevents iOS bounce */
  position: fixed;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS safe-area insets */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);

  /* Custom Scrollbar Styling */
  scrollbar-width: thin;
  scrollbar-color: var(--color-golden-secondary) transparent;
}

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

::-webkit-scrollbar-track {
  background: transparent;
  /* Transparent track */
}

::-webkit-scrollbar-thumb {
  background: #151b2a;
  /* Dark grey thumb */
  border-radius: 4px;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: #1f2940;
  /* Slightly lighter grey on hover */
}

/* ============================================
   Background & Effects
   ============================================ */

.background-gradient {
  position: fixed;
  inset: 0;
  z-index: var(--z-background);
  background:
    radial-gradient(ellipse 100% 80% at 50% 30%, rgba(17, 24, 38, 0.9) 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 30% 80%, rgba(14, 20, 32, 0.6) 0%, transparent 50%),
    linear-gradient(to bottom, #0b0e14 0%, #111826 40%, #0d1018 100%);
  will-change: background-position;
}

.wave-canvas {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  z-index: var(--z-wave);
  pointer-events: none;
  opacity: 0.85;
  will-change: transform;
  /* GPU acceleration hint for iOS */
}

/* ============================================
   Layout
   ============================================ */

.container {
  position: relative;
  z-index: var(--z-content);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  /* Fixed height for app */
  overflow: hidden;
  padding: 0;
  /* Remove padding to handle full screen layers */
}

/* Centered content wrapper that becomes sticky */
.centered-content {
  position: sticky;
  top: 0;
  margin-top: 40vh;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  z-index: 35;
  overflow: visible;
  transition: margin-top var(--duration-slower) var(--easing-smooth),
    transform var(--duration-slower) var(--easing-smooth),
    padding var(--duration-slower) var(--easing-smooth),
    background-color var(--duration-slower) var(--easing-smooth),
    box-shadow var(--duration-slower) var(--easing-smooth);
}

/* When chatting, move centered content to top with gradient background */
.container.chatting .centered-content {
  margin-top: 0;
  transform: translateY(0);
  padding: var(--space-sm) var(--space-lg) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 35;
  background: linear-gradient(to bottom,
    var(--color-bg-dark) 0%,
    var(--color-bg-dark) 40%,
    rgba(11, 14, 20, 0.85) 65%,
    rgba(11, 14, 20, 0.4) 85%,
    transparent 100%);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  flex-direction: column-reverse; /* Seal on top, text below */
  gap: 0.5rem;
}

/* Hide avatar/seal in chat mode — keep only text logo */
.container.chatting .avatar-container {
  display: none;
}

/* ============================================
   Header
   ============================================ */

.header {
  text-align: center;
  margin-bottom: var(--space-lg);
  transition: all var(--duration-slower) var(--easing-smooth);
}

/* Screen reader only — hides element visually but keeps it accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.title-logo {
  max-width: clamp(220px, 40vw, 420px);
  height: auto;
  margin: 0 auto;
  display: block;
  transition: all var(--duration-slower) var(--easing-smooth);
}

/* Chatting state - header shrinks */
.container.chatting .header {
  padding-top: 0;
  margin-bottom: var(--space-xs);
}

.container.chatting .title-logo {
  max-width: 160px;
}

/* ============================================
   Avatar
   ============================================ */

.avatar-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-lg);
  transition: transform var(--duration-slower) var(--easing-spring),
    margin var(--duration-slower) var(--easing-smooth),
    opacity var(--duration-slower) var(--easing-smooth);
  z-index: var(--z-avatar);
}

.avatar {
  position: relative;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: avatarFloat 5s ease-in-out infinite;
  transition: width var(--duration-slower) var(--easing-spring),
    height var(--duration-slower) var(--easing-spring);
}

.avatar-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 0, 0, 0.6) 30%, transparent 70%);
  opacity: 0.8;
  filter: blur(25px);
  z-index: -1;
  transition: inset var(--duration-slower) var(--easing-smooth),
    filter var(--duration-slower) var(--easing-smooth);
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: contrast(1.1) brightness(0.95);
  border: 3px solid rgba(201, 169, 78, 0.35);
  box-shadow:
    0 0 0 1px rgba(40, 60, 90, 0.3),
    0 8px 40px rgba(0, 0, 0, 0.6);
  transition: all var(--duration-slow) var(--easing-smooth);
}

.avatar-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(40, 60, 90, 0.25);
  opacity: 0.6;
  transition: inset var(--duration-slower) var(--easing-smooth);
}

/* Thinking State */
.thinking-ripple {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  border: 2px solid var(--color-golden-primary);
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.avatar.thinking .thinking-ripple {
  animation: thinkingRipple 1.5s ease-out infinite;
}

.avatar.thinking .avatar-image {
  filter: grayscale(80%) contrast(1.1) brightness(1.05);
}

.avatar.thinking .avatar-glow {
  animation: thinkingGlow 1s ease-in-out infinite;
}

/* Chatting State - Avatar shrinks and stays centered with title */
.container.chatting .avatar-container {
  margin-bottom: var(--space-sm);
}

.container.chatting .avatar {
  width: var(--avatar-size-small);
  height: var(--avatar-size-small);
  animation: none;
}

.container.chatting .avatar-image {
  box-shadow: none !important;
  border-width: 2px;
}

.container.chatting .avatar-glow {
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-smooth);
}

.container.chatting .avatar-ring {
  inset: -4px;
}

/* ============================================
   Chat Area
   ============================================ */

.chat-area {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity var(--duration-slower) var(--easing-smooth),
    visibility var(--duration-slower) var(--easing-smooth),
    transform var(--duration-slower) var(--easing-smooth);
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.container.chatting .chat-area {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.messages {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;

  /* Padding: top for header space, bottom for input space */
  padding: 160px calc(50% - var(--container-max-width) / 2 + var(--space-lg)) 140px calc(50% - var(--container-max-width) / 2 + var(--space-lg));

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);  /* Subtle edge fade — only fades the very edges, not message content */
  mask-image: linear-gradient(to bottom,
      transparent 0px,
      black 20px,
      black calc(100% - 100px),
      transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom,
      transparent 0px,
      black 20px,
      black calc(100% - 100px),
      transparent 100%);
}


.message {
  padding: var(--space-md) var(--space-lg);
  border-radius: 16px;
  animation: messageSlideIn var(--duration-normal) var(--easing-out);
  line-height: var(--line-height-normal);
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 85%;
}

.message.user {
  align-self: flex-end;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.message.assistant {
  align-self: flex-start;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-elevated) 100%);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

/* ============================================
   Message Content & Share Actions
   ============================================ */

.msg-content {
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.7;
}

.msg-content strong {
  color: var(--color-golden-primary);
  font-weight: 600;
}

.msg-content em {
  color: rgba(232, 220, 200, 0.85);
  font-style: italic;
}

.msg-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88em;
}

.msg-content pre {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(201, 169, 78, 0.15);
  border-radius: 8px;
  padding: 0.8em 1em;
  overflow-x: auto;
  margin: 0.5em 0;
  white-space: pre-wrap;
}

.msg-content pre code {
  background: none;
  padding: 0;
}

.msg-content li {
  margin: 0.2em 0;
}

/* ---- Per-Message Action Row ---- */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(196, 160, 106, 0.08);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.message.assistant:hover .msg-actions,
.message.assistant:focus-within .msg-actions,
.message.assistant .msg-actions:focus-within {
  opacity: 1;
  transform: translateY(0);
}

/* On touch devices, always show actions */
@media (hover: none) {
  .msg-actions {
    opacity: 0.7;
    transform: translateY(0);
  }
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.msg-action-btn:hover {
  background: rgba(196, 160, 106, 0.1);
  color: var(--color-golden-primary);
}

.msg-action-btn:active {
  transform: scale(0.94);
}

.msg-action-btn.active {
  color: var(--color-success);
}

.msg-action-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.msg-action-label {
  line-height: 1;
}

/* ---- Quote Selection Popup ---- */
.quote-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 4, 3, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.quote-popup.visible {
  opacity: 1;
}

.quote-popup-content {
  max-width: 420px;
  width: calc(100% - 2rem);
  background: linear-gradient(165deg, rgba(18, 26, 42, 0.96) 0%, rgba(12, 16, 28, 0.98) 100%);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quote-popup.visible .quote-popup-content {
  transform: scale(1) translateY(0);
}

.quote-popup-text {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--color-text-secondary);
  line-height: 1.65;
  padding: 0.75rem 1rem;
  background: rgba(196, 160, 106, 0.04);
  border-left: 3px solid var(--color-golden-primary);
  border-radius: 0 10px 10px 0;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.quote-popup-actions {
  display: flex;
  gap: 0.5rem;
}

.quote-popup-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: rgba(196, 160, 106, 0.06);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quote-popup-btn:hover {
  background: rgba(196, 160, 106, 0.12);
  border-color: rgba(196, 160, 106, 0.3);
  color: var(--color-golden-primary);
}

.quote-popup-btn:active {
  transform: scale(0.96);
}

/* ---- Top-Left Actions Container ---- */
.top-left-actions {
  position: fixed;
  top: 1rem;
  left: 1.25rem;
  z-index: 50;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.5rem;
  animation: greetingFadeIn 0.6s ease forwards;
}

/* ---- Share Chat Button (same row as Feedback, shown when chatting) ---- */
.share-chat-btn {
  position: relative;
  top: auto;
  left: auto;
  z-index: 50;
  display: none;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: rgba(16, 22, 36, 0.8);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.02em;
}

@keyframes shareChatSlideIn {
  from {
    opacity: 0;
    transform: translateX(-0.5rem);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.share-chat-btn.visible {
  display: inline-flex;
  animation: shareChatSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.share-chat-btn:hover {
  border-color: rgba(196, 160, 106, 0.35);
  color: var(--color-golden-primary);
  background: rgba(16, 22, 36, 0.95);
}

.share-chat-btn:active {
  transform: scale(0.96);
}

.share-chat-btn svg {
  flex-shrink: 0;
}

/* ---- Share Chat Menu (Bottom Sheet) ---- */
.share-chat-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 4, 3, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.share-chat-menu-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.share-chat-menu {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(165deg, rgba(16, 22, 36, 0.98) 0%, rgba(10, 14, 24, 0.99) 100%);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.1, 0.64, 1);
  box-shadow: 0 -16px 60px rgba(0, 0, 0, 0.5);
}

.share-chat-menu-overlay.visible .share-chat-menu {
  transform: translateY(0);
}

/* Desktop: center as a card instead of bottom sheet */
@media (min-width: 769px) {
  .share-chat-menu-overlay {
    align-items: center;
  }

  .share-chat-menu {
    border-radius: 22px;
    border-bottom: 1px solid var(--color-border);
    max-height: 80vh;
    transform: translateY(20px) scale(0.97);
  }

  .share-chat-menu-overlay.visible .share-chat-menu {
    transform: translateY(0) scale(1);
  }
}

.share-chat-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem 0.65rem;
  border-bottom: 1px solid rgba(196, 160, 106, 0.08);
}

.share-chat-menu-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

.share-chat-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(196, 160, 106, 0.12);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.share-chat-menu-close:hover {
  background: rgba(196, 160, 106, 0.1);
  color: var(--color-golden-primary);
}

.share-chat-menu-body {
  padding: 0.5rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.share-chat-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.75rem;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--color-text-primary);
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.share-chat-option:hover {
  background: rgba(196, 160, 106, 0.07);
}

.share-chat-option:active {
  transform: scale(0.98);
}

.share-chat-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(196, 160, 106, 0.08);
  border: 1px solid rgba(196, 160, 106, 0.12);
  color: var(--color-golden-primary);
  flex-shrink: 0;
}

.share-chat-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-chat-option-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.share-chat-option-desc {
  font-size: 0.76rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

.typing-indicator {
  position: fixed;
  bottom: calc(var(--space-2xl) + 100px);
  left: 50%;
  transform: translateX(-50%) scale(var(--zoom-scale));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface-elevated);
  border-radius: 20px;
  width: fit-content;
  border: 1px solid var(--color-border);
  z-index: var(--z-input);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.typing-indicator[hidden] {
  display: none;
}

.thinking-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  letter-spacing: var(--letter-spacing-wide);
}

.thinking-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.thinking-dots span {
  width: 10px;
  height: 10px;
  background: var(--color-golden-primary);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ============================================
   Input Area - Matching Reference Design
   ============================================ */

.input-area {
  position: fixed;
  bottom: var(--space-2xl);
  bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px) + var(--keyboard-offset));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-xl) * 2);
  max-width: var(--input-max-width);
  z-index: var(--z-input);
}

.input-form {
  width: 100%;
}

.input-pill {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(18, 24, 38, 0.95);
  border: none;
  border-radius: 30px;
  padding: var(--space-md) var(--space-lg);
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(80, 70, 60, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  transition: all var(--duration-normal) var(--easing-smooth);
}

.input-pill:focus-within {
  box-shadow:
    0 4px 30px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(80, 70, 60, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 40px rgba(201, 169, 78, 0.1);
}

.message-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  font-family: 'IBM Plex Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.15rem;
  resize: none;
  min-height: 24px;
  max-height: none;
  line-height: 1.5;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
  border-radius: 0;
}

.message-input::placeholder {
  color: rgba(140, 155, 180, 0.6);
  font-style: normal;
}

.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  flex-shrink: 0;
  opacity: 0.6;
  touch-action: manipulation;
  /* Prevent iOS double-tap zoom */
}

.send-button:hover {
  opacity: 1;
  color: var(--color-golden-primary);
}

.send-button:active {
  transform: scale(0.95);
}

.send-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

/* ---- File Upload Button ---- */
.upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  flex-shrink: 0;
  opacity: 0.6;
  touch-action: manipulation;
  position: relative;
}

.upload-button:hover {
  opacity: 1;
  color: var(--color-golden-primary);
}

.upload-button:active {
  transform: scale(0.95);
}

.upload-button.active {
  opacity: 1;
  color: var(--color-golden-primary);
  background: rgba(201, 169, 78, 0.12);
  box-shadow: 0 0 12px rgba(201, 169, 78, 0.2);
}

.upload-button.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-golden-primary);
  animation: searchDotPulse 2s ease-in-out infinite;
}

.upload-file-input {
  display: none;
}

/* ---- File Preview Chips ---- */
.file-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px 0;
  max-width: var(--input-max-width);
  width: calc(100% - var(--space-xl) * 2);
  position: fixed;
  bottom: calc(var(--space-2xl) + 70px + env(safe-area-inset-bottom, 0px) + var(--keyboard-offset));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-input);
}

.file-preview-container:empty {
  display: none;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(18, 24, 38, 0.92);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-family: var(--font-family);
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  animation: fileChipIn 0.25s var(--easing-spring);
  max-width: 220px;
  overflow: hidden;
}

@keyframes fileChipIn {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.file-chip-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--color-golden-primary);
}

.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-size {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.file-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(196, 160, 106, 0.1);
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}

.file-chip-remove:hover {
  background: rgba(201, 84, 77, 0.2);
  color: var(--color-error);
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 8px;
  font-size: var(--font-size-sm);
  animation: toastSlideIn var(--duration-normal) var(--easing-out);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.toast.success {
  border-color: var(--color-success);
  color: var(--color-success);
}

.toast.info {
  border-color: #4da8da;
  color: #4da8da;
}

/* ============================================
   Session Sidebar
   ============================================ */

/* ---- Arrow Tab Toggle ---- */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 6px 0 10px;
  border-radius: 0 20px 20px 0;
  background: rgba(16, 22, 36, 0.8);
  border: 1px solid var(--color-border);
  border-left: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
}

.sidebar-toggle:hover {
  border-color: rgba(196, 160, 106, 0.35);
  color: var(--color-golden-primary);
  background: rgba(16, 22, 36, 0.95);
}

.sidebar-toggle:active {
  transform: translateY(-50%) scale(0.96);
}

.sidebar-toggle svg {
  flex-shrink: 0;
}

.sidebar-toggle-label {
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

/* ---- Backdrop ---- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 69;
  background: rgba(5, 4, 3, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Sidebar Panel ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  width: 300px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 16, 28, 0.97) 0%, rgba(8, 12, 20, 0.98) 100%);
  border-right: 1px solid var(--color-border);
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

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

/* ---- Sidebar Header ---- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(196, 160, 106, 0.08);
  flex-shrink: 0;
}

.sidebar-title {
  font-family: var(--font-family);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
}

.sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-close:hover {
  background: rgba(196, 160, 106, 0.08);
  border-color: var(--color-border);
  color: var(--color-golden-primary);
}

/* ---- New Chat Button ---- */
.sidebar-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0.75rem 0.5rem;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, rgba(196, 160, 106, 0.12) 0%, rgba(196, 160, 106, 0.05) 100%);
  border: 1px solid rgba(196, 160, 106, 0.25);
  border-radius: 14px;
  color: var(--color-golden-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.sidebar-new-chat:hover {
  background: linear-gradient(135deg, rgba(196, 160, 106, 0.2) 0%, rgba(196, 160, 106, 0.1) 100%);
  border-color: rgba(196, 160, 106, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(196, 160, 106, 0.1);
}

.sidebar-new-chat:active {
  transform: translateY(0);
}

.sidebar-new-chat svg {
  flex-shrink: 0;
}

/* ---- Session List ---- */
.sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.5rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(40, 60, 90, 0.3) transparent;
}

.sidebar-sessions::-webkit-scrollbar {
  width: 4px;
}

.sidebar-sessions::-webkit-scrollbar-thumb {
  background: rgba(40, 60, 90, 0.3);
  border-radius: 2px;
}

/* ---- Session Item ---- */
.session-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
  position: relative;
  border: 1px solid transparent;
}

.session-item:hover {
  background: rgba(196, 160, 106, 0.06);
}

.session-item.active {
  background: rgba(196, 160, 106, 0.1);
  border-color: rgba(196, 160, 106, 0.2);
}

.session-item-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.session-item.active .session-item-icon {
  color: var(--color-golden-primary);
}

.session-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-item-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item.active .session-item-title {
  color: var(--color-text-primary);
}

.session-item-time {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.session-item-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}

.session-item:hover .session-item-delete {
  opacity: 0.6;
}

.session-item-delete:hover {
  opacity: 1 !important;
  background: rgba(201, 84, 77, 0.15);
  color: var(--color-error);
}

/* ---- Sidebar Empty State ---- */
.sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
}

.sidebar-empty-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.sidebar-empty-text {
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ============================================
   Animations
   ============================================ */

@keyframes avatarFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes glowPulse {

  0%,
  100% {
    opacity: 0.4;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

@keyframes thinkingRipple {
  0% {
    opacity: 0.8;
    transform: scale(0.9);
  }

  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes thinkingGlow {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 0.9;
  }
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-6px);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .avatar {
    animation: none;
  }

  .avatar-glow {
    animation: none;
  }

  .wave-canvas {
    opacity: 0.2;
  }
}

/* ============================================
   Responsive
   ============================================ */

/* Mobile responsive styles moved to mobile.css */


/* ============================================
   User Greeting & Sign Out
   ============================================ */

.user-greeting {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.85rem;
  background: rgba(16, 22, 36, 0.8);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: greetingFadeIn 0.6s ease forwards;
}

@keyframes greetingFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-greeting-text {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.user-name {
  font-weight: 500;
  color: var(--color-golden-primary);
}

.sign-out-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(196, 160, 106, 0.15);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
}

.sign-out-btn:hover {
  color: var(--color-golden-primary);
  border-color: rgba(196, 160, 106, 0.35);
  background: rgba(196, 160, 106, 0.08);
  transform: scale(1.05);
}

.sign-out-btn:active {
  transform: scale(0.95);
}

/* ============================================
   Focus Styles
   ============================================ */

:focus-visible {
  outline: none;
}

.message-input:focus {
  outline: none;
}

.send-button:focus-visible {
  outline: none;
}

/* ============================================
   Intro Text (Before Interaction)
   ============================================ */

.intro-text {
  max-width: 600px;
  text-align: center;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-secondary);
  margin-top: var(--space-lg);
  padding: 0 var(--space-lg);
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--easing-smooth),
    transform var(--duration-slow) var(--easing-smooth);
}

/* Hide intro text when chatting */
.container.chatting .intro-text {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* ============================================
   Zoom Controls
   ============================================ */

.zoom-controls {
  position: fixed !important;
  bottom: 28px;
  right: 28px;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px;
  z-index: 50;
}

.zoom-control {
  width: 44px;
  height: 44px;
  border-radius: 50% !important;
  background: rgba(18, 26, 42, 0.95) !important;
  border: 1px solid rgba(201, 169, 78, 0.3) !important;
  color: var(--color-golden-primary) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  padding: 0 !important;
  margin: 0 !important;
}

.zoom-control svg {
  width: 18px;
  height: 18px;
  stroke: currentColor !important;
}

.zoom-control:hover:not(:disabled) {
  background: rgba(26, 37, 58, 1) !important;
  color: var(--color-golden-primary) !important;
  transform: scale(1.08) !important;
  border-color: rgba(201, 169, 78, 0.5) !important;
}

.zoom-control:active:not(:disabled) {
  transform: scale(0.95) !important;
}

.zoom-control:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
}

/* ============================================
   Dynamic Zoom Scale Application
   ============================================ */

/* Apply zoom to scalable elements using CSS custom property */
.container {
  transform-origin: top center;
}

/* Scale text and UI elements based on zoom */
.message,
.intro-text {
  font-size: calc(var(--font-size-base) * var(--zoom-scale));
}

.thinking-indicator {
  transform: translateX(-50%) scale(var(--zoom-scale));
}

/* ============================================
   Feedback Button & Modal
   ============================================ */

/* Feedback Button - inside top-left-actions, no longer position:fixed */
.feedback-btn {
  position: relative;
  top: auto;
  left: auto;
  z-index: 50;

  /* Match share-chat-btn pill */
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 24px;

  /* Glassmorphism pill */
  background: rgba(16, 22, 36, 0.8);
  border: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  /* Typography - match share-chat-btn */
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;

  /* Interaction */
  cursor: pointer;
  transition: all 0.25s ease;
}

.feedback-btn svg {
  flex-shrink: 0;
}

.feedback-btn:hover {
  border-color: rgba(196, 160, 106, 0.35);
  color: var(--color-golden-primary);
  background: rgba(16, 22, 36, 0.95);
}

.feedback-btn:active {
  transform: scale(0.96);
}

.feedback-btn:focus-visible {
  outline: 2px solid var(--color-golden-primary);
  outline-offset: 2px;
}

/* Modal Overlay */
.feedback-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;

  /* Backdrop */
  background: rgba(10, 7, 4, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  /* Flexbox centering */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  /* Hidden by default */
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--easing-smooth),
    visibility var(--duration-normal) var(--easing-smooth);
}

.feedback-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.feedback-modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  /* Dark theme styling */
  background: linear-gradient(135deg, rgba(16, 22, 36, 0.98) 0%, rgba(22, 30, 48, 0.98) 100%);
  border: 1px solid rgba(196, 160, 106, 0.25);
  border-radius: 20px;

  /* Padding */
  padding: 32px;

  /* Shadow & effects */
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(40, 60, 90, 0.1) inset;

  /* Animation */
  transform: scale(0.95) translateY(10px);
  transition: transform var(--duration-normal) var(--easing-spring);
}

.feedback-modal-overlay.active .feedback-modal {
  transform: scale(1) translateY(0);
}

/* Close Button */
.feedback-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;

  width: 36px;
  height: 36px;
  border-radius: 50%;

  background: rgba(50, 40, 32, 0.6);
  border: 1px solid rgba(196, 160, 106, 0.2);
  color: var(--color-text-muted);

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: all var(--duration-fast) var(--easing-smooth);
}

.feedback-modal-close:hover {
  background: rgba(60, 50, 42, 0.8);
  color: var(--color-golden-primary);
  border-color: rgba(196, 160, 106, 0.4);
}

.feedback-modal-close:active {
  transform: scale(0.95);
}

/* Modal Header */
.feedback-modal-header {
  text-align: center;
  margin-bottom: 28px;
}

.feedback-modal-title {
  font-family: var(--font-family);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin: 0 0 8px 0;
}

.feedback-modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
}

/* Feedback Form */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form Field */
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-field label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.feedback-field .required {
  color: var(--color-error);
}

.feedback-field input,
.feedback-field textarea {
  width: 100%;
  padding: 12px 16px;

  background: rgba(14, 18, 30, 0.8);
  border: 1px solid rgba(196, 160, 106, 0.2);
  border-radius: 12px;

  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: var(--font-size-base);

  transition: all var(--duration-fast) var(--easing-smooth);
}

.feedback-field input::placeholder,
.feedback-field textarea::placeholder {
  color: rgba(140, 155, 180, 0.5);
}

.feedback-field input:focus,
.feedback-field textarea:focus {
  outline: none;
  border-color: rgba(196, 160, 106, 0.5);
  box-shadow: 0 0 0 3px rgba(196, 160, 106, 0.1);
}

/* Error state */
.feedback-field input.has-error,
.feedback-field textarea.has-error {
  border-color: var(--color-error);
}

.feedback-field input.has-error:focus,
.feedback-field textarea.has-error:focus {
  box-shadow: 0 0 0 3px rgba(201, 84, 77, 0.15);
}

.feedback-field textarea {
  min-height: 100px;
  resize: vertical;
}

/* Field Error Message */
.field-error {
  font-size: 0.8rem;
  color: var(--color-error);
  min-height: 1.2em;
}

/* Submit Button */
.feedback-submit-btn {
  position: relative;
  width: 100%;
  padding: 14px 24px;
  margin-top: 8px;

  background: linear-gradient(135deg, var(--color-golden-secondary) 0%, var(--color-golden-primary) 100%);
  border: none;
  border-radius: 12px;

  color: #1a1008;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);

  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  box-shadow: 0 4px 15px rgba(196, 160, 106, 0.2);
}

.feedback-submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196, 160, 106, 0.3);
}

.feedback-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.feedback-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Button Loader */
.feedback-submit-btn .btn-loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(26, 16, 8, 0.3);
  border-top-color: #1a1008;
  border-radius: 50%;
  animation: spinLoader 0.8s linear infinite;
}

.feedback-submit-btn .btn-loader[hidden] {
  display: none;
}

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

/* Status Messages */
.feedback-status {
  text-align: center;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: var(--font-size-sm);
  margin-top: 4px;
}

.feedback-status[hidden] {
  display: none;
}

.feedback-status.success {
  background: rgba(90, 154, 110, 0.15);
  border: 1px solid rgba(90, 154, 110, 0.3);
  color: var(--color-success);
}

.feedback-status.error {
  background: rgba(201, 84, 77, 0.15);
  border: 1px solid rgba(201, 84, 77, 0.3);
  color: var(--color-error);
}

/* Feedback modal mobile styles moved to mobile.css */




/* ============================================
   iOS / Apple Compatibility Fixes
   ============================================ */

/* Safe-area padding for input area on notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .input-area {
    bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom, 0px));
  }

  .top-left-actions {
    top: calc(1rem + env(safe-area-inset-top, 0px));
    left: calc(1.25rem + env(safe-area-inset-left, 0px));
  }

  .user-greeting {
    top: calc(1rem + env(safe-area-inset-top, 0px));
    right: calc(1.25rem + env(safe-area-inset-right, 0px));
  }
}

/* Backdrop-filter fallback for older iOS */
@supports not ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {

  .feedback-btn,
  .share-chat-btn,
  .user-greeting,
  .share-chat-menu,
  .share-chat-menu-overlay {
    background: rgba(16, 22, 36, 0.97);
  }
}

/* ============================================
   Social Share Modal
   ============================================ */

.social-share-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 4, 3, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.social-share-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.social-share-modal {
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  background: linear-gradient(165deg, rgba(16, 22, 36, 0.98) 0%, rgba(10, 14, 24, 0.99) 100%);
  border: 1px solid rgba(196, 160, 106, 0.18);
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(196, 160, 106, 0.06);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.social-share-overlay.visible .social-share-modal {
  transform: scale(1) translateY(0);
}

.social-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.25rem 0.65rem;
  border-bottom: 1px solid rgba(196, 160, 106, 0.08);
}

.social-share-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  margin: 0;
}

.social-share-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(196, 160, 106, 0.12);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.social-share-close:hover {
  color: var(--color-golden-primary);
  border-color: rgba(196, 160, 106, 0.3);
  background: rgba(196, 160, 106, 0.08);
}

.social-share-body {
  padding: 0.75rem 1rem 1rem;
}

/* Copy Link Row */
.social-share-copy-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.social-share-url {
  flex: 1;
  padding: 0.6rem 0.85rem;
  background: rgba(10, 14, 24, 0.7);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-share-copy-btn {
  padding: 0.6rem 0.85rem;
  background: rgba(196, 160, 106, 0.12);
  border: 1px solid rgba(196, 160, 106, 0.25);
  border-radius: 12px;
  color: var(--color-golden-primary);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.social-share-copy-btn:hover {
  background: rgba(196, 160, 106, 0.2);
  border-color: rgba(196, 160, 106, 0.4);
}

.social-share-copy-btn:active {
  transform: scale(0.96);
}

/* Social Icons Row */
.social-share-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.65rem;
}

.social-share-icons {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.social-share-icon-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.social-share-icon-btn:hover {
  border-color: rgba(196, 160, 106, 0.35);
  color: var(--color-golden-primary);
  background: rgba(196, 160, 106, 0.08);
}

.social-share-icon-btn:active {
  transform: scale(0.96);
}

.social-share-icon-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Mobile social share modal */
@media (max-width: 480px) {
  .social-share-modal {
    max-width: 100%;
    margin: 0.5rem;
    border-radius: 18px;
  }

  .social-share-icons {
    gap: 0.5rem;
  }

  .social-share-icon-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.75rem;
  }
}

/* ============================================
   Source Citations & Founder Badges
   ============================================ */

.msg-citations {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(201, 169, 78, 0.1);
  font-size: 0.78rem;
  animation: fadeInUp 0.3s ease;
}

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

.citations-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.citations-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.founder-badges {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.founder-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--badge-color, #666) 15%, transparent);
  color: var(--badge-color, #aaa);
  border: 1px solid color-mix(in srgb, var(--badge-color, #666) 25%, transparent);
}

.tension-indicator, .analogy-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.tension-indicator {
  background: rgba(139, 50, 50, 0.1);
  color: #d4846e;
  border: 1px solid rgba(139, 50, 50, 0.2);
}

.analogy-indicator {
  background: rgba(42, 74, 127, 0.1);
  color: #7a9ec9;
  border: 1px solid rgba(42, 74, 127, 0.2);
}

.tension-icon, .analogy-icon {
  font-size: 0.85rem;
}

.citations-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.citation-item {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.citation-founder {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.citation-title {
  font-style: italic;
}

.citation-date {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ============================================
   Search Toggle Button
   ============================================ */

.search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--duration-normal) var(--easing-smooth);
  flex-shrink: 0;
  opacity: 0.6;
  touch-action: manipulation;
  position: relative;
}

.search-toggle:hover {
  opacity: 1;
  color: var(--color-golden-primary);
}

.search-toggle:active {
  transform: scale(0.95);
}

.search-toggle.active {
  opacity: 1;
  color: var(--color-golden-primary);
  background: rgba(201, 169, 78, 0.12);
  box-shadow: 0 0 12px rgba(201, 169, 78, 0.2);
}

.search-toggle.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-golden-primary);
  animation: searchDotPulse 2s ease-in-out infinite;
}

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

/* ============================================
   Web Search Results
   ============================================ */

.web-results {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(201, 169, 78, 0.1);
}

.web-results-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

.web-results-header svg {
  color: var(--color-golden-secondary);
  flex-shrink: 0;
}

.web-results-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-golden-secondary);
}

.web-results-list {
  display: flex;
  flex-direction: row;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.web-result-card {
  display: block;
  padding: 0.4rem 0.55rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(201, 169, 78, 0.08);
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--duration-normal) var(--easing-smooth);
  color: inherit;
  min-width: 180px;
  max-width: 220px;
  flex-shrink: 0;
}

.web-result-card:hover {
  background: rgba(201, 169, 78, 0.06);
  border-color: rgba(201, 169, 78, 0.2);
  transform: translateX(2px);
}

.web-result-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.25;
  margin-bottom: 0.15rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.web-result-card:hover .web-result-title {
  color: var(--color-golden-primary);
}

.web-result-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.web-result-domain {
  font-size: 0.7rem;
  color: var(--color-golden-secondary);
  opacity: 0.8;
}

.web-result-age {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  opacity: 0.6;
}

.web-result-desc {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Shadow overlay is now handled by .centered-content background gradient */

/* ============================================
   AI Disclaimer
   ============================================ */

.ai-disclaimer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: rgba(8, 10, 16, 0.88);
  border-top: 1px solid rgba(201, 169, 78, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}

.ai-disclaimer-icon {
  flex-shrink: 0;
  color: var(--color-golden-secondary);
  opacity: 0.7;
}

.ai-disclaimer-text {
  font-family: var(--font-family);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0.01em;
}

