/* 이야기 대화 팝업 — sms-humor · publish 공용 */
.shsv-modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: center; z-index: 90; padding: 20px;
}
.shsv-modal-bg[hidden] { display: none !important; }
.shsv-modal {
  width: min(920px, 100%); background: var(--panel, #1a222c);
  border: 1px solid var(--line, #2c3846); border-radius: 16px;
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
  max-height: min(88vh, 820px);
}
.shsv-modal.longform {
  width: min(1480px, 100%);
  max-height: 94vh;
}
.shsv-failed-modal { width: min(1100px, 100%); max-height: 90vh; }
.shsv-failed-modal .shsv-history { max-height: calc(90vh - 90px); }
.shsv-history-modal-bg { z-index: 100; }
.shsv-history-modal {
  width: min(1100px, 100%);
  max-height: 92vh;
}
.shsv-history-modal .shsv-history {
  flex: 1;
  min-height: 0;
  max-height: calc(92vh - 100px);
  border-top: 0;
  padding-top: 4px;
}
.shsv-modal.longform .shsv-bilingual { flex: 0 0 auto; }
.shsv-modal.longform .shsv-chat-phone {
  aspect-ratio: 16 / 9;
  max-height: min(57vh, 620px);
}
.shsv-modal.longform .shsv-shorts-check { display: none; }
.shsv-modal-head {
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line, #2c3846);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.shsv-modal-head h2 { margin: 0 0 4px; font-size: 1.05rem; }
.shsv-modal-head-main { flex: 1; min-width: 0; }
.shsv-modal-head-actions {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.shsv-title-ja-field {
  display: grid; gap: 4px; margin: 8px 0 0;
  font-size: .82rem; color: var(--muted, #9aabbc); font-weight: 600;
}
.shsv-title-ja-row { display: flex; gap: 8px; align-items: center; }
.shsv-title-ja-row input { flex: 1; min-width: 0; font-size: .95rem; }
.shsv-title-ja-row button {
  flex: 0 0 auto; margin: 0; padding: 7px 12px; font-size: .82rem;
  border: 0; border-radius: 999px; background: #2a3644; color: var(--text, #eef3f8);
  font-weight: 700; cursor: pointer;
}
.shsv-title-ja-status { font-size: .78rem; color: var(--muted, #9aabbc); min-height: 1.1em; }
.shsv-title-ja-status.ok { color: var(--accent, #3dcea7); }
.shsv-rating { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.shsv-rating .meta { margin: 0; color: var(--muted, #9aabbc); font-size: .82rem; }
.shsv-shorts-check {
  display: flex; align-items: center; gap: 6px; margin: 0;
  color: var(--text, #eef3f8); font-weight: 600; font-size: .86rem; cursor: pointer;
  white-space: nowrap;
}
.shsv-shorts-check input { width: auto; margin: 0; }
.shsv-stars { display: inline-flex; align-items: center; gap: 2px; line-height: 1; }
.shsv-stars .star-slot {
  position: relative; width: 1.15em; height: 1.15em; font-size: 1.15rem;
  color: #3a4654; display: inline-grid; place-items: center; user-select: none;
}
.shsv-stars .star-slot .star-bg, .shsv-stars .star-slot .star-fg { grid-area: 1 / 1; font-style: normal; }
.shsv-stars .star-slot .star-bg { color: #3a4654; }
.shsv-stars .star-slot .star-fg {
  color: #f5c542; overflow: hidden; width: 0; justify-self: start;
  display: block; white-space: nowrap;
}
.shsv-stars .star-slot[data-fill="full"] .star-fg { width: 100%; }
.shsv-stars .star-slot[data-fill="half"] .star-fg { width: 50%; }
.shsv-stars.interactive .star-slot { cursor: pointer; }
.shsv-stars.interactive .star-hit {
  position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; z-index: 1;
}
.shsv-stars.interactive .star-hit button {
  padding: 0; margin: 0; border: 0; background: transparent; opacity: 0; cursor: pointer;
}
.shsv-star-clear { margin-left: 6px; font-size: .72rem; padding: 2px 8px;
  border: 0; border-radius: 999px; background: #2a3644; color: var(--text, #eef3f8);
  font-weight: 700; cursor: pointer;
}
.shsv-bilingual {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-bottom: 1px solid var(--line, #2c3846);
}
@media (max-width: 720px) { .shsv-bilingual { grid-template-columns: 1fr; } }
.shsv-bilingual-pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border-right: 1px solid var(--line, #2c3846);
}
.shsv-bilingual-pane:last-child { border-right: 0; }
.shsv-bilingual-pane .pane-h {
  padding: 8px 14px; font-size: .8rem; font-weight: 700; color: var(--muted, #9aabbc);
  border-bottom: 1px solid var(--line, #2c3846); background: #121820;
}
.shsv-chat-phone {
  flex: 1; min-height: 0; overflow: hidden; background: #000;
  display: flex; flex-direction: column;
}
.shsv-chat-phone .chat-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #000;
  color: #fff;
}
.shsv-chat-phone .chat-header .side {
  font-size: .82rem; font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shsv-chat-phone .chat-header .side.left { text-align: left; }
.shsv-chat-phone .chat-header .side.right { text-align: right; }
.shsv-chat-phone .chat-header .title {
  text-align: center; color: #ffe100; font-size: .9rem; font-weight: 900;
  line-height: 1.25; overflow: hidden; word-break: break-word;
}
.shsv-chat-phone .chat-header.long {
  display: block; padding: 8px 14px;
}
.shsv-chat-phone .cast-strip {
  display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 10px;
  background: #171d28; border-bottom: 1px solid #303a48;
}
.shsv-chat-phone .cast-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 999px; background: #2a3644; color: #e8eef5;
  font-size: .7rem; white-space: nowrap;
}
.shsv-chat-phone .cast-chip b { color: #ffe100; }
.shsv-chat-phone .cast-chip.speaker-c { background: #3a3420; }
.shsv-chat-phone .cast-chip.speaker-c b { color: #ffd666; }
.shsv-chat-phone .board-scroll {
  flex: 1; min-height: 0; overflow: auto;
  background: #b8bdd8;
}
.shsv-chat-phone .board {
  min-height: 100%; background: transparent;
  padding: 14px 12px; display: flex; flex-direction: column; gap: 12px;
}
.shsv-chat-phone .row { display: flex; width: 100%; flex-direction: column; }
.shsv-chat-phone .row.me { align-items: flex-end; }
.shsv-chat-phone .row.them { align-items: flex-start; }
.shsv-chat-phone .speaker-name {
  margin: 0 4px 3px; color: #334155; font-size: .72rem; font-weight: 800;
}
.shsv-chat-phone .speaker-name span { color: #667085; font-size: .62rem; font-weight: 700; }
.shsv-chat-phone .bundle { display: flex; align-items: flex-end; gap: 6px; max-width: 82%; }
.shsv-chat-phone .bubble {
  position: relative; padding: 9px 12px; border-radius: 12px;
  font-size: .92rem; line-height: 1.4; font-weight: 600; word-break: break-word;
}
.shsv-chat-phone .them .bubble { background: #fff; color: #111; border-top-left-radius: 3px; }
.shsv-chat-phone .me .bubble { background: #8de05f; color: #111; border-top-right-radius: 3px; }
.shsv-chat-phone .them .bubble.speaker-c { background: #fff0b8; }
.shsv-chat-phone .them .bubble.speaker-d { background: #d9edff; }
.shsv-chat-phone .them .bubble.speaker-e { background: #f3ddff; }
.shsv-chat-phone .scene-separator {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px;
  align-self: center; margin: 6px auto 2px; padding: 5px 10px;
  border-radius: 999px; background: rgba(31,41,55,.82); color: #fff;
  font-size: .7rem; text-align: center;
}
.shsv-chat-phone .scene-separator b { color: #ffe100; }
.shsv-chat-phone .scene-separator em { color: #cbd5e1; font-style: normal; }
.shsv-chat-phone .epilogue {
  margin: 8px 4px 2px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,.88); color: #182230; border-left: 4px solid #ffe100;
}
.shsv-chat-phone .epilogue b { font-size: .72rem; color: #8a6500; }
.shsv-chat-phone .epilogue p { margin: 4px 0 0; font-size: .82rem; line-height: 1.5; white-space: pre-wrap; }
.shsv-chat-phone .stamp {
  font-size: .68rem; color: #4a5563; font-weight: 600;
  line-height: 1.2; white-space: nowrap; padding-bottom: 1px;
}
.shsv-chat-phone .stamp .read { display: block; margin-bottom: 1px; }
.shsv-modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--line, #2c3846);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.shsv-history {
  max-height: 52vh; overflow: auto; padding: 12px 16px;
  background: #10161d; border-top: 1px solid var(--line, #2c3846);
}
.shsv-history[hidden] { display: none; }
.shsv-history-run + .shsv-history-run { margin-top: 14px; }
.shsv-history .run-head {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.shsv-history .run-head span { color: var(--muted, #9aabbc); font-size: .76rem; }
.shsv-history-steps { display: grid; gap: 7px; }
.shsv-history details {
  border: 1px solid var(--line, #2c3846); border-radius: 10px;
  background: #151c24; overflow: hidden;
}
.shsv-history summary {
  display: flex; justify-content: space-between; gap: 10px; cursor: pointer;
  padding: 9px 11px; font-size: .82rem;
}
.shsv-history summary span { color: var(--muted, #9aabbc); font-size: .72rem; }
.shsv-history h4 { margin: 10px 11px 5px; font-size: .76rem; color: var(--muted, #9aabbc); }
.shsv-history pre {
  margin: 0 11px 11px; padding: 10px; max-height: 300px; overflow: auto;
  border-radius: 8px; background: #0b1016; color: var(--text, #eef3f8);
  font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; word-break: break-word;
}
.shsv-history .history-error { color: #ffb4b4; font-size: .8rem; margin: 8px 11px; }
.shsv-modal-foot button, .shsv-modal-head-actions > button {
  border: 0; border-radius: 999px; padding: 8px 12px; font-weight: 700;
  cursor: pointer; background: #2a3644; color: var(--text, #eef3f8); font: inherit;
}
.shsv-meta { color: var(--muted, #9aabbc); font-size: .82rem; margin: 4px 0 0; }
@media (max-width: 720px) {
  .shsv-modal.longform .shsv-chat-phone { aspect-ratio: 16 / 9; min-height: 260px; }
}
