:root {
  color-scheme: light;
  --bg: #f7f9ff;
  --panel: #ffffff;
  --line: #e3e8f4;
  --text: #101828;
  --muted: #667085;
  --accent: #3964ff;
  --accent-2: #15c8a8;
  --danger: #c33f3f;
  --soft: #eef3ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(57, 100, 255, 0.12), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(21, 200, 168, 0.10), transparent 30%),
    var(--bg);
  color: var(--text);
}

.language-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 34px rgba(16, 24, 40, 0.10);
  backdrop-filter: blur(12px);
}

.language-toggle button {
  width: 42px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.language-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.landing-shell,
.demo-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.demo-panel,
.demo-summary {
  width: min(680px, 100%);
  padding: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.04;
  letter-spacing: 0;
}

.intro,
#demo-state {
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.url-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}

input,
button {
  height: 52px;
  border: 0;
  border-radius: 6px;
  font: inherit;
}

input {
  min-width: 0;
  padding: 0 14px;
  background: #f8faff;
  color: var(--text);
  outline: 1px solid transparent;
}

input:focus {
  outline-color: var(--accent);
}

button,
.new-demo {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 0 18px;
  cursor: pointer;
}

button:disabled,
input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--danger);
}

.progress {
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  background: #e5ebff;
  border-radius: 999px;
}

.progress span {
  display: block;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: loading 1.1s infinite ease-in-out;
}

@keyframes loading {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

.new-demo {
  display: inline-flex;
  align-items: center;
  height: 44px;
  text-decoration: none;
  border-radius: 6px;
}

.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(390px, calc(100vw - 24px));
  height: min(620px, calc(100vh - 24px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.20);
}

.chat-widget header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent), #6d8aff);
  color: #fff;
}

.chat-widget header span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.chat-list {
  overflow-y: auto;
  padding: 16px;
}

.chat-message {
  width: fit-content;
  max-width: 88%;
  margin-bottom: 10px;
  padding: 11px 13px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-message.bot {
  background: var(--soft);
  color: var(--text);
}

.chat-message a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-message.user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
}

.chat-message.pending {
  color: var(--muted);
  padding: 7px 9px;
  line-height: 1.2;
  font-size: 13px;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.thinking-indicator span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  animation: thinking-bounce 1s infinite ease-in-out;
}

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

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

.thinking-text {
  display: inline-block;
  font-weight: 650;
  font-size: 12px;
  animation: thinking-fade 1.4s infinite ease-in-out;
}

@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-3px); opacity: 1; }
}

@keyframes thinking-fade {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.chat-form input,
.chat-form button {
  height: 46px;
}

.expired-box {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.18);
}

@media (max-width: 640px) {
  .landing-shell,
  .demo-shell {
    align-items: start;
    padding: 76px 16px 32px;
  }

  .language-toggle {
    top: 12px;
    right: 12px;
  }

  .demo-panel,
  .demo-summary {
    padding: 28px 18px;
  }

  .input-row,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-widget {
    inset: auto 8px 8px 8px;
    width: auto;
    height: min(70vh, 620px);
  }

  .expired-box {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
  }
}
