:root {
  color-scheme: dark;
  --bg-app: #212121;
  --bg-surface: #212121;
  --bg-surface-alt: #2a2a2a;
  --bg-sidebar: #171717;
  --bg-sidebar-hover: #232323;
  --bg-sidebar-active: #2b2b2b;
  --bg-composer: #2f2f2f;
  --bg-user: #303030;
  --text: #ececec;
  --muted: #a7a7a7;
  --muted-2: #8a8a8a;
  --line: #343434;
  --line-soft: #2c2c2c;
  --accent: #10a37f;
  --accent-soft: rgba(16, 163, 127, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --sidebar-width: 260px;
  --content-width: 48rem;
  --transition: 160ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--bg-app);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.035), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 24%);
  pointer-events: none;
}

.backdrop {
  display: none;
}

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 12px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line-soft);
}

.brand-block h1,
.topbar h2,
.thread-header h3,
.hover-panel h4,
.overlay-card h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.brand-block {
  padding: 10px 8px 12px;
}

.sidebar .eyebrow {
  display: none;
}

.brand-block h1 {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.brand-copy,
.system-banner p,
.hover-panel p,
.sidebar-note p,
.overlay-card p,
.topbar-copy p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.brand-copy {
  display: none;
}

.new-thread-button,
.send-button,
.end-session-button,
.prompt-chip,
.thread-item {
  font: inherit;
}

.new-thread-button,
.end-session-button,
.thread-item,
.prompt-chip {
  appearance: none;
  border: 1px solid transparent;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    transform var(--transition),
    opacity var(--transition);
}

.new-thread-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: var(--bg-sidebar-active);
  border-color: var(--line);
  color: var(--text);
  cursor: pointer;
}

.new-thread-button:hover,
.end-session-button:hover,
.prompt-chip:hover,
.thread-item:hover {
  transform: translateY(-1px);
}

.thread-list {
  display: grid;
  gap: 4px;
  overflow: auto;
  padding-right: 2px;
}

.thread-item {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 14px;
  background: transparent;
  border-color: transparent;
  color: var(--text);
  cursor: pointer;
}

.thread-item:hover,
.thread-item.active {
  background: var(--bg-sidebar-hover);
  border-color: var(--line-soft);
}

.thread-item:disabled {
  opacity: 0.74;
  cursor: default;
}

.thread-item:disabled:hover {
  transform: none;
  background: transparent;
  border-color: transparent;
}

.thread-title,
.thread-preview,
.thread-stamp {
  display: block;
}

.thread-title {
  font-size: 0.92rem;
  font-weight: 600;
}

.thread-preview {
  display: none;
}

.thread-stamp {
  display: none;
}

.sidebar-note {
  display: none;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  background: var(--bg-surface);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
}

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

.topbar-copy h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-copy p:last-child {
  display: none;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.end-session-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bg-surface-alt);
  border-color: var(--line);
  color: var(--text);
  cursor: pointer;
}

.workspace-grid {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 24px 24px;
}

.inspector {
  display: none;
}

.thread-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.thread-header,
.system-banner {
  display: none;
}

.empty-state {
  display: grid;
  gap: 12px;
  place-items: center;
  justify-items: center;
  width: min(100%, 42rem);
  margin: auto auto 24px;
  padding-top: 10vh;
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.empty-state h3 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.empty-state p {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.chat-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 28px;
  min-height: 0;
  overflow: auto;
  padding: 18px 0 176px;
}

.message {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  width: min(100%, var(--content-width));
  align-self: center;
}

.message-body {
  min-width: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.assistant .message-body {
  padding: 0;
}

.message-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #111111;
  font-size: 0.86rem;
  font-weight: 800;
}

.assistant-avatar {
  background: #f4f4f4;
}

.message-content {
  min-width: 0;
}

.message.user {
  grid-template-columns: minmax(0, 1fr);
}

.message.user .message-body {
  width: fit-content;
  max-width: min(100%, 34rem);
  margin-left: auto;
  padding: 12px 16px;
  border-radius: 22px;
  background: var(--bg-user);
  border: 1px solid #3b3b3b;
}

.message.typing .message-body {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  animation: bounce 720ms infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 90ms;
}

.typing-dot:nth-child(3) {
  animation-delay: 180ms;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 48rem);
  margin: 0 auto 18px;
}

.quick-prompts.hidden {
  display: none;
}

.prompt-chip {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--bg-surface-alt);
  border-color: var(--line);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.prompt-chip strong,
.prompt-chip span {
  display: block;
}

.prompt-chip strong {
  font-size: 0.95rem;
}

.prompt-chip span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  width: min(100%, var(--content-width));
  align-self: center;
  padding: 12px;
  border: 1px solid #3a3a3a;
  border-radius: 28px;
  background: rgba(47, 47, 47, 0.96);
  box-shadow: var(--shadow);
}

.composer-plus {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.composer-plus:hover {
  background: rgba(255, 255, 255, 0.06);
}

textarea {
  width: 100%;
  min-height: 24px;
  max-height: 180px;
  padding: 4px 4px 2px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
}

textarea::placeholder {
  color: var(--muted);
}

.send-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #f5f5f5;
  color: #111111;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform var(--transition),
    opacity var(--transition),
    background-color var(--transition);
}

.send-button:hover {
  transform: translateY(-1px);
}

.composer-note {
  width: min(100%, var(--content-width));
  margin: 10px auto 0;
  color: var(--muted-2);
  font-size: 0.74rem;
  text-align: center;
}

.session-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.session-overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid #3b3b3b;
  background: #202020;
  box-shadow: var(--shadow);
}

.overlay-card h2 {
  margin-top: 4px;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.overlay-card p:last-of-type {
  margin-top: 12px;
  margin-bottom: 20px;
}

.overlay-card .new-thread-button {
  margin-bottom: 0;
}

.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;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #4b4b4b;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .thread-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 860px) {
  .workspace-grid {
    padding: 0 16px 18px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 16px;
  }

  .end-session-button {
    width: 100%;
  }

  .workspace-grid {
    padding-left: 12px;
    padding-right: 12px;
  }

  .system-banner {
    grid-template-columns: 1fr;
  }

  .message {
    width: 100%;
  }

  .quick-prompts {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .composer {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .composer {
    gap: 10px;
    padding: 10px;
  }
}
