/* Chat UX — media cards, live preview, prompt studio, chips, drop zone */

.composer-field {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}
.composer-field textarea {
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
/* Overlay placeholder on top — behind-textarea breaks on desktop (opaque textarea paint). */
.composer-ph {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  user-select: none;
  color: var(--composer-placeholder, rgba(34, 34, 34, 0.38));
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
}
.composer-field.is-idle .composer-ph {
  opacity: 1;
}
.composer-field.is-idle textarea {
  color: transparent;
  caret-color: var(--ink, #0a0a0a);
  -webkit-text-fill-color: transparent;
}
.composer-field.is-idle textarea::placeholder {
  color: transparent;
}
.main.is-empty .composer-field.is-idle .composer-ph {
  font-size: 15px;
  line-height: 1.4;
}
.composer-ph-line {
  display: inline;
}
.composer-ph-caret {
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-inline-start: 2px;
  vertical-align: text-bottom;
  background: var(--composer-placeholder, rgba(34, 34, 34, 0.38));
  opacity: 0.7;
  animation: composerPhCaret 0.9s step-end infinite;
}
@keyframes composerPhCaret {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .composer-ph-caret {
    animation: none;
  }
}
.composer-field-actions {
  display: none;
}
.composer-actions .composer-mini {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  flex-shrink: 0;
}
.composer-mini {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: var(--hover);
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
.composer-mini .ico-svg,
.attach-btn .ico-svg,
.composer-mini iconsax-icon,
.attach-btn iconsax-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
  color: inherit;
}
.attach-btn .ico-svg,
.attach-btn iconsax-icon { width: 20px; height: 20px; }
.ico-svg.fill-current { fill: currentColor; }
.ico-svg.stroke-current { stroke: currentColor; fill: none; }
.composer-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  margin-inline-start: auto;
}
.composer-actions .composer-mini[hidden],
.composer-actions .composer-mini[aria-hidden="true"] {
  display: none !important;
}
.composer-actions .composer-mini,
.composer-actions .composer-mic,
.composer-actions .send,
.composer-bar > .attach-btn {
  pointer-events: auto;
  touch-action: manipulation;
}
html.is-twa .att-preview img,
html.is-standalone .att-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* attach-previews live in .attach-previews--stack above textarea (not in icon row) */
html.is-twa .composer > .attach-previews--stack,
html.is-standalone .composer > .attach-previews--stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: none;
  overflow: visible;
}
.composer-mini:active { transform: scale(0.96); }
html[data-theme="dark"] .composer-mini {
  background: #262626;
  color: #f5f5f5;
}
#input.prompt-flash {
  animation: promptFlash 0.65s ease;
}
@keyframes promptFlash {
  0% { background: color-mix(in srgb, #3b82f6 22%, transparent); }
  100% { background: transparent; }
}

.suggest-row {
  display: none !important;
}
.suggest-row[hidden] {
  display: none !important;
}
.suggest-row::-webkit-scrollbar { display: none; }
.main.is-empty .suggest-row {
  justify-content: center;
  width: min(768px, calc(100% - 48px));
}
.suggest-chip {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.suggest-chip:active { transform: scale(0.98); }
html[data-theme="dark"] .suggest-chip {
  background: #1a1a1a;
  border-color: #2a2a2a;
}

.msg-model-badge {
  display: inline-block;
  align-self: flex-start;
  width: fit-content;
  max-width: min(220px, 72vw);
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--muted, #666);
  background: color-mix(in srgb, var(--muted, #666) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--muted, #666) 22%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
html[data-theme="dark"] .msg-model-badge {
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.drop-veil {
  position: absolute;
  inset: 8px;
  z-index: 8;
  display: none;
  place-items: center;
  border-radius: 24px;
  border: 1.5px dashed #3b82f6;
  background: color-mix(in srgb, #3b82f6 12%, var(--composer));
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
}
.drop-veil.is-active {
  display: grid;
}
.composer-wrap.is-drop .composer { outline: 2px solid #3b82f6; }

.att-preview {
  position: relative;
}
.att-meta {
  display: block;
  font-size: 10px;
  color: var(--muted);
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-preview.att-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 8px;
  border-radius: 12px;
  background: var(--hover);
  border: 1px solid var(--stroke);
}

.attach-previews.is-loading {
  pointer-events: none;
}

.att-preview.att-loading {
  cursor: default;
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
}
.att-preview.att-loading-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
}
.att-load-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.att-load-placeholder {
  position: absolute;
  inset: 0;
  background: var(--hover);
}
.att-load-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 4px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.att-load-fill {
  height: 100%;
  border-radius: 0;
  background: #3b82f6;
  transition: width 0.08s linear;
}
.att-preview.att-loading.is-done .att-load-bar {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.media-card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}
.media-card-actions button span {
  font-size: 11px;
  font-weight: 600;
}
.media-video-card {
  width: 100%;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 18px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid var(--stroke);
}
.media-video {
  display: block;
  width: 100%;
  min-height: 200px;
  max-height: min(420px, 70vh);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0d0d0d;
}
.media-video-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #141414;
}
.media-v-btn, .media-v-speed {
  height: 28px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #1f1f1f;
  color: #f5f5f5;
  padding: 0 10px;
  font-size: 12px;
}
.media-v-btn.on { border-color: #3b82f6; color: #93c5fd; }

.media-skel-bar {
  height: 6px;
  border-radius: 999px;
  background: #2a2a2a;
  overflow: hidden;
  margin: 8px 4px 0;
}
.media-skel-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.code-block-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
    .code-preview {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  background: #2563eb;
  color: #fafafa;
  font-size: 11px;
  font-weight: 700;
}
.code-live-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 16px;
}
.code-live-overlay[hidden] { display: none !important; }
.code-live-panel {
  width: min(920px, 100%);
  height: min(78vh, 720px);
  background: #0a0a0a;
  border-radius: 18px;
  border: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.code-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: #f5f5f5;
  border-bottom: 1px solid #222;
}
.code-live-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #262626;
  color: #fafafa;
  font-size: 20px;
}
.code-live-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #111;
}

.md.is-streaming::after {
  content: "▍";
  display: inline;
  margin-inline-start: 2px;
  color: var(--ink);
  animation: caretBlink 0.9s step-end infinite;
}
@keyframes caretBlink {
  50% { opacity: 0; }
}

.prompt-lib {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.prompt-lib-cat h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}
.prompt-lib-item {
  display: block;
  width: 100%;
  text-align: start;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--account-bento-bg, var(--hover));
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
}
.prompt-lib-item:active { transform: scale(0.99); }
