:root {
  --tt-bg: #0f1419;
  --tt-surface: #1a2332;
  --tt-text: #e8ecf1;
  --tt-muted: #8b98a8;
  --tt-accent: var(--tt-brand, #3d9a6e);
  --tt-radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.tt-chat {
  margin: 0;
  min-height: 100vh;
  background: var(--tt-bg);
  color: var(--tt-text);
  display: flex;
  flex-direction: column;
}

.tt-header {
  padding: 1rem 1.25rem;
  background: var(--tt-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tt-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--tt-accent), #1e5c40);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.tt-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.tt-tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--tt-muted);
}

.tt-main {
  flex: 1;
  padding: 1rem 1.25rem 2rem;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
}

.tt-panel {
  background: var(--tt-surface);
  border-radius: var(--tt-radius);
  padding: 1rem;
  min-height: 12rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tt-placeholder {
  color: var(--tt-muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}

.tt-slug {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--tt-muted);
  margin-top: 1rem;
}

.tt-repo-line {
  margin: 1rem 0 0.35rem;
}

.tt-repo-link {
  color: var(--tt-accent);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}

.tt-repo-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tt-repo-caption {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--tt-muted);
  line-height: 1.45;
}

.tt-code {
  font-family: ui-monospace, monospace;
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.tt-pre {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.tt-messages {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(52vh, 28rem);
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.25rem;
}

.tt-msg {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.tt-msg-user {
  align-items: flex-end;
}

.tt-msg-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tt-muted);
}

.tt-msg-bubble {
  max-width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.tt-msg-user .tt-msg-bubble {
  background: color-mix(in srgb, var(--tt-accent) 22%, var(--tt-surface));
  border: 1px solid color-mix(in srgb, var(--tt-accent) 40%, transparent);
}

.tt-msg-assistant .tt-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tt-api-hint {
  font-size: 0.72rem;
  color: var(--tt-muted);
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.tt-chat-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tt-input {
  width: 100%;
  resize: vertical;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: var(--tt-text);
  font: inherit;
  line-height: 1.45;
}

.tt-input:focus {
  outline: 2px solid color-mix(in srgb, var(--tt-accent) 55%, transparent);
  outline-offset: 1px;
}

.tt-send {
  align-self: flex-end;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--tt-accent), #1e6b47);
  color: #fff;
}

.tt-send:hover:not(:disabled) {
  filter: brightness(1.08);
}

.tt-send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
