/* Extracted from index.html. Prompt editor box, toolbar, reverse prompt state, and generation controls. */

.prompt-box {
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 16px;
  background: var(--soft);
  min-height: 320px;
  padding: 12px;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    border-radius 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.28s ease,
    background-color 0.22s ease,
    border-color 0.15s ease;
  will-change: transform;
  backface-visibility: hidden;
  z-index: 20;
}
@keyframes tech-border-spin {
  0% { --tech-angle: 0deg; }
  100% { --tech-angle: 360deg; }
}
@property --tech-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.prompt-box.reverse-drag-over {
  border-color: transparent;
}
.prompt-box.reverse-drag-over::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 19px;
  padding: 3px;
  background: conic-gradient(
    from var(--tech-angle),
    #6366f1, #a855f7, #3b82f6, transparent 40%, transparent 60%, #6366f1
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: blur(6px);
  animation: tech-border-spin 4.8s linear infinite;
  pointer-events: none;
  z-index: 30;
}
.prompt-box.reverse-processing {
  border-color: transparent;
}
.prompt-box.reverse-processing::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 19px;
  padding: 3px;
  background: conic-gradient(
    from var(--tech-angle),
    #6366f1, #a855f7, #3b82f6, transparent 40%, transparent 60%, #6366f1
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter: blur(6px);
  animation: tech-border-spin 2.4s linear infinite;
  pointer-events: none;
  z-index: 30;
}
.prompt-box.reverse-processing .prompt-textarea::placeholder {
  color: transparent;
}
.prompt-box.reverse-processing .reverse-placeholder-anim {
  display: flex;
}
.reverse-placeholder-anim {
  display: none;
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 14px;
  color: var(--muted);
  align-items: center;
  gap: 8px;
  z-index: 1;
  pointer-events: none;
}
.reverse-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 72px;
  height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  z-index: 36;
  cursor: pointer;
}
.prompt-box.reverse-processing:hover .reverse-stop-btn,
.prompt-box.reverse-processing:focus-within .reverse-stop-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.reverse-stop-btn:hover {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
}
.icon-btn.reverse-ready {
  opacity: 1 !important;
  background: var(--surface);
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.12);
  transition: opacity 0.18s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.prompt-reverse-btn .reverse-prompt-button-preview-frame {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.prompt-reverse-btn .reverse-prompt-button-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
  transform-origin: center;
}
.prompt-reverse-btn.reverse-ready {
  background: transparent;
}
.prompt-reverse-btn.reverse-ready > svg {
  opacity: 0;
}
.prompt-reverse-btn .reverse-prompt-button-preview.is-visible {
  opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
  .prompt-reverse-btn.reverse-ready:hover .reverse-prompt-button-preview {
    transform: scale(1.08);
  }
}

.prompt-box.fullscreen {
  position: fixed;
  z-index: 1001;
  top: 50%;
  left: 50%;
  width: min(760px, 78vw);
  height: min(560px, 68vh);
  transform: translate(-50%, -50%);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
  background: #fff;
  padding: 14px;
}

.prompt-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.prompt-box:hover .prompt-toolbar,
.prompt-box:focus-within .prompt-toolbar {
  opacity: 1;
  pointer-events: auto;
}
.prompt-toolbar.keep-visible,
.prompt-toolbar:has(.shield-active),
.prompt-toolbar:has(.reverse-ready),
.prompt-toolbar:has(.reverse-loading) {
  opacity: 1;
  pointer-events: auto;
}

.icon-btn {
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  color: #3a3a3c;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  transition: opacity 0.18s ease;
}
.icon-btn[data-tip] {
  position: relative;
}
.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(3px);
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(20, 20, 22, 0.9);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 6;
}
.icon-btn[data-tip]:hover::after,
.icon-btn[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.icon-btn:hover {
  opacity: 1;
}
.icon-btn.prompt-save-tip-btn {
  opacity: 0.38;
  border-style: solid;
  color: color-mix(in srgb, var(--text) 72%, var(--muted));
}
.icon-btn.prompt-save-tip-btn:hover,
.icon-btn.prompt-save-tip-btn:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--surface) 92%, var(--soft));
  color: var(--text);
}
.icon-btn.prompt-save-tip-btn::after {
  right: 0;
  left: auto;
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateY(-3px);
}
.icon-btn.prompt-save-tip-btn:hover::after,
.icon-btn.prompt-save-tip-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
.prompt-save-tip-append-btn {
  position: fixed;
  z-index: 32000;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: visible;
  opacity: 0;
  transform: translateX(8px) scale(0.82);
  transform-origin: right center;
  transition: opacity 0.14s ease, transform 0.18s cubic-bezier(0.2, 0.9, 0.18, 1), background 0.16s ease;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
}
.prompt-save-tip-append-btn.show {
  opacity: 0.46;
  transform: translateX(0) scale(1);
}
.prompt-save-tip-append-btn:hover,
.prompt-save-tip-append-btn:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--surface) 92%, var(--soft));
}
.prompt-save-tip-append-btn::after {
  content: "追加技巧";
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(4px) scale(0.96);
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(20, 20, 22, 0.9);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 760;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.14s cubic-bezier(0.2, 0.9, 0.18, 1);
}
.prompt-save-tip-append-btn:hover::after,
.prompt-save-tip-append-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
}
.prompt-save-tip-append-btn .append-tip-main-icon {
  width: 13px;
  height: 13px;
  stroke: currentColor;
}
.prompt-save-tip-append-btn .append-tip-plus {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 7px;
  height: 7px;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
}
html.theme-dark .prompt-save-tip-append-btn {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}
.icon-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

html.theme-dark .icon-btn {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f0f0f0;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
@keyframes shield-sweep {
  0%   { background-position: -50px 0; }
  100% { background-position: 50px 0; }
}
.icon-btn.shield-active {
  opacity: 1;
  background: linear-gradient(180deg, #3dd863 0%, #2aad4a 100%);
  border: none;
  color: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 0 2px 5px rgba(45, 184, 77, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}
.icon-btn.shield-active::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 45%,
    rgba(255, 255, 255, 0.35) 55%,
    transparent 100%
  );
  background-size: 50px 100%;
  background-repeat: no-repeat;
  animation: shield-sweep 2s ease-in-out infinite;
  pointer-events: none;
}
html.theme-dark .icon-btn.shield-active {
  background: linear-gradient(180deg, #38c455 0%, #27944a 100%);
  border: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 2px 5px rgba(35, 147, 64, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.prompt-textarea {
  border: 0;
  width: 100%;
  min-height: 294px;
  resize: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  margin: 0;
  display: block;
  padding: 2px 42px 0 2px;
  scrollbar-width: none;
}
.prompt-textarea::-webkit-scrollbar {
  display: none;
}

.prompt-box.fullscreen .prompt-textarea {
  min-height: calc(100% - 4px);
  height: calc(100% - 4px);
  resize: none;
}

.fullscreen-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(14, 14, 18, 0.24);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0s linear 0.24s;
}

.fullscreen-backdrop.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.24s ease, visibility 0s linear 0s;
}

.field-row {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.action-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  height: 36px;
  min-width: 88px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0 14px;
  transition: 0.2s ease;
}

.action-btn.clear {
  background: #fff;
  color: #3a3a3c;
}

.action-btn.clear:hover {
  background: #f2f2f5;
}

.action-btn.generate {
  background: #F0EEE9;
  color: #1d1d1f;
  border-color: transparent;
}

.action-btn.generate:hover {
  background: #e5e2dc;
}

.action-btn.generate {
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: transform 0.12s ease;
}
.action-btn.generate:hover {
  transform: scale(1.02);
}
.action-btn.generate:active {
  transform: scale(0.96);
}

.action-btn.generate::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(20, 20, 22, 0.86);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.action-btn.generate[data-tip=""]::after {
  display: none;
}

.action-btn.generate:hover::after,
.action-btn.generate:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.action-btn.generate.generating {
  box-shadow: none;
  outline: none;
}

.action-btn.generate.generate-red-countdown::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  background: #ff5c60;
  border-radius: inherit;
  z-index: 0;
  animation: generate-red-drain 3s linear forwards;
  pointer-events: none;
}
@keyframes generate-red-drain {
  0% { width: 100%; }
  100% { width: 0%; }
}
.action-btn.generate.generate-red-countdown .generate-btn-label {
  color: #fff;
  position: relative;
  z-index: 1;
}

.action-status {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.field-group label {
  font-size: 12px;
  color: var(--muted);
}

.field-group select {
  height: 36px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.field-group select:focus,
.field-group select:focus-visible {
  outline: none;
  border-color: rgba(0, 0, 0, 0.12);
}

html.theme-dark .field-group select {
  background: #242424;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f0f0f0;
}

html.theme-dark .field-group select:focus,
html.theme-dark .field-group select:focus-visible {
  outline: none;
  border-color: rgba(255, 255, 255, 0.12);
}

html.theme-dark .field-group select option {
  background: #242424;
  color: #f0f0f0;
}

.action-btn.generate .generate-btn-timer,
.action-btn.generate .generate-btn-stop {
  display: none !important;
}
.action-btn.generate.show-stop-icon .generate-btn-label {
  display: none !important;
}
.action-btn.generate.show-stop-icon .generate-btn-stop {
  display: inline !important;
}
