/* ══════════════════════════════════════════════════════════════════
   VIUCraft API Playground
   Two-panel interactive console. Matches the docs shell — uses the
   --docs-* variables defined in docs.css (loaded first). Blue → cyan
   accents, dark glass panels, resizable split. Dark mode via the
   --docs-* overrides. All IDs come from the template; this only styles.
   ══════════════════════════════════════════════════════════════════ */

.playground-full-width { max-width: 100% !important; }
.playground {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 600px;
  border: 1px solid var(--docs-border-color);
  border-radius: var(--radius-lg);
  background: var(--docs-bg-primary);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ───── header bar ───── */
.playground-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  background: var(--docs-bg-tertiary);
  border-bottom: 1px solid var(--docs-border-color);
}
.playground-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--docs-text-primary);
}
.playground-title > i { color: var(--docs-accent); }
.playground-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--docs-grad);
  border-radius: var(--radius-full);
  padding: 0.15rem 0.55rem;
}
.playground-header-right { display: flex; gap: 0.4rem; }
.playground-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--docs-border-strong);
  background: var(--docs-bg-primary);
  color: var(--docs-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.playground-header-btn:hover { background: var(--docs-accent-soft); color: var(--docs-accent-strong); border-color: var(--docs-accent-ring); }
.playground-header-btn-reset:hover { color: var(--primary-red, #ef4444); border-color: rgba(239, 68, 68, 0.4); background: rgba(239, 68, 68, 0.08); }
@media (max-width: 640px) { .playground-header-btn-label { display: none; } }

/* ───── panels + resize handle ───── */
.playground-panels { display: grid; grid-template-columns: 1fr 7px 1fr; flex: 1; min-height: 0; }
.playground-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.playground-panel-request { border-right: none; }
.playground-panel-response { background: var(--docs-bg-secondary); }
.playground-panel-scroll { flex: 1; overflow-y: auto; padding: 1.1rem; min-height: 0; }

.playground-resize-handle {
  flex: 0 0 7px;
  cursor: col-resize;
  display: grid;
  place-items: center;
  background: var(--docs-bg-tertiary);
  border-right: 1px solid var(--docs-border-color);
}
.playground-resize-handle-grip { width: 3px; height: 34px; border-radius: var(--radius-full); background: var(--docs-border-strong); transition: background var(--transition-fast); }
.playground-resize-handle:hover .playground-resize-handle-grip { background: var(--docs-accent); }
@media (max-width: 860px) {
  .playground-panels { display: flex; flex-direction: column; }
  .playground-panel-request { flex: none; border-bottom: 1px solid var(--docs-border-color); }
  .playground-resize-handle { display: none; }
}

/* ───── request sections ───── */
.playground-section { margin-bottom: 1rem; border: 1px solid var(--docs-border-color); border-radius: var(--radius-md); background: var(--docs-bg-primary); overflow: hidden; }
.playground-section-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0.9rem; background: var(--docs-bg-tertiary); border-bottom: 1px solid var(--docs-border-color); }
.playground-section-title { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--font-size-sm); font-weight: 700; color: var(--docs-text-primary); }
.playground-section-title i { color: var(--docs-accent); }
.playground-section-body { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.85rem; }
.playground-section-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--docs-text-muted);
  background: var(--docs-bg-primary);
  border: 1px solid var(--docs-border-color);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.6rem;
}
.playground-auth-status.is-valid { color: var(--primary-green, #10b981); border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }

/* fields */
.playground-field { display: flex; flex-direction: column; gap: 0.35rem; }
.playground-label { font-size: var(--font-size-xs); font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--docs-text-muted); }
.playground-input, .playground-select {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--docs-input-border);
  background-color: var(--docs-input-bg);
  color: var(--docs-text-primary);
  padding: 0 0.8rem;
  font-size: var(--font-size-sm);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.playground-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3e%3cpath fill='%2394a3b8' d='M1.4 0L6 4.6L10.6 0L12 1.4L6 7.4L0 1.4z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 12px;
  padding-right: 2.2rem;
}
.playground-input { font-family: var(--docs-mono); }
.playground-input:focus, .playground-select:focus { outline: none; border-color: var(--docs-accent); box-shadow: 0 0 0 4px var(--docs-accent-ring); }
.playground-input-group { position: relative; display: flex; align-items: stretch; }
.playground-input-group .playground-input { flex: 1; }
.playground-input-addon {
  width: 42px;
  border: 1px solid var(--docs-input-border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--docs-bg-tertiary);
  color: var(--docs-text-secondary);
  cursor: pointer;
}
.playground-input-group .playground-input { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.playground-input-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 0.7rem;
  border: 1px solid var(--docs-input-border);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--docs-bg-tertiary);
  color: var(--docs-text-muted);
  font-size: var(--font-size-xs);
  font-family: var(--docs-mono);
}
.playground-input-group .playground-input:has(+ .playground-input-suffix) { border-radius: var(--radius-md) 0 0 var(--radius-md); }

/* key chips */
.playground-key-select { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.playground-key-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.playground-key-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--docs-border-color);
  background: var(--docs-bg-primary);
  color: var(--docs-text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.playground-key-chip:hover { border-color: var(--docs-accent-ring); background: var(--docs-accent-soft); }
.playground-key-chip-env { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: var(--radius-full); color: #fff; }
.playground-key-chip-env-live { background: var(--primary-green, #10b981); }
.playground-key-chip-env-test { background: var(--primary-orange, #f59e0b); }

.playground-endpoint-description, .playground-placeholder-text {
  font-size: var(--font-size-xs);
  color: var(--docs-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.playground-params-placeholder { padding: 0.5rem 0; }

/* execute */
.playground-execute { display: flex; align-items: center; gap: 0.75rem; padding-top: 0.25rem; }
.playground-execute-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 46px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: 700;
  color: #fff;
  background: var(--docs-grad);
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.playground-execute-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(37, 99, 235, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.playground-execute-hint { font-size: var(--font-size-xs); color: var(--docs-text-muted); white-space: nowrap; }
.playground-execute-hint kbd {
  font-family: var(--docs-mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: var(--docs-bg-tertiary);
  border: 1px solid var(--docs-border-strong);
  color: var(--docs-text-secondary);
}

/* url preview bar */
.playground-footer-bar {
  display: grid;
  grid-template-columns: 1fr 7px 1fr;
  border-top: 1px solid var(--docs-border-color);
  background: var(--docs-bg-tertiary);
}
.playground-footer-bar .playground-resize-spacer { border-right: 1px solid var(--docs-border-color); }
.playground-url-preview {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  min-width: 0;
}
.playground-url-method { font-family: var(--docs-mono); font-size: 0.75rem; font-weight: 700; color: var(--docs-accent-strong); flex-shrink: 0; }
.playground-url-text { flex: 1; min-width: 0; font-family: var(--docs-mono); font-size: 0.78rem; color: var(--docs-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.playground-url-copy { border: none; background: transparent; color: var(--docs-text-muted); cursor: pointer; padding: 0.2rem 0.4rem; border-radius: var(--radius-sm); }
.playground-url-copy:hover { color: var(--docs-text-primary); background: var(--docs-accent-soft); }
[data-theme="dark"] .playground-footer-bar { background: var(--docs-code-bg); }
[data-theme="dark"] .playground-url-method { color: #7fe0a8; }
[data-theme="dark"] .playground-url-text { color: #9fd0ff; }
[data-theme="dark"] .playground-url-copy { color: #94a3b8; }
[data-theme="dark"] .playground-url-copy:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

/* ───── response panel ───── */
.playground-response-tabs { display: flex; gap: 0.15rem; padding: 0.5rem 0.6rem 0; background: var(--docs-bg-tertiary); border-bottom: 1px solid var(--docs-border-color); }
.playground-response-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--docs-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.playground-response-tab i { font-size: 0.85em; opacity: 0.75; }
.playground-response-tab:hover { color: var(--docs-text-primary); }
.playground-response-tab.active { color: var(--docs-accent-strong); border-bottom-color: var(--docs-accent); }
[data-theme="dark"] .playground-response-tab.active { color: #7dd3fc; }
.playground-response-content { flex: 1; overflow: auto; min-height: 0; }
.playground-tab-pane { display: none; height: 100%; }
.playground-tab-pane.active { display: block; }

.playground-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 280px; padding: 2rem; text-align: center; color: var(--docs-text-muted); }
.playground-empty-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: var(--radius-full); font-size: 1.5rem; color: var(--docs-accent); background: var(--docs-accent-soft); margin-bottom: 1rem; }
.playground-empty-state h4 { font-size: 1rem; font-weight: 700; color: var(--docs-text-secondary); margin: 0 0 0.4rem; }
.playground-empty-state p { font-size: var(--font-size-sm); margin: 0; max-width: 320px; }
.playground-empty-state kbd { font-family: var(--docs-mono); font-size: 0.7rem; padding: 0.1rem 0.35rem; border-radius: 4px; background: var(--docs-bg-tertiary); border: 1px solid var(--docs-border-strong); }

.playground-response-body {
  margin: 0;
  padding: 1.1rem 1.25rem;
  font-family: var(--docs-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--docs-text-primary);
  background: var(--docs-bg-primary);
  min-height: 100%;
  overflow-x: auto;
  white-space: pre;
  border: 1px solid var(--docs-border-color);
  border-radius: var(--radius-md);
}
[data-theme="dark"] .playground-response-body {
  color: #cdd6f4;
  background: var(--docs-code-bg);
  border-color: transparent;
}
.playground-headers-table { padding: 0.75rem 1rem; font-family: var(--docs-mono); font-size: var(--font-size-sm); }
.playground-headers-table .pg-header-row { display: flex; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--docs-border-color); }
.playground-headers-table .pg-header-key { color: var(--docs-accent-strong); font-weight: 600; flex: 0 0 40%; }
.playground-headers-table .pg-header-val { color: var(--docs-text-secondary); word-break: break-all; }
.playground-image-preview { display: grid; place-items: center; padding: 1.5rem; min-height: 280px; }
.playground-image-preview img { max-width: 100%; border-radius: var(--radius-md); box-shadow: var(--shadow-md); }

/* status bar */
.playground-status-bar { display: flex; gap: 1.5rem; padding: 0.6rem 1rem; }
.playground-status-item { display: flex; align-items: center; gap: 0.4rem; font-size: var(--font-size-xs); }
.playground-status-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--docs-text-muted); }
.playground-status-value { font-family: var(--docs-mono); color: var(--docs-text-primary); }
.playground-status-code.is-success { color: var(--primary-green, #10b981); }
.playground-status-code.is-error { color: var(--primary-red, #ef4444); }

/* loading */
.playground-loading { padding: 0.75rem 1rem; border-top: 1px solid var(--docs-border-color); }
.playground-loading-bar { height: 3px; border-radius: var(--radius-full); background: var(--docs-bg-tertiary); overflow: hidden; position: relative; }
.playground-loading-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--docs-grad); border-radius: inherit; animation: pgLoading 1.1s ease-in-out infinite; }
@keyframes pgLoading { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.playground-loading-text { font-size: var(--font-size-xs); color: var(--docs-text-muted); margin-top: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  .playground-loading-bar::after { animation: none; }
}

/* ==========================================================================
   Dynamic Parameter Form (E22-S02)
   ========================================================================== */

/* ---------- Parameter form layout ---------- */
.playground-param-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.playground-param {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.playground-param-label {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--neutral-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.playground-param-required {
    color: var(--danger-text);
    font-weight: 700;
}

.playground-param-optional {
    color: var(--neutral-400);
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.playground-param-description {
    font-size: var(--font-size-xs);
    color: var(--neutral-400);
    line-height: 1.4;
    margin-bottom: 2px;
}

/* ---------- Parameter inputs ---------- */
.playground-param-input {
    width: 100%;
    padding: var(--space-8) var(--space-12);
    font-size: var(--font-size-sm);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--neutral-900);
    background: #fff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.playground-param-input:focus {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(113, 97, 239, 0.1);
}

.playground-param-input::placeholder {
    color: var(--neutral-400);
    font-family: var(--font-family);
}

.playground-param-input.is-invalid {
    border-color: var(--danger);
}

.playground-param-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(255, 86, 48, 0.1);
}

/* ---------- Number inputs ---------- */
.playground-param-number {
    -moz-appearance: textfield;
}

.playground-param-number::-webkit-outer-spin-button,
.playground-param-number::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ---------- Select inputs ---------- */
.playground-param-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239e9e9e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ---------- Color input group ---------- */
.playground-param-color-group {
    display: flex;
    gap: var(--space-8);
    align-items: stretch;
}

.playground-param-color-swatch {
    width: 42px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
}

.playground-param-color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.playground-param-color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.playground-param-color-swatch::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.playground-param-color-text {
    flex: 1;
}

/* ---------- Toggle switch ---------- */
.playground-param-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-8);
    cursor: pointer;
    user-select: none;
}

.playground-param-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.playground-param-toggle-slider {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background: var(--neutral-200);
    border-radius: 999px;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.playground-param-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.playground-param-toggle-input:checked + .playground-param-toggle-slider {
    background: var(--primary-purple);
}

.playground-param-toggle-input:checked + .playground-param-toggle-slider::after {
    transform: translateX(16px);
}

.playground-param-toggle-input:focus + .playground-param-toggle-slider {
    box-shadow: 0 0 0 3px rgba(113, 97, 239, 0.1);
}

.playground-param-toggle-label {
    font-size: var(--font-size-sm);
    color: var(--neutral-600);
    font-weight: 500;
}

/* ---------- File upload zone ---------- */
.playground-param-file-zone {
    border: 2px dashed var(--neutral-200);
    border-radius: var(--radius-sm);
    padding: var(--space-16) var(--space-24);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.playground-param-file-zone:hover {
    border-color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.02);
}

.playground-param-file-zone.dragover {
    border-color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.06);
}

.playground-param-file-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: rgba(54, 179, 126, 0.04);
}

.playground-param-file-zone.is-invalid {
    border-color: var(--danger);
}

.playground-param-file-label {
    font-size: var(--font-size-sm);
    color: var(--neutral-500);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
}

.playground-param-file-label i {
    font-size: 1.1em;
    color: var(--neutral-400);
}

.playground-param-file-zone.has-file .playground-param-file-label {
    color: var(--neutral-700);
    font-weight: 500;
}

.playground-param-file-zone.has-file .playground-param-file-label i {
    color: var(--success-text);
}

.playground-param-file-info {
    font-size: var(--font-size-xs);
    color: var(--neutral-400);
    margin-top: var(--space-4);
}

/* ---------- Validation error ---------- */
.playground-param-error {
    font-size: var(--font-size-xs);
    color: var(--danger-text);
    line-height: 1.4;
}

/* ---------- Reset to defaults ---------- */
.playground-param-reset {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--font-size-xs);
    color: var(--neutral-400);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
    padding-top: var(--space-4);
    align-self: flex-start;
}

.playground-param-reset:hover {
    color: var(--primary-purple);
}

.playground-param-reset i {
    font-size: 0.7em;
}

/* ---------- Endpoint description ---------- */
.playground-endpoint-description {
    font-size: var(--font-size-xs);
    color: var(--neutral-500);
    line-height: 1.5;
    margin-top: var(--space-8);
    padding: var(--space-8) var(--space-12);
    background: var(--neutral-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-purple);
}

/* ---------- Method badge in select options ---------- */
.playground-method-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-right: var(--space-4);
}

.playground-method-badge-get {
    color: var(--success-text);
    background: rgba(54, 179, 126, 0.1);
}

.playground-method-badge-post {
    color: var(--info-text);
    background: rgba(66, 104, 230, 0.1);
}

.playground-method-badge-delete {
    color: var(--danger-text);
    background: rgba(255, 86, 48, 0.1);
}

/* ==========================================================================
   Dynamic Parameter Form Dark Mode (E22-S02)
   ========================================================================== */

[data-theme="dark"] .playground-param-label {
    color: #71717a;
}

[data-theme="dark"] .playground-param-optional {
    color: #52567a;
}

[data-theme="dark"] .playground-param-description {
    color: #52567a;
}

[data-theme="dark"] .playground-param-input {
    background: #0f0f23;
    border-color: #2a2a3e;
    color: #e4e4e7;
}

[data-theme="dark"] .playground-param-input::placeholder {
    color: #52567a;
}

[data-theme="dark"] .playground-param-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(113, 97, 239, 0.15);
}

[data-theme="dark"] .playground-param-input.is-invalid {
    border-color: var(--danger);
}

[data-theme="dark"] .playground-param-input.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(255, 86, 48, 0.15);
}

[data-theme="dark"] .playground-param-select {
    background-color: #0f0f23;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

[data-theme="dark"] .playground-param-color-swatch {
    border-color: #2a2a3e;
    background: #0f0f23;
}

[data-theme="dark"] .playground-param-toggle-slider {
    background: #2a2a3e;
}

[data-theme="dark"] .playground-param-toggle-slider::after {
    background: #71717a;
}

[data-theme="dark"] .playground-param-toggle-input:checked + .playground-param-toggle-slider {
    background: #3b82f6;
}

[data-theme="dark"] .playground-param-toggle-input:checked + .playground-param-toggle-slider::after {
    background: #fff;
}

[data-theme="dark"] .playground-param-toggle-label {
    color: #a1a1aa;
}

[data-theme="dark"] .playground-param-file-zone {
    border-color: #2a2a3e;
}

[data-theme="dark"] .playground-param-file-zone:hover {
    border-color: #3b82f6;
    background: rgba(113, 97, 239, 0.04);
}

[data-theme="dark"] .playground-param-file-zone.dragover {
    border-color: #3b82f6;
    background: rgba(113, 97, 239, 0.1);
}

[data-theme="dark"] .playground-param-file-zone.has-file {
    border-color: var(--success);
    background: rgba(54, 179, 126, 0.06);
}

[data-theme="dark"] .playground-param-file-label {
    color: #71717a;
}

[data-theme="dark"] .playground-param-file-label i {
    color: #52567a;
}

[data-theme="dark"] .playground-param-file-zone.has-file .playground-param-file-label {
    color: #e4e4e7;
}

[data-theme="dark"] .playground-param-file-info {
    color: #52567a;
}

[data-theme="dark"] .playground-param-error {
    color: #ff6b6b;
}

[data-theme="dark"] .playground-param-reset {
    color: #52567a;
}

[data-theme="dark"] .playground-param-reset:hover {
    color: #60a5fa;
}

[data-theme="dark"] .playground-endpoint-description {
    color: #71717a;
    background: #13132b;
    border-left-color: #3b82f6;
}

/* ---------- Dynamic param responsive ---------- */
@media (max-width: 767px) {
    .playground-param-color-group {
        flex-direction: column;
    }

    .playground-param-color-swatch {
        width: 100%;
        height: 32px;
    }

    .playground-param-file-zone {
        padding: var(--space-12) var(--space-16);
    }
}

/* ---------- Dynamic param reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-param-input,
    .playground-param-toggle-slider,
    .playground-param-toggle-slider::after,
    .playground-param-file-zone,
    .playground-param-reset,
    .playground-param-color-swatch {
        transition: none !important;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .playground {
        display: none !important;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .playground-execute-btn,
    .playground-header-btn,
    .playground-response-tab,
    .playground-input,
    .playground-select,
    .playground-resize-handle,
    .playground-url-copy,
    .playground-key-chip {
        transition: none !important;
    }

    .playground-loading-bar::after {
        animation: none;
        width: 100%;
        opacity: 0.5;
    }

    .playground-execute-btn.is-loading i {
        animation: none;
    }
}

/* ==========================================================================
   Auth State Styles (E22-S06)
   ========================================================================== */

/* ---------- Auth status badge enhancements ---------- */
.playground-auth-status {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: all var(--transition-fast);
}

.playground-auth-icon {
    margin-right: 4px;
    font-size: 0.6rem;
}

.playground-auth-status.auth-unauthenticated {
    background: var(--neutral-100);
    color: var(--neutral-500);
}

.playground-auth-status.auth-authenticated {
    background: rgba(54, 179, 126, 0.1);
    color: var(--success-text);
}

.playground-auth-status.auth-invalid {
    background: rgba(255, 86, 48, 0.1);
    color: var(--danger-text);
}

/* ---------- Key chip selected state ---------- */
.playground-key-chip.selected {
    border-color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.1);
    color: var(--primary-purple);
}

/* ---------- Key override link ---------- */
.playground-key-override {
    margin-top: 8px;
}

.playground-key-override-link {
    font-size: 0.75rem;
    color: var(--primary-purple);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.playground-key-override-link:hover {
    color: #5f4fd6;
    text-decoration: underline;
}

/* ---------- Auth messages ---------- */
.playground-auth-message {
    font-size: 0.75rem;
    margin-top: 6px;
    line-height: 1.4;
    padding: 4px 0;
}

.playground-auth-message.error {
    color: var(--danger-text);
}

.playground-auth-message.info {
    color: var(--neutral-500);
}

/* ==========================================================================
   Auth State Dark Mode (E22-S06)
   ========================================================================== */

[data-theme="dark"] .playground-auth-status.auth-unauthenticated {
    background: #2a2a3e;
    color: #71717a;
}

[data-theme="dark"] .playground-auth-status.auth-authenticated {
    background: rgba(54, 179, 126, 0.15);
    color: #4ade80;
}

[data-theme="dark"] .playground-auth-status.auth-invalid {
    background: rgba(255, 86, 48, 0.15);
    color: #ff6b6b;
}

[data-theme="dark"] .playground-key-chip.selected {
    border-color: #3b82f6;
    background: rgba(113, 97, 239, 0.15);
    color: #60a5fa;
}

[data-theme="dark"] .playground-key-override-link {
    color: #60a5fa;
}

[data-theme="dark"] .playground-key-override-link:hover {
    color: #c4b5fd;
}

[data-theme="dark"] .playground-auth-message.error {
    color: #ff6b6b;
}

[data-theme="dark"] .playground-auth-message.info {
    color: #71717a;
}

/* ---------- Auth reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-auth-status,
    .playground-key-override-link {
        transition: none !important;
    }
}

/* ==========================================================================
   Request Execution & Response Display (E22-S03)
   ========================================================================== */

/* ---------- JSON Syntax Highlighting ---------- */
.json-key { color: #dc2626; }
.json-string { color: #22c55e; }
.json-number { color: #3b82f6; }
.json-boolean { color: #a855f7; }
.json-null { color: #9ca3af; font-style: italic; }
.json-bracket { color: var(--neutral-500); }

/* ---------- Response body with content ---------- */
.playground-response-body.has-content {
    position: relative;
    padding: 0;
    overflow: auto;
}

/* ---------- JSON wrapper ---------- */
.playground-json-wrapper {
    position: relative;
}

.playground-json-code {
    display: block;
    counter-reset: line;
    padding: 16px 16px 16px 3.5em;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre;
}

/* ---------- Line numbers ---------- */
.playground-response-line {
    display: block;
}

.playground-response-line::before {
    counter-increment: line;
    content: attr(data-line);
    display: inline-block;
    width: 2.5em;
    margin-left: -3.5em;
    padding-right: 0.5em;
    text-align: right;
    color: var(--neutral-300);
    border-right: 1px solid var(--neutral-200);
    margin-right: 0.5em;
    font-size: 0.8em;
    user-select: none;
    -webkit-user-select: none;
}

/* ---------- Copy response button ---------- */
.playground-copy-response {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--neutral-500);
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 2;
    transition: all 0.15s ease;
    font-family: inherit;
}

.playground-copy-response:hover {
    color: var(--neutral-700);
    background: var(--neutral-100);
    border-color: var(--neutral-300);
}

.playground-copy-response.copy-success {
    color: var(--success-text);
    border-color: var(--success);
    background: rgba(54, 179, 126, 0.05);
}

.playground-copy-response.copy-failed {
    color: var(--danger-text);
    border-color: var(--danger);
}

/* ---------- Error box ---------- */
.playground-error-box {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 16px;
}

.playground-error-code {
    font-weight: 700;
    color: var(--danger-text);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.875rem;
}

.playground-error-message {
    color: var(--neutral-700);
    margin-top: 4px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.playground-error-details {
    margin-top: 8px;
}

.playground-error-details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--neutral-500);
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.playground-error-details-toggle:hover {
    color: var(--neutral-700);
}

.playground-error-details-toggle i {
    font-size: 0.6rem;
    transition: transform 0.15s ease;
}

.playground-error-details-content {
    margin-top: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8rem;
    color: var(--neutral-600);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------- Timing colors ---------- */
.playground-timing-fast {
    color: var(--success-text) !important;
}

.playground-timing-medium {
    color: var(--warning-text) !important;
}

.playground-timing-slow {
    color: var(--danger-text) !important;
}

/* ---------- Status code colors ---------- */
.playground-status-code.status-2xx {
    color: var(--success-text);
    font-weight: 600;
}

.playground-status-code.status-3xx {
    color: var(--info-text);
    font-weight: 600;
}

.playground-status-code.status-4xx {
    color: var(--warning-text);
    font-weight: 600;
}

.playground-status-code.status-5xx {
    color: var(--danger-text);
    font-weight: 600;
}

/* ---------- Network error display ---------- */
.playground-network-error {
    text-align: center;
    padding: 32px;
}

.playground-network-error-icon {
    font-size: 2rem;
    color: var(--danger-text);
    margin-bottom: 12px;
}

.playground-network-error-title {
    font-weight: 600;
    color: var(--neutral-700);
    margin-bottom: 4px;
    font-size: 1rem;
}

.playground-network-error-message {
    color: var(--neutral-500);
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* ---------- Image response body notice ---------- */
.playground-image-body-notice {
    text-align: center;
    padding: 32px;
    color: var(--neutral-500);
    font-size: 0.875rem;
}

.playground-image-body-notice i {
    margin-right: 6px;
    color: var(--primary-purple);
}

/* ---------- Empty body notice ---------- */
.playground-empty-body-notice {
    text-align: center;
    padding: 32px;
    color: var(--neutral-400);
    font-size: 0.875rem;
    font-style: italic;
}

/* ---------- Headers table ---------- */
.playground-headers-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.playground-headers-tbl th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: var(--neutral-600);
    background: var(--neutral-50);
    border-bottom: 2px solid var(--neutral-200);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.playground-headers-tbl td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--neutral-100);
    color: var(--neutral-700);
}

.playground-headers-tbl .playground-header-value {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.playground-header-important td:first-child {
    color: var(--primary-purple);
    font-weight: 600;
}

.playground-headers-tbl tbody tr:hover {
    background: var(--neutral-50);
}

/* ---------- Image preview ---------- */
.playground-preview-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}

.playground-preview-img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                      linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    box-shadow: var(--shadow-sm);
}

.playground-preview-info {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--neutral-500);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ==========================================================================
   Response Display Dark Mode (E22-S03)
   ========================================================================== */

[data-theme="dark"] .json-key { color: #f87171; }
[data-theme="dark"] .json-string { color: #4ade80; }
[data-theme="dark"] .json-number { color: #60a5fa; }
[data-theme="dark"] .json-boolean { color: #c084fc; }
[data-theme="dark"] .json-null { color: #6b7280; }
[data-theme="dark"] .json-bracket { color: var(--neutral-400); }

[data-theme="dark"] .playground-response-line::before {
    color: #52567a;
    border-right-color: #2a2a3e;
}

[data-theme="dark"] .playground-copy-response {
    color: #a1a1aa;
    background: #1a1a2e;
    border-color: #2a2a3e;
}

[data-theme="dark"] .playground-copy-response:hover {
    color: #d4d4d8;
    background: #2a2a3e;
    border-color: #3a3a4e;
}

[data-theme="dark"] .playground-error-box {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .playground-error-code {
    color: #ff6b6b;
}

[data-theme="dark"] .playground-error-message {
    color: #a1a1aa;
}

[data-theme="dark"] .playground-error-details-toggle {
    color: #71717a;
}

[data-theme="dark"] .playground-error-details-toggle:hover {
    color: #a1a1aa;
}

[data-theme="dark"] .playground-error-details-content {
    background: rgba(255, 255, 255, 0.03);
    color: #a1a1aa;
}

[data-theme="dark"] .playground-network-error-title {
    color: #d4d4d8;
}

[data-theme="dark"] .playground-network-error-message {
    color: #71717a;
}

[data-theme="dark"] .playground-image-body-notice {
    color: #71717a;
}

[data-theme="dark"] .playground-empty-body-notice {
    color: #52567a;
}

[data-theme="dark"] .playground-headers-tbl th {
    color: #a1a1aa;
    background: #1a1a2e;
    border-bottom-color: #2a2a3e;
}

[data-theme="dark"] .playground-headers-tbl td {
    border-bottom-color: #1e1e32;
    color: #d4d4d8;
}

[data-theme="dark"] .playground-header-important td:first-child {
    color: #60a5fa;
}

[data-theme="dark"] .playground-headers-tbl tbody tr:hover {
    background: #1a1a2e;
}

[data-theme="dark"] .playground-preview-img {
    background-image: linear-gradient(45deg, #2a2a3e 25%, transparent 25%),
                      linear-gradient(-45deg, #2a2a3e 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #2a2a3e 75%),
                      linear-gradient(-45deg, transparent 75%, #2a2a3e 75%);
}

[data-theme="dark"] .playground-preview-info {
    color: #71717a;
}

/* ---------- Response display reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-copy-response,
    .playground-error-details-toggle i {
        transition: none !important;
    }
}

/* ==========================================================================
   History Panel (E22-S05)
   ========================================================================== */

/* ---------- History Panel Container ---------- */
.playground-history-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 360px;
    max-width: 100%;
    background: #fff;
    border-right: 1px solid var(--neutral-200);
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease-out;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.08);
}

.playground-history-panel.is-open {
    transform: translateX(0);
}

/* ---------- History Header ---------- */
.playground-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--neutral-200);
    flex-shrink: 0;
}

.playground-history-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.playground-history-title i {
    color: var(--primary-purple);
    font-size: 0.8125rem;
}

.playground-history-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--neutral-400);
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.playground-history-close:hover {
    color: var(--neutral-700);
    background: var(--neutral-100);
}

/* ---------- History Search ---------- */
.playground-history-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--neutral-200);
    flex-shrink: 0;
}

.playground-history-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    transition: border-color 0.15s ease;
}

.playground-history-search-input-wrap:focus-within {
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(113, 97, 239, 0.1);
}

.playground-history-search-icon {
    color: var(--neutral-400);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.playground-history-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 7px 0;
    font-size: 0.8125rem;
    color: var(--neutral-900);
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.playground-history-search-input::placeholder {
    color: var(--neutral-400);
}

.playground-history-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--neutral-400);
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.playground-history-search-clear:hover {
    color: var(--neutral-600);
}

/* ---------- History List ---------- */
.playground-history-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ---------- History Card ---------- */
.playground-history-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--neutral-100);
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.playground-history-card:hover {
    background: var(--neutral-50);
}

.playground-history-card:last-child {
    border-bottom: none;
}

.playground-history-card-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.playground-history-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.playground-history-card-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.6875rem;
}

/* ---------- Method Badge ---------- */
.playground-history-method {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 3px;
    flex-shrink: 0;
    line-height: 1.6;
}

.playground-history-method.method-get {
    color: var(--success-text);
    background: rgba(54, 179, 126, 0.1);
}

.playground-history-method.method-post {
    color: var(--info-text);
    background: rgba(66, 104, 230, 0.1);
}

.playground-history-method.method-put {
    color: var(--warning-text);
    background: rgba(255, 171, 0, 0.1);
}

.playground-history-method.method-patch {
    color: var(--warning-text);
    background: rgba(255, 171, 0, 0.1);
}

.playground-history-method.method-delete {
    color: var(--danger-text);
    background: rgba(255, 86, 48, 0.1);
}

/* ---------- Endpoint Name ---------- */
.playground-history-endpoint {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--neutral-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* ---------- Time ---------- */
.playground-history-time {
    font-size: 0.6875rem;
    color: var(--neutral-400);
    flex-shrink: 0;
}

/* ---------- Status ---------- */
.playground-history-status {
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    color: var(--neutral-400);
}

.playground-history-status.status-success {
    color: var(--success-text);
}

.playground-history-status.status-error {
    color: var(--danger-text);
}

.playground-history-status.status-other {
    color: var(--info-text);
}

/* ---------- Latency ---------- */
.playground-history-latency {
    font-size: 0.6875rem;
    color: var(--neutral-400);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ---------- Delete Button ---------- */
.playground-history-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--neutral-300);
    font-size: 0.6875rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.playground-history-card:hover .playground-history-delete {
    opacity: 1;
}

.playground-history-delete:hover {
    color: var(--danger-text);
    background: rgba(255, 86, 48, 0.1);
}

/* ---------- Empty State ---------- */
.playground-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--neutral-400);
}

.playground-history-empty i {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--neutral-300);
}

.playground-history-empty p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* ---------- History Footer ---------- */
.playground-history-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--neutral-200);
    flex-shrink: 0;
}

.playground-history-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--danger-text);
    background: transparent;
    border: 1px solid rgba(255, 86, 48, 0.25);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.playground-history-clear-btn:hover {
    background: rgba(255, 86, 48, 0.05);
    border-color: rgba(255, 86, 48, 0.4);
}

/* ---------- Active History Button State ---------- */
#playgroundHistoryBtn.active {
    color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.1);
}

/* ---------- Toast Notification ---------- */
.playground-toast {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--neutral-900);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 30;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.playground-toast.is-visible {
    opacity: 1;
}

/* ==========================================================================
   History Panel Dark Mode (E22-S05)
   ========================================================================== */

[data-theme="dark"] .playground-history-panel {
    background: #1a1a2e;
    border-right-color: #2a2a3e;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .playground-history-header {
    border-bottom-color: #2a2a3e;
}

[data-theme="dark"] .playground-history-title {
    color: #e4e4e7;
}

[data-theme="dark"] .playground-history-close {
    color: #71717a;
}

[data-theme="dark"] .playground-history-close:hover {
    color: #d4d4d8;
    background: #2a2a3e;
}

[data-theme="dark"] .playground-history-search {
    border-bottom-color: #2a2a3e;
}

[data-theme="dark"] .playground-history-search-input-wrap {
    background: #0f0f23;
    border-color: #2a2a3e;
}

[data-theme="dark"] .playground-history-search-input-wrap:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(113, 97, 239, 0.15);
}

[data-theme="dark"] .playground-history-search-icon {
    color: #52567a;
}

[data-theme="dark"] .playground-history-search-input {
    color: #e4e4e7;
}

[data-theme="dark"] .playground-history-search-input::placeholder {
    color: #52567a;
}

[data-theme="dark"] .playground-history-search-clear {
    color: #52567a;
}

[data-theme="dark"] .playground-history-search-clear:hover {
    color: #a1a1aa;
}

[data-theme="dark"] .playground-history-card {
    border-bottom-color: #2a2a3e;
}

[data-theme="dark"] .playground-history-card:hover {
    background: #2a2a3e;
}

[data-theme="dark"] .playground-history-endpoint {
    color: #e4e4e7;
}

[data-theme="dark"] .playground-history-time {
    color: #52567a;
}

[data-theme="dark"] .playground-history-status {
    color: #52567a;
}

[data-theme="dark"] .playground-history-status.status-success {
    color: #4ade80;
}

[data-theme="dark"] .playground-history-status.status-error {
    color: #ff6b6b;
}

[data-theme="dark"] .playground-history-latency {
    color: #52567a;
}

[data-theme="dark"] .playground-history-delete {
    color: #3a3a4e;
}

[data-theme="dark"] .playground-history-delete:hover {
    color: #ff6b6b;
    background: rgba(255, 86, 48, 0.15);
}

[data-theme="dark"] .playground-history-empty {
    color: #52567a;
}

[data-theme="dark"] .playground-history-empty i {
    color: #3a3a4e;
}

[data-theme="dark"] .playground-history-footer {
    border-top-color: #2a2a3e;
}

[data-theme="dark"] .playground-history-clear-btn {
    color: #ff6b6b;
    border-color: rgba(255, 86, 48, 0.3);
}

[data-theme="dark"] .playground-history-clear-btn:hover {
    background: rgba(255, 86, 48, 0.1);
    border-color: rgba(255, 86, 48, 0.5);
}

[data-theme="dark"] #playgroundHistoryBtn.active {
    color: #60a5fa;
    background: rgba(113, 97, 239, 0.15);
}

[data-theme="dark"] .playground-toast {
    background: #e4e4e7;
    color: #1a1a2e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- History Responsive ---------- */
@media (max-width: 767px) {
    .playground-history-panel {
        width: 100%;
    }
}

/* ---------- History Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-history-panel {
        transition: none !important;
    }

    .playground-toast {
        transition: none !important;
    }

    .playground-history-close,
    .playground-history-search-input-wrap,
    .playground-history-search-clear,
    .playground-history-card,
    .playground-history-delete,
    .playground-history-clear-btn {
        transition: none !important;
    }
}

/* ==========================================================================
   Enhanced Image Preview (E22-S04)
   ========================================================================== */

/* ---------- Image Toolbar ---------- */
.playground-image-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: var(--neutral-50);
    border-bottom: 1px solid var(--neutral-200);
    flex-shrink: 0;
}

.playground-image-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.playground-image-info-item {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--neutral-600);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.playground-image-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.playground-image-ctrl-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    color: var(--neutral-600);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.75rem;
}

.playground-image-ctrl-btn:hover {
    color: var(--primary-purple);
    border-color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.05);
}

.playground-image-zoom-level {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--neutral-500);
    min-width: 40px;
    text-align: center;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.playground-image-separator {
    width: 1px;
    height: 20px;
    background: var(--neutral-200);
    margin: 0 4px;
}

/* ---------- Image Viewport ---------- */
.playground-image-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    /* Checkered transparency background */
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playground-image-viewport.opaque {
    background-image: none;
    background-color: #f0f0f0;
}

.playground-image-viewport.is-panning {
    cursor: grabbing;
}

.playground-image-el {
    transform-origin: center center;
    transition: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* When the preview is active, make the tab pane flex */
#playgroundTabPreview.has-image.active {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100%;
}

#playgroundTabPreview.has-image .playground-empty-state {
    display: none;
}

#playgroundTabPreview.has-image .playground-image-preview {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background-image: none;
    background-color: transparent;
}

/* ---------- Image Preview Dark Mode ---------- */
[data-theme="dark"] .playground-image-toolbar {
    background: #13132b;
    border-bottom-color: #2a2a3e;
}

[data-theme="dark"] .playground-image-info-item {
    color: #a1a1aa;
}

[data-theme="dark"] .playground-image-ctrl-btn {
    border-color: #2a2a3e;
    color: #71717a;
}

[data-theme="dark"] .playground-image-ctrl-btn:hover {
    color: #60a5fa;
    border-color: #3b82f6;
    background: rgba(113, 97, 239, 0.1);
}

[data-theme="dark"] .playground-image-zoom-level {
    color: #71717a;
}

[data-theme="dark"] .playground-image-separator {
    background: #2a2a3e;
}

[data-theme="dark"] .playground-image-viewport {
    background-image:
        linear-gradient(45deg, #2a2a3e 25%, transparent 25%),
        linear-gradient(-45deg, #2a2a3e 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2a2a3e 75%),
        linear-gradient(-45deg, transparent 75%, #2a2a3e 75%);
}

[data-theme="dark"] .playground-image-viewport.opaque {
    background-color: #1a1a2e;
}

/* ---------- Image Preview Responsive ---------- */
@media (max-width: 767px) {
    .playground-image-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ---------- Image Preview Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-image-ctrl-btn {
        transition: none !important;
    }
}

/* ==========================================================================
   Export Panel (E22-S07)
   ========================================================================== */

/* ---------- Export Overlay ---------- */
.playground-export-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Export Panel ---------- */
.playground-export-panel {
    width: 90%;
    max-width: 680px;
    max-height: 90%;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ---------- Export Header ---------- */
.playground-export-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--neutral-200); }
.playground-export-title { font-size: 0.875rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; color: var(--neutral-900); }
.playground-export-title i { color: var(--primary-purple); }
.playground-export-header-right { display: flex; align-items: center; gap: 12px; }
.playground-export-redact { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--neutral-600); cursor: pointer; }
.playground-export-close { background: transparent; border: none; color: var(--neutral-400); cursor: pointer; font-size: 1rem; padding: 4px; border-radius: var(--radius-sm); transition: all 0.15s; }
.playground-export-close:hover { color: var(--neutral-700); background: var(--neutral-100); }

/* ---------- Export Tabs ---------- */
.playground-export-tabs { display: flex; padding: 0 12px; background: var(--neutral-50); border-bottom: 1px solid var(--neutral-200); }
.playground-export-tab { padding: 8px 12px; font-size: 0.8125rem; font-weight: 500; color: var(--neutral-500); background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.playground-export-tab:hover { color: var(--neutral-700); }
.playground-export-tab.active { color: var(--primary-purple); border-bottom-color: var(--primary-purple); }

/* ---------- Export Code Area ---------- */
.playground-export-code-wrap { flex: 1; overflow: auto; position: relative; padding: 16px; }
.playground-export-code { margin: 0; font-size: 0.8125rem; font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--neutral-800); background: var(--neutral-50); border: 1px solid var(--neutral-200); border-radius: var(--radius-sm); padding: 16px; }
.playground-export-copy { position: absolute; top: 24px; right: 24px; display: flex; align-items: center; gap: 4px; padding: 6px 12px; font-size: 0.75rem; font-weight: 500; background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; font-family: inherit; color: var(--neutral-600); }
.playground-export-copy:hover { border-color: var(--primary-purple); color: var(--primary-purple); }
.playground-export-copy.copied { color: var(--success-text); border-color: var(--success); }

/* ---------- Export Share ---------- */
.playground-export-share { padding: 12px 16px; border-top: 1px solid var(--neutral-200); }
.playground-export-share-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px; font-size: 0.8125rem; font-weight: 500; color: var(--primary-purple); background: rgba(113,97,239,0.05); border: 1px solid rgba(113,97,239,0.2); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; font-family: inherit; }
.playground-export-share-btn:hover { background: rgba(113,97,239,0.1); border-color: rgba(113,97,239,0.3); }

/* ---------- Syntax Highlighting ---------- */
.export-keyword { color: #c026d3; font-weight: 500; }
.export-string { color: #22c55e; }
.export-comment { color: #9ca3af; font-style: italic; }
.export-function { color: #3b82f6; }
.export-variable { color: #dc2626; }
.export-number { color: #f59e0b; }

/* ---------- Active Export Button State ---------- */
#playgroundExportBtn.active {
    color: var(--primary-purple);
    background: rgba(113, 97, 239, 0.1);
}

/* ==========================================================================
   Export Panel Dark Mode (E22-S07)
   ========================================================================== */

[data-theme="dark"] .playground-export-overlay { background: rgba(0,0,0,0.5); }
[data-theme="dark"] .playground-export-panel { background: #1a1a2e; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
[data-theme="dark"] .playground-export-header { border-bottom-color: #2a2a3e; }
[data-theme="dark"] .playground-export-title { color: #e4e4e7; }
[data-theme="dark"] .playground-export-redact { color: #a1a1aa; }
[data-theme="dark"] .playground-export-close { color: #52567a; }
[data-theme="dark"] .playground-export-close:hover { color: #a1a1aa; background: #2a2a3e; }
[data-theme="dark"] .playground-export-tabs { background: #13132b; border-bottom-color: #2a2a3e; }
[data-theme="dark"] .playground-export-tab { color: #52567a; }
[data-theme="dark"] .playground-export-tab:hover { color: #a1a1aa; }
[data-theme="dark"] .playground-export-tab.active { color: #60a5fa; border-bottom-color: #60a5fa; }
[data-theme="dark"] .playground-export-code { background: #0f0f23; border-color: #2a2a3e; color: #e4e4e7; }
[data-theme="dark"] .playground-export-copy { background: #1a1a2e; border-color: #2a2a3e; color: #a1a1aa; }
[data-theme="dark"] .playground-export-copy:hover { border-color: #3b82f6; color: #60a5fa; }
[data-theme="dark"] .playground-export-share { border-top-color: #2a2a3e; }
[data-theme="dark"] .playground-export-share-btn { background: rgba(113,97,239,0.1); border-color: rgba(113,97,239,0.2); }
[data-theme="dark"] .playground-export-share-btn:hover { background: rgba(113,97,239,0.15); border-color: rgba(113,97,239,0.3); }
[data-theme="dark"] .export-keyword { color: #e879f9; }
[data-theme="dark"] .export-string { color: #4ade80; }
[data-theme="dark"] .export-comment { color: #6b7280; }
[data-theme="dark"] .export-function { color: #60a5fa; }
[data-theme="dark"] .export-variable { color: #f87171; }
[data-theme="dark"] .export-number { color: #fbbf24; }

[data-theme="dark"] #playgroundExportBtn.active {
    color: #60a5fa;
    background: rgba(113, 97, 239, 0.15);
}

/* ---------- Export Responsive ---------- */
@media (max-width: 767px) {
    .playground-export-panel { width: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
    .playground-export-tabs { overflow-x: auto; }
}

/* ---------- Export Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .playground-export-tab,
    .playground-export-copy,
    .playground-export-share-btn,
    .playground-export-close {
        transition: none !important;
    }
}
