/* Particle Studio — tool styles on top of assets/landing.css.
   Dark, precise, instrument-like: one strong canvas, a quiet side panel,
   at most four control groups visible. */

main { max-width: 1180px; }

.tool-hero--compact { padding: 40px 0 16px; }
.tool-hero--compact h1 { font-size: clamp(30px, 4.4vw, 44px); margin-bottom: 8px; }
.tool-hero--compact p { margin-bottom: 0; font-size: 15px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Prompt area                                                          */
/* ------------------------------------------------------------------ */

.ps-prompt { margin-bottom: 22px; }

.prompt-box {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
}

#prompt-input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
  min-height: 44px;
  max-height: 180px;
}
#prompt-input:focus { outline: none; }
.prompt-box:focus-within { border-color: var(--glass-line-hover); }

.prompt-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#prompt-count { font-size: 11.5px; color: var(--text-muted); min-width: 58px; }

.mode-toggle {
  display: flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin: 0;
}
.mode-toggle label { position: relative; cursor: pointer; }
.mode-toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.mode-toggle span {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.mode-toggle input:checked + span { background: var(--bg-inset); color: var(--text); }
.mode-toggle input:focus-visible + span { outline: 2px solid var(--accent-a); outline-offset: 1px; }

.prompt-actions { margin-left: auto; display: flex; gap: 8px; }

#btn-generate.busy { opacity: 0.75; pointer-events: none; }

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--glass-line-hover); }

.prompt-privacy {
  margin: 10px 2px 0;
  font-size: 11.5px;
  color: var(--text-muted);
}
#demo-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-c);
}

.prompt-status { margin: 6px 2px 0; font-size: 12.5px; color: var(--text-dim); min-height: 18px; }
.prompt-status.error { color: #f87171; }

/* ------------------------------------------------------------------ */
/* Featured scene rail                                                  */
/* ------------------------------------------------------------------ */

.ps-featured { margin: 22px 0 24px; }

.rail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.rail-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.rail-more { font-size: 12.5px; color: var(--text-muted); }
.rail-more:hover { color: var(--text); text-decoration: none; }
.rail-more::after { content: " ↓"; }

.featured-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

/* Scene cards (shared by the rail and the library) */
.scene-card {
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 7px 10px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.scene-card:hover { border-color: var(--glass-line-hover); transform: translateY(-2px); }
.scene-card[aria-pressed="true"] { border-color: var(--accent-a); }

.scene-card__thumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 9px;
  /* palette gradient shows while the PNG loads (or if it ever 404s) */
  background: var(--scene-fallback, var(--bg-inset));
}
.scene-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.scene-card__name { display: block; font-weight: 600; font-size: 13px; padding: 0 3px; }
.scene-card__tpl { display: block; margin-top: 1px; font-size: 11px; color: var(--text-muted); padding: 0 3px; }

/* Mobile: horizontally swipeable rail */
@media (max-width: 700px) {
  .featured-rail {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    margin: 0 calc(-1 * 24px);
    padding: 2px 24px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .featured-rail .scene-card {
    flex: 0 0 62%;
    scroll-snap-align: start;
  }
}

/* ------------------------------------------------------------------ */
/* Workspace                                                            */
/* ------------------------------------------------------------------ */

.ps-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.ps-stage {
  position: sticky;
  top: 16px;
}

.stage-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stage-wrap:fullscreen { aspect-ratio: auto; border-radius: 0; }

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.static-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage-wrap.unsupported .stage-overlay { background: linear-gradient(180deg, rgba(8,8,10,.28), rgba(8,8,10,.78)); justify-content: flex-end; padding: 28px; }
.stage-wrap.unsupported .stage-overlay p { max-width: 460px; color: #fff; font-size: 14px; line-height: 1.5; text-shadow: 0 2px 10px #000; }
.stage-wrap.unsupported #stage { visibility: hidden; }

.stage-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1px solid var(--glass-line-hover);
  background: rgba(10, 10, 12, 0.62);
  backdrop-filter: blur(6px);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.stage-play:hover { transform: scale(1.06); border-color: var(--accent-a); }
.stage-play svg { width: 30px; height: 30px; margin-left: 3px; }

.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(8, 8, 10, 0.82);
  text-align: center;
  padding: 20px;
}
.stage-overlay p { margin: 0; color: var(--text-dim); font-size: 14px; }

/* Toolbar */
.ps-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.tbtn {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tbtn:hover:not(:disabled) { color: var(--text); border-color: var(--glass-line-hover); }
.tbtn:disabled { opacity: 0.4; cursor: default; }
.tbtn[aria-pressed="true"] { color: var(--text); }

.tsep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }

.tperf { margin-left: auto; }
.tperf select {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 9px;
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
}

/* ------------------------------------------------------------------ */
/* Side panel                                                           */
/* ------------------------------------------------------------------ */

.ps-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.panel-block {
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-block summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.panel-block summary::-webkit-details-marker { display: none; }
.panel-block summary h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.panel-block summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.panel-block[open] summary::after { transform: rotate(225deg); }
.panel-block summary:hover h2 { color: var(--text); }

.panel-body { padding: 2px 16px 16px; }

/* Controls */
.ctl-group { margin-bottom: 14px; }
.ctl-group:last-child { margin-bottom: 0; }
.ctl-group__title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ctl-group__body { display: flex; flex-direction: column; gap: 10px; }

.ctl-row { display: flex; flex-direction: column; gap: 5px; }
.ctl-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ctl-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ctl-value { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.ctl-row input[type="range"] {
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: var(--accent-a);
  background: transparent;
}

.ctl-select {
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
}

.ctl-row--color { flex-direction: row; align-items: center; justify-content: space-between; }
.ctl-color {
  width: 74px;
  height: 30px;
  padding: 2px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.ctl-swatches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ctl-swatch {
  width: 34px;
  height: 28px;
  padding: 2px;
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.ctl-mini-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.ctl-mini-btn:hover:not(:disabled) { color: var(--text); border-color: var(--glass-line-hover); }
.ctl-mini-btn:disabled { opacity: 0.35; cursor: default; }

/* Details */
.details-body { font-size: 13px; }
.d-title { margin: 4px 0 6px; font-size: 16px; }
.d-summary { margin: 0 0 10px; color: var(--text-dim); line-height: 1.5; }
.d-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.d-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.d-chip--class { color: var(--accent-c); border-color: rgba(255, 176, 136, 0.35); }

.d-stats { display: flex; gap: 18px; margin: 0 0 12px; }
.d-stats div { display: flex; flex-direction: column; gap: 2px; }
.d-stats dt { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.d-stats dd { margin: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.d-note { margin: 0 0 10px; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; }
.d-explain { margin: 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.5; }

/* Export */
.export-body { display: flex; flex-direction: column; gap: 14px; }
.export-group { display: flex; flex-direction: column; gap: 8px; }
.export-label { font-size: 12.5px; font-weight: 600; }
.export-label .pro-tag {
  font-style: normal;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-c);
  margin-left: 6px;
}
.export-group .btn-row { flex-wrap: wrap; }
.export-note { margin: 0; font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.export-status { margin: 0; font-size: 12px; color: var(--valid); min-height: 16px; }
.export-status.error { color: #f87171; }

/* ------------------------------------------------------------------ */
/* Presets                                                              */
/* ------------------------------------------------------------------ */

.ps-presets { margin-top: 34px; }
.ps-presets h2 { margin: 0 0 4px; font-size: 22px; }
.presets-sub { margin: 0 0 16px; color: var(--text-muted); font-size: 13px; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

/* Pro dialog + CTA card (shared pattern with OG Studio) */
#pro-dialog {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  width: min(440px, 92vw);
}
#pro-dialog::backdrop { background: rgba(4, 4, 6, 0.7); }
#pro-dialog h3 { margin: 0 0 8px; font-size: 18px; }
.pro-pitch { margin: 0 0 14px; font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.pro-error { margin: -6px 0 10px; font-size: 12px; color: #f87171; }
#pro-dialog input[type="email"] {
  width: 100%;
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  padding: 9px 12px;
  margin-bottom: 12px;
}
#pro-dialog input[type="email"]:focus { outline: 1px solid var(--accent-a); }
.btn-row { display: flex; gap: 10px; }
.btn-row.right { justify-content: flex-end; }

.cta-card {
  margin: 36px 0 8px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.cta-card h3 { margin: 0 0 8px; font-size: 19px; }
.cta-card p { margin: 0 0 18px; font-size: 14px; color: var(--text-dim); max-width: 620px; }

/* ------------------------------------------------------------------ */
/* Responsive                                                           */
/* ------------------------------------------------------------------ */

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

@media (max-width: 620px) {
  .stage-wrap { aspect-ratio: 4 / 3.4; }
  .prompt-meta { gap: 10px; }
  .prompt-actions { margin-left: 0; width: 100%; }
  .prompt-actions .btn { flex: 1; }
  .tperf { margin-left: 0; width: 100%; }
  .tperf select { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-card:hover, .stage-play:hover { transform: none; }
  .featured-rail { scroll-behavior: auto; }
}
