/* Prompt Builder — warm leather shell, clear working surface */

.pb-page {
  font-size: 18px;
}

.pb-inner {
  max-width: 1280px;
}

.pb-masthead .masthead-name-inner {
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
}

.pb-masthead .crest,
.pb-masthead .crest-link {
  width: clamp(110px, 12vw, 150px);
  height: clamp(110px, 12vw, 150px);
}

.pb-main {
  position: relative;
  z-index: 3;
}

/* ── Mode bar ── */
.pb-mode-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  align-items: center;
  margin-bottom: 22px;
  padding: 16px 18px;
  background:
    linear-gradient(180deg, rgba(241, 230, 205, 0.97), rgba(232, 218, 186, 0.95));
  border: 1px solid rgba(42, 32, 24, 0.18);
  border-radius: 4px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 10px 28px rgba(0, 0, 0, 0.28);
}

.pb-mode-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faded);
}

.pb-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pb-mode-btn {
  appearance: none;
  border: 1px solid rgba(42, 32, 24, 0.22);
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  border-radius: 3px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pb-mode-btn small {
  display: block;
  margin-top: 2px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink-faded);
  line-height: 1.35;
}

.pb-mode-btn:hover {
  border-color: rgba(138, 42, 34, 0.45);
}

.pb-mode-btn.is-active {
  background: linear-gradient(180deg, #fff8ec, #f1e6cd);
  border-color: var(--stamp-red);
  box-shadow: 0 0 0 1px rgba(138, 42, 34, 0.25);
}

.pb-mode-btn.is-active small {
  color: var(--stamp-red-deep);
}

.pb-mode-hint {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
}

/* ── Two-column layout ── */
.pb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(16px, 2.5vw, 28px);
  align-items: start;
}

@media (max-width: 960px) {
  .pb-layout {
    grid-template-columns: 1fr;
  }

  .pb-output {
    position: static !important;
  }

  .pb-mode-bar {
    grid-template-columns: 1fr;
  }
}

/* ── Menu panel ── */
.pb-menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pb-section {
  background:
    linear-gradient(165deg, rgba(247, 239, 220, 0.98), rgba(236, 224, 196, 0.96));
  border: 1px solid rgba(42, 32, 24, 0.16);
  border-radius: 4px;
  padding: 16px 16px 14px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 8px 22px rgba(0, 0, 0, 0.22);
}

.pb-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(156, 56, 42, 0.28);
  letter-spacing: 0.01em;
}

.pb-optional {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faded);
}

.pb-section-note {
  margin: -4px 0 10px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faded);
  line-height: 1.4;
}

.pb-option[hidden],
.pb-field[hidden] {
  display: none;
}

.pb-field + .pb-field {
  margin-top: 12px;
}

.pb-options-nested {
  padding-top: 2px;
  border-top: 1px dotted rgba(156, 56, 42, 0.22);
}

.pb-field {
  display: block;
}

.pb-field-label {
  display: block;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faded);
  margin-bottom: 6px;
}

.pb-field textarea,
.pb-field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(42, 32, 24, 0.22);
  border-radius: 3px;
  background: rgba(255, 252, 245, 0.9);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.4;
}

.pb-field textarea {
  resize: vertical;
  min-height: 72px;
}

.pb-field textarea:focus,
.pb-field input[type="text"]:focus {
  outline: 2px solid rgba(138, 42, 34, 0.45);
  outline-offset: 1px;
}

.pb-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.pb-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  border: 1px solid rgba(42, 32, 24, 0.14);
  border-radius: 3px;
  background: rgba(255, 252, 245, 0.55);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.2s ease;
}

.pb-option:hover {
  border-color: rgba(138, 42, 34, 0.4);
  background: rgba(255, 252, 245, 0.9);
}

.pb-option:has(input:checked) {
  border-color: var(--stamp-red);
  background: rgba(255, 248, 236, 0.95);
  box-shadow: inset 0 0 0 1px rgba(138, 42, 34, 0.12);
}

.pb-option input {
  margin-top: 4px;
  accent-color: var(--stamp-red);
  flex-shrink: 0;
}

.pb-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pb-option-body strong {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.pb-option-body em {
  font-style: normal;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--ink-faded);
  line-height: 1.35;
}

/* Beginner mode: mute advanced options */
.pb-page[data-mode="beginner"] .pb-option[data-level="advanced"] {
  opacity: 0.42;
  filter: grayscale(0.35);
  cursor: not-allowed;
}

.pb-page[data-mode="beginner"] .pb-option[data-level="advanced"] input {
  pointer-events: none;
}

.pb-page[data-mode="beginner"] .pb-option[data-level="advanced"]::after {
  content: 'Next Level';
  margin-left: auto;
  align-self: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faded);
  white-space: nowrap;
}

.pb-option-warn {
  border-color: rgba(138, 42, 34, 0.35);
  background: rgba(138, 42, 34, 0.06);
}

.pb-option-warn:hover,
.pb-option-warn:has(input:checked) {
  border-color: var(--stamp-red);
  background: rgba(138, 42, 34, 0.1);
}

.pb-option-warn .pb-option-body strong {
  color: var(--stamp-red-deep);
}

/* ── Output panel ── */
.pb-output {
  position: sticky;
  top: 16px;
  background:
    linear-gradient(180deg, #2a1810 0%, #1c100c 100%);
  border: 1px solid rgba(216, 166, 68, 0.35);
  border-radius: 4px;
  padding: 16px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    0 16px 40px rgba(0, 0, 0, 0.45);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.pb-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.pb-output-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  color: var(--brass-hi);
  margin: 0;
}

.pb-output-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pb-output-lede {
  font-size: 0.88rem;
  color: rgba(232, 200, 120, 0.72);
  margin: 0 0 10px;
}

.pb-btn {
  appearance: none;
  border-radius: 3px;
  padding: 7px 12px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.1s ease;
}

.pb-btn:active {
  transform: translateY(1px);
}

.pb-btn-primary {
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  color: #1c100c;
  border-color: rgba(106, 74, 24, 0.5);
  font-weight: 600;
}

.pb-btn-primary:hover {
  filter: brightness(1.06);
}

.pb-btn-primary.is-copied {
  background: linear-gradient(180deg, #c8e0b8, #8aaf6a);
  color: #142010;
}

.pb-btn-ghost {
  background: transparent;
  color: rgba(232, 200, 120, 0.85);
  border-color: rgba(216, 166, 68, 0.35);
}

.pb-btn-ghost:hover {
  background: rgba(216, 166, 68, 0.12);
}

.pb-prompt {
  flex: 1;
  overflow: auto;
  margin: 0;
  padding: 14px;
  background: rgba(10, 5, 4, 0.55);
  border: 1px solid rgba(216, 166, 68, 0.18);
  border-radius: 3px;
  color: #f1e6cd;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.pb-output-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  flex-shrink: 0;
}

.pb-copy-status {
  min-height: 1.2em;
  margin: 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--brass-hi);
  flex: 1;
  min-width: 0;
}

.lib-footer a {
  color: var(--brass-hi);
}
