/* demo 화면 전용 스타일. 공용 토큰·레이아웃은 styles.css 에 있다.
   이 파일의 주인은 그 화면을 담당하는 레인 하나뿐이다 — 다른 화면 규칙을 여기 쓰지 않는다. */

.demo-setup-layout {
  grid-template-columns: minmax(260px, .85fr) minmax(340px, 1.35fr);
}

.demo-results {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.demo-panel-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
}

.demo-panel-heading h3 {
  margin: 0;
}

.demo-feed-panel {
  display: flex;
  flex-direction: column;
  min-height: 360px;
}

.demo-lifecycle {
  margin: 10px 0 12px;
  padding: 7px 10px;
  border: 1px solid #c9d8f6;
  border-radius: 999px;
  background: #f1f5ff;
  color: #385b99;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.demo-activity {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfc;
}

.demo-activity h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.demo-speaker-activity,
.demo-feed,
.demo-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-speaker-activity {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.demo-activity-row {
  display: grid;
  grid-template-columns: minmax(72px, .7fr) minmax(80px, 1fr) 36px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.demo-activity-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-activity-name::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #9aa1aa;
  content: "";
  opacity: .45;
}

.demo-activity-row.is-active {
  color: #16191d;
  font-weight: 600;
}

.demo-activity-row.is-active .demo-activity-name::before {
  opacity: 1;
  box-shadow: 0 0 0 3px rgb(47 111 237 / 14%);
}

.demo-activity-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e8ec;
}

.demo-activity-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2f6fed;
  transition: width .2s ease;
}

.demo-activity-prob {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.demo-feed {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  max-height: 56vh;
  overflow-y: auto;
  padding: 2px 4px 4px;
}

.demo-feed-empty {
  padding: 40px 0;
  color: var(--muted);
  text-align: center;
}

.demo-utterance {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  animation: demo-rise .2s ease;
}

.demo-utterance.is-orphan {
  border-color: #e2b65a;
  background: var(--warning-bg);
}

@keyframes demo-rise {
  from { opacity: 0; transform: translateY(4px); }
}

.demo-avatar {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #697386;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.demo-avatar.demo-speaker-0 { background: #2563eb; }
.demo-avatar.demo-speaker-1 { background: #047857; }
.demo-avatar.demo-speaker-2 { background: #b45309; }
.demo-avatar.demo-speaker-3 { background: #6d28d9; }
.demo-avatar.demo-speaker-pending {
  border: 2px dashed #9aa1aa;
  background: #eef1f4;
  color: var(--muted);
}

.demo-utterance-body {
  flex: 1;
  min-width: 0;
}

.demo-utterance-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin-bottom: 2px;
}

.demo-utterance-speaker {
  overflow-wrap: anywhere;
  color: #303640;
  font-size: 13px;
}

.demo-utterance-time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.demo-utterance-text {
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.demo-utterance-text.is-provisional {
  color: var(--muted);
  font-style: italic;
}

.demo-timeline-panel {
  padding: 0;
  overflow: hidden;
}

.demo-timeline-panel > summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 14px 16px;
  cursor: pointer;
  list-style-position: inside;
}

.demo-timeline-panel > summary:hover {
  background: #fbfbfc;
}

.demo-frame-counts {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.demo-diagnostic-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 0 16px 10px;
}

.demo-diagnostic-actions .notice {
  margin: 0;
}

.demo-diagnostic-actions button {
  flex: none;
  padding: 4px 9px;
  font-size: 12px;
}

.demo-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 72vh;
  overflow-y: auto;
  padding: 0 16px 16px;
}

.demo-frame {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 7px;
  background: #fbfbfc;
}

.demo-frame-partial { border-left-color: #9aa1aa; background: #f3f4f6; color: var(--muted); }
.demo-frame-final { border-left-color: var(--success); background: var(--success-bg); color: #183c27; }
.demo-frame-lifecycle { border-left-color: var(--focus-ring); background: #eaf0ff; }
.demo-frame-diagnostic { border-left-color: #6068c8; background: #eef0ff; }
.demo-frame-error,
.demo-frame-invalid { border-left-color: var(--danger); background: var(--danger-bg); }
.demo-frame-unknown { border-left-color: var(--warning); }

.demo-frame-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.demo-frame-head time {
  margin-left: auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.demo-frame-summary {
  margin: 7px 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.demo-frame pre {
  max-height: 180px;
  overflow: auto;
  margin: 0;
  padding: 7px;
  border-radius: 5px;
  background: #fff9;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}


/* 오프라인은 세그먼트의 시작·길이를 실제 시간축 위치로 보여줘야 하므로 기존
   세로 피드만으로 표현할 수 없다. 색·패널·배지·표는 기존 클래스를 그대로 쓴다. */
.demo-offline-panel {
  margin-top: 16px;
}

.demo-offline-controls {
  margin-top: 12px;
}

.demo-offline-controls > *,
.demo-offline-controls .field,
.demo-offline-controls input,
.demo-offline-controls select {
  min-width: 0;
}

.demo-offline-controls input[type="file"],
.demo-offline-controls select {
  width: 100%;
  max-width: 100%;
}

.demo-offline-progress {
  width: 100%;
  height: 12px;
  margin-top: 12px;
}

.demo-offline-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.demo-offline-stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfbfc;
}

.demo-offline-stat-label,
.demo-offline-stat-detail {
  color: var(--muted);
  font-size: 11px;
}

.demo-offline-stat-value {
  overflow-wrap: anywhere;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.demo-offline-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0 0 16px;
  padding: 12px;
  border-radius: 7px;
  background: #f7f8fa;
  font-size: 12px;
}

.demo-offline-facts dt {
  color: var(--muted);
  font-weight: 700;
}

.demo-offline-facts dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.demo-offline-subtitle {
  margin: 18px 0 6px;
  font-size: 13px;
}

.demo-offline-detail-body {
  padding: 0 16px 16px;
}

.demo-offline-detail-body > .notice {
  margin-top: 0;
}

.demo-offline-chart {
  min-width: 0;
  overflow-x: auto;
  padding: 10px 2px 14px;
}

.demo-offline-axis {
  position: relative;
  height: 26px;
  margin-left: 132px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  min-width: 488px;
}

.demo-offline-axis span {
  position: absolute;
  bottom: 3px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.demo-offline-axis span:first-child { transform: none; }
.demo-offline-axis span:last-child { transform: translateX(-100%); }

.demo-offline-lane {
  display: grid;
  grid-template-columns: 120px minmax(480px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 36px;
  min-width: 620px;
}

.demo-offline-lane-label {
  overflow: hidden;
  color: #303640;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-offline-track {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), #d6dae0 calc(25% - 1px), #d6dae0 25%),
    #f7f8fa;
}

.demo-offline-segment {
  position: absolute;
  top: 2px;
  min-width: 3px;
  height: 16px;
  border-radius: 3px;
  opacity: .9;
}

.demo-offline-segment.demo-speaker-0 { background: #2563eb; }
.demo-offline-segment.demo-speaker-1 { background: #047857; }
.demo-offline-segment.demo-speaker-2 { background: #b45309; }
.demo-offline-segment.demo-speaker-3 { background: #6d28d9; }

.demo-offline-table-scroll {
  overflow-x: auto;
}

.demo-offline-table-scroll .table {
  min-width: 900px;
}

.demo-offline-speaker-summary .table {
  min-width: 680px;
}

.demo-offline-table-scroll td .badge {
  margin: 4px 4px 0 0;
}

.demo-offline-latency .demo-local-latency {
  background: var(--success-bg);
  font-weight: 700;
}

.demo-offline-json {
  max-height: 50vh;
  overflow: auto;
  margin: 0 16px 16px;
  padding: 12px;
  border-radius: 6px;
  background: #f7f8fa;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}
@media (max-width: 760px) {
  .demo-setup-layout,
  .demo-speaker-activity {
    grid-template-columns: 1fr;
  }

  .demo-frame-counts {
    width: 100%;
    margin-left: 20px;
  }

  .demo-diagnostic-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-offline-facts {
    grid-template-columns: 1fr;
  }

  .demo-offline-facts dd {
    margin-bottom: 4px;
  }

  .demo-frame-head time {
    width: 100%;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-utterance { animation: none; }
  .demo-activity-meter i { transition: none; }
}
