@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Poppins:wght@400;500;600&display=swap");

/* Untitled Studio components. Plain CSS classes (us-*) that work in any
   frontend; every value comes from tokens, so a client theme only has to
   override the brand tokens (accent family, fonts) to re-skin everything. */

.us-root, .us-root * { box-sizing: border-box; }
.us-root [hidden] { display: none !important; }
.us-root { font-family: var(--font-sans); color: var(--ink); background: var(--surface); }

/* Focus ring: solid accent, 2px, offset. 5.2:1 on surface. */
.us-btn:focus-visible, .us-input:focus-visible, .us-prompt textarea:focus-visible,
.us-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Button ---- */
.us-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 20px; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 15px; line-height: 20px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.us-btn-primary { background: var(--accent); color: var(--accent-ink); }
.us-btn-primary:hover { background: var(--accent-deep); }
.us-btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.us-btn-secondary:hover { background: var(--accent-soft); border-color: var(--accent-deep); color: var(--accent-deep); }
.us-btn-ghost { background: transparent; color: var(--ink); }
.us-btn-ghost:hover { background: var(--accent-soft); color: var(--accent-deep); }
.us-btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: var(--radius-sm); }
.us-btn-block { width: 100%; }
.us-btn[disabled], .us-btn[aria-busy="true"] { cursor: not-allowed; }
.us-btn[disabled] { background: var(--line); color: var(--ink-muted); border-color: transparent; }
.us-btn-primary[aria-busy="true"] { background: var(--accent-deep); color: var(--accent-ink); }
.us-spinner {
  width: 16px; height: 16px; border-radius: var(--radius-full);
  border: 2px solid currentColor; border-right-color: transparent;
  animation: us-spin .8s linear infinite;
}
@keyframes us-spin { to { transform: rotate(360deg); } }

/* ---- Icon button (used inside PromptInput and ResultCard) ---- */
.us-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--ink-muted);
  font-family: var(--font-sans); font-size: 14px; cursor: pointer;
}
.us-icon-btn:hover { background: var(--accent-soft); color: var(--accent-deep); }
.us-icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.us-icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Input ---- */
.us-field { display: flex; flex-direction: column; gap: 6px; }
.us-label { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); }
.us-input {
  min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: 16px; line-height: 24px; width: 100%;
}
.us-input::placeholder { color: var(--ink-muted); }
.us-help { font-size: 14px; line-height: 20px; color: var(--ink-muted); margin: 0; }
.us-field-error .us-input { border-color: var(--danger); }
.us-field-error .us-help { color: var(--danger); }

/* ---- Card ---- */
.us-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); }
@media (min-width: 640px) { .us-card { padding: var(--space-6); } }
.us-card-title { margin: 0 0 var(--space-2); font-size: 18px; line-height: 26px; font-weight: 600; }
.us-card-body { margin: 0; font-size: 16px; line-height: 24px; color: var(--ink); }
.us-card-footer { margin-top: var(--space-4); display: flex; gap: var(--space-2); flex-wrap: wrap; }
.us-card-tinted { background: var(--accent-soft); border-color: transparent; }

/* ---- Badge ---- */
.us-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px;
  border-radius: var(--radius-full); font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: .6px; text-transform: uppercase; border: 1px solid var(--line);
  color: var(--ink); background: var(--surface);
}
.us-badge-accent { background: var(--accent-soft); color: var(--accent-deep); border-color: transparent; }
.us-badge-success { color: var(--success); border-color: currentColor; }
.us-badge-danger { color: var(--danger); border-color: currentColor; }
.us-badge-dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }

/* ---- AppBar ---- */
.us-appbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  min-height: 64px; padding: 0 var(--space-4); background: var(--surface); border-bottom: 1px solid var(--line);
}
.us-appbar-brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--ink); }
.us-appbar-logo { height: 32px; width: auto; display: block; }
.us-appbar-name { font-family: var(--font-display); font-size: 28px; line-height: 32px; letter-spacing: .5px; }
.us-appbar-actions { display: flex; align-items: center; gap: var(--space-2); }

/* ---- ChatMessage ---- */
.us-chat { display: flex; flex-direction: column; gap: var(--space-4); }
.us-msg { display: flex; flex-direction: column; gap: 4px; max-width: 85%; }
.us-msg-user { align-self: flex-end; align-items: flex-end; }
.us-msg-assistant { align-self: flex-start; }
.us-msg-who { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .6px; text-transform: uppercase; color: var(--ink-muted); }
.us-msg-bubble { padding: 12px 16px; border-radius: var(--radius-md); font-size: 16px; line-height: 24px; white-space: pre-wrap; }
.us-msg-user .us-msg-bubble { background: var(--accent-soft); color: var(--ink); }
.us-msg-assistant .us-msg-bubble { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.us-msg-error .us-msg-bubble { border-color: var(--danger); }
.us-msg-error .us-msg-who { color: var(--danger); }

/* ---- PromptInput ---- */
.us-prompt {
  display: flex; align-items: flex-end; gap: var(--space-2); padding: 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface);
}
.us-prompt:focus-within { border-color: var(--accent); }
.us-prompt textarea {
  flex: 1; min-height: 44px; max-height: 200px; resize: none; border: 0; padding: 10px 8px;
  font-family: var(--font-sans); font-size: 16px; line-height: 24px; color: var(--ink); background: transparent;
}
.us-prompt textarea:focus-visible { outline: none; }
.us-prompt textarea::placeholder { color: var(--ink-muted); }
.us-prompt .us-btn { min-height: 44px; padding: 0 16px; }

/* ---- ThinkingIndicator ---- */
.us-thinking { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.us-thinking-dots { display: inline-flex; gap: 4px; }
.us-thinking-dots span { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--accent); animation: us-pulse 1.2s ease-in-out infinite; }
.us-thinking-dots span:nth-child(2) { animation-delay: .15s; }
.us-thinking-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes us-pulse { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .us-thinking-dots span, .us-spinner { animation: none; }
  .us-thinking-dots span { opacity: .6; }
}

/* ---- ResultCard ---- */
.us-result { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.us-result-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 12px var(--space-4); border-bottom: 1px solid var(--line); }
.us-result-title { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.us-result-body { padding: var(--space-4); font-size: 16px; line-height: 24px; white-space: pre-wrap; }
.us-result-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); }
.us-result-note { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
