:root {
  color-scheme: dark;
  font: 100%/1.5 system-ui, -apple-system, sans-serif;
  --bg: #141520;
  --rail: #10111a;
  --surface: #1d1f2d;
  --border: #303142;
  --text: #f3f1fa;
  --muted: #abaabc;
  --accent: #c3b3ff;
  --accent-ink: #21183a;
  --width: 47.5rem;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, .stage:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden], .symbols { display: none !important; }
.sr-only {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  white-space: nowrap;
}
.icon {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app { display: grid; grid-template-columns: 15rem minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 1.3rem 0.9rem 1rem;
  background: var(--rail);
  border-inline-end: 1px solid #242537;
  min-width: 0;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding-inline: .3rem;
  margin-bottom: 1.75rem;
  font-size: 1.27rem;
  font-weight: 720;
  letter-spacing: -.035em;
}
.accent { color: var(--accent); }
.brand-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.2rem;
  aspect-ratio: 1;
  border-radius: .7rem;
  color: #d4c8ff;
  background: linear-gradient(155deg, #40366b, #282346);
  border: 1px solid #51477a;
}
.brand-icon svg { width: 1.2rem; height: 1.2rem; }
.brand-icon.small { width: 2rem; border-radius: .6rem; }
.new-chat {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 3rem;
  padding: 0 .85rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: #1c1d2a;
  text-align: start;
  font-size: .875rem;
  font-weight: 630;
}
.new-chat:hover:not(:disabled) { background: #27283b; border-color: #4a4664; }
.new-chat .icon { color: var(--accent); }
.recents { margin-top: 1.9rem; }
.eyebrow {
  margin: 0 0 .45rem .65rem;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.recent {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .65rem;
  border-radius: .55rem;
  background: #1a1b29;
  color: #dfdbee;
  font-size: .825rem;
}
.recent .icon { color: #a99bd6; }
.recent span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-footer {
  margin-top: auto;
  padding: .9rem .35rem .25rem;
  border-top: 1px solid #292a3b;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .8rem;
}
.sidebar-footer strong, .sidebar-footer div span { display: block; }
.sidebar-footer div span { color: var(--muted); font-size: .72rem; }

.main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.6rem;
  min-height: 4.1rem;
  border-bottom: 1px solid #242537;
}
.model-name { display: flex; align-items: center; gap: .45rem; font-size: 1.05rem; font-weight: 700; }
.version {
  padding: .12rem .4rem;
  background: #29253e;
  border: 1px solid #3a3352;
  color: #cfc3f3;
  border-radius: .35rem;
  font-size: .69rem;
  line-height: 1.2;
}
.online {
  display: flex;
  align-items: center;
  gap: .42rem;
  margin-inline-start: auto;
  font-size: .75rem;
  font-weight: 570;
  color: #c6c3d5;
}
.online span { width: .41rem; height: .41rem; border-radius: 50%; background: #7ee0b1; box-shadow: 0 0 .65rem #7ee0b148; }
.mobile-mark, .mobile-new { display: none; }

.stage {
  min-height: 0;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #4b4762 transparent;
  scrollbar-width: thin;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.stage:has(.welcome:not([hidden])) {
  display: flex;
  background: radial-gradient(ellipse 34rem 20rem at 50% 45%, #231f3a 0%, transparent 77%);
}
.welcome { margin: auto; width: min(100%, 40rem); padding-block: 1.7rem; text-align: center; }
.emblem {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.5rem;
  aspect-ratio: 1;
  margin: 0 auto 1.45rem;
  border-radius: 1.45rem;
  background: linear-gradient(145deg, #4a3e76, #252039);
  border: 1px solid #685892;
  color: #d9ceff;
  box-shadow: 0 0 0 .45rem #8d70e015, 0 0 0 .9rem #8d70e00b, 0 .8rem 3rem #1410209e;
}
.emblem svg { width: 2.55rem; height: 2.55rem; filter: drop-shadow(0 0 .6rem #b091ff66); }
.welcome h1 {
  margin: 0;
  font-size: clamp(1.95rem, 5vw, 3.15rem);
  font-weight: 690;
  line-height: 1.1;
  letter-spacing: -.057em;
  text-wrap: balance;
}
.welcome p { margin: .7rem 0 0; font-size: 1rem; color: var(--muted); }
.suggestions { margin: 2rem auto 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.suggestions button {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  min-height: 3rem;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: #1e2030;
  text-align: start;
  font-size: .78rem;
  font-weight: 570;
}
.suggestions button:hover:not(:disabled) { background: #29263e; border-color: #615580; }
.tile-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: .45rem;
  background: #312a49;
  color: #cbb9fa;
}
.tile-icon .icon { width: .95rem; height: .95rem; }
.chevron { margin-inline-start: auto; width: .8rem; height: .8rem; color: #a9a2bd; }

.messages { display: grid; gap: 1.35rem; width: min(100%, var(--width)); margin-inline: auto; }
#messages { padding-block: 1.6rem .9rem; }
.pending { padding-block: .45rem 1rem; }
.turn.user { justify-self: end; max-width: 83%; }
.turn.user p {
  margin: 0;
  padding: .65rem .95rem;
  border-radius: 1.15rem 1.15rem .35rem 1.15rem;
  background: #2c2745;
  border: 1px solid #3d3558;
  color: #f5f0ff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant { display: flex; align-items: flex-start; gap: .65rem; }
.turn-content { min-width: 0; padding-top: .18rem; }
.speaker { display: block; font-size: .83rem; }
.answer { margin-top: .32rem; }
.thinking { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.dot {
  flex: none;
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: .5; transform: scale(.75); } to { opacity: 1; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

.composer {
  width: 100%;
  padding: .55rem clamp(1rem, 4vw, 2rem) calc(.75rem + env(safe-area-inset-bottom, 0px));
}
#chat-form {
  display: flex;
  align-items: flex-end;
  gap: .55rem;
  max-width: var(--width);
  margin-inline: auto;
  padding: .5rem;
  border: 1px solid #3f3e54;
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: 0 .35rem 1.4rem #0d0d1866;
}
#chat-form:focus-within { border-color: #8b7ba9; }
#message {
  width: 100%;
  min-height: 3rem;
  max-height: 8rem;
  max-height: min(8rem, 25dvh);
  padding: .75rem .55rem .55rem;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 1rem;
  line-height: 1.4;
  resize: none;
}
#message::placeholder { color: #aba9bd; }
#send {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border: 0;
  border-radius: .8rem;
  background: var(--accent);
  color: var(--accent-ink);
}
#send .icon { width: 1.3rem; height: 1.3rem; stroke-width: 2.15; }
#send:hover:not(:disabled) { background: #ddd0ff; }
#send:disabled, #chat-form:not(:focus-within) #message:placeholder-shown + #send { background: #373147; color: #b8a9d1; }
.disclaimer { margin: .65rem 0 0; color: #a2a0b5; text-align: center; font-size: .72rem; }

@media (max-width: 54rem) {
  .app { grid-template-columns: 12rem minmax(0, 1fr); }
  .suggestions { grid-template-columns: 1fr; max-width: 18rem; gap: .4rem; }
}
@media (max-width: 43rem) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { min-height: 3.6rem; padding: .35rem .8rem; gap: .55rem; }
  .mobile-mark { display: grid; margin-inline-end: .2rem; width: 1.85rem; }
  .mobile-mark svg { width: 1rem; height: 1rem; }
  .mobile-new { display: grid; place-items: center; width: 3rem; padding: 0; }
  .welcome { padding-block: 1.1rem; }
  .emblem { width: 3.5rem; border-radius: 1.05rem; margin-bottom: 1.05rem; }
  .emblem svg { width: 2rem; height: 2rem; }
  .suggestions { margin-top: 1.25rem; }
  .disclaimer { font-size: .68rem; }
}
@media (max-height: 32rem) {
  .welcome { padding-block: 1rem; }
  .suggestions { margin-top: .8rem; }
  .emblem { display: none; }
}
