.prompt-editor-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.prompt-mention-editor {
  min-height: 118px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--color-tertiary);
  border-radius: 8px;
  background: var(--color-secondary);
  color: var(--color-text-primary);
  font-size: 12px;
  line-height: 1.45;
  outline: none;
  overflow: auto;
}

.prompt-mention-editor:focus-within {
  border-color: #8a642e;
  box-shadow: 0 0 0 1px rgba(252, 175, 27, 0.22);
}

.prompt-mention-editor-content {
  min-height: 118px;
  box-sizing: border-box;
  padding: 10px 12px 44px;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt-compose-toolbar {
  position: absolute;
  inset-inline: 7px;
  inset-block-end: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.prompt-compose-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: auto;
}

.prompt-icon-button,
.prompt-generate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 26px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.prompt-icon-button {
  min-inline-size: 26px;
  padding: 0;
}

.prompt-icon-button .material-icons {
  font-size: 15px;
  line-height: 1;
}

.prompt-icon-symbol {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.prompt-generate-button {
  flex: 0 0 auto;
  padding: 0 14px;
  border-color: rgba(252, 175, 27, 0.44);
  background: rgba(111, 76, 29, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  pointer-events: auto;
  white-space: nowrap;
}

.prompt-icon-button:hover,
.prompt-generate-button:hover {
  border-color: rgba(252, 175, 27, 0.7);
  background: rgba(252, 175, 27, 0.18);
  color: #fff;
}

.prompt-attachment-input {
  display: none;
}

.prompt-mention-editor-content p {
  min-height: 1.45em;
  margin: 0;
}

.prompt-mention-editor-content p.is-editor-empty:first-child::before {
  color: var(--color-text-secondary);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  opacity: 0.75;
  pointer-events: none;
}

.prompt-mention-hidden {
  display: none;
}

.prompt-mention-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.45;
  white-space: nowrap;
  vertical-align: baseline;
}

.prompt-mention-chip--character {
  color: #f3dfc0;
  border: 1px solid rgba(252, 175, 27, 0.45);
  background: rgba(111, 76, 29, 0.55);
}

.prompt-mention-chip--background,
.prompt-mention-chip--scene {
  color: #d9edff;
  border: 1px solid rgba(90, 155, 220, 0.45);
  background: rgba(34, 66, 94, 0.58);
}

.prompt-mention-chip--attachment {
  color: #e7f6df;
  border: 1px solid rgba(111, 190, 108, 0.44);
  background: rgba(44, 88, 52, 0.55);
}

.tippy-box[data-theme~="prompt-mention-card"] {
  color: var(--color-text-primary);
  border: 1px solid var(--color-tertiary);
  border-radius: 8px;
  background: var(--color-base);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.tippy-box[data-theme~="prompt-mention-card"] .tippy-content {
  padding: 0;
}

.tippy-box[data-theme~="prompt-mention-card"] .tippy-arrow {
  color: var(--color-base);
}

.prompt-mention-tooltip-card {
  display: flex;
  gap: 10px;
  inline-size: min(320px, calc(100vw - 32px));
  max-inline-size: 100%;
  padding: 10px;
}

.prompt-mention-tooltip-media {
  flex: 0 0 clamp(58px, 18vw, 84px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--color-tertiary);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.prompt-mention-tooltip-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prompt-mention-tooltip-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.prompt-mention-tooltip-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.prompt-mention-tooltip-title {
  min-width: 0;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.prompt-mention-tooltip-badge {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.2;
}

.prompt-mention-tooltip-badge--character {
  color: #f3dfc0;
  background: rgba(111, 76, 29, 0.7);
}

.prompt-mention-tooltip-badge--background {
  color: #d9edff;
  background: rgba(34, 66, 94, 0.75);
}

.prompt-mention-tooltip-badge--attachment {
  color: #e7f6df;
  background: rgba(44, 88, 52, 0.75);
}

.prompt-mention-tooltip-description,
.prompt-mention-tooltip-prompt {
  color: var(--color-text-secondary);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.prompt-mention-tooltip-prompt {
  padding: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.prompt-mention-tooltip-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.prompt-mention-tooltip-field {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 10px;
  line-height: 1.35;
}

.prompt-mention-tooltip-field-label {
  flex: 0 0 auto;
  padding: 2px 4px 2px 6px;
  color: var(--color-text-secondary);
}

.prompt-mention-tooltip-field-value {
  min-width: 0;
  padding: 2px 6px 2px 0;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-mention-menu {
  position: fixed;
  z-index: calc(var(--z-modal) + 2);
  display: none;
  width: min(320px, calc(100vw - 16px));
  max-height: min(320px, calc(100vh - 24px));
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--color-tertiary);
  border-radius: 8px;
  background: var(--color-base);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.45);
}

.prompt-mention-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-primary);
  cursor: pointer;
  text-align: left;
}

.prompt-mention-option:hover {
  border-color: rgba(252, 175, 27, 0.36);
  background: rgba(255, 255, 255, 0.06);
}

.prompt-mention-option.is-selected {
  border-color: rgba(252, 175, 27, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

.prompt-mention-option-thumb {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
}

.prompt-mention-option-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.prompt-mention-option-label {
  font-size: 12px;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-mention-option-sub {
  font-size: 10px;
  color: var(--color-text-secondary);
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.prompt-mention-menu-empty {
  padding: 10px;
  font-size: 11px;
  color: var(--color-text-secondary);
}

#other-controls-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#other-controls-mini > .individual-ai-control {
  margin-top: 0;
  box-shadow: none;
}

#other-controls-mini .individual-ai-control .textarea-label-wrapper {
  min-height: 24px;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

#other-controls-mini .individual-ai-control .textarea-label {
  color: var(--color-text-primary);
  font-weight: 700;
  line-height: 1.2;
}

#other-controls-mini .individual-ai-control .textarea-hint {
  margin: 0 0 4px;
  color: #ffb21f;
  font-size: 10.5px;
  line-height: 1.25;
}

#other-controls-mini .individual-ai-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

#other-controls-mini .individual-ai-actions .role-assign-trigger {
  margin-left: 0;
  padding: 2px 7px;
}

.controls-mini .dual-number-control.individual-ai-seed-row {
  gap: 8px;
}

.controls-mini .dual-number-control.individual-ai-seed-row .control {
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
  box-shadow: none;
}

#other-controls-mini .panel-reference-selected-list,
#other-controls-mini .character-role-selected-list {
  min-height: 20px;
  margin-top: 2px;
  gap: 4px;
}

.panel-reference-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 24px;
  margin-top: 4px;
}

.panel-reference-empty,
.panel-reference-chip {
  font-size: 11px;
}

.panel-reference-empty {
  color: var(--color-text-secondary);
  opacity: 0.8;
}

.panel-reference-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 8px;
  border: 1px solid rgba(252, 175, 27, 0.34);
  border-radius: 999px;
  background: rgba(111, 76, 29, 0.34);
  color: var(--color-text-secondary);
}

.panel-reference-chip-name {
  max-width: min(180px, 100%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-reference-chip-remove {
  border: none;
  padding: 0 2px;
  margin: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.panel-reference-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.panel-reference-dialog {
  width: min(880px, 100%);
  max-height: 82vh;
  background: var(--color-base);
  border: 1px solid var(--color-tertiary);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-reference-header,
.panel-reference-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-color: var(--color-tertiary);
}

.panel-reference-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--color-tertiary);
}

.panel-reference-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--color-tertiary);
}

.panel-reference-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.panel-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  overflow: auto;
}

.panel-reference-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.panel-reference-card.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px rgba(160, 48, 48, 0.36) inset;
}

.panel-reference-thumb-wrap {
  aspect-ratio: 4 / 3;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.panel-reference-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-reference-thumb-loading,
.panel-reference-empty {
  color: var(--color-text-secondary);
  font-size: 11px;
}

.panel-reference-card-name {
  padding: 6px 8px 8px;
  font-size: 11px;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-reference-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.panel-reference-btn-primary {
  border-color: rgba(252, 175, 27, 0.42);
  background: rgba(111, 76, 29, 0.5);
  color: #fff;
}
