:root {
  --bg-main: #05060a;
  --ios-glass-bg: rgba(22, 27, 46, 0.45);
  --ios-glass-card: rgba(255, 255, 255, 0.045);
  --ios-glass-card-hover: rgba(255, 255, 255, 0.08);
  --ios-glass-border: rgba(255, 255, 255, 0.12);
  --ios-glass-bevel: rgba(255, 255, 255, 0.22);
  --ios-glass-inner-shadow: rgba(0, 0, 0, 0.35);

  --accent-cyan: #38bdf8;
  --accent-purple: #c084fc;
  --accent-rose: #fb7185;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  color: #f1f5f9;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ================= ФОН ================= */
.ios-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora-mesh {
  position: absolute;
  width: 130vw;
  height: 130vh;
  top: -15vh;
  left: -15vw;
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(ellipse 50% 50% at 82% 78%, rgba(192, 132, 252, 0.17), transparent 65%),
    radial-gradient(ellipse 45% 40% at 50% 50%, rgba(99, 102, 241, 0.13), transparent 65%),
    radial-gradient(ellipse 40% 35% at 80% 20%, rgba(244, 114, 182, 0.12), transparent 55%),
    radial-gradient(ellipse 35% 35% at 20% 85%, rgba(14, 165, 233, 0.14), transparent 60%);
  filter: blur(80px);
  animation: meshFlow 22s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes meshFlow {
  0% { transform: scale(1) rotate(0deg) translate(0, 0); }
  50% { transform: scale(1.06) rotate(3deg) translate(20px, 15px); }
  100% { transform: scale(0.97) rotate(-2deg) translate(-25px, 20px); }
}

.ios-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(5, 6, 10, 0.75) 100%);
}

.subtle-film {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ================= СТЕКЛО ================= */
.ios-glass {
  background: var(--ios-glass-bg);
  backdrop-filter: blur(40px) saturate(190%) contrast(102%);
  -webkit-backdrop-filter: blur(40px) saturate(190%) contrast(102%);
  border: 1px solid var(--ios-glass-border);
  box-shadow:
    0 30px 60px -15px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px 0 var(--ios-glass-bevel),
    inset 0 -1px 2px 0 var(--ios-glass-inner-shadow);
  border-radius: 28px;
  position: relative;
}

.ios-glass-item {
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}
.ios-glass-item:hover {
  background: var(--ios-glass-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.ios-input-bar {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1.5px 3px rgba(0, 0, 0, 0.35),
    0 10px 30px -8px rgba(0, 0, 0, 0.45);
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  border-radius: 22px;
}

.ios-input-bar:focus-within {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow:
    0 0 25px -2px rgba(56, 189, 248, 0.28),
    inset 0 1.5px 3px rgba(0, 0, 0, 0.35);
}

.ios-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
  border-radius: 9999px;
}
.ios-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(56, 189, 248, 0.25);
}

/* ================= КАРТОЧКА БЛОКА КОДА КАК В GEMINI ================= */
.gemini-code-card {
  margin: 0.75rem 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 8, 15, 0.85);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.gemini-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gemini-code-lang {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #38bdf8;
  text-transform: uppercase;
}

.gemini-code-copy-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.75rem;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
  cursor: pointer;
}
.gemini-code-copy-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
}

.gemini-code-pre {
  margin: 0 !important;
  padding: 1rem !important;
  background: transparent !important;
  border: none !important;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #e2e8f0;
}

/* Карточки файлов внутри сообщений */
.chat-file-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s ease;
}
.chat-file-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.chat-image-preview {
  max-width: 260px;
  max-height: 220px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.chat-image-preview:hover {
  transform: scale(1.02);
}

/* ================= АНИМАЦИИ ================= */
.msg-anim {
  animation: iosPop 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes iosPop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.message-body {
  word-break: break-word;
}
.message-body p { margin-bottom: 0.5rem; }
.message-body p:last-child { margin-bottom: 0; }
.message-body strong { color: #fff; font-weight: 600; }
.message-body ul { list-style: disc; margin-left: 1.25rem; margin-bottom: 0.5rem; }
.message-body ol { list-style: decimal; margin-left: 1.25rem; margin-bottom: 0.5rem; }

.thinking-wave {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}

.wave-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: wavePulse 1.4s ease-in-out infinite;
}
.wave-dot:nth-child(2) { animation-delay: 0.2s; background: var(--accent-purple); }
.wave-dot:nth-child(3) { animation-delay: 0.4s; background: var(--accent-rose); }

@keyframes wavePulse {
  0%, 100% { transform: translateY(0) scale(0.85); opacity: 0.35; }
  50% { transform: translateY(-5px) scale(1.15); opacity: 1; filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8)); }
}

.recording-pulse {
  color: #f43f5e !important;
  animation: recPulse 1.1s ease-in-out infinite alternate;
}

@keyframes recPulse {
  from { transform: scale(1); filter: drop-shadow(0 0 3px rgba(244, 63, 94, 0.4)); }
  to { transform: scale(1.12); filter: drop-shadow(0 0 10px rgba(244, 63, 94, 0.9)); }
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }