/* UI Components: Buttons, Auth, Conversations, Chat Bubbles, Markdown, Drawer, Modal */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 4px 12px rgba(76, 133, 103, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger-ghost {
  background: transparent;
  border-color: rgba(217, 112, 112, 0.35);
  color: var(--blush);
}

.btn-danger-ghost:hover {
  background: var(--blush-soft);
}

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.chip-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chip-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chip-btn.speaking {
  background: var(--blush-soft);
  border-color: var(--blush);
  color: var(--blush);
}

/* Conversation Items */
.conv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.conv-item:hover {
  background: var(--bg-hover);
}

.conv-item.active {
  background: var(--bg-active);
  border-color: var(--border-subtle);
}

.conv-text {
  min-width: 0;
  flex: 1;
}

.conv-title {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.conv-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.conv-item:hover .conv-actions,
.conv-item.active .conv-actions {
  opacity: 1;
}

.conv-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.conv-action-btn:hover {
  background: var(--bg-surface-solid);
  color: var(--text-primary);
}

.conv-action-btn.delete:hover {
  color: var(--blush);
}

/* Sidebar Util Buttons */
.sidebar-util-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sidebar-util-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-util-btn.danger-subtle:hover {
  background: var(--blush-soft);
  color: var(--blush);
}

.util-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.count-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Empty Welcome State */
.welcome-card {
  margin: 36px auto 12px;
  max-width: 560px;
  text-align: center;
  padding: 28px 24px;
  border-radius: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.welcome-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.welcome-card p {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.65;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.starter-chip {
  text-align: left;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.starter-chip:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Message Rows */
.msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: msg-fade-in 0.2s ease;
}

@keyframes msg-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.msg-body {
  max-width: min(78%, 680px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.msg-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.7;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}

.msg-row.user .msg-bubble {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  border-bottom-right-radius: 5px;
  white-space: pre-wrap;
}

.msg-row.assistant .msg-bubble {
  background: var(--bubble-ai-bg);
  border: 1px solid var(--bubble-ai-border);
  border-bottom-left-radius: 5px;
  color: var(--text-primary);
}

.msg-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
}

.msg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.msg-row:hover .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.msg-action-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Streaming typing cursor */
.streaming-cursor::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: blink-cursor 0.9s steps(1) infinite;
}

@keyframes blink-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Markdown Styling inside AI bubbles */
.md-content > *:first-child { margin-top: 0; }
.md-content > *:last-child { margin-bottom: 0; }
.md-content p { margin: 0.55em 0; }
.md-content h1, .md-content h2, .md-content h3, .md-content h4 {
  margin: 0.8em 0 0.4em;
  line-height: 1.35;
}
.md-content ul, .md-content ol {
  margin: 0.5em 0;
  padding-left: 1.4em;
}
.md-content li { margin: 0.25em 0; }
.md-content blockquote {
  margin: 0.6em 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.md-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md-content code.inline-code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
}
.md-content .code-block {
  margin: 0.75em 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.md-content .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--code-header);
  font-size: 11.5px;
  color: #9cb8a8;
}
.md-content .code-copy-btn {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #dbece2;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.md-content .code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.md-content pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
.md-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.7em 0;
  font-size: 13px;
}
.md-content th, .md-content td {
  border: 1px solid var(--border-subtle);
  padding: 6px 10px;
  text-align: left;
}
.md-content th {
  background: var(--bg-elevated);
}

/* Composer Controls */
.composer-textarea {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 14.5px;
  line-height: 1.55;
  max-height: 160px;
  padding: 7px 4px;
  color: var(--text-primary);
}

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

.composer-icon-btn,
.composer-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.composer-icon-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.composer-icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.composer-icon-btn.recording {
  background: var(--blush);
  color: #ffffff;
  animation: rec-pulse 1.1s infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 112, 112, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(217, 112, 112, 0); }
}

.composer-send-btn {
  background: var(--accent);
  color: var(--accent-text);
}

.composer-send-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.composer-send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.composer-send-btn.stop {
  background: var(--blush);
  color: #ffffff;
}

/* Auth Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 26px 26px;
  border-radius: 26px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
}

.auth-hero {
  text-align: center;
  margin-bottom: 18px;
}

.auth-avatar {
  width: 104px;
  height: 140px;
  object-fit: contain;
  filter: var(--avatar-shadow);
  margin-bottom: 4px;
}

.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.auth-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-elevated);
  margin-bottom: 18px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.16s ease;
}

.auth-tab.active {
  background: var(--bg-surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-error {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--blush-soft);
  color: var(--blush);
  font-size: 13px;
  font-weight: 500;
}

.form-feedback {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}

/* Memory Drawer & Profile Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 17, 0.42);
  backdrop-filter: blur(4px);
  z-index: 60;
}

.drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(400px, calc(100vw - 28px));
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header, .modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-header h3, .modal-header h3 {
  margin: 0;
  font-size: 16px;
}

.drawer-desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.memory-add-form {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.memory-add-form input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 13.5px;
  outline: none;
}

.memory-add-form input:focus {
  border-color: var(--accent);
}

.memory-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 13.5px;
  line-height: 1.5;
}

.memory-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 22, 17, 0.45);
  backdrop-filter: blur(4px);
  z-index: 80;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: var(--text-primary);
  color: var(--bg-surface-solid);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: msg-fade-in 0.2s ease;
}

/* Tri-Device Viewport Switcher */
.viewport-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.vp-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.16s ease;
}

.vp-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.vp-btn.active {
  background: var(--bg-surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

html[data-viewport="mobile"] .vp-btn {
  padding: 4px 6px;
  font-size: 11px;
}

/* Instant Thinking Indicator (eliminates blank wait before first streamed token) */
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13.5px;
  padding: 2px 0;
}

.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.45; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* Rendered Images inside Chat Markdown */
.md-content img.chat-inline-img {
  display: block;
  max-width: min(100%, 380px);
  max-height: 360px;
  object-fit: contain;
  border-radius: 14px;
  margin: 8px 0;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* Count pill warn variant */
.count-pill.warn {
  background: var(--blush-soft);
  color: var(--blush);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

/* AI Image Editing Studio Modal */
.image-studio-card {
  max-width: 920px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.studio-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-status-pill {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.studio-status-pill.warn {
  background: var(--blush-soft);
  color: var(--blush);
}

.studio-scroll {
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-config-panel {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
}

.studio-config-head p {
  margin: 4px 0 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.studio-config-head code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
}

.studio-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.studio-config-grid select,
.compact-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
}

.studio-config-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.muted-inline {
  font-weight: 400;
  color: var(--text-muted);
}

.studio-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.studio-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.studio-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.image-dropzone,
.image-result-box {
  position: relative;
  min-height: 220px;
  max-height: 290px;
  border-radius: 16px;
  border: 1.5px dashed var(--border-strong);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.image-dropzone {
  cursor: pointer;
}

.image-dropzone:hover,
.image-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.image-result-box {
  border-style: solid;
  border-color: var(--border-subtle);
}

.drop-placeholder {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.drop-placeholder small {
  display: block;
  color: var(--text-muted);
  font-size: 11.5px;
  margin-top: 2px;
}

.drop-icon {
  font-size: 30px;
  margin-bottom: 6px;
}

.preview-img {
  max-width: 100%;
  max-height: 264px;
  border-radius: 10px;
  object-fit: contain;
}

.studio-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.studio-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-solid);
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.studio-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.studio-controls-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.compact-field {
  flex: 1;
}

.studio-submit-btn {
  height: 40px;
  white-space: nowrap;
}

.studio-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.studio-history-section {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.studio-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.history-thumb-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  cursor: pointer;
  aspect-ratio: 1;
}

.history-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 760px) {
  .studio-workspace,
  .studio-config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .starter-grid {
    grid-template-columns: 1fr;
  }
  .msg-body {
    max-width: 88%;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
}
