/* VectoUI demos — gallery + per-demo stage styling. */

/* ---- Demos gallery ---- */
.demos-section {
  padding: 5rem 0 8rem;
}

.demos-lede {
  text-align: center;
  max-width: 640px;
  margin: -2.5rem auto 3.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.demo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 2rem;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.demo-card:hover {
  transform: translateY(-5px);
  border-color: rgba(91, 156, 255, 0.45);
  box-shadow: 0 12px 36px rgba(37, 99, 235, 0.14);
}

.demo-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--accent);
}

.demo-card h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: #fff;
}

.demo-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.demo-go {
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---- Per-demo page ---- */
.demo-wrap {
  padding: 3rem 0 6rem;
}

.demo-back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.demo-back:hover {
  color: var(--accent);
}

.demo-head h1 {
  font-family: var(--font-title);
  font-size: 2.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.demo-lede {
  max-width: 720px;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* The "player" stage holding the canvas. */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 70vh;
  margin: 1.75rem 0 1.25rem;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(37, 99, 235, 0.16), transparent 60%),
    linear-gradient(180deg, #0a0e1a 0%, #070a13 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

#stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* A pure dark field for the particle demo. */
.stage-nexus {
  background:
    radial-gradient(900px 600px at 50% 40%, rgba(37, 99, 235, 0.1), transparent 70%), #04060d;
}

.nexus-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(7, 10, 19, 0.55);
  border: 1px solid rgba(91, 156, 255, 0.2);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

#danmaku-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Fullscreen: fill the screen rather than keeping the 16:9 letterbox. */
.stage:fullscreen {
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
}

/* Video control bar pinned to the stage bottom. */
.vbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
}

.vbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 10, 19, 0.5);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.vbtn:hover {
  background: rgba(37, 99, 235, 0.55);
}

.vupload {
  cursor: pointer;
}

.vseek {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.vtime {
  font-size: 0.76rem;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.vrate {
  height: 32px;
  padding: 0 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 10, 19, 0.5);
  color: #fff;
  cursor: pointer;
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 14px;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(7, 10, 19, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(91, 156, 255, 0.18);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.hud b {
  color: #fff;
  font-weight: 700;
}

.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  background: rgba(13, 19, 33, 0.92);
  border: 1px solid rgba(91, 156, 255, 0.3);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.sendbar {
  position: absolute;
  left: 50%;
  bottom: 58px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  width: min(560px, calc(100% - 28px));
  padding: 8px;
  border-radius: 12px;
  background: rgba(7, 10, 19, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sendbar input[type='text'] {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 0.92rem;
}

.sendbar input[type='text']:focus {
  outline: none;
  border-color: rgba(91, 156, 255, 0.6);
}

.sendbar input[type='color'] {
  width: 38px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.sendbar button {
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.sendbar button:hover {
  filter: brightness(1.08);
}

.demo-credit {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.demo-credit a {
  color: var(--accent);
  text-decoration: none;
}

.demo-credit a:hover {
  text-decoration: underline;
}

/* Control panel below the stage. */
.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem 2rem;
  padding: 1.5rem;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ctl output {
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ctl input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.ctl-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.ctl-actions button {
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-color);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.ctl-actions button:hover {
  border-color: rgba(91, 156, 255, 0.45);
}

.ctl-actions button.active {
  background: rgba(37, 99, 235, 0.25);
  border-color: rgba(91, 156, 255, 0.6);
  color: #fff;
}

.ctl-inline,
.ctl-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ctl-inline select {
  padding: 0.35rem 0.5rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* Chrome renders the popup options with a default light background, so an
   inherited white text color makes them invisible. Force a dark option list
   across every select on the demo page (controls + video bar). */
.demo-wrap select option {
  background: #0d1320;
  color: #fff;
}

.ctl-check input {
  accent-color: var(--accent);
}

.report-btn {
  margin-left: auto;
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(91, 156, 255, 0.5) !important;
  color: #fff !important;
}

.report-btn:hover {
  background: rgba(37, 99, 235, 0.3) !important;
}

/* Real-browser performance report panel. */
.report-panel {
  margin-top: 1.25rem;
  border-radius: 12px;
  background: #060a13;
  border: 1px solid rgba(91, 156, 255, 0.3);
  overflow: hidden;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  background: rgba(37, 99, 235, 0.12);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.report-actions {
  display: flex;
  gap: 0.5rem;
}

.report-actions button {
  padding: 0.3rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  font-size: 0.78rem;
  cursor: pointer;
}

.report-actions button:hover {
  border-color: rgba(91, 156, 255, 0.5);
  color: #fff;
}

.report-panel pre {
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* On-demand accessible projection of on-screen comments. */
.a11y-list {
  margin-top: 1.25rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.75rem;
  list-style: none;
  border-radius: 12px;
  background: rgba(7, 10, 19, 0.5);
  border: 1px solid var(--border-color);
}

.a11y-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-color);
}

.a11y-list li:hover {
  background: rgba(255, 255, 255, 0.04);
}

.a11y-list li button {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: #ff6b9d;
  cursor: pointer;
}

/* ---- AI Chat demo ---- */
.chat-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  margin-top: 1.75rem;
}

.chat-side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.25rem;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  height: fit-content;
}

.chat-new {
  padding: 0.6rem 1rem;
  border-radius: 9px;
  border: 1px solid rgba(91, 156, 255, 0.4);
  background: rgba(37, 99, 235, 0.18);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.chat-new:hover {
  background: rgba(37, 99, 235, 0.3);
}

.chat-side-group h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.chat-side-group [data-sample] {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-color);
  font-size: 0.86rem;
  line-height: 1.35;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.chat-side-group [data-sample]:hover {
  background: rgba(91, 156, 255, 0.1);
  border-color: rgba(91, 156, 255, 0.4);
}

.chat-settings {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-settings summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-color);
}

.chat-settings label {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.78rem;
}

.chat-settings label.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.chat-settings input,
.chat-settings textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-radius: 7px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 0.82rem;
  font-family: inherit;
}

.chat-settings label.row input {
  width: 5rem;
  margin-top: 0;
}

.chat-note {
  margin-top: 0.7rem;
  font-size: 0.76rem;
  opacity: 0.8;
}

.chat-main {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.chat-stage {
  position: relative;
  height: 64vh;
  min-height: 420px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: linear-gradient(180deg, #0a0e1a 0%, #070a13 100%);
}

#chat-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.chat-form {
  display: flex;
  gap: 0.6rem;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1rem;
  border-radius: 11px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: #fff;
  font-size: 0.95rem;
}

.chat-form input:focus {
  outline: none;
  border-color: rgba(91, 156, 255, 0.6);
}

.chat-form button {
  padding: 0.7rem 1.5rem;
  border-radius: 11px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.chat-form button:hover {
  filter: brightness(1.08);
}

@media (max-width: 880px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }
}

/* Three-way comparison. */
.demo-explain {
  margin-top: 3.5rem;
}

.demo-explain h2 {
  font-family: var(--font-title);
  font-size: 1.7rem;
  color: #fff;
  margin-bottom: 1.5rem;
}

.explain-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.explain-card {
  padding: 1.5rem;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.explain-card h4 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

.explain-card h4 span {
  color: var(--text-muted);
  font-weight: 400;
}

.explain-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.explain-win {
  border-color: rgba(91, 156, 255, 0.5);
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(17, 24, 39, 0.7));
}

.explain-win h4 {
  color: var(--accent);
}

@media (max-width: 768px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .explain-grid {
    grid-template-columns: 1fr;
  }
  .demo-head h1 {
    font-size: 2rem;
  }
}
