/* Chat format carousel: the starting frame plus the matching chat screenshot. */
.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.chat-panel,
.chat-stage {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(25, 23, 20, 0.92);
  padding: 26px;
  box-shadow: 0 30px 90px #0007;
}

.chat-panel fieldset {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 20px;
  padding: 18px 0 0;
}

.chat-panel fieldset:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.chat-panel legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 0 10px;
}

.chat-panel select,
.chat-panel input[type="text"],
.chat-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #12110f;
  color: var(--text);
  padding: 11px 12px;
  font: 13px inherit;
  outline: 0;
}

.chat-panel textarea {
  height: auto;
  min-height: 58px;
  resize: vertical;
  line-height: 1.5;
}

.chat-panel input[type="text"]::placeholder,
.chat-panel textarea::placeholder {
  color: #68635b;
}

.chat-panel select {
  height: 44px;
}

.chat-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chat-pair label {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.chat-pair input {
  margin-top: 6px;
}

.chat-picker-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.chat-picker-actions button,
.chat-row-actions button,
.chat-stage button {
  border: 1px solid #38332c;
  border-radius: 10px;
  background: #211e1a;
  color: #cfc7bb;
  padding: 9px 13px;
  font: 12px inherit;
  cursor: pointer;
}

.chat-picker-actions button:hover,
.chat-row-actions button:hover,
.chat-stage button:hover {
  border-color: #725b3b;
  color: var(--text);
}

.chat-picker-actions button:disabled,
.chat-stage button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.chat-theme {
  display: flex;
  gap: 10px;
}

.chat-theme label {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.chat-theme label:has(input:checked) {
  border-color: #98794c;
  color: var(--gold2);
}

.chat-theme input {
  margin-right: 8px;
}

.chat-rows {
  display: grid;
  gap: 10px;
}

.chat-row {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #181614;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.chat-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-row-head .chat-side {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 2px;
  background: #12110f;
}

.chat-row-head .chat-side input {
  display: none;
}

.chat-row-head .chat-side span {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}

.chat-row-head .chat-side input:checked + span {
  background: #2c2620;
  color: var(--gold2);
}

.chat-row-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.chat-row-actions button {
  padding: 6px 10px;
  font-size: 11px;
}

.chat-row-actions .chat-remove {
  color: #c98d80;
}

.chat-brief {
  display: grid;
  gap: 7px;
}

.chat-brief.hidden {
  display: none;
}

.chat-brief small {
  color: var(--muted);
  font-size: 11px;
}

.chat-stage {
  display: grid;
  gap: 20px;
}

.chat-stage h3 {
  font: 500 18px "Playfair Display", serif;
  margin: 0 0 4px;
}

.chat-stage p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 12px;
}

.chat-stage label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin: 12px 0 0;
}

.chat-stage textarea {
  width: 100%;
  height: auto;
  min-height: 92px;
  resize: vertical;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #12110f;
  color: var(--text);
  padding: 11px 12px;
  font: 13px/1.5 inherit;
  outline: 0;
}

.chat-stage input[type="text"],
.chat-stage select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #12110f;
  color: var(--text);
  padding: 11px 12px;
  font: 13px inherit;
  outline: 0;
}

.chat-stage select {
  height: 42px;
}

.chat-frame-preview,
.chat-shot-preview {
  margin-top: 14px;
  border-radius: 16px;
  overflow: hidden;
  background: #0b0a09;
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid var(--line);
}

.chat-frame-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.chat-frame-preview.empty,
.chat-shot-preview.empty {
  color: #6f6a62;
  font-size: 12px;
  padding: 30px 20px;
  text-align: center;
}

.chat-shot-preview > span {
  color: #6f6a62;
  font-size: 12px;
  padding: 40px 22px;
  text-align: center;
}

#chatCanvas {
  display: block;
  width: 100%;
  height: auto;
}

.chat-downloads {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.chat-downloads button {
  flex: 1;
  min-width: 150px;
  background: linear-gradient(110deg, #b98743, var(--gold2));
  border: 0;
  color: #21170b;
  font-weight: 600;
  padding: 13px 16px;
}

.chat-downloads button:disabled {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 980px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .chat-panel,
  .chat-stage {
    padding: 18px;
  }

  .chat-pair {
    grid-template-columns: 1fr;
  }
}
