/* =========================================
   ASTERIZER - Playground (interactive chat demo)
   Scoped under .pg / .pg-*. Blends with the site's dark + platinum theme.
   ========================================= */

.pg-hero { padding-bottom: 24px; }
.pg-demo-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: rgba(var(--accent-rgb), 0.07);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: var(--radius-full);
  padding: 6px 14px;
}
.pg-demo-note i { color: var(--accent-primary); }

.pg { padding: 0 0 90px; }

.pg-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 22px;
  align-items: start;
}

/* --------- Config sidebar --------- */
.pg-config {
  background: 
    radial-gradient(120% 80% at 50% -10%, rgba(var(--accent-rgb), 0.08), transparent 60%),
    var(--bg-card);
  border: 1px solid rgba(244, 244, 239, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: sticky;
  top: 100px;
}
.pg-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(244, 244, 239, 0.07);
}
.pg-config-head h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.pg-config-head h2 i { color: var(--accent-primary); }
.pg-config-toggle {
  display: none;
  background: transparent; border: 0; color: var(--text-secondary);
  cursor: pointer; font-size: 1rem; padding: 4px;
}
.pg-config-body { padding: 20px; display: flex; flex-direction: column; gap: 22px; }

.pg-field { display: flex; flex-direction: column; gap: 10px; }
.pg-label {
  font-family: var(--ai-mono, 'JetBrains Mono', monospace);
  font-size: 0.68rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* model cards */
.pg-models { display: flex; flex-direction: column; gap: 8px; }
.pg-model {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(244, 244, 239, 0.1);
  border-radius: 12px;
  cursor: pointer; font: inherit; color: var(--text-secondary);
  text-align: left; width: 100%;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}
.pg-model:hover { border-color: rgba(var(--accent-rgb), 0.4); transform: translateY(-1px); }
.pg-model.active {
  border-color: rgba(var(--accent-rgb), 0.7);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.12);
}
.pg-model-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent-primary); font-size: 1rem;
}
.pg-model-meta { display: flex; flex-direction: column; line-height: 1.3; }
.pg-model-meta strong { font-family: var(--font-display); color: var(--text-primary); font-size: 0.92rem; letter-spacing: 0.5px; }
.pg-model-meta span { font-size: 0.76rem; color: var(--text-muted); }

/* presets */
.pg-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pg-preset {
  padding: 9px 6px; font: inherit; font-size: 0.82rem; font-weight: 600;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(244, 244, 239, 0.1);
  border-radius: 9px; color: var(--text-secondary); cursor: pointer;
  transition: all 0.25s ease;
}
.pg-preset:hover { border-color: rgba(var(--accent-rgb), 0.4); color: var(--text-primary); }
.pg-preset.active {
  border-color: transparent; color: var(--bg-dark);
  background: var(--accent-gradient); font-weight: 700;
}

/* sliders */
.pg-slider-head { display: flex; align-items: center; justify-content: space-between; }
.pg-slider-val {
  font-family: var(--ai-mono, 'JetBrains Mono', monospace);
  font-size: 0.82rem; color: var(--accent-primary); font-weight: 600;
}
.pg-range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: rgba(244, 244, 239, 0.12);
  outline: none; cursor: pointer;
}
.pg-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-gradient);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5);
  cursor: pointer; transition: transform 0.15s ease;
}
.pg-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.pg-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #cfd0c9; border: 2px solid var(--bg-card);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5); cursor: pointer;
}
.pg-hint { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }

.pg-textarea {
  width: 100%; resize: vertical; min-height: 64px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(244, 244, 239, 0.12);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit; font-size: 0.86rem; line-height: 1.55;
  transition: border-color 0.25s ease;
}
.pg-textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.5); }

/* --------- Chat --------- */
.pg-chat {
  display: flex; flex-direction: column;
  min-height: 600px; height: 74vh; max-height: 760px;
  background: 
    radial-gradient(120% 60% at 50% -10%, rgba(var(--accent-rgb), 0.06), transparent 55%),
    var(--bg-card);
  border: 1px solid rgba(244, 244, 239, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.pg-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(244, 244, 239, 0.07);
  background: rgba(0, 0, 0, 0.14);
}
.pg-chat-title { display: flex; align-items: center; gap: 11px; }
.pg-chat-title > span { display: flex; flex-direction: column; line-height: 1.35; }
.pg-chat-title strong { font-family: var(--font-display); font-size: 0.98rem; }
.pg-chat-sub { font-size: 0.76rem; color: var(--text-muted); }
.pg-status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #6fe0a8; box-shadow: 0 0 10px #6fe0a8;
  animation: pg-dot 2s ease-in-out infinite;
}
.pg-status-dot.busy { background: var(--accent-primary); box-shadow: 0 0 10px var(--accent-primary); }
@keyframes pg-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.pg-clear {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid rgba(244, 244, 239, 0.14);
  color: var(--text-secondary); font: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 7px 13px; border-radius: var(--radius-full); cursor: pointer;
  transition: all 0.25s ease;
}
.pg-clear:hover { border-color: rgba(var(--accent-rgb), 0.4); color: var(--text-primary); }

.pg-messages {
  flex: 1; overflow-y: auto;
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 18px;
  scroll-behavior: smooth;
}
.pg-messages::-webkit-scrollbar { width: 8px; }
.pg-messages::-webkit-scrollbar-thumb { background: rgba(244, 244, 239, 0.14); border-radius: 4px; }

.pg-msg { display: flex; gap: 12px; max-width: 100%; animation: pg-in 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.pg-msg-avatar {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.9rem;
}
.pg-msg.user .pg-msg-avatar { background: rgba(244, 244, 239, 0.1); color: var(--text-secondary); }
.pg-msg.ai .pg-msg-avatar { background: rgba(var(--accent-rgb), 0.14); color: var(--accent-primary); }
.pg-msg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pg-msg-role { font-family: var(--ai-mono, monospace); font-size: 0.64rem; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); }
.pg-msg-text {
  font-size: 0.95rem; line-height: 1.7; color: var(--text-primary);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.pg-msg-text p { margin-bottom: 10px; }
.pg-msg-text p:last-child { margin-bottom: 0; }
.pg-msg-text strong { color: var(--text-primary); font-weight: 700; }
.pg-msg-text code {
  font-family: var(--ai-mono, monospace); font-size: 0.86rem;
  background: rgba(0, 0, 0, 0.3); padding: 2px 6px; border-radius: 5px; color: #d6ffe9;
}
.pg-msg-text ul { margin: 6px 0 10px; padding-left: 20px; }
.pg-msg-text li { margin-bottom: 4px; line-height: 1.6; }
.pg-msg.user .pg-msg-text {
  background: rgba(244, 244, 239, 0.06);
  border: 1px solid rgba(244, 244, 239, 0.08);
  padding: 12px 15px; border-radius: 12px;
}
.pg-msg-actions { display: flex; gap: 6px; margin-top: 2px; }
.pg-msg-act {
  background: transparent; border: 0; color: var(--text-muted);
  cursor: pointer; font-size: 0.74rem; padding: 4px 8px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 5px; transition: all 0.2s ease;
}
.pg-msg-act:hover { background: rgba(244, 244, 239, 0.08); color: var(--text-primary); }

/* typing indicator */
.pg-typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.pg-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-primary);
  animation: pg-bounce 1.2s ease-in-out infinite;
}
.pg-typing span:nth-child(2) { animation-delay: 0.18s; }
.pg-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes pg-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }
.pg-caret { display: inline-block; width: 8px; height: 1.05em; background: var(--accent-primary); margin-left: 2px; vertical-align: text-bottom; animation: pg-dot 1s steps(2) infinite; }

/* suggestion chips */
.pg-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 12px; }
.pg-chip {
  font: inherit; font-size: 0.82rem; color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(244, 244, 239, 0.12);
  border-radius: var(--radius-full); padding: 8px 14px; cursor: pointer;
  transition: all 0.25s ease;
}
.pg-chip:hover { border-color: rgba(var(--accent-rgb), 0.45); color: var(--text-primary); transform: translateY(-2px); }

/* input */
.pg-input {
  display: flex; align-items: flex-end; gap: 10px;
  margin: 0 16px 8px; padding: 10px 10px 10px 16px;
  background: rgba(0, 0, 0, 0.26);
  border: 1px solid rgba(244, 244, 239, 0.12);
  border-radius: 16px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.pg-input:focus-within { border-color: rgba(var(--accent-rgb), 0.5); box-shadow: 0 0 22px rgba(var(--accent-rgb), 0.1); }
.pg-input-field {
  flex: 1; resize: none; max-height: 160px;
  background: transparent; border: 0; outline: none;
  color: var(--text-primary); font-family: inherit; font-size: 0.95rem; line-height: 1.5;
  padding: 7px 0;
}
.pg-input-actions { display: flex; align-items: center; gap: 8px; }
.pg-count { font-family: var(--ai-mono, monospace); font-size: 0.7rem; color: var(--text-muted); }
.pg-send, .pg-stop {
  width: 38px; height: 38px; flex-shrink: 0; border: 0; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.95rem; transition: transform 0.2s ease, opacity 0.2s ease;
}
.pg-send { background: var(--accent-gradient); color: var(--bg-dark); }
.pg-send:hover { transform: translateY(-2px) scale(1.05); }
.pg-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.pg-stop { background: rgba(255, 107, 107, 0.16); color: #ff8585; border: 1px solid rgba(255, 107, 107, 0.4); }
.pg-stop:hover { background: rgba(255, 107, 107, 0.25); }

.pg-foot-note { text-align: center; font-size: 0.74rem; color: var(--text-muted); padding: 0 20px 16px; }

/* welcome state */
.pg-welcome { text-align: center; margin: auto; padding: 30px 16px; max-width: 420px; }
.pg-welcome-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb), 0.12); color: var(--accent-primary); font-size: 1.6rem;
  box-shadow: inset 0 0 22px rgba(var(--accent-rgb), 0.16);
}
.pg-welcome h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 8px; }
.pg-welcome p { color: var(--text-muted); font-size: 0.92rem; line-height: 1.6; }

/* --------- responsive --------- */
@media (max-width: 920px) {
  .pg-shell { grid-template-columns: 1fr; }
  .pg-config { position: static; }
  .pg-config-toggle { display: inline-flex; }
  .pg-config-body.collapsed { display: none; }
  .pg-chat { height: 70vh; min-height: 520px; }
}
@media (max-width: 480px) {
  .pg-chat { height: 76vh; }
  .pg-suggest .pg-chip:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-msg, .pg-status-dot, .pg-typing span, .pg-caret { animation: none !important; }
}