/* Prompt Playground workspace (.pg-*), shared by /playground/ and the free
   stock photo description generator (/stock-photo-description-generator/). */
:root {
  --pg-accent: #E67E5C;
  --pg-accent-hover: #D86346;
  --pg-gradient: linear-gradient(135deg, #E67E5C, #FFB84D);
  --pg-b: #2563eb;
  --pg-text: #1f2328;
  --pg-muted: #6b7280;
  --pg-border: #e5e7eb;
  --pg-surface: #ffffff;
  --pg-soft: #fff7ed;
  --pg-bg: #f6f7f9;
}
.pg { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--pg-text); max-width: 1680px; margin: 0 auto; padding: 12px 24px 32px; font-size: 14px; }
.pg *, .pg *::before, .pg *::after { box-sizing: border-box; }
.pg [hidden] { display: none !important; }

/* Header: one slim row */
.pg-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pg-top h1 { font-size: 1.35rem; font-weight: 700; margin: 0; line-height: 1.2; }
.pg-top h1 small { font-size: 13px; font-weight: 500; color: var(--pg-muted); margin-left: 8px; }
.pg-auth { display: flex; gap: 8px; align-items: center; }
.pg-quota { font-size: 13px; color: var(--pg-muted); background: var(--pg-surface); border: 1px solid var(--pg-border); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }
.pg-quota strong { color: var(--pg-text); }
.pg-quota.is-empty { border-color: #fed7aa; background: var(--pg-soft); color: #7c2d12; }

/* Workspace: fills the viewport on desktop */
.pg-work { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; height: calc(100vh - var(--pg-top, 150px) - 16px); min-height: 520px; }
.pg-panel { background: var(--pg-surface); border: 1px solid var(--pg-border); border-radius: 14px; min-height: 0; }

/* Left: setup */
.pg-setup { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: auto; }
.pg-label { font-size: 12px; font-weight: 600; color: var(--pg-muted); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pg-drop { position: relative; display: flex; align-items: center; justify-content: center; height: 150px; border: 2px dashed var(--pg-border); border-radius: 10px; background: var(--pg-bg); cursor: pointer; overflow: hidden; text-align: center; transition: border-color .2s; flex: none; }
.pg-drop:hover, .pg-drop.is-over { border-color: var(--pg-accent); }
.pg-drop.has-image { border-style: solid; }
.pg-drop img { width: 100%; height: 100%; object-fit: contain; }
.pg-drop input { display: none; }
.pg-drop-empty { padding: 12px; color: var(--pg-muted); font-size: 13px; }
.pg-drop-empty strong { display: block; color: var(--pg-text); margin-bottom: 2px; }
.pg-photo-actions { display: flex; justify-content: space-between; font-size: 12px; color: var(--pg-muted); margin-top: 4px; }
.pg-link-btn { background: none; border: none; color: var(--pg-accent-hover); font-weight: 600; padding: 0; cursor: pointer; font-size: 12px; font-family: inherit; }
.pg-link-btn:hover { text-decoration: underline; }

.pg select, .pg textarea, .pg input[type=text] { width: 100%; border: 1px solid var(--pg-border); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--pg-text); background: var(--pg-surface); }
.pg select:focus, .pg textarea:focus, .pg input[type=text]:focus { outline: none; border-color: var(--pg-accent); box-shadow: 0 0 0 3px rgba(230,126,92,.15); }
.pg-model-row { display: flex; align-items: center; gap: 8px; }
.pg-model-row + .pg-model-row { margin-top: 6px; }
.pg-slot { display: inline-flex; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--pg-accent); color: #fff; font-size: 11px; font-weight: 700; align-items: center; justify-content: center; }
.pg-slot.is-b { background: var(--pg-b); }
.pg-single-mode .pg-slot-a { display: none; }

.pg-switch { position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--pg-text); text-transform: none; letter-spacing: 0; cursor: pointer; user-select: none; }
.pg-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pg-switch-track { width: 30px; height: 17px; border-radius: 999px; background: #d1d5db; position: relative; transition: background .2s; flex: none; }
.pg-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pg-switch input:checked + .pg-switch-track { background: var(--pg-accent); }
.pg-switch input:checked + .pg-switch-track::after { transform: translateX(13px); }
.pg-switch input:focus-visible + .pg-switch-track { outline: 3px solid rgba(230,126,92,.35); outline-offset: 2px; }

.pg-prompt-wrap { display: flex; flex-direction: column; flex: 1 0 auto; }
.pg-prompt-wrap select { width: auto; max-width: 60%; padding: 3px 6px; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.pg textarea { flex: 1 1 auto; min-height: 140px; resize: none; line-height: 1.5; }
.pg-prompt-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--pg-muted); margin-top: 4px; }

.pg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .15s, box-shadow .15s, background .15s; }
.pg-btn-primary { background: var(--pg-gradient); color: #fff; }
.pg-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(230,126,92,.3); color: #fff; }
.pg-btn-primary:disabled { opacity: .6; cursor: progress; transform: none; box-shadow: none; }
.pg-btn-ghost { background: var(--pg-surface); color: var(--pg-text); border: 1px solid var(--pg-border); }
.pg-btn-ghost:hover { border-color: var(--pg-accent); color: var(--pg-accent-hover); }
.pg-btn-sm { padding: 6px 12px; font-size: 13px; }
.pg-btn-block { width: 100%; }
.pg-run-btn { flex: none; padding: 12px 18px; font-size: 15px; }
.pg-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: pg-spin .8s linear infinite; }
.pg-spinner.is-dark { border-color: rgba(230,126,92,.25); border-top-color: var(--pg-accent); width: 28px; height: 28px; border-width: 3px; }
@keyframes pg-spin { to { transform: rotate(360deg); } }
.pg-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; font-size: 13px; }

/* Right: results */
.pg-results { display: flex; flex-direction: column; overflow: hidden; }
.pg-results-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--pg-border); min-height: 48px; flex-wrap: wrap; }
.pg-results-head .pg-label { margin: 0 4px 0 0; }
.pg-history { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: thin; }
.pg-pill { flex: none; border: 1px solid var(--pg-border); background: var(--pg-surface); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; color: var(--pg-muted); cursor: pointer; white-space: nowrap; }
.pg-pill:hover { border-color: #f3b49f; }
.pg-pill.is-active { border-color: var(--pg-accent); background: var(--pg-soft); color: var(--pg-accent-hover); font-weight: 600; }
.pg-results-body { flex: 1 1 auto; overflow: auto; padding: 14px; min-height: 0; }

.pg-empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--pg-muted); gap: 22px; padding: 16px; }
.pg-empty h2 { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--pg-text); margin: 0; }
.pg-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px; align-items: center; width: 100%; max-width: 1080px; }
.pg-hero-copy { display: flex; flex-direction: column; gap: 12px; }
.pg-hero-copy p { margin: 0; font-size: 15px; line-height: 1.55; }
.pg-eyebrow { align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--pg-accent-hover); background: var(--pg-soft); border: 1px solid #fed7aa; border-radius: 999px; padding: 3px 10px; }
.pg-models-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pg-model-badge { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 3px 10px; border: 1px solid; }
.pg-model-badge.is-gpt { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.pg-model-badge.is-claude { color: #9a3412; background: #fff7ed; border-color: #fed7aa; }
.pg-model-badge.is-gemini { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }
.pg-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Animated example: photo -> metadata */
.pg-demo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); background: var(--pg-surface); border: 1px solid var(--pg-border); border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(31,35,40,.08); }
.pg-demo-photo { position: relative; min-height: 240px; background: var(--pg-bg); overflow: hidden; }
.pg-demo-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-demo-scan { position: absolute; left: 0; right: 0; height: 40%; background: linear-gradient(180deg, transparent, rgba(255,184,77,.35) 85%, rgba(255,184,77,.9)); animation: pg-scan 3.2s ease-in-out infinite; }
@keyframes pg-scan { 0% { top: -40%; } 60%, 100% { top: 100%; } }
.pg-demo-tag { position: absolute; left: 10px; bottom: 10px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(17,24,39,.65); backdrop-filter: blur(4px); border-radius: 999px; padding: 3px 10px; }
.pg-demo-out { padding: 14px 16px; text-align: left; font-size: 12.5px; line-height: 1.45; }
.pg-demo-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--pg-muted); margin: 8px 0 2px; }
.pg-demo-label:first-child { margin-top: 0; }
.pg-demo-title { font-weight: 600; font-size: 13.5px; color: var(--pg-text); }
.pg-demo-desc { color: var(--pg-text); }
.pg-demo-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pg-demo-chips span { background: var(--pg-soft); border: 1px solid #fbd5c5; color: #7c2d12; border-radius: 999px; padding: 0 8px; font-size: 11.5px; line-height: 1.7; opacity: 0; animation: pg-pop 6s ease-out infinite; animation-delay: calc(var(--i) * .12s); }
.pg-demo-chips span.is-more { background: var(--pg-bg); border-color: var(--pg-border); color: var(--pg-muted); }
@keyframes pg-pop { 0% { opacity: 0; transform: scale(.7); } 6%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .pg-demo-scan { display: none; }
  .pg-demo-chips span { animation: none; opacity: 1; }
}

.pg-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 1080px; }
.pg-steps div { background: var(--pg-bg); border-radius: 10px; padding: 12px 14px; font-size: 13px; text-align: left; }
.pg-steps i { color: var(--pg-accent); font-size: 16px; margin-bottom: 6px; display: block; }
.pg-steps strong { display: block; color: var(--pg-text); margin-bottom: 2px; }
@media (max-width: 1399px) { .pg-hero { grid-template-columns: minmax(0, 1fr); gap: 18px; } }
@media (max-height: 820px) and (min-width: 1100px) { .pg-steps { display: none; } .pg-empty h2 { font-size: 22px; } }
.pg-loading { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--pg-muted); }

/* Result layouts */
.pg-summary { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; font-size: 13px; color: var(--pg-muted); margin-bottom: 12px; }
.pg-summary strong { color: var(--pg-text); }
.pg-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--pg-soft); border: 1px solid #f3b49f; margin-right: 4px; vertical-align: -1px; }
.pg-out-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.pg-out { border: 1px solid var(--pg-border); border-radius: 12px; padding: 14px; min-width: 0; }
.pg-out.is-winner { border-color: var(--pg-accent); box-shadow: 0 0 0 2px rgba(230,126,92,.18); }
.pg-out-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.pg-out-model { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pg-out-meta { font-size: 12px; color: var(--pg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pg-out-head .pg-btn { margin-left: auto; flex: none; }
.pg-single { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 16px; align-items: start; }
@media (max-width: 1399px) { .pg-single { grid-template-columns: minmax(0, 1fr); } }
.pg-field + .pg-field { margin-top: 10px; }
.pg-field-label { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; color: var(--pg-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.pg-field-value { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.pg-title-value { font-weight: 600; font-size: 15px; }
.pg-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pg-chip { background: var(--pg-bg); border: 1px solid var(--pg-border); border-radius: 999px; padding: 1px 8px; font-size: 12px; line-height: 1.6; }
.pg-chip.is-shared { background: var(--pg-soft); border-color: #f3b49f; color: var(--pg-accent-hover); }
.pg-len { text-transform: none; letter-spacing: 0; font-weight: 500; margin-right: auto; margin-left: 2px; }

/* Keyword panels (same layout as the Review in Details page) */
.pg-kw-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; }
.pg-kw-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.pg-out-grid .pg-kw-grid { grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
.pg-kw-panel { border: 1px solid var(--pg-border); border-radius: 10px; padding: 10px; min-width: 0; background: var(--pg-surface); }
.pg-kw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pg-kw-tools { display: flex; align-items: center; gap: 10px; }
.pg-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.pg-tab { border: none; background: transparent; border-radius: 6px; padding: 3px 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--pg-muted); cursor: pointer; }
.pg-tab:hover { background: var(--pg-bg); }
.pg-tab.is-active { background: var(--pg-text); color: #fff; }
.pg-tab-n { font-weight: 500; opacity: .75; margin-left: 4px; font-variant-numeric: tabular-nums; }
.pg-tab.is-over .pg-tab-n { color: #fca5a5; opacity: 1; }
.pg-src { font-size: 11px; font-weight: 600; color: var(--pg-muted); background: var(--pg-bg); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.pg-src.is-model { color: #065f46; background: #ecfdf5; }
.pg-chips-scroll { max-height: 300px; overflow-y: auto; align-content: flex-start; }
.pg-chip.is-kw, .pg-chip.is-sg { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 4px; padding-right: 4px; }
.pg-chip.is-kw { background: var(--pg-soft); border-color: #fbd5c5; color: #7c2d12; }
.pg-chip.is-kw:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.pg-chip.is-kw.is-shared { border-color: var(--pg-accent); }
.pg-chip.is-sg { background: var(--pg-surface); border-style: dashed; }
.pg-chip.is-sg:hover { background: #ecfdf5; border-color: #059669; border-style: solid; color: #065f46; }
.pg-chip.is-off { color: var(--pg-muted); text-decoration: line-through; text-decoration-color: #d1d5db; }
.pg-idx { font-size: 10px; color: var(--pg-muted); margin-right: 3px; font-variant-numeric: tabular-nums; }
.pg-x { font-size: 13px; line-height: 1; opacity: .5; width: 12px; text-align: center; }
.pg-chip:hover .pg-x { opacity: 1; }
.pg-kw-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--pg-border); font-size: 12px; color: var(--pg-muted); }
.pg-kw-foot + .pg-error { margin-top: 8px; }
.pg-muted-note { font-size: 12px; color: var(--pg-muted); padding: 4px 0; }
.pg-spinner.is-sm { width: 14px; height: 14px; border-width: 2px; }

/* Bottom bars */
.pg-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: linear-gradient(135deg, #fff7ed, #ffedd5); border-top: 1px solid #fed7aa; font-size: 13px; color: #7c2d12; }
.pg-cta strong { color: var(--pg-text); }
.pg-cta-actions { display: flex; gap: 8px; margin-left: auto; }
.pg-savebar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--pg-border); flex-wrap: wrap; }
.pg-savebar input[type=text] { flex: 1 1 220px; width: auto; }
.pg-tier-note { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; font-size: 12px; line-height: 1.45; }
.pg-tier-note strong { color: #312e81; }
.pg-tier-note details { display: inline; }
.pg-tier-note details[open] { display: block; margin-top: 4px; }
.pg-tier-note summary { display: inline; cursor: pointer; font-weight: 600; text-decoration: underline; list-style: none; }
.pg-tier-note summary::-webkit-details-marker { display: none; }
.pg-tier-badge { display: inline-block; flex: none; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #3730a3; background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 999px; padding: 1px 7px; }
.pg-loading small { font-size: 12px; }
.pg-save-with { font-size: 13px; color: var(--pg-muted); white-space: nowrap; }
.pg-save-with strong { color: var(--pg-text); }
.pg-save-msg { padding: 8px 14px; font-size: 13px; border-top: 1px solid #a7f3d0; background: #ecfdf5; color: #065f46; }
.pg-save-msg.is-warn { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.pg-save-msg a { color: inherit; font-weight: 600; }

@media (max-width: 1499px) { .pg-cta-more { display: none; } }
@media (min-width: 1100px) and (max-height: 820px) {
  .pg { padding-top: 8px; }
  .pg-top { margin-bottom: 8px; }
  .pg-setup { gap: 8px; padding: 12px; }
  .pg-drop { height: 84px; }
  .pg textarea { min-height: 80px; }
  .pg-tier-note { margin-top: 6px; padding: 6px 8px; }
  .pg-label { margin-bottom: 4px; }
  .pg-results-body { padding: 10px 12px; }
  .pg-out { padding: 10px 12px; }
  .pg-summary { margin-bottom: 8px; }
  .pg-field + .pg-field { margin-top: 6px; }
  .pg-field-value { font-size: 13px; line-height: 1.45; }
  .pg-title-value { font-size: 14px; }
  .pg-chip { font-size: 11.5px; line-height: 1.5; }
  .pg-cta, .pg-savebar { padding: 8px 12px; }
  .pg-run-btn { padding: 10px 18px; }
}

/* Tablets and phones: normal page flow */
@media (max-width: 1099px) {
  .pg-work { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .pg-setup, .pg-results { overflow: visible; }
  .pg-results-body { min-height: 260px; }
  .pg-textarea-fallback { min-height: 160px; }
}
@media (max-width: 760px) {
  .pg { padding: 12px 16px 24px; }
  .pg-out-grid, .pg-single, .pg-steps, .pg-kw-grid { grid-template-columns: 1fr; }
  .pg-top h1 small { display: none; }
  .pg-cta-actions { margin-left: 0; }
  .pg-auth { flex-wrap: wrap; }
  .pg-quota { white-space: normal; }
}
@media (max-width: 560px) {
  .pg-demo { grid-template-columns: 1fr; }
  .pg-demo-photo { min-height: 180px; }
}
