:root {
  --story-frame: 968px;
  --story-panel: #111412;
  --story-line: #2b302c;
  --story-muted: #9ca39e;
}

html,
body.story-studio {
  min-height: 100%;
  background: #060907;
}

body.story-studio {
  margin: 0;
  color: #e7eae8;
}

.story-studio .app-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  padding: 0;
  background: #060907;
}

.story-studio .story-authoring-topbar {
  box-sizing: border-box;
  width: min(calc(100% - 48px),1120px);
  height: 64px;
  margin: auto;
  padding: 0;
  border: 0;
  background: #060907;
}

.story-studio .back-nav {
  gap: 22px;
  color: #f4f5f4;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.story-studio .story-temp-save {
  width: auto;
  min-width: 72px;
  height: 34px;
  margin-left: auto;
  padding: 0 14px;
  border-radius: 11px;
  background: #5d5e63;
  font-size: 13px;
}

.story-studio .story-authoring-form {
  min-height: calc(100dvh - 64px);
}

.story-studio .story-step-tabs {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(8,1fr);
  width: 100%;
  height: 45px;
  margin: 0;
  padding: 0 max(24px,calc((100% - var(--story-frame))/2));
  border-bottom: 1px solid #252a27;
  overflow: visible;
  background: #060907;
}

.story-studio .story-step-tabs button {
  position: relative;
  height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #969d98;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.story-studio .story-step-tabs button.active {
  color: #f0f2f1;
  font-weight: 600;
}

.story-studio .story-step-tabs button.active:after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1px;
  height: 2px;
  background: #e5e9e6;
}

.story-studio .story-global-error,
.story-studio .story-save-status {
  position: fixed;
  z-index: 15;
  left: 50%;
  transform: translateX(-50%);
  max-width: 520px;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12px;
  pointer-events: none;
}

.story-studio .story-global-error:not(:empty) {
  top: 76px;
  background: #541f27;
  color: #ffd9df;
}

.story-studio .story-save-status:not(:empty) {
  top: 20px;
  background: #17251f;
  color: #bdebd9;
}

.story-studio .story-authoring-body {
  box-sizing: border-box;
  width: var(--story-frame);
  max-width: calc(100% - 48px);
  margin: 0 auto;
  padding: 20px 0 82px;
}

.story-studio .story-step {
  display: grid;
  grid-template-columns: minmax(0,468px) minmax(0,448px);
  gap: 52px;
  align-items: start;
  margin: 0;
}

.story-studio .story-step.wizard-hidden {
  display: none;
}

.story-studio .story-step .step-fields {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-top: 2px;
}

.story-studio .field-label,
.story-studio legend {
  margin: 0 0 6px;
  color: #eee;
  font-size: 16px;
  font-weight: 650;
}

.story-studio .hint {
  color: var(--story-muted);
  font-size: 11px;
  line-height: 1.65;
}

.story-studio p.hint {
  margin: 0 0 14px;
}

.story-studio .field,
.story-studio .textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #686e69;
  border-radius: 12px;
  background: #171a18;
  color: #e9ebe9;
  font-size: 13px;
}

.story-studio .field {
  height: 42px;
  padding: 0 14px;
}

.story-studio .textarea {
  min-height: 96px;
  padding: 13px 14px;
  line-height: 1.6;
  resize: vertical;
}

.story-studio .story-detail-field .textarea {
  min-height: 110px;
}

.story-studio .story-field {
  display: block;
  color: #eceeec;
  font-size: 13px;
  font-weight: 600;
}

.story-studio .story-field>.field,
.story-studio .story-field>.textarea {
  margin-top: 8px;
}

/* 인트로 단계는 캐릭터 모드의 인트로 편집기·추천답변 레이아웃을 그대로 따른다. */
.story-studio .intro-settings-list { gap: 44px; }
.story-studio .intro-settings-list .field-label { display: block; font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.story-studio .intro-settings-list .hint { margin: 0 0 16px; font-size: 13px; line-height: 21px; }
.story-studio .intro-settings-list #play-guide { height: 96px; min-height: 96px; resize: none; }
.story-studio .intro-settings-list #story-starter-reply-add { height: 48px; margin-top: 24px; padding: 0 12px; font-size: 16px; font-weight: 400; border-radius: 16px; }
.story-studio .intro-settings-list .reply-row { display: flex; align-items: center; gap: 4px; margin: 0 0 20px; min-height: 48px; border: 1px solid transparent; border-radius: 12px; padding: 0 10px; background: #101311; }
.story-studio .intro-settings-list .reply-row:focus-within { border-color: #26d6a0; }
.story-studio .intro-settings-list .reply-row textarea { height: 46px; min-height: 46px; border: 0; background: none; padding: 12px 4px; border-radius: 0; resize: none; outline: 0; font-size: 16px; line-height: 22px; }
.story-studio .intro-settings-list .reply-row button { flex: none; width: 28px; height: 32px; padding: 0; background: none; color: #a9b0ab; border: 0; font-size: 20px; }
@media(max-width:760px) { .story-studio .intro-settings-list { gap: 28px; } .story-studio .intro-settings-list .field-label { font-size: 18px; } }

.story-studio .counter {
  display: block;
  margin-top: 5px;
  color: #9ba19d;
  font-size: 10px;
  font-weight: 400;
  text-align: right;
}

.story-studio .field-foot {
  display: flex;
  justify-content: space-between;
  color: #9ba19d;
  font-size: 11px;
  font-weight: 400;
}

.story-studio .field-foot .counter {
  margin: 0;
}

.story-studio .story-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-studio .auto-generate-btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: #242724;
  color: #d8dcda;
  font-size: 11px;
}

.story-studio .story-cover-stage {
  display: grid;
  grid-template-columns: 122px minmax(0,1fr);
  gap: 26px;
  margin-top: 16px;
}

.story-studio .story-cover-stage .character-image-preview {
  width: 122px;
  height: 164px;
  border: 1px dashed #3b423d;
  border-radius: 14px;
  background: #121513 center/cover no-repeat;
}

.story-studio .story-cover-stage .profile-image-controls {
  min-width: 0;
  align-self: center;
}

.story-studio .profile-policy {
  margin-top: 16px !important;
}

.story-studio .profile-image-buttons {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}

.story-studio .profile-image-buttons .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 6px;
  border-radius: 10px;
  background: #272a28;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.story-studio .profile-image-buttons .file-trigger {
  height: 34px;
  min-height: 34px;
  background: #65666b;
}

.story-studio .profile-image-buttons .profile-action-icon {
  flex: none;
  width: 14px;
  height: 14px;
}

.story-studio .step-inspector,
.story-studio .step-inspector.cover-inspector {
  box-sizing: border-box;
  position: sticky;
  top: 16px;
  height: 643px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--story-line);
  border-radius: 15px;
  background: #101311;
}

.story-studio .step-inspector>strong {
  display: block;
  min-height: 44px;
  box-sizing: border-box;
  padding: 12px 14px;
  border-bottom: 1px solid var(--story-line);
  font-size: 15px;
}

.story-studio .detail-inspector {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 190px);
  min-height: 500px;
  max-height: 660px;
  /* .step-inspector 기본 규칙이 overflow:hidden을 준다. 이 패널에 들어가는 캐릭터·에피소드·
     엔딩·로어북 편집 카드는 상태창 같은 항목이 늘어나면 고정 높이를 넘는데, hidden이 그대로
     남아 있으면 스크롤 없이 내용이 잘려 상태창 입력란이 아예 안 보이게 된다. */
  overflow-x: hidden;
  overflow-y: auto;
}

.story-studio .detail-inspector>.inline-editor {
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.story-studio .inspector-placeholder {
  display: grid;
  flex: 1;
  place-items: center;
  color: #9ba19d;
  font-size: 12px;
  text-align: center;
}

.story-studio .cover-inspector .work-preview-grid {
  box-sizing: border-box;
  grid-template-columns: repeat(3,minmax(0,1fr));
  max-height: calc(100% - 45px);
  padding: 28px 16px;
  gap: 14px 10px;
  overflow: auto;
}

.story-studio .work-preview-grid .work-preview-image {
  max-height: none;
  aspect-ratio: 3/4;
  background-size: cover;
  background-position: center;
  border-radius: 13px;
}

.story-studio .work-preview-card strong {
  font-size: 15px;
  text-align: center;
}

.story-studio .own-preview-card strong {
  text-align: left;
}

.story-studio .work-preview-metrics {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #28dca8;
  font-size: 9px;
}

.story-studio .work-preview-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.story-studio .work-preview-metrics .preview-conversations:before,
.story-studio .work-preview-metrics .preview-likes:before {
  content: none;
}

.story-studio .work-preview-card p {
  color: #aab0ac;
  font-size: 9px;
  line-height: 14px;
}

.story-studio .detail-settings-list {
  gap: 36px !important;
}

.story-studio .detail-settings-group .field-label {
  margin: 0;
}

.story-studio .detail-settings-group .hint {
  margin: 4px 0 18px;
}

.story-studio #story-character-list,
.story-studio #story-user-persona-list,
.story-studio .story-repeat-list {
  display: grid;
  gap: 12px;
}

.story-studio .detail-list-row,
.story-studio .story-repeat-card {
  box-sizing: border-box;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: #121513;
}

.story-studio .detail-list-row.selected,
.story-studio .story-repeat-card.selected {
  border-color: #24dba4;
}

.story-studio .detail-list-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
}

.story-studio .detail-list-row .detail-row-name {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #dfe3e0;
  font-size: 14px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-studio .detail-list-row .detail-row-edit,
.story-studio .detail-list-row .detail-row-delete {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9ca49e;
}

.story-studio .detail-list-row .detail-row-edit svg,
.story-studio .detail-list-row .detail-row-delete svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
}

.story-studio .detail-inspector>.detail-list-row,
.story-studio .detail-inspector>.story-repeat-card {
  display: block;
  flex: none;
  width: 100%;
  height: auto;
  min-height: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.story-studio .detail-inspector>.story-repeat-card>.story-repeat-head {
  min-height: 48px;
}

.story-studio .detail-inspector>.story-repeat-card>.story-repeat-body {
  display: grid;
  height: auto;
  padding: 14px;
  overflow: visible;
}

.story-studio #story-character-inspector>.story-character-editor-card {
  display: block;
  height: auto;
  min-height: 100%;
  padding: 14px;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.story-studio #story-character-inspector .story-upload-card {
  display: grid;
  grid-template-columns: 122px repeat(3,minmax(0,1fr));
  gap: 8px;
  padding: 12px;
  background: transparent;
}

.story-studio #story-character-inspector .story-upload-card::before {
  content: '캐릭터를 대표하는 이미지를 등록해 주세요. 5MB 이하 · 1,080×1,620px';
  grid-column: 2 / 5;
  grid-row: 1;
  align-self: end;
  color: var(--story-muted);
  font-size: 10px;
  line-height: 16px;
}

.story-studio #story-character-inspector .story-upload-preview.square {
  grid-row: 1/3;
  grid-column: 1;
  width: 122px;
  height: 164px;
  min-height: 164px;
  aspect-ratio: 3/4;
}

.story-studio #story-character-inspector .story-upload-card>.ghost-btn,
.story-studio #story-character-inspector .story-upload-card>.primary-btn {
  grid-column: auto;
  grid-row: 2;
  align-self: end;
  height: 36px;
  min-height: 36px;
  padding: 0 5px;
  font-size: 11px;
  white-space: nowrap;
}

.story-studio #story-character-inspector .story-upload-card>.scenario-mini-btn {
  grid-column: 4;
  grid-row: 2;
  min-height: 36px;
  border-radius: 10px;
  background: #272a28;
  color: #d5d9d6;
  font-size: 0;
}

.story-studio #story-character-inspector .story-upload-card>.scenario-mini-btn::after {
  content: '삭제';
  font-size: 11px;
}

.story-studio .story-persona-editor {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: transparent;
}

.story-studio .story-persona-editor>.creator-persona-heading {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--story-line);
}

.story-studio .story-persona-editor>.story-inspector-heading {
  box-sizing: border-box;
  display: flex;
  flex: none;
  align-items: center;
  min-height: 48px;
  margin: 0 -14px 14px;
  padding: 0 14px;
  border-bottom: 1px solid var(--story-line);
  font-size: 15px;
}

.story-studio .story-persona-editor>.creator-persona-heading strong {
  font-size: 15px;
}

.story-studio .story-persona-editor>.story-persona-editor-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.story-studio .story-persona-editor .story-cover-stage,
.story-studio .story-persona-editor .persona-image-stage {
  display: grid;
  grid-template-columns: 122px minmax(0,1fr);
  gap: 26px;
  margin: 0;
}

.story-studio .story-persona-editor .character-image-preview,
.story-studio .story-persona-editor .persona-card-avatar {
  width: 122px;
  height: 164px;
  min-height: 164px;
  border: 1px dashed #3b423d;
  border-radius: 14px;
  background: #121513 center/cover no-repeat;
}

.story-studio .story-persona-editor .profile-image-buttons {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 7px;
  margin-top: 16px;
}

.story-studio .story-persona-editor .profile-image-buttons>* {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

.story-studio .story-persona-editor label {
  display: block;
  color: #dfe2e0;
  font-size: 13px;
  font-weight: 600;
}

.story-studio .story-persona-editor label>.field,
.story-studio .story-persona-editor label>.textarea {
  margin-top: 8px;
}

.story-studio .story-persona-editor label>.textarea {
  min-height: 112px;
}

.story-studio .detail-inspector>#story-dialogue-editor,
.story-studio .detail-inspector #story-dialogue-editor.inline-editor {
  position: static;
  inset: auto;
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: transparent;
  transform: none;
}

.story-studio .detail-inspector>#story-dialogue-editor.wizard-hidden {
  display: none;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-editor-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  transform: none;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-editor-topbar {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--story-line);
  background: #101311;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-editor-topbar button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #aeb5b0;
}

.story-studio .detail-inspector #story-dialogue-editor #story-dialogue-done {
  background: #2bdda8;
  color: #06251b;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-editor-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 0 14px;
  overflow: auto;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-chat-preview {
  flex: 1;
  min-height: 0;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-chat-preview.has-recommendations {
  flex: none;
}

.story-studio .detail-inspector #story-dialogue-play-guide-preview.wizard-hidden {
  display: none;
}

.story-studio .detail-inspector #story-dialogue-replies-preview {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 0;
}

.story-studio .detail-inspector .reply-preview-heading {
  font-size: 13px;
  color: #c8ceca;
}

.story-studio .detail-inspector .reply-preview-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}

.story-studio .detail-inspector .reply-preview-row > .message-edit-icon,
.story-studio .detail-inspector .reply-preview-row > .message-delete-icon {
  flex: none;
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: #969e98;
}

.story-studio .detail-inspector .reply-preview-bubble {
  max-width: calc(100% - 76px);
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid #303b33;
  border-radius: 18px 4px 18px 18px;
  background: #1d231f;
  color: #e0e5e1;
  padding: 12px 16px;
  line-height: 22px;
  font-size: 14px;
}

.story-studio .detail-inspector .reply-preview-bubble:focus-visible {
  outline: 1px solid #26d6a0;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-composer {
  display: flex;
  flex: none;
  flex-direction: column;
  height: 172px;
  min-height: 172px;
  padding: 0;
  border: 1px solid #353a36;
  border-radius: 14px 14px 0 0;
  background: #171b18;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-speakers {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 10px 14px;
  border-bottom: 1px solid #303531;
  overflow-x: auto;
}

.story-studio .detail-inspector #story-dialogue-editor .speaker-chip,
.story-studio .detail-inspector #story-dialogue-editor .story-speaker-chip,
.story-studio .detail-inspector #story-dialogue-editor .story-dialogue-image-upload {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: auto;
  min-width: max-content;
  height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.story-studio .detail-inspector #story-dialogue-content {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 52px;
  min-height: 52px;
  margin: 0;
  padding: 14px 18px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e4e7e5;
  font: inherit;
  font-size: 13px;
  resize: none;
}

.story-studio .detail-inspector #story-dialogue-editor .scenario-compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 62px;
  padding: 8px 14px;
}

.story-studio .story-dialogue-image-row {
  display: flex;
  align-items: center;
  width: 100%;
  height: 44px;
  margin: 12px 0;
  border-radius: 12px;
  background: #282e2a;
}

.story-studio .story-dialogue-image-row .attachment-grip {
  flex: none;
  width: 16px;
  height: 24px;
  margin-left: 10px;
  background: radial-gradient(circle,#929b95 1px,transparent 1.5px) 3px 3px/6px 6px;
  clip-path: inset(3px 2px);
  cursor: grab;
}

.story-studio .story-dialogue-image-row .drag-grip {
  flex: none;
  width: 16px;
  height: 24px;
  margin-left: 10px;
  overflow: hidden;
  color: #929b95;
  font-size: 16px;
  line-height: 24px;
  cursor: grab;
}

.story-studio .story-dialogue-image-row img {
  flex: none;
  width: 32px;
  height: 32px;
  margin-left: 8px;
  border-radius: 3px;
  object-fit: cover;
}

.story-studio .story-dialogue-image-row .attachment-name {
  flex: 1;
  min-width: 0;
  margin: 0 10px;
  overflow: hidden;
  color: #d9ddda;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-studio .story-dialogue-image-row>span:not(.drag-grip):not(.attachment-grip) {
  flex: 1;
  min-width: 0;
  margin: 0 10px;
  overflow: hidden;
  color: #d9ddda;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-studio .story-dialogue-image-row .scenario-mini-btn {
  flex: none;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #989f9a;
}

.story-studio .story-list-settings {
  gap: 0;
}

.story-studio .story-list-intro {
  margin-bottom: 20px;
}

.story-studio .story-list-intro .hint {
  margin: 4px 0 0;
}

.story-studio .story-list-settings>.scenario-add-btn {
  margin-top: 8px;
}

.story-studio .scenario-add-btn,
.story-studio .scenario-setup-btn {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  margin-top: 16px;
  border: 0;
  border-radius: 11px;
  background: #212422;
  color: #d2d6d3;
  font-size: 14px;
}

.story-studio #story-starter-reply-list {
  display: grid;
  gap: 10px;
}

.story-studio .story-character-tabs {
  gap: 10px;
}

.story-studio .story-character-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  background: #242725;
  color: #ccc;
  padding: 0 14px;
}

.story-studio .story-character-tabs button.active {
  background: #31dfaa;
  color: #08251c;
}

.story-studio .story-appearance-grid {
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 16px;
}

/* 캐릭터 모드 [data-step="4"] .appearance-card와 같은 비율. 고정 min-height 대신
   aspect-ratio를 써야 그리드 칸 너비가 달라져도 캐릭터 모드와 같은 3:4 카드가 된다. */
.story-studio .story-appearance-card,
.story-studio .story-appearance-empty {
  height: auto;
  min-height: 0;
  aspect-ratio: 3 / 4;
}

.story-studio .two-col {
  gap: 12px;
}

.story-studio [data-step-panel="6"]>.step-fields {
  height: 643px;
}

.story-studio [data-step-panel="6"] .two-col {
  margin-top: auto;
}

.story-studio .story-appearance-empty {
  display: grid;
  place-items: center;
  color: #aab0ac;
}

.story-studio .story-appearance-empty>span:not(.appearance-empty-icon) {
  display: none;
}

.story-studio .story-appearance-empty .appearance-empty-icon {
  font-size: 0;
}

.story-studio .story-appearance-empty .appearance-empty-icon:after {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  background: #bec3bf;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Crect x='3' y='4' width='18' height='16' rx='3'/%3E%3Ccircle cx='8' cy='9' r='1.5'/%3E%3Cpath d='m4 17 5-5 4 3 3-4 5 6'/%3E%3C/svg%3E") center/contain no-repeat;
}

.story-studio .story-appearance-empty .appearance-empty-icon {
  width: 24px;
  max-width: 24px;
  height: 24px;
  max-height: 24px;
}

.story-studio #story-appearance-inspector {
  display: flex;
  flex-direction: column;
}

.story-studio #story-appearance-inspector>.story-appearance-detail {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}

.story-studio #story-appearance-inspector .selected-appearance-preview {
  position: relative;
  flex: none;
  width: 240px;
  height: 320px;
  margin: 0 auto 22px;
  overflow: hidden;
  border-radius: 14px;
  background: #181c19 center/cover no-repeat;
}

.story-studio #story-appearance-inspector .selected-appearance-preview .appearance-card-top {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-studio #story-appearance-inspector .selected-appearance-preview .appearance-card-bottom {
  position: absolute;
  z-index: 1;
  right: 10px;
  bottom: 10px;
  left: 10px;
}

.story-studio #story-appearance-inspector .appearance-badge,
.story-studio #story-appearance-inspector .appearance-card-bottom button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 14px;
  background: rgba(30,34,31,.86);
  color: #e4e7e5;
  font-size: 11px;
}

.story-studio #story-appearance-inspector h3 {
  margin: 0 0 12px;
  color: #ecefed;
  font-size: 15px;
}

.story-studio #story-appearance-inspector .story-appearance-episode-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 22px;
}

.story-studio #story-appearance-inspector .story-appearance-episode-picker button,
.story-studio #story-appearance-inspector .story-appearance-presets button {
  width: auto;
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 14px;
  background: #242725;
  color: #c9ceca;
  font-size: 11px;
  white-space: nowrap;
}

.story-studio #story-appearance-inspector .story-appearance-episode-picker button.active,
.story-studio #story-appearance-inspector .story-appearance-presets button.active {
  background: #2bdda8;
  color: #06251b;
  font-weight: 700;
}

.story-studio #story-appearance-inspector .story-appearance-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.story-studio #story-appearance-inspector .story-appearance-custom {
  display: grid;
  grid-template-columns: minmax(0,1fr) 58px;
  gap: 8px;
  margin-top: auto;
}

.story-studio #story-appearance-inspector .story-appearance-custom .field,
.story-studio #story-appearance-inspector .story-appearance-custom button {
  height: 42px;
  min-height: 42px;
}

.story-studio #story-appearance-inspector .story-appearance-custom button {
  padding: 0;
  border: 1px solid #656b67;
  border-radius: 12px;
  background: #171a18;
  color: #e0e4e1;
  font-size: 12px;
}

.story-studio .story-registration-step .registration-fields {
  gap: 26px;
}

.story-studio fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.story-studio .toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.story-studio .toggle-row>span {
  font-size: 14px;
}

.story-studio .toggle-row small {
  display: block;
  margin-top: 5px;
  color: #929995;
  font-size: 11px;
}

.story-studio .toggle-row input[role=switch] {
  width: 34px;
  height: 20px;
  accent-color: #2bdda8;
}

.story-studio .audience-options {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
}

.story-studio .audience-options input,
.story-studio .genre-options input {
  position: absolute;
  opacity: 0;
}

.story-studio .audience-options span {
  display: grid;
  place-items: center;
  height: 38px;
  border-radius: 12px;
  background: #222523;
  font-size: 12px;
}

.story-studio .audience-options input:checked+span,
.story-studio .genre-options input:checked+span {
  background: #2bdda8;
  color: #06251b;
  font-weight: 700;
}

.story-studio .genre-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.story-studio .genre-options span {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 14px;
  background: #232624;
  font-size: 11px;
}

.story-studio .story-authoring-actions {
  box-sizing: border-box;
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: none;
  height: 62px;
  margin: 0;
  padding: 10px max(24px,calc((100% - 1120px)/2));
  border-top: 1px solid #282d29;
  background: #060907;
  transform: none;
  justify-content: flex-end;
}

.story-studio .story-authoring-actions button {
  flex: none;
  width: auto;
  min-width: 65px;
  height: 40px;
  min-height: 40px;
  border-radius: 13px;
}

.story-studio .story-authoring-actions .primary-btn {
  background: #2bdda8;
}

.story-studio dialog {
  width: 330px;
  padding: 22px;
  border: 0;
  border-radius: 16px;
  background: #363936;
  color: #f4f5f4;
  text-align: center;
}

.story-studio dialog::backdrop {
  background: rgba(0,0,0,.72);
}

.story-studio dialog h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.story-studio dialog p {
  color: #d0d4d1;
  font-size: 12px;
  line-height: 1.55;
}

.story-studio dialog>div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width:760px) {
  .story-studio .story-authoring-topbar {
    width: 100%;
    height: 56px;
    padding: 0 14px;
  }
  .story-studio .story-step-tabs {
    display: flex;
    height: 48px;
    padding: 0 12px;
    overflow-x: auto;
  }
  .story-studio .story-step-tabs button {
    flex: 0 0 auto;
    min-width: 82px;
  }
  .story-studio .story-authoring-body {
    width: auto;
    max-width: none;
    padding: 16px 12px 88px;
  }
  .story-studio .story-step {
    display: block;
  }
  .story-studio .story-step .step-fields {
    gap: 24px;
  }
  .story-studio .step-inspector {
    position: relative;
    top: 0;
    height: 540px;
    margin-top: 24px;
  }
  .story-studio .story-cover-stage {
    grid-template-columns: 108px minmax(0,1fr);
    gap: 16px;
  }
  .story-studio .story-cover-stage .character-image-preview {
    width: 108px;
    height: 144px;
  }
  .story-studio .profile-image-buttons {
    flex-wrap: wrap;
  }
  .story-studio .story-authoring-actions {
    padding: 10px 12px;
  }
}

.story-studio [data-step-panel="6"] > .step-fields {
  gap: 16px;
}
.story-studio [data-step-panel="6"] > .step-fields > :not(.story-appearance-grid) {
  flex-shrink: 0;
}
.story-studio #story-appearance-character-tabs {
  display: flex;
  min-height: 32px;
}
.story-studio #story-appearance-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}
.story-studio [data-step-panel="6"] .two-col > .ghost-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  min-height: 42px;
}
.story-studio .appearance-label-button {
  justify-content: center;
  text-align: center;
}
.story-studio .story-field-help {
  color: #9ca39e;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.6;
}

.story-studio .detail-inspector > .story-repeat-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.story-studio .detail-inspector > .story-repeat-card > .story-repeat-head {
  flex: none;
}
.story-studio .detail-inspector > .story-repeat-card > .story-repeat-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.story-studio .story-appearance-episode-picker[hidden] {
  display: none;
}
.story-studio .story-appearance-grid > .appearance-add-card:only-child {
  grid-column: auto;
}
.story-studio #story-dialogue-editor .scenario-compose-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
}
.story-studio #story-dialogue-user-token {
  border: 1px solid #343b35;
  border-radius: 18px;
  background: #090d0b;
  color: #d6d9d7;
  padding: 6px 12px;
}
.story-studio #story-dialogue-counter {
  margin-left: auto;
  color: #919a93;
  font-size: 10px;
}
.story-studio #story-dialogue-add-block {
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: #2bdda8;
  color: #09271c;
}

.story-studio #story-appearance-inspector .story-appearance-episode-picker[hidden] {
  display: none;
}
.story-studio #story-character-inspector > .story-persona-editor {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
}
.story-studio #story-character-inspector .story-persona-editor > .story-inspector-heading {
  margin: 0;
}
.story-studio #story-character-inspector .story-persona-editor-body {
  min-height: 0;
  overflow-y: auto;
}
.story-studio #story-character-inspector .story-persona-editor-body > * {
  flex-shrink: 0;
}

/* Match the shared character profile's compact numeric controls. */
.story-studio .detail-inspector .state-range-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.story-studio .detail-inspector .state-range-box {
    min-width: 0;
    padding: 0;
    background: transparent;
    gap: 0;
    font-size: 11px;
    color: #aaa;
}
.story-studio .detail-inspector .state-range-box input {
    box-sizing: border-box;
    width: 100%;
    height: 34px;
    min-height: 34px;
    margin-top: 6px;
    border: 1px solid #686a68;
    border-radius: 11px;
    background: #202221;
    padding: 0 12px;
    color: #ddd;
}
