:root {
  color-scheme: dark;
  --bg: #080b0f;
  --panel: #0e141b;
  --panel-soft: #151d26;
  --panel-raised: #1b2530;
  --ink: #f4f7f8;
  --muted: #9aa8b3;
  --line: #283542;
  --accent: #35b89f;
  --accent-strong: #25a58e;
  --gold: #f0c85a;
  --danger: #ff7b72;
  --user: #163d38;
  --shadow: rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
}

button,
textarea,
input {
  min-width: 0;
  font: inherit;
}

button {
  cursor: pointer;
}

[v-cloak] {
  display: none;
}

.login-body {
  display: grid;
  min-height: 100dvh;
  overflow-y: auto;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 20% 10%, rgba(53, 184, 159, 0.18), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(240, 200, 90, 0.14), transparent 32%),
    var(--bg);
}

.login-shell {
  width: min(100%, 390px);
}

.login-card {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: clamp(18px, 6vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 20, 27, 0.96);
  box-shadow: 0 24px 80px var(--shadow);
}

.login-logo {
  width: clamp(86px, 34vw, 132px);
  height: auto;
  padding: 8px;
  border: 1px solid rgba(240, 200, 90, 0.38);
  border-radius: 8px;
  background: #f8f2d8;
}

.kicker {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 2px 0 0;
  font-size: clamp(1.85rem, 10vw, 2.55rem);
  line-height: 0.98;
}

.login-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.login-card label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.login-card input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #0a0f14;
  color: var(--ink);
}

.login-card input:focus,
.composer textarea:focus {
  outline: 2px solid rgba(53, 184, 159, 0.44);
  outline-offset: 2px;
}

.login-card button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #04100e;
  font-weight: 900;
}

.login-error {
  border: 1px solid rgba(255, 123, 114, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--danger);
  background: rgba(255, 123, 114, 0.08);
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
  height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
  background: var(--panel);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: max(10px, env(safe-area-inset-top)) 10px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 20, 27, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: clamp(42px, 12vw, 58px);
  height: auto;
  flex: 0 0 auto;
  padding: 4px;
  border: 1px solid rgba(240, 200, 90, 0.42);
  border-radius: 6px;
  background: #f8f2d8;
}

.brand-copy {
  min-width: 0;
}

.topbar h1 {
  margin: 1px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(1.05rem, 5.4vw, 1.32rem);
  line-height: 1.08;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.icon-button,
.send-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.icon-button {
  width: clamp(38px, 10.5vw, 44px);
  height: clamp(38px, 10.5vw, 44px);
  background: var(--panel-soft);
  color: var(--ink);
  font-size: clamp(1.25rem, 7vw, 1.55rem);
  line-height: 1;
}

.chat-pane {
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 10px 16px;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  min-width: 0;
  margin: 0 0 12px;
}

.message-user {
  justify-content: flex-end;
}

.bubble {
  width: fit-content;
  max-width: min(92%, 640px);
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--panel-raised);
  box-shadow: 0 10px 28px var(--shadow);
}

.message-user .bubble {
  border-color: rgba(53, 184, 159, 0.34);
  background: var(--user);
}

.message-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.plain-message,
.markdown-body {
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.48;
}

.plain-message {
  margin: 0;
  white-space: pre-wrap;
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body p {
  margin: 0 0 0.72rem;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 0.95rem 0 0.38rem;
  line-height: 1.18;
}

.markdown-body h2 {
  font-size: 1.08rem;
}

.markdown-body h3,
.markdown-body h4 {
  font-size: 1rem;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.35rem 0 0.8rem;
  padding-left: 1.25rem;
}

.markdown-body li {
  margin: 0.25rem 0;
}

.markdown-body code {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08rem 0.28rem;
  background: #0a0f14;
  color: #f7d66d;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #0a0f14;
}

.markdown-body pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.markdown-body blockquote {
  margin: 0.65rem 0;
  border-left: 3px solid var(--gold);
  padding: 0.1rem 0 0.1rem 0.75rem;
  color: #d9e1e5;
}


.table-scroll {
  max-width: 100%;
  margin: 0.7rem 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.markdown-body table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #101821;
  font-size: 0.86rem;
}

.markdown-body th,
.markdown-body td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.markdown-body th {
  color: var(--gold);
  font-weight: 900;
  background: #141f2a;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}
.sources {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.loading-bubble {
  display: flex;
  gap: 6px;
  width: 66px;
  justify-content: center;
}

.loading-bubble span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s infinite ease-in-out;
}

.loading-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-bubble span:nth-child(3) {
  animation-delay: 0.3s;
}

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

.composer-wrap {
  min-width: 0;
  padding: 9px 9px max(9px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(14, 20, 27, 0.98);
}

.suggestions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin-bottom: 9px;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.suggestions button {
  display: flex;
  align-items: center;
  flex: 0 0 clamp(156px, 58vw, 280px);
  min-height: 42px;
  max-width: min(76vw, 280px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel-soft);
  color: var(--ink);
  font-size: clamp(0.76rem, 3.3vw, 0.86rem);
  line-height: 1.18;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(44px, 11vw, 50px);
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.composer textarea {
  width: 100%;
  min-height: 46px;
  max-height: 128px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #090e13;
  color: var(--ink);
  line-height: 1.35;
}

.send-button {
  width: clamp(44px, 11vw, 50px);
  height: clamp(44px, 11vw, 50px);
  background: var(--accent);
  color: #04100e;
  font-size: 1.35rem;
  font-weight: 900;
}

.send-button:disabled,
.composer textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.send-button:not(:disabled):hover,
.login-card button:hover {
  background: var(--accent-strong);
}

.icon-button:hover,
.suggestions button:hover {
  border-color: rgba(53, 184, 159, 0.55);
  background: #1e2b36;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (min-width: 720px) {
  body {
    background:
      radial-gradient(circle at 12% 8%, rgba(53, 184, 159, 0.16), transparent 30%),
      radial-gradient(circle at 90% 12%, rgba(240, 200, 90, 0.10), transparent 34%),
      var(--bg);
  }

  .app-shell {
    height: min(100dvh, 980px);
    border-inline: 1px solid var(--line);
  }

  .chat-pane {
    padding: 18px 14px 20px;
  }

  .composer-wrap {
    padding-inline: 12px;
  }
}

@media (max-width: 380px) {
  .brand {
    gap: 7px;
  }

  .kicker {
    font-size: 0.64rem;
  }

  .header-actions {
    gap: 5px;
  }

  .bubble {
    max-width: 95%;
    padding: 9px 10px;
  }
}
.landing-body {
  display: grid;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: 0;
  background: #000;
}

.landing-shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  place-items: center;
}

.landing-logo {
  display: block;
  width: min(72vw, 320px);
  height: auto;
  padding: clamp(10px, 4vw, 18px);
  border-radius: 8px;
  background: #f8f2d8;
}