:root {
  --bg: #faf8f3;
  --bg-soft: #fff7ef;
  --panel: #ffffff;
  --panel-2: #fffaf4;
  --line: #e8e1d7;
  --text: #1f1b16;
  --muted: #7c7468;
  --brand: #f97316;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Inter, sans-serif;
  background: radial-gradient(circle at 55% -30%, #ffe8d4 0%, #fff8ef 34%, #faf8f3 62%, #f8f6f1 100%);
  color: var(--text);
}

.brand-word {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.chat-app {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid #34353b;
  background: linear-gradient(180deg, #17181b 0%, #15161a 100%);
  padding: 14px;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f2efe7;
  text-decoration: none;
  font-weight: 700;
  margin: 4px 0 12px;
}

.sidebar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sidebar-btn {
  width: 100%;
  border: 1px solid #3c3d44;
  background: #23242a;
  color: #f3f0e8;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.sidebar-btn.ghost {
  background: transparent;
  color: #d8d4ca;
}

.sidebar-btn:hover {
  border-color: #595b65;
}

.section-title {
  margin: 0;
  font-size: 10px;
  color: #98978f;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.section-value {
  margin: 5px 0 0;
  font-weight: 600;
  font-size: 13px;
}

.recent-list {
  margin-top: 16px;
}

.recent-title {
  margin: 0 0 8px;
  font-size: 11px;
  color: #86857e;
}

.recent-item {
  margin: 0 0 6px;
  font-size: 13px;
  color: #c5c2b8;
  padding: 2px 0;
}

.main {
  height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto;
  background: linear-gradient(180deg, rgba(255, 247, 236, 0.9) 0%, #fffdfa 35%, #faf8f3 100%);
  overflow: hidden;
}

.home-state {
  max-width: 760px;
  width: calc(100% - 48px);
  margin: 0 auto;
  align-self: center;
  text-align: center;
}

.home-badge {
  display: inline-flex;
  border: 1px solid #eadfce;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #9a856f;
  background: #fff;
}

.home-title {
  margin: 20px 0 0;
  font-size: clamp(38px, 7vw, 56px);
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.home-title .brand-word {
  color: var(--brand);
}

.home-copy {
  margin: 12px auto 0;
  max-width: 58ch;
  color: #6f6252;
  font-size: 16px;
  line-height: 1.7;
}

.connection-note {
  margin: 14px auto 0;
  max-width: 58ch;
  font-size: 12px;
  color: #8f7d68;
}

.messages {
  width: min(940px, calc(100% - 40px));
  margin: 0 auto;
  display: none;
  overflow-y: auto;
  padding: 22px 0 130px;
}

.messages {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.messages::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.messages.has-chat {
  display: block;
}

.message {
  margin-bottom: 12px;
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.assistant {
  display: flex;
  justify-content: flex-start;
}

.bubble-wrap {
  max-width: min(760px, 92%);
}

.message-label {
  margin: 0 0 6px;
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #8d7f6f;
}

.assistant-label {
  margin-bottom: 8px;
}

.assistant-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.assistant-avatar {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: none;
}

.assistant-avatar.white-spin {
  width: 38px;
  height: 38px;
  filter: brightness(0) invert(1);
  animation: thinkingSpin 1.2s linear infinite;
}

.assistant-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
  color: #1a1a1a;
}

.message.user .message-label {
  text-align: right;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.72;
  font-size: 16px;
}

.message-text h1,
.message-text h2,
.message-text h3 {
  margin: 18px 0 8px;
  line-height: 1.35;
}

.message-text h1 {
  font-size: 22px;
}

.message-text h2 {
  font-size: 20px;
}

.message-text h3 {
  font-size: 17px;
}

.message-text p {
  margin: 0 0 12px;
}

.message-text ul {
  margin: 4px 0 14px 22px;
  padding: 0;
}

.message-text ol {
  margin: 4px 0 14px 22px;
  padding: 0;
}

.message-text li {
  margin: 0 0 6px;
}

.message-text strong {
  font-weight: 800;
}

.bubble {
  border-radius: 18px;
  padding: 11px 14px;
  border: 1px solid transparent;
}

.bubble-user {
  color: #fff4ea;
  background: linear-gradient(180deg, #f97316, #ea6800);
  border-color: rgba(255, 181, 125, 0.35);
}

.bubble-assistant {
  color: #231f1a;
  background: transparent;
  border: none;
  padding: 0;
}

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #413629;
}

.thinking-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: none;
  animation: thinkingSpin 1.2s linear infinite;
}

.thinking-text {
  font-weight: 600;
  color: #8d704f;
  animation: thinkingSoftPulse 1.3s ease-in-out infinite;
}

@keyframes thinkingSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes thinkingSoftPulse {
  0%,
  100% {
    opacity: 0.78;
    color: #b38e65;
  }

  50% {
    opacity: 1;
    color: #8d704f;
  }
}

.composer {
  padding: 10px 20px 18px;
  background: linear-gradient(180deg, rgba(250, 248, 243, 0.15) 0%, rgba(250, 248, 243, 0.92) 28%, #faf8f3 100%);
  border-top: 1px solid #eee3d4;
}

.composer-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  border: 1px solid #ebddcc;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdf9, #fff9f1);
  padding: 14px;
  box-shadow: 0 12px 35px rgba(164, 118, 65, 0.08);
}

.composer textarea {
  width: 100%;
  min-height: 56px;
  border: 0;
  outline: none;
  resize: none;
  color: #2b241d;
  background: transparent;
  font: inherit;
  line-height: 1.6;
  max-height: 260px;
}

.composer textarea::placeholder {
  color: #9a8a78;
}

.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.voice-toggle {
  border: 1px solid #e7d8c4;
  border-radius: 14px;
  background: #fff;
  color: #8f704f;
  box-shadow: 0 8px 18px rgba(164, 118, 65, 0.12);
  cursor: pointer;
}

.voice-toggle:hover {
  border-color: #dbbc94;
  color: #7f5b36;
  transform: translateY(-1px);
}

.voice-toggle.recording {
  background: #1f1b16;
  border-color: #1f1b16;
  color: #fff;
}

.voice-toggle .icon--stop {
  display: none;
}

.voice-toggle.recording .icon--mic {
  display: none;
}

.voice-toggle.recording .icon--stop {
  display: block;
}

.model-pill {
  border: 1px solid #eadfce;
  color: #705c45;
  background: #fff;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
}

.send-btn {
  border: 1px solid #e5721c;
  background: linear-gradient(135deg, #f97316, #f56013);
  color: #fff;
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.28);
}

.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 24px rgba(249, 115, 22, 0.34);
}

.icon {
  width: 19px;
  height: 19px;
}

.composer button:focus-visible {
  outline: 2px solid #f6b27f;
  outline-offset: 2px;
}

.composer button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.composer button:disabled:hover {
  transform: none;
}

.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;
}

.composer-meta {
  width: min(940px, 100%);
  margin: 8px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.token-usage,
.back-link {
  color: #867563;
  font-size: 12px;
}

.sidebar .brand-word,
.recent-title .brand-word,
.recent-item .brand-word {
  color: #ffffff;
}

.back-link {
  text-decoration: none;
}

@media (max-width: 980px) {
  .chat-app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .home-title {
    font-size: clamp(32px, 9vw, 44px);
  }
}
