
/* Satoshi Variable Font */
@font-face {
  font-family: 'Satoshi';
  src: url('/static/font/Satoshi-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

* {
  font-family: 'Satoshi', ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

*:hover {
  scrollbar-color: #ffffff transparent !important;
}

*:hover::-webkit-scrollbar-thumb {
  background: #ffffff !important;
}

html, body {
  margin: 0;
  background: linear-gradient(180deg, #303b57 100%);
  color: #9ca3af;
  font-family: 'Satoshi', ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

html {
  color-scheme: dark;
}

:root, .uk-theme-slate {
  --background: #0c121e;
  --foreground: 241 241 241;
}

.text-base {
  font-size: 0.9rem !important;
  line-height: 1.5rem;
  color: #f1f1f1;
}

.chat-panel {
  background: transparent;
}

.chat-row-user {
  margin: 0 20px;
  clear: both;
  color: #9ca3af;
}

.user-message-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-left: 0;
}

.user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  color: #3b82f6;
  border-radius: 8px;
  font-weight: 500;
  font-size: 2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.user-message-content .marked {
  flex: 1;
}

.chat-row-user p {
  margin-bottom: 6px;
  text-align: left;
  font-weight: 600;
  font-size: 1rem;
  color: #f1f1f1;
}

.chat-row-user .marked {
  color: #9ca3af;
  text-align: left;
  font-size: 1rem;
}

.chat-row-assistant {
  background: transparent;
  margin: 0 20px;
  clear: both;
}

.chat-row-assistant .marked {
  margin-left: 36px;
}

.chat-row-block {
  padding: 3px 7px;
  clear: both;
}

/* Only apply flex reordering when .tool-html is present */
.chat-row-assistant .marked:has(.tool-html) {
  display: flex;
  flex-direction: column;
  padding-left: 0;
  margin-left: 36px;
}

.chat-row-assistant .marked:has(.tool-html) .tool-html {
  order: 2;
}

.chat-row-assistant .marked:has(.tool-html) p {
  order: 1;
}

.chat-row-user .marked:has(.tool-html) {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.chat-row-user .marked:has(.tool-html) .tool-html {
  order: 2;
}

.chat-row-user .marked:has(.tool-html) p {
  order: 1;
}

.tool-status {
  display: block;
  width: fit-content;
  margin: 5px 0 5px 0px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.tool-status--running {
  position: relative;
  color: #9CA3AF;
}

.tool-status--running::after {
  content: " ...";
  animation: loading-dots 1.4s steps(4, end) infinite;
}

.tool-status--done {
  color:#9CA3AF;
}

.tool-status--done .tool-status-check {
  color: #16a34a;
  font-weight: 700;
  margin-left: 0.25rem;
}

@keyframes loading-dots {
  0%, 20% { content: " ."; }
  40% { content: " .."; }
  60%, 100% { content: " ..."; }
}

@keyframes tool-shimmer {
  0% { transform: translateX(0); }
  100% { transform: translateX(100%); }
}

.assistant-loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(241, 241, 241, 0.35);
  border-top-color: #f1f1f1;
  animation: assistant-spin 0.85s linear infinite;
}

@keyframes assistant-spin {
  to { transform: rotate(360deg); }
}

.marked a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

.marked a:hover {
  color: #1d4ed8;
}

.marked table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
  color: #f1f1f1;
  background: rgba(12, 18, 30, 0.45);
  border: 1px solid #3a475d;
  border-radius: 10px;
  overflow: hidden;
}

.marked thead th {
  background: rgba(48, 59, 87, 0.8);
  color: #f1f1f1;
  font-weight: 600;
  border: 1px solid #3a475d;
  padding: 10px 12px;
  text-align: left;
}

.marked tbody td {
  border: 1px solid #3a475d;
  background: rgba(12, 18, 30, 0.35);
  color: #f1f1f1;
  padding: 10px 12px;
  vertical-align: top;
}

.marked tbody tr:nth-child(odd) {
  background: transparent;
}

.marked tbody tr:hover {
  background: rgba(48, 59, 87, 0.5);
}

.marked blockquote {
  margin: 16px 0;
  padding: 12px 14px;
  background: #f8fafc;
  color: #475569;
  border-radius: 8px;
}

.marked pre {
  background: #f8fafc;
  color: #0f172a;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: auto;
  text-align: left;
  position: relative;
}

.marked {
  font-family: 'Martel Sans', ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}

.marked :not(pre) > code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  font-size: 0.95em;
}

.marked pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  text-align: left;
}

.marked pre .code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.9);
  color: #64748b;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  pointer-events: none;
}

.marked pre:hover .code-copy-btn,
.marked pre:focus-within .code-copy-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.marked pre .code-copy-btn svg {
  width: 16px;
  height: 16px;
}

.marked pre .code-copy-btn:hover {
  color: #0f172a;
  border-color: #cbd5f5;
}

.marked pre .code-copy-btn[data-copied="true"] {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.marked .mermaid-container {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 8px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.marked .mermaid-wrapper {
  min-height: 0;
  height: fit-content;
  overflow: hidden;
  position: relative;
}

.marked .mermaid-wrapper svg {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.marked .mermaid-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 4px 6px;
  z-index: 10;
}

.marked .mermaid-controls button {
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 999px;
  cursor: pointer;
}

.marked .mermaid-controls button:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.marked .mermaid-error {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.9rem;
  padding: 10px 12px;
  margin: 8px 0;
}

.marked .tool-html {
  margin: 14px 0 14px 0;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(138, 207, 249, 0.28);
  /* background: linear-gradient(180deg, rgba(48, 59, 87, 0.35) 0%, rgba(12, 18, 30, 0.35) 100%);
  box-shadow:
    0 0 0 1px rgba(118, 142, 248, 0.2) inset,
    0 0 18px rgba(138, 207, 249, 0.22),
    0 0 38px rgba(118, 142, 248, 0.18); */
}

.marked .tool-html iframe,
.marked .tool-html canvas,
.marked .tool-html svg {
  border-radius: 10px;
}

.marked ul,
.marked ol {
  margin: 12px 0;
  padding-left: 1.25rem;
}

.marked ul {
  list-style: disc;
}

.marked ol {
  list-style: decimal;
}

.marked li {
  display: list-item;
}

.marked li::marker {
  color: currentColor;
}

.marked hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 20px 0;
}

#cards,
.chat-panel {
  overflow-anchor: none;
}

.marked details.tool-call {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px 8px;
  color: #475569;
  margin: 14px 0;
  font-size: 0.85rem;
}

.marked details.tool-call summary {
  cursor: pointer;
  color: #64748b;
  font-weight: 600;
  font-size: 0.85rem;
}

.marked details.tool-call pre {
  background: #e2e8f0;
  color: #334155;
  border-color: #cbd5f5;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.copy-btn {
  display: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #94a3b8;
}

.copy-btn:hover {
  color: #475569;
}

.copy-chat-btn {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 10px;
  color: #475569;
  gap: 6px;
  display: inline-flex;
  align-items: center;
}

.copy-chat-btn:hover {
  color: inherit;
}

.copy-chat-btn svg {
  width: 14px;
  height: 14px;
  color: #f1f1f1;
}

.copy-btn svg {
  width: 12px;
  height: 12px;
}

.copy-btn[data-copied="true"] {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

.copy-btn .copy-label {
  display: none;
}

.copy-chat-btn[data-copied="true"] {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

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