:root {
  --bg: #ffffff;
  --bg-elevated: #f7f8fa;
  --bg-soft: rgba(0, 0, 0, 0.02);
  --bg-accent: rgba(0, 100, 200, 0.06);
  --card: rgba(255, 255, 255, 0.96);
  --card-strong: rgba(255, 255, 255, 0.98);
  --ink: rgba(0, 0, 0, 0.88);
  --muted: rgba(0, 0, 0, 0.62);
  --subtle: rgba(0, 0, 0, 0.44);
  --accent: rgba(0, 0, 0, 0.06);
  --accent-strong: rgba(0, 0, 0, 0.1);
  --user: #eef6ff;
  --assistant: #ffffff;
  --thought: #f7f8fa;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(0, 100, 200, 0.08) 0%, rgba(0, 100, 200, 0) 28%),
    radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0) 28%),
    linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
  min-height: 100vh;
  padding: 12px 12px 24px;
}
.container {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.header {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-copy {
  display: grid;
  gap: 1px;
}
.brand-kicker {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}
.title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}
.intro {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: clamp(56px, 10vw, 96px) 24px 42px;
  min-height: 52vh;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.015), rgba(0, 0, 0, 0)),
    radial-gradient(circle at top, rgba(0, 100, 200, 0.05) 0%, rgba(0, 100, 200, 0) 42%);
}
.intro[hidden] {
  display: none;
}
.intro-mark {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 250, 0.98));
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.06);
}
.intro-logo {
  width: 72px;
  height: 72px;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.06));
}
.intro-kicker {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
}
.intro-title {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.intro-copy {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.12rem);
  line-height: 1.8;
}
.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 760px;
  margin-top: 8px;
}
.suggestion {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 17px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.04);
}
.suggestion:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--bg-elevated);
}
.messages {
  display: none;
  gap: 18px;
  padding: 0 24px 24px;
}
.messages.has-messages {
  display: grid;
}
.assistant-entry {
  display: grid;
  gap: 10px;
  justify-items: start;
}
.reasoning {
  width: min(84%, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--thought);
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.03);
}
.reasoning summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  color: var(--subtle);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.reasoning summary::-webkit-details-marker {
  display: none;
}
.reasoning-body {
  padding: 14px 16px 16px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.94rem;
  color: var(--muted);
}
.bubble {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px 16px;
  line-height: 1.6;
  word-wrap: break-word;
  max-width: min(84%, 720px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.04);
}
.bubble.user {
  background: var(--user);
  color: var(--ink);
  justify-self: end;
  white-space: pre-wrap;
}
.bubble.assistant {
  background: var(--assistant);
  color: var(--ink);
  justify-self: start;
  white-space: pre-wrap;
}
.bubble.assistant.is-waiting {
  display: inline-flex;
  align-items: center;
  min-width: 84px;
  min-height: 60px;
}
.bubble.assistant.is-rich {
  white-space: normal;
  line-height: 1.72;
}
.bubble.assistant.is-rich > *:first-child {
  margin-top: 0;
}
.bubble.assistant.is-rich > *:last-child {
  margin-bottom: 0;
}
.bubble.assistant.is-rich p,
.bubble.assistant.is-rich ul,
.bubble.assistant.is-rich ol,
.bubble.assistant.is-rich .assistant-table-wrap {
  margin: 0 0 12px;
}
.bubble.assistant.is-rich ul,
.bubble.assistant.is-rich ol {
  padding-left: 1.25rem;
}
.bubble.assistant.is-rich li + li {
  margin-top: 0.45rem;
}
.bubble.assistant.is-rich .assistant-heading {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.bubble.assistant.is-rich strong {
  font-weight: 700;
}
.bubble.assistant.is-rich code {
  font-family: "SFMono-Regular", ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.92em;
  padding: 0.08em 0.38em;
  border-radius: 8px;
  background: var(--bg-elevated);
}
.assistant-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elevated);
}
.assistant-table-wrap table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.assistant-table-wrap th,
.assistant-table-wrap td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}
.assistant-table-wrap thead th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 700;
}
.assistant-table-wrap tbody tr:last-child td {
  border-bottom: 0;
}
.typing-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}
.typing-indicator-logo {
  width: 30px;
  height: 30px;
  display: block;
  transform-origin: center;
  animation: typing-logo 1.6s infinite ease-in-out;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.08));
}
@keyframes typing-logo {
  0%, 100% {
    opacity: 0.72;
    transform: translateY(0) scale(0.97);
  }
  50% {
    opacity: 1;
    transform: translateY(-4px) scale(1.06);
  }
}
.error {
  margin: 0 24px 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(180, 35, 24, 0.14);
  color: var(--danger);
  background: var(--danger-bg);
}
.error[hidden] {
  display: none;
}
.controls {
  padding: 0 24px 24px;
}
.composer {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card-strong);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.05);
  padding: 16px;
}
.chat-form {
  display: grid;
  gap: 14px;
}
#reset-form {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.guard-note {
  margin: 14px 2px 0;
  color: var(--subtle);
  font-size: 0.84rem;
  line-height: 1.65;
}
textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(0, 100, 200, 0.08);
}
textarea:disabled {
  background: var(--bg-elevated);
  color: var(--subtle);
}
.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.composer-note {
  font-size: 0.88rem;
  color: var(--muted);
}
button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease, background 160ms ease;
}
button:disabled {
  cursor: wait;
  opacity: 0.7;
}
.send {
  background: var(--accent);
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--ink);
  font-weight: 600;
}
.reset {
  background: var(--bg-elevated);
  border-color: var(--line);
  color: var(--ink);
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--accent-strong);
}
.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;
}
@media (max-width: 720px) {
  body {
    padding: 10px 10px 18px;
  }
  .container {
    border-radius: 22px;
  }
  .header,
  .messages,
  .controls,
  .error {
    margin-left: 0;
    margin-right: 0;
  }
  .header {
    padding: 16px 18px;
  }
  .intro {
    padding: 44px 18px 30px;
  }
  .messages {
    padding: 0 18px 20px;
  }
  .controls {
    padding: 0 18px 18px;
  }
  .bubble,
  .reasoning {
    max-width: 100%;
    width: 100%;
  }
  .actions {
    align-items: stretch;
  }
  .composer-note {
    width: 100%;
  }
  .assistant-table-wrap table {
    min-width: 0;
    font-size: 0.9rem;
  }
}
