main.prompt-copy-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 1480px;
}

.prompt-copy-shell {
  width: 100%;
}

.back-link {
  align-self: flex-start;
  margin-bottom: 12px;
  font-size: 13px;
}

.prompt-detail {
  min-width: 0;
}

.prompt-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(300px, 1.08fr) minmax(360px, 1.5fr);
  gap: 14px;
  scroll-margin-top: calc(var(--header-h) + 14px);
}

.prompt-library-panel,
.prompt-form-panel,
.prompt-output-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
}

.prompt-library-panel {
  align-self: start;
  position: sticky;
  top: calc(var(--header-h) + 16px);
  padding: 16px;
}

.workspace-eyebrow {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-library-panel h2,
.workspace-panel-heading h2 {
  font-size: 17px;
}

.prompt-library-panel > p,
.workspace-panel-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.workspace-prompt-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - var(--header-h) - 150px);
  margin-top: 14px;
  overflow: auto;
}

.workspace-prompt-dropdown-label,
.workspace-prompt-dropdown {
  display: none;
}

.workspace-prompt-item {
  display: block;
  padding: 11px 12px;
  border: 1px solid rgba(0, 133, 124, 0.18);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.45;
  text-decoration: none;
}

.workspace-prompt-item:hover {
  border-color: rgba(0, 133, 124, 0.42);
  background: rgba(0, 133, 124, 0.05);
  text-decoration: none;
}

.workspace-prompt-item.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.prompt-form-panel,
.prompt-output-panel {
  padding: 16px;
}

.workspace-panel-heading {
  margin-bottom: 14px;
}

.example-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.example-fill-btn,
.generate-btn,
.form-reset-btn,
.copy-btn {
  border: 1px solid rgba(0, 133, 124, 0.28);
  border-radius: 11px;
  background: rgba(0, 133, 124, 0.08);
  color: var(--brand);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 11px;
  transition:
    background 0.12s ease,
    transform 0.12s ease;
}

.example-fill-btn:hover,
.generate-btn:hover,
.form-reset-btn:hover,
.copy-btn:hover {
  background: rgba(0, 133, 124, 0.14);
  transform: translateY(-1px);
}

.prompt-variable-form {
  display: grid;
  gap: 11px;
  max-height: 680px;
  padding-right: 4px;
  overflow: auto;
}

.prompt-field {
  display: grid;
  gap: 6px;
}

.prompt-field > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.prompt-field textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: var(--text);
  font: 12.5px/1.55 "Poppins", system-ui, sans-serif;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.prompt-field textarea:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 4px var(--focus-shadow);
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 12px;
  background: linear-gradient(to bottom, transparent, #fff 18%);
}

.generate-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  padding: 11px 14px;
}

.generate-btn:hover {
  background: var(--brand-2);
}

.generate-btn:disabled,
.generate-btn:disabled:hover {
  border-color: var(--border-strong);
  background: #d9e1e4;
  color: #718087;
  cursor: not-allowed;
  transform: none;
}

.form-required-notice {
  margin: -2px 2px 0;
  color: #b45309;
  font-size: 11.5px;
  line-height: 1.5;
}

.form-required-notice.is-complete {
  color: var(--brand);
}

.form-reset-btn {
  border-color: var(--border);
  background: #fff;
  color: var(--muted);
}

.prompt-output-panel {
  align-self: start;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.output-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.copy-btn {
  flex: 0 0 auto;
}

.prompt-output-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  padding: 28px;
  border: 1px dashed rgba(0, 133, 124, 0.3);
  border-radius: 12px;
  background: rgba(0, 133, 124, 0.035);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.generated-prompt {
  min-height: 360px;
  max-height: 680px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.035);
  color: var(--text);
  font: 12.5px/1.7 "Poppins", system-ui, sans-serif;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

[hidden] {
  display: none !important;
}

.example-result {
  margin-top: 14px;
}

.example-result:empty {
  display: none;
}

.example-result h3 {
  margin-bottom: 9px;
  font-size: 14px;
}

.result-image {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #fff;
  cursor: zoom-in;
  overflow: hidden;
}

.result-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  transition: transform 0.16s ease;
}

.result-image:hover img {
  transform: scale(1.015);
}

.result-video-button {
  position: relative;
  display: block;
  width: min(210px, 100%);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: #111827;
  cursor: zoom-in;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

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

.result-video-button span {
  position: absolute;
  inset: auto 10px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  text-align: center;
}

.result-video-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.result-video-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-34%, -50%);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 16px solid var(--brand);
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 72px 18px 24px;
  background: rgba(15, 23, 42, 0.78);
}

.image-modal.is-open {
  display: flex;
}

.image-modal img {
  max-width: min(980px, 100%);
  max-height: 82vh;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.image-modal video {
  width: min(430px, 100%);
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 116px);
  border-radius: 14px;
  background: #000;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 200;
  max-width: calc(100vw - 28px);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.copy-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1120px) {
  .prompt-workspace {
    grid-template-columns: minmax(170px, 0.7fr) minmax(280px, 1fr) minmax(320px, 1.25fr);
  }
}

@media (max-width: 880px) {
  .prompt-workspace {
    grid-template-columns: 1fr;
  }

  .prompt-library-panel,
  .prompt-output-panel {
    position: static;
  }

  .workspace-prompt-dropdown-label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }

  .workspace-prompt-dropdown {
    position: relative;
    display: block;
    width: 100%;
  }

  .workspace-prompt-dropdown-button {
    position: relative;
    min-height: 48px;
    padding: 13px 44px 13px 14px;
    border: 1px solid rgba(0, 133, 124, 0.28);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    list-style: none;
  }

  .workspace-prompt-dropdown-button::-webkit-details-marker {
    display: none;
  }

  .workspace-prompt-dropdown-button::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 17px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--brand);
    border-bottom: 2px solid var(--brand);
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.2s ease;
  }

  .workspace-prompt-dropdown[open] .workspace-prompt-dropdown-button {
    border-color: var(--brand);
    outline: 3px solid rgba(0, 133, 124, 0.12);
  }

  .workspace-prompt-dropdown-button:focus-visible {
    border-color: var(--brand);
    outline: 3px solid rgba(0, 133, 124, 0.12);
  }

  .workspace-prompt-dropdown[open] .workspace-prompt-dropdown-button::after {
    transform: translateY(-30%) rotate(225deg);
  }

  .workspace-prompt-dropdown-menu {
    --dropdown-item-height: 48px;
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: grid;
    gap: 4px;
    max-height: min(
      calc((var(--dropdown-item-height) * 5) + (4px * 4) + 12px),
      50vh
    );
    padding: 6px;
    overflow-y: auto;
    border: 1px solid rgba(0, 133, 124, 0.18);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(22, 45, 54, 0.16);
  }

  .workspace-prompt-dropdown-item {
    display: flex;
    align-items: center;
    min-height: var(--dropdown-item-height);
    padding: 11px 12px;
    border-radius: 9px;
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.45;
    text-decoration: none;
  }

  .workspace-prompt-dropdown-item:hover {
    background: rgba(0, 133, 124, 0.07);
    text-decoration: none;
  }

  .workspace-prompt-dropdown-item.is-active {
    background: rgba(0, 133, 124, 0.11);
    color: var(--brand);
    font-weight: 600;
  }

  .workspace-prompt-list {
    display: none;
  }

  .prompt-variable-form,
  .generated-prompt {
    max-height: none;
  }

  .form-actions {
    position: static;
  }

  .prompt-output-empty {
    min-height: 240px;
  }

  .generated-prompt {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .prompt-copy-shell {
    padding: 14px;
  }

  .output-heading {
    display: grid;
  }

  .copy-btn {
    width: 100%;
  }

  .example-fill-btn,
  .generate-btn,
  .form-reset-btn,
  .copy-btn {
    min-height: 44px;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .prompt-form-panel,
  .prompt-output-panel,
  .prompt-library-panel {
    padding: 14px;
  }

  .prompt-output-empty,
  .generated-prompt {
    min-height: 220px;
  }

  .image-modal {
    padding: 64px 12px 16px;
  }

  .image-modal img,
  .image-modal video {
    max-height: calc(100dvh - 96px);
    border-radius: 12px;
  }

  .modal-close {
    top: 12px;
    right: 12px;
  }
}
