/* ============== 在线体验（Playground）====================== */
.playground-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: var(--theme-color); color: #fff;
  border: 1px solid var(--theme-color);
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.playground-btn:hover { background: #1d4ed8; border-color: #1d4ed8; box-shadow: 0 3px 10px rgba(37,99,235,.28); }
.playground-btn svg { width: 15px; height: 15px; }
.playground-btn:disabled { opacity: .55; cursor: not-allowed; }

.pg-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: pgFade .18s ease;
}
.pg-overlay[hidden] { display: none; }
@keyframes pgFade { from { opacity: 0; } to { opacity: 1; } }
.pg-modal {
  width: min(1680px, 96vw);
  height: min(94vh, 1040px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pgPop .2s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pgPop { from { transform: translateY(14px) scale(.985); opacity: .4; } to { transform: none; opacity: 1; } }

.pg-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: #fff;
  flex-shrink: 0;
}
.pg-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.pg-badge {
  background: var(--theme-color); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .04em; flex-shrink: 0;
}
.pg-title { font-size: 15px; font-weight: 700; color: var(--text-main); white-space: nowrap; }
.pg-endpoint {
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
  font-size: 12px; color: #1d4ed8; background: var(--theme-color-light);
  border: 1px solid #dbeafe; padding: 3px 9px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 460px;
}
.pg-head-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pg-balance {
  font-size: 12.5px; color: var(--text-sub); background: #f8fafc;
  border: 1px solid var(--border-color); padding: 4px 10px; border-radius: 999px;
}
.pg-balance b { color: #059669; font-weight: 700; }
.pg-icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-color);
  background: #fff; color: var(--text-muted); cursor: pointer; font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pg-icon-btn:hover { border-color: var(--theme-color); color: var(--theme-color); background: #f8faff; }

.pg-body { flex: 1; display: flex; min-height: 0; }
.pg-left {
  width: 430px; flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column; min-height: 0; background: #fcfdff;
}
.pg-auth { padding: 12px 16px; border-bottom: 1px solid var(--border-color); background: #fff; }
.pg-auth-row { display: flex; gap: 8px; align-items: center; }
.pg-auth-row + .pg-auth-row { margin-top: 8px; }
.pg-auth label { font-size: 11.5px; color: var(--text-muted); width: 62px; flex-shrink: 0; font-weight: 600; }
.pg-input, .pg-select, .pg-textarea {
  width: 100%; border: 1px solid var(--border-color); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; font-family: inherit; color: var(--text-main);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.pg-input:focus, .pg-select:focus, .pg-textarea:focus {
  outline: none; border-color: var(--theme-color); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.pg-textarea { resize: vertical; min-height: 82px; line-height: 1.6; }
.pg-auth .pg-input, .pg-auth .pg-select { font-size: 12.5px; padding: 6px 9px; }
.pg-mini-btn {
  border: 1px solid var(--border-color); background: #fff; color: var(--text-sub);
  border-radius: 8px; font-size: 12px; padding: 6px 10px; cursor: pointer; white-space: nowrap;
}
.pg-mini-btn:hover { border-color: var(--theme-color); color: var(--theme-color); }
/* 登录主按钮 */
.pg-mini-primary {
  background: var(--theme-color); border-color: var(--theme-color); color: #fff; font-weight: 600;
}
.pg-mini-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
/* 退出按钮 */
.pg-mini-danger { background: #fff; border-color: #fca5a5; color: #dc2626; }
.pg-mini-danger:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }
/* 已登录时账号/密码输入框置灰 */
.pg-auth .pg-input:disabled {
  background: #f4f6fa; color: var(--text-muted); cursor: not-allowed;
}
.pg-auth-tip { margin-top: 8px; font-size: 11.5px; color: var(--text-muted); line-height: 1.6; }
.pg-auth-tip b { color: var(--text-main); font-weight: 600; }

.pg-fields { flex: 1; overflow-y: auto; padding: 14px 16px 20px; min-height: 0; }
.pg-field { margin-bottom: 14px; }
.pg-field.hidden { display: none; }
.pg-field-label {
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--text-main);
}
.pg-field-label .req { color: #ef4444; font-size: 11px; }
.pg-field-label .fname { font-family: ui-monospace, "SF Mono", Monaco, monospace; font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.pg-field-desc { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.55; }
.pg-switch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-sub); cursor: pointer; }
.pg-switch input { width: 15px; height: 15px; accent-color: var(--theme-color); cursor: pointer; }

.pg-up { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 8px; background: #fff; }
.pg-up-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.pg-up-list { display: flex; flex-direction: column; gap: 6px; }
.pg-up-item { display: flex; gap: 6px; align-items: center; }
.pg-up-item .pg-input { flex: 1; font-size: 11.5px; padding: 5px 8px; }
.pg-up-del {
  border: 1px solid var(--border-color); background: #fff; color: var(--text-muted);
  border-radius: 6px; width: 26px; height: 26px; cursor: pointer; flex-shrink: 0; font-size: 13px;
}
.pg-up-del:hover { border-color: #ef4444; color: #ef4444; }
.pg-up-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pg-up-thumb { position: relative; width: 54px; height: 54px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-color); background: #f8fafc; }
.pg-up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pg-up-thumb span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--text-muted); text-align: center; padding: 2px; }
/* 上传状态提示行（media / qiyun_upload 控件共用） */
.pg-up-status:empty { display: none; }
.pg-up-status { margin-top: 6px; }
.pg-up-status .pg-field-desc { word-break: break-all; }

.pg-left-foot {
  padding: 12px 16px; border-top: 1px solid var(--border-color); background: #fff;
  display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.pg-submit {
  flex: 1; border: none; background: var(--theme-color); color: #fff;
  border-radius: 9px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.pg-submit:hover { background: #1d4ed8; }
.pg-submit:disabled { opacity: .6; cursor: not-allowed; }
.pg-reset {
  border: 1px solid var(--border-color); background: #fff; color: var(--text-sub);
  border-radius: 9px; padding: 10px 14px; font-size: 13px; cursor: pointer;
}
.pg-reset:hover { border-color: var(--theme-color); color: var(--theme-color); }
.pg-foot-hint { font-size: 11px; color: var(--text-muted); margin-right: auto; }

.pg-right { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pg-status {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  border-bottom: 1px solid var(--border-color); font-size: 12.5px; color: var(--text-sub);
  flex-shrink: 0; background: #fff; min-height: 41px;
}
.pg-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.pg-dot.run { background: #f59e0b; animation: pgPulse 1s infinite; }
.pg-dot.ok { background: #10b981; }
.pg-dot.err { background: #ef4444; }
@keyframes pgPulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.pg-status .spacer { margin-left: auto; }
.pg-cost { color: #059669; font-weight: 700; }
.pg-elapsed { font-family: ui-monospace, Monaco, monospace; color: var(--text-muted); }

.pg-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--border-color); background: #fff; flex-shrink: 0; }
.pg-tab {
  border: none; background: transparent; padding: 9px 14px; font-size: 13px;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500;
}
.pg-tab.active { color: var(--theme-color); border-bottom-color: var(--theme-color); font-weight: 600; }
.pg-tab-body { flex: 1; overflow-y: auto; min-height: 0; padding: 16px 18px 24px; background: #fbfcfe; }
.pg-pane[hidden] { display: none; }
.pg-pane pre {
  background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 10px;
  overflow: auto; font-size: 12.5px; line-height: 1.6; margin: 0;
  font-family: ui-monospace, "SF Mono", Monaco, monospace;
}
.pg-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 60px 20px; line-height: 1.8; }
.pg-empty svg { width: 40px; height: 40px; opacity: .3; margin-bottom: 10px; }

.pg-card { background: #fff; border: 1px solid var(--border-color); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.pg-card-title { font-size: 13px; font-weight: 700; color: var(--text-main); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.pg-kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 6px 14px; font-size: 12.5px; }
.pg-kv dt { color: var(--text-muted); font-family: ui-monospace, Monaco, monospace; font-size: 11.5px; word-break: break-all; }
.pg-kv dd { margin: 0; color: var(--text-main); word-break: break-word; }
.pg-media { margin-bottom: 14px; }
.pg-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pg-media-item { border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; background: #fff; }
.pg-media-item img, .pg-media-item video { width: 100%; display: block; max-height: 420px; object-fit: contain; background: #0f172a; }
.pg-media-item audio { width: 100%; display: block; }
.pg-media-cap { padding: 7px 10px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border-color); word-break: break-all; background: #fafbfc; }
.pg-text-out {
  background: #fff; border: 1px solid var(--border-color); border-radius: 10px;
  padding: 14px 16px; font-size: 13.5px; line-height: 1.85; color: var(--text-main);
  white-space: pre-wrap; word-break: break-word; max-height: 560px; overflow: auto;
}
.pg-text-out code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; color: #be123c; }
.pg-text-out pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow: auto; font-size: 12px; margin: 8px 0; }
.pg-text-out strong { color: var(--text-main); }
.pg-err-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 10px; padding: 12px 14px; color: #b91c1c; font-size: 13px; line-height: 1.7; }
.pg-shots { display: flex; flex-direction: column; gap: 10px; }
.pg-shot { border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 12px; background: #fff; }
.pg-shot-head { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 12px; color: var(--text-muted); }
.pg-shot-head b { color: var(--theme-color); }
.pg-shot textarea { width: 100%; border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.6; font-family: inherit; resize: vertical; min-height: 78px; }
.pg-pbar { height: 6px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.pg-pbar i { display: block; height: 100%; background: linear-gradient(90deg,#2563eb,#38bdf8); width: 40%; animation: pgSlide 1.2s infinite linear; }
@keyframes pgSlide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
@media (max-width: 1100px) {
  .pg-left { width: 340px; }
}
@media (max-width: 820px) {
  .pg-body { flex-direction: column; }
  .pg-left { width: 100%; max-height: 46%; border-right: none; border-bottom: 1px solid var(--border-color); }
}
