﻿:root {
  color-scheme: light;
  --bg: #f1f3f5;
  --panel: #fbfcfd;
  --surface: #ffffff;
  --surface-alt: #f3f4f6;
  --ink: #1e1d19;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #1e1d19;
  --accent-hover: #34312c;
  --user: #d8dee6;
  --bot: #ffffff;
  --shadow-soft: 0 10px 30px rgba(42, 35, 24, 0.06);
  --shadow-card: 0 4px 14px rgba(42, 35, 24, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 28%),
    linear-gradient(180deg, #f8f9fb 0%, var(--bg) 100%);
  color: var(--ink);
}

.chat-shell {
  min-height: 100vh;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.chat-app {
  min-width: 0;
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 253, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-soft);
}

.header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chat-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
  padding: 20px 14px 8px;
  margin-top: 16px;
  background: transparent;
}

.message {
  max-width: min(720px, 100%);
  padding: 16px 18px;
  border-radius: 20px;
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  transform-origin: center bottom;
  animation: message-in 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.message-system {
  align-self: flex-start;
  background: var(--bot);
}

.message-user {
  align-self: flex-end;
  background: var(--user);
  color: var(--ink);
  border-color: #bcc5d0;
}

.message-result {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.35;
  padding: 18px 20px;
  border-radius: 22px;
  letter-spacing: -0.01em;
}

.message-image {
  align-self: flex-start;
  background: var(--surface);
  padding: 10px;
}

.result-image {
  display: block;
  max-width: min(420px, 100%);
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 0 0;
}

.chat > .nav-row {
  align-self: stretch;
  width: 100%;
}

.back-slot {
  margin-left: auto;
  width: min(720px, 100%);
  display: flex;
  justify-content: flex-end;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.answers-compact {
  flex-direction: row;
  justify-content: flex-end;
  gap: 8px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.chat > .answers {
  align-self: flex-end;
  margin-top: -2px;
  margin-right: 0;
  width: min(720px, 100%);
  transform-origin: center bottom;
  animation: message-in 620ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

.chat > .nav-row {
  animation: message-in 620ms cubic-bezier(0.16, 1, 0.3, 1) 170ms both;
}

.btn {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-option {
  width: 100%;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-option-compact {
  width: auto;
  min-width: 96px;
  align-self: auto;
  text-align: center;
}

.option-image {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  flex: 0 0 64px;
  background: #f3f4f6;
}

.option-label {
  display: block;
  flex: 1;
}

.btn-quiet {
  padding: 8px 12px;
  border-radius: 10px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.btn-text {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

.btn-text:hover {
  background: transparent;
  color: var(--ink);
  transform: none;
}

.btn-text:disabled {
  opacity: 0.45;
  color: var(--muted);
}

.btn-quiet:hover {
  background: var(--surface-alt);
  color: var(--ink);
  transform: none;
}

.btn-quiet:disabled {
  opacity: 0.45;
  background: transparent;
  color: var(--muted);
}

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

.hidden {
  display: none;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

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

@media (max-width: 700px) {
  .chat-shell {
    width: min(100%, calc(100% - 20px));
    padding: 10px 0 20px;
  }

  .chat-header {
    padding: 18px 18px 16px;
    border-radius: 20px;
  }

  .chat {
    padding: 14px 6px 8px;
  }

  .header-main {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-row {
    padding: 6px 0 0;
  }

  .chat > .nav-row {
    width: 100%;
  }

  .back-slot {
    width: 100%;
  }

  .answers {
    width: 100%;
  }

  .chat > .answers {
    margin-right: 0;
    width: 100%;
  }

  .answers .btn {
    width: 100%;
  }

  .answers-compact {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .answers-compact .btn-option-compact {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
  }

}

