:root {
  color-scheme: dark;
  font: 16px/1.55 "Geist", "Inter", "Segoe UI", system-ui, sans-serif;
  color: #ededed;
  background: #141415;
  --base: #141415;
  --paper: #19191b;
  --raised: #232325;
  --line: #303033;
  --secondary: #a9a9af;
  --accent: #c3d0dc;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
main { width: min(920px, calc(100% - 48px)); margin: 28px auto; }
.heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; }
h1 { font-size: 1.25rem; line-height: 1.3; margin: 0; font-weight: 600; }
.panel, .thread { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.host { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
#clear-chat { margin-left: auto; color: #ffb4b4; }
button, input {
  font: inherit; color: inherit; background: var(--raised); border: 1px solid var(--line);
  min-height: 36px; padding: 6px 12px; border-radius: 8px; font-size: .84rem;
}
button { cursor: pointer; display: inline-flex; align-items: center; transition: background-color 140ms ease; }
button:hover { background: #303034; }
button:disabled { cursor: default; opacity: .55; }
button.primary { background: #ededed; color: #171719; border-color: #ededed; }
button.primary:hover { background: #d5d5d8; }
.host button[aria-pressed="true"] { border-color: #63768c; color: #dce7f2; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.thread { height: clamp(340px, calc(100dvh - 148px), 820px); overflow: hidden; }
.host:not([hidden]) ~ .thread { height: clamp(320px, calc(100dvh - 214px), 760px); }
.thread-empty { padding: 20px; color: var(--secondary); font-size: .92rem; }
.thread .cs-chat-container, .thread .cs-message-list, .thread .cs-message-input { background: transparent; border: 0; font-family: inherit; }
.thread .cs-message-list { padding: 8px 12px; }
.thread .cs-message { max-width: min(84%, 720px); }
.thread .cs-message__content {
  background: transparent; color: #ededed; padding: 8px 16px; border-radius: 16px;
  font-size: .94rem; line-height: 1.6; overflow-wrap: anywhere;
}
.thread .cs-message--outgoing .cs-message__content { background: #26272c; }
.thread .cs-message p { margin: 4px 0 0; white-space: pre-wrap; }
.thread .cs-message-input { border-top: 1px solid var(--line); padding: 12px; }
.thread .cs-message-input__content-editor-wrapper, .thread .cs-message-input__content-editor {
  background: var(--raised); color: #ededed; border-radius: 8px; font-family: inherit;
}
.thread .cs-message-input__content-editor[data-placeholder]::before { color: var(--secondary); }
.thread .cs-button--send, .thread .cs-typing-indicator__text { color: var(--accent); }
.thread .cs-typing-indicator { background: var(--paper); }
.thread .cs-typing-indicator__dot { background: var(--secondary); animation: none; }
.thread .ps__rail-y, .thread .ps__rail-y:hover { background: transparent; }
.thread .ps__thumb-y, .thread .ps__rail-y:hover .ps__thumb-y { background: #505054; }
.join { max-width: 440px; margin: 48px auto; padding: 24px; }
.join p { color: var(--secondary); }
.join label { display: block; margin-bottom: 8px; font-size: .86rem; }
.join input { display: block; width: 100%; margin-bottom: 12px; }
.join details { margin-bottom: 12px; }
.join summary { cursor: pointer; color: var(--secondary); font-size: .86rem; }
.join details[open] label { margin-top: 12px; }
.error { color: #f2b5b5; padding: 8px 12px; background: #302324; border-radius: 8px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border: 1px solid #505058; border-radius: 12px; background: #29292e; color: #ededed; font-size: .86rem; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 670px) {
  .top { padding-inline: 12px; }
  .brand { font-size: .85rem; }
  main { width: calc(100% - 24px); margin-top: 16px; }
  .heading { align-items: center; gap: 8px; }
  h1 { font-size: 1.08rem; }
  .thread .cs-message { max-width: 97%; }
  .thread .cs-message-list { padding-inline: 4px; }
  .thread .cs-message__content { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}

/* DEEP UI Kit chat frame and composer, adapted without the application header. */
.room-frame { position: relative; isolation: isolate; }
.room-scene { position: relative; isolation: isolate; border-radius: 32px; background: #17181b; }
@property --ai-chat-gradient-angle { syntax: '<angle>'; inherits: false; initial-value: 243.864deg; }
.room-rim, .room-ambient {
  position: absolute; pointer-events: none; inset: 0; border-radius: inherit;
  background: linear-gradient(var(--ai-chat-gradient-angle), #90b4df, #a78fe2, #d492af, #78bda1);
  animation: edgeDrift 20s linear infinite;
}
.room-rim { z-index: 0; overflow: hidden; }
.room-rim::after {
  content: ''; position: absolute; inset: 2px; border-radius: inherit;
  background: #17181b; filter: blur(24px);
}
.room-ambient { z-index: -1; border-radius: 32px; filter: blur(24px); opacity: .3; }
@keyframes edgeDrift {
  from { --ai-chat-gradient-angle: 243.864deg; }
  to { --ai-chat-gradient-angle: 603.864deg; }
}
.room-frame[data-glow-paused="true"] .room-rim, .room-frame[data-glow-paused="true"] .room-ambient {
  visibility: hidden;
  animation-play-state: paused;
}
.room-body { position: relative; z-index: 1; padding: 16px 24px 24px; }
.utility { display: flex; gap: 8px; align-items: center; min-height: 36px; margin-bottom: 8px; }
#glow { margin-left: auto; min-width: 36px; justify-content: center; padding: 4px; border: 0; background: transparent; color: var(--secondary); }
#glow:hover { color: #ededed; background: var(--raised); }
#glow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.room-body .thread { border: 0; background: transparent; }
.thread-layout { height: 100%; display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.thread-layout > .cs-chat-container { flex: 1; min-height: 0; }
.composer {
  display: flex; align-items: center; gap: 8px; min-height: 64px;
  padding: 8px 12px; border-radius: 24px; background: #26272c; color: #ededed;
}
.composer:focus-within { background: #2c2d33; }
.composer textarea {
  field-sizing: content;
  flex: 1; min-width: 0; min-height: 44px; max-height: 25dvh;
  resize: vertical; border: 0; background: transparent; color: inherit; font: inherit;
  line-height: 1.5; padding: 10px 4px;
}
.composer textarea:focus-visible { outline: 0; }
.composer textarea::placeholder { color: #a1a1a6; }
.composer .send {
  justify-content: center; width: 36px; height: 36px; min-height: 36px; margin-block: 4px;
  padding: 0; border-radius: 50%; background: #e1e2e6; color: #17181b; font-size: 1.1rem;
}
@media (max-width: 670px) {
  .composer { align-items: flex-end; }
  .room-scene, .room-ambient { border-radius: 24px; }
  .room-body { padding: 12px; }
  .room-body .thread { height: clamp(330px, calc(100dvh - 135px), 750px); }
}
@media (prefers-reduced-motion: reduce) {
  .room-rim, .room-ambient { animation: none; --ai-chat-gradient-angle: 243.864deg; }
}

main:has(.room-frame:not([hidden])) {
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.room-frame, .room-scene, .room-body { height: 100%; min-height: 0; }
.room-body { display: flex; flex-direction: column; }
.room-body .utility, .room-body .host, .room-body .error { flex: none; }
.room-body .error { margin: 0 0 8px; }
.room-body .thread { flex: 1; min-height: 0; height: auto; }
@media (max-width: 670px) {
  .room-body .thread { height: auto; }
  .host { gap: 6px; }
  .host button { min-height: 36px; padding-inline: 10px; }
}
