/* 답변 속 인터랙티브 화면(static/js/chat_open_ui.js — ```openui 블록) 카드.
   무대에 출처 없는 샌드박스 iframe 을 둔다. 화면 쪽 문서는 바탕이 투명해 대화 바탕이 비친다 — 카드는 테두리·바탕을
   두지 않고, 뜨기 전·쓰는 중에만 옅은 자리를 보인다. 오른쪽 위 ⋯ 메뉴는 OpenIntelligentUI 의 ExportOverlay 꼴. */

.oui {
  position: relative;
  width: 100%;
  margin: 12px 0 6px;
}

.oui__stage {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  transition: height 0.2s ease-out;
}

/* 뜨기 전·쓰는 중 — ChatGPT 처럼 옅은 회색 카드(화면 안 .card 와 같은 테두리·모서리). */
.oui--loading .oui__stage,
.oui--pending .oui__stage {
  background: #f9f9f9;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .oui--loading .oui__stage,
[data-theme="dark"] .oui--pending .oui__stage {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.oui__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.oui__frame--preview {
  pointer-events: none;
}

.oui__wait {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: #5d5d5d;
  text-align: center;
}

[data-theme="dark"] .oui__wait {
  color: #b4b4b4;
}

.oui__spin {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: #5d5d5d;
  animation: oui-spin 0.8s linear infinite;
}

[data-theme="dark"] .oui__spin {
  border-color: rgba(255, 255, 255, 0.15);
  border-top-color: #b4b4b4;
}

/* 진행 글은 ChatGPT 의 "생각 중" 처럼 빛이 지나가는 글자. */
.oui__phrase {
  background: linear-gradient(90deg, currentColor 0%, currentColor 40%, rgba(160, 160, 160, 0.35) 50%, currentColor 60%, currentColor 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: oui-shimmer 1.8s linear infinite;
}

@keyframes oui-spin {
  to { transform: rotate(360deg); }
}

@keyframes oui-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .oui__spin { animation-duration: 2.4s; }
  .oui__phrase { animation: none; -webkit-text-fill-color: currentColor; }
  .oui__stage { transition: none; }
}

/* ⋯ 메뉴 — 마우스를 올리면 보인다(터치 화면은 늘 옅게). */
.oui__more {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.2s;
}

.oui:hover .oui__more,
.oui__more:focus-within,
.oui__more--open {
  opacity: 1;
}

@media (hover: none) {
  .oui__more { opacity: 0.85; }
}

.oui--loading .oui__more {
  display: none;
}

.oui__more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #ffffff;
  color: #555555;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.oui__more-btn:hover {
  background: #f4f4f2;
}

.oui__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 168px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.oui__menu[hidden] {
  display: none;
}

.oui__menu-item {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1a1a1a;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.oui__menu-item:hover,
.oui__menu-item:focus-visible {
  background: #f4f4f2;
}

[data-theme="dark"] .oui__more-btn,
[data-theme="dark"] .oui__menu {
  background: #2b2b2b;
  border-color: rgba(255, 255, 255, 0.12);
  color: #d8d8d8;
}

[data-theme="dark"] .oui__more-btn:hover,
[data-theme="dark"] .oui__menu-item:hover,
[data-theme="dark"] .oui__menu-item:focus-visible {
  background: #383838;
}

[data-theme="dark"] .oui__menu-item {
  color: #e8e6de;
}

/* 잡히지 않은 오류 — 까닭과 "고쳐 달라고 하기". */
.oui__error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #a32d2d;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.oui__error[hidden] {
  display: none;
}

[data-theme="dark"] .oui__error {
  color: #f09595;
}

.oui__fix {
  min-height: 0;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
